00001 /* test-value.c 00002 * 00003 * Copyright 2002 Lutz M\uffffller <lutz@users.sourceforge.net> 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Lesser General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Lesser General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Lesser General Public 00016 * License along with this library; if not, write to the 00017 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 * Boston, MA 02110-1301 USA. 00019 */ 00020 00021 #include <libexif/exif-utils.h> 00022 #include <libexif/exif-data.h> 00023 00024 #include <stdio.h> 00025 #include <stdlib.h> 00026 00027 int 00028 main () 00029 { 00030 ExifData *d; 00031 ExifEntry *e; 00032 char v[1024]; 00033 ExifSRational r = {1., 20.}; 00034 unsigned int i; 00035 00036 d = exif_data_new (); 00037 if (!d) { 00038 printf ("Error running exif_data_new()\n"); 00039 exit(13); 00040 } 00041 00042 e = exif_entry_new (); 00043 if (!e) { 00044 printf ("Error running exif_entry_new()\n"); 00045 exit(13); 00046 } 00047 00048 exif_content_add_entry (d->ifd[EXIF_IFD_0], e); 00049 exif_entry_initialize (e, EXIF_TAG_SHUTTER_SPEED_VALUE); 00050 exif_set_srational (e->data, exif_data_get_byte_order (d), r); 00051 00052 for (i = 30; i > 0; i--) { 00053 printf ("Length %2i: '%s'\n", i, 00054 exif_entry_get_value (e, v, i)); 00055 } 00056 00057 exif_entry_unref (e); 00058 exif_data_unref (d); 00059 00060 return 0; 00061 }