diff 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
line wrap: on
line diff
--- a/bpgdec.c	Sun Mar 08 19:14:25 2020 +0200
+++ b/bpgdec.c	Sun Mar 08 19:18:48 2020 +0200
@@ -37,6 +37,10 @@
 #include <png.h>
 #endif
 
+#ifdef HAVE_LIBEXIF
+#include <exif-data.h>
+#endif
+
 #include "libbpg.h"
 
 static void ppm_save(BPGDecoderContext *img, const char *filename)
@@ -249,6 +253,35 @@
 
             printf("  tag=%d (%s) length=%d\n",
                    md->tag, tag_name, md->buf_len);
+
+            switch (md->tag)
+            {
+                case BPG_EXTENSION_TAG_XMP:
+//                    fwrite(md->buf, md->buf_len, 1, stderr);
+                    break;
+
+#ifdef HAVE_LIBEXIF
+                case BPG_EXTENSION_TAG_EXIF:
+                    {
+                        ExifMem *exif_mem = exif_mem_new_default();
+                        if (exif_mem != NULL)
+                        {
+                            ExifData *exif = exif_data_new_mem(exif_mem);
+                            if (exif != NULL)
+                            {
+                                exif_data_load_data(exif, md->buf, md->buf_len);
+                                exif_data_fix(exif);
+                                exif_data_dump(exif);
+                                exif_data_free(exif);
+                            }
+                        }
+                    }
+                    break;
+#endif
+
+                default:
+                    break;
+            }
         }
         bpg_decoder_free_extension_data(first_md);
     }