comparison bpgdec.c @ 34:5d51fff843eb default tip

A "commit dump" of random changes I've made, as I probably won't be touching this code anymore.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 08 Mar 2020 19:18:48 +0200
parents 33594243ce31
children
comparison
equal deleted inserted replaced
33:33594243ce31 34:5d51fff843eb
33 /* define it to include PNG output */ 33 /* define it to include PNG output */
34 #define USE_PNG 34 #define USE_PNG
35 35
36 #ifdef USE_PNG 36 #ifdef USE_PNG
37 #include <png.h> 37 #include <png.h>
38 #endif
39
40 #ifdef HAVE_LIBEXIF
41 #include <exif-data.h>
38 #endif 42 #endif
39 43
40 #include "libbpg.h" 44 #include "libbpg.h"
41 45
42 static void ppm_save(BPGDecoderContext *img, const char *filename) 46 static void ppm_save(BPGDecoderContext *img, const char *filename)
247 tag_name = (md->tag < sizeof(extension_tag_str) / sizeof(extension_tag_str[0])) ? 251 tag_name = (md->tag < sizeof(extension_tag_str) / sizeof(extension_tag_str[0])) ?
248 extension_tag_str[md->tag] : extension_tag_str[0]; 252 extension_tag_str[md->tag] : extension_tag_str[0];
249 253
250 printf(" tag=%d (%s) length=%d\n", 254 printf(" tag=%d (%s) length=%d\n",
251 md->tag, tag_name, md->buf_len); 255 md->tag, tag_name, md->buf_len);
256
257 switch (md->tag)
258 {
259 case BPG_EXTENSION_TAG_XMP:
260 // fwrite(md->buf, md->buf_len, 1, stderr);
261 break;
262
263 #ifdef HAVE_LIBEXIF
264 case BPG_EXTENSION_TAG_EXIF:
265 {
266 ExifMem *exif_mem = exif_mem_new_default();
267 if (exif_mem != NULL)
268 {
269 ExifData *exif = exif_data_new_mem(exif_mem);
270 if (exif != NULL)
271 {
272 exif_data_load_data(exif, md->buf, md->buf_len);
273 exif_data_fix(exif);
274 exif_data_dump(exif);
275 exif_data_free(exif);
276 }
277 }
278 }
279 break;
280 #endif
281
282 default:
283 break;
284 }
252 } 285 }
253 bpg_decoder_free_extension_data(first_md); 286 bpg_decoder_free_extension_data(first_md);
254 } 287 }
255 } 288 }
256 289