Convert from EXIF to XMP DataTime as local time.

Original commit message from CVS:
Convert from EXIF to XMP DataTime as local time.
This commit is contained in:
Edgard Lima 2008-02-10 18:36:46 +00:00
parent a0254c0e2f
commit d86770610e
3 changed files with 17 additions and 7 deletions

View file

@ -1,3 +1,9 @@
2008-02-10 Edgard Lima <edgard.lima@indt.org.br>
* ext/metadata/TODO:
* ext/metadata/metadataexif.c:
Convert from EXIF to XMP DataTime as local time.
2008-02-10 Edgard Lima <edgard.lima@indt.org.br>
* ext/metadata/TODO:

View file

@ -15,6 +15,7 @@ TODO:
5- Improve the test application (to save also in png and to make it possible to set the metadata elements properties)
6- Implement GDateTime support in GLib to be used by GStreamer (http://bugzilla.gnome.org/show_bug.cgi?id=50076)
7- Use a standard GStreamer Data-Time type to map our Data-time tags
8- Make the correct merge mode for multiple value tags (bag and seq) like dc:creator, ...
OPEN ISSUES:

View file

@ -613,8 +613,8 @@ metadataparse_exif_content_foreach_entry_func (ExifEntry * entry,
if (entry->tag == EXIF_TAG_DATE_TIME_DIGITIZED
|| entry->tag == EXIF_TAG_DATE_TIME
|| entry->tag == EXIF_TAG_DATE_TIME_ORIGINAL) {
value = g_string_new_len (str, 21);
/* 21 is enough memory to hold "YYYY-MM-DDTHH:MM:SSZ" */
value = g_string_new_len (str, 20);
/* 20 is enough memory to hold "YYYY-MM-DDTHH:MM:SS" */
if (metadataparse_exif_convert_to_datetime (value)) {
str = value->str;
@ -1092,14 +1092,17 @@ metadataparse_exif_convert_to_datetime (GString * dt)
/* "YYYY:MM:DD HH:MM:SS" */
/* 012345678901234567890 */
if (dt->allocated_len < 21)
if (dt->allocated_len < 20)
return FALSE;
/* Fix me: Ideally would be good to get the time zone from othe Exif tag
* for the time being, just use local time as explained in XMP specification
* (converting from EXIF to XMP date and time) */
dt->str[4] = '-';
dt->str[7] = '-';
dt->str[10] = 'T';
dt->str[19] = 'Z';
dt->str[20] = '\0';
dt->str[19] = '\0';
return TRUE;
@ -1228,8 +1231,8 @@ metadatamux_exif_convert_from_datetime (GString * dt)
if (*p == ':') {
p++;
} else if (*p == 'Z' || *p == '+' || *p == '-') {
/* FIXME: in case of '+' or '-', would it be better to calculate the
* UTC 'Z' date and time? */
/* FIXME: in case of '+' or '-', it would be better to also fill another
* EXIF tag in order to save, somehow the time zone info */
sprintf (p, ":00");
goto done;
} else