• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* test-value.c
2  *
3  * Copyright 2002 Lutz M\uffffller <lutz@users.sourceforge.net>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA  02110-1301  USA.
19  */
20 
21 #include <libexif/exif-utils.h>
22 #include <libexif/exif-data.h>
23 
24 #include <stdio.h>
25 #include <stdlib.h>
26 
27 int
main()28 main ()
29 {
30 	ExifData *d;
31 	ExifEntry *e;
32 	char v[1024];
33 	ExifSRational r = {1., 20.};
34 	unsigned int i;
35 
36 	d = exif_data_new ();
37 	if (!d) {
38 		printf ("Error running exif_data_new()\n");
39 		exit(13);
40 	}
41 
42 	e = exif_entry_new ();
43 	if (!e) {
44 		printf ("Error running exif_entry_new()\n");
45 		exit(13);
46 	}
47 
48 	exif_content_add_entry (d->ifd[EXIF_IFD_0], e);
49 	exif_entry_initialize (e, EXIF_TAG_SHUTTER_SPEED_VALUE);
50 	exif_set_srational (e->data, exif_data_get_byte_order (d), r);
51 
52 	for (i = 30; i > 0; i--) {
53 		printf ("Length %2i: '%s'\n", i,
54 			exif_entry_get_value (e, v, i));
55 	}
56 
57 	exif_entry_unref (e);
58 	exif_data_unref (d);
59 
60 	return 0;
61 }
62