00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <config.h>
00022
00023 #include <libexif/exif-data.h>
00024 #include <libexif/exif-ifd.h>
00025 #include <libexif/exif-loader.h>
00026
00027 #include <stdio.h>
00028 #include <stdlib.h>
00029
00030 int
00031 main ()
00032 {
00033 ExifData *ed;
00034
00035 unsigned char *eb, size[2];
00036 unsigned int ebs;
00037 ExifLoader *loader;
00038 unsigned int i;
00039
00040 printf ("Creating EXIF data...\n");
00041 ed = exif_data_new ();
00042 exif_data_set_data_type (ed, EXIF_DATA_TYPE_UNCOMPRESSED_CHUNKY);
00043
00044 printf ("Fill EXIF data with all necessary entries to follow specs...\n");
00045 exif_data_fix (ed);
00046
00047 exif_data_dump (ed);
00048
00049 printf ("Saving EXIF data to memory...\n");
00050 exif_data_save_data (ed, &eb, &ebs);
00051 exif_data_unref (ed);
00052
00053 printf ("Writing %i byte(s) EXIF data to loader...\n", ebs);
00054 loader = exif_loader_new ();
00055 size[0] = (unsigned char) ebs;
00056 size[1] = (unsigned char) (ebs >> 8);
00057 exif_loader_write (loader, size, 2);
00058 for (i = 0; i < ebs && exif_loader_write (loader, eb + i, 1); i++);
00059 printf ("Wrote %i byte(s).\n", i);
00060 free (eb);
00061 ed = exif_loader_get_data (loader);
00062 exif_loader_unref (loader);
00063 exif_data_dump (ed);
00064 exif_data_unref (ed);
00065
00066 return 0;
00067 }