From: Dan F. <dfa...@us...> - 2009-01-22 07:41:17
|
Update of /cvsroot/libexif/exif/exif In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv30967/exif Modified Files: actions.c actions.h main.c Log Message: Create mandatory EXIF tags with the --create-exif option Index: main.c =================================================================== RCS file: /cvsroot/libexif/exif/exif/main.c,v retrieving revision 1.72 retrieving revision 1.73 diff -u -p -d -r1.72 -r1.73 --- main.c 20 Jan 2009 23:46:09 -0000 1.72 +++ main.c 22 Jan 2009 07:41:11 -0000 1.73 @@ -355,8 +355,15 @@ main (int argc, const char **argv) exif_loader_unref (l); if (!ed) { if (create_exif) { + /* Create a new EXIF data set */ ed = exif_data_new (); exif_data_log (ed, log); + exif_data_set_data_type(ed, EXIF_DATA_TYPE_COMPRESSED); + /* Add all the mandatory fields */ + exif_data_fix(ed); + + /* Create a new date tag */ + action_create_value (ed, log, EXIF_TAG_DATE_TIME, EXIF_IFD_0); } else { exif_log (log, -1, "exif", _("'%s' is not " "readable or does not contain EXIF data!"), Index: actions.c =================================================================== RCS file: /cvsroot/libexif/exif/exif/actions.c,v retrieving revision 1.41 retrieving revision 1.42 diff -u -p -d -r1.41 -r1.42 --- actions.c 15 Jan 2009 02:32:30 -0000 1.41 +++ actions.c 22 Jan 2009 07:41:11 -0000 1.42 @@ -214,18 +214,26 @@ show_entry (ExifEntry *entry, unsigned i exif_entry_dump (entry, 0); } -void -action_set_value (ExifData *ed, ExifLog *log, ExifParams p) +/*! If the entry doesn't exist, create it. */ +ExifEntry * +action_create_value (ExifData *ed, ExifLog *log, ExifTag tag, ExifIfd ifd) { ExifEntry *e; - /* If the entry doesn't exist, create it. */ - if (!((e = exif_content_get_entry (ed->ifd[p.ifd], p.tag)))) { + if (!((e = exif_content_get_entry (ed->ifd[ifd], tag)))) { exif_log (log, EXIF_LOG_CODE_DEBUG, "exif", "Adding entry..."); e = exif_entry_new (); - exif_content_add_entry (ed->ifd[p.ifd], e); - exif_entry_initialize (e, p.tag); + exif_content_add_entry (ed->ifd[ifd], e); + exif_entry_initialize (e, tag); } + return e; +} + +void +action_set_value (ExifData *ed, ExifLog *log, ExifParams p) +{ + /* If the entry doesn't exist, create it. */ + ExifEntry *e = action_create_value(ed, log, p.tag, p.ifd); /* Now set the value and save the data. */ convert_arg_to_entry (p.set_value, e, exif_data_get_byte_order (ed), log); Index: actions.h =================================================================== RCS file: /cvsroot/libexif/exif/exif/actions.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -p -d -r1.10 -r1.11 --- actions.h 17 Feb 2008 18:17:08 -0000 1.10 +++ actions.h 22 Jan 2009 07:41:11 -0000 1.11 @@ -41,6 +41,8 @@ void action_remove_thumb (ExifData * void action_show_tag (ExifData *, ExifLog *, ExifParams); void action_set_value (ExifData *, ExifLog *, ExifParams); void action_remove_tag (ExifData *, ExifLog *, ExifParams); +ExifEntry * +action_create_value (ExifData *ed, ExifLog *log, ExifTag tag, ExifIfd ifd); void action_save (ExifData *, ExifLog *, ExifParams, const char *); void action_save_thumb (ExifData *, ExifLog *, ExifParams, const char *); |