3 * Copyright 2002 Lutz M\uffffller <lutz@users.sourceforge.net>
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.
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.
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.
26 #include <libexif/exif-data.h>
29 test_exif_data (ExifData
*d
)
35 fprintf (stdout
, "Byte order: %s\n",
36 exif_byte_order_get_name (exif_data_get_byte_order (d
)));
38 fprintf (stdout
, "Parsing maker note...\n");
39 md
= exif_data_get_mnote_data (d
);
41 fprintf (stderr
, "Could not parse maker note!\n");
46 fprintf (stdout
, "Increasing ref-count...\n");
47 exif_mnote_data_ref (md
);
49 fprintf (stdout
, "Decreasing ref-count...\n");
50 exif_mnote_data_unref (md
);
52 fprintf (stdout
, "Counting entries...\n");
53 c
= exif_mnote_data_count (md
);
54 fprintf (stdout
, "Found %i entries.\n", c
);
55 for (i
= 0; i
< c
; i
++) {
56 fprintf (stdout
, "Dumping entry number %i...\n", i
);
57 fprintf (stdout
, " Name: '%s'\n",
58 exif_mnote_data_get_name (md
, i
));
59 fprintf (stdout
, " Title: '%s'\n",
60 exif_mnote_data_get_title (md
, i
));
61 fprintf (stdout
, " Description: '%s'\n",
62 exif_mnote_data_get_description (md
, i
));
63 p
= exif_mnote_data_get_value (md
, i
, v
, sizeof (v
));
64 if (p
) { fprintf (stdout
, " Value: '%s'\n", v
); }
71 main (int argc
, char **argv
)
74 unsigned int buf_size
;
79 fprintf (stderr
, "You need to supply a filename!\n");
83 fprintf (stdout
, "Loading '%s'...\n", argv
[1]);
84 d
= exif_data_new_from_file (argv
[1]);
86 fprintf (stderr
, "Could not load data from '%s'!\n", argv
[1]);
89 fprintf (stdout
, "Loaded '%s'.\n", argv
[1]);
91 fprintf (stdout
, "######### Test 1 #########\n");
92 r
= test_exif_data (d
);
95 exif_data_save_data (d
, &buf
, &buf_size
);
97 d
= exif_data_new_from_data (buf
, buf_size
);
100 fprintf (stdout
, "######### Test 2 #########\n");
101 r
= test_exif_data (d
);
104 fprintf (stdout
, "Test successful!\n");