After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 613690 - [xmp] refactoring to 1-n tag mappings
[xmp] refactoring to 1-n tag mappings
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
git master
Other All
: Normal enhancement
: 0.10.29
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2010-03-23 13:03 UTC by Thiago Sousa Santos
Modified: 2010-03-24 18:58 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
tag: xmp: Refactor mappings storage (12.85 KB, patch)
2010-03-23 13:28 UTC, Thiago Sousa Santos
needs-work Details | Review
tag: xmp: Refactor buffer parsing (2.96 KB, patch)
2010-03-23 13:28 UTC, Thiago Sousa Santos
needs-work Details | Review
tag: xmp: Adds mappings for LATITUDE and LONGITUDE (8.80 KB, patch)
2010-03-23 13:29 UTC, Thiago Sousa Santos
committed Details | Review
tag: xmp: Fix off by one (936 bytes, patch)
2010-03-23 13:30 UTC, Thiago Sousa Santos
committed Details | Review
tag: xmp: Add Elevation tag mapping (10.67 KB, patch)
2010-03-23 13:30 UTC, Thiago Sousa Santos
needs-work Details | Review
tag: xmp: Refactor mappings storage (12.92 KB, patch)
2010-03-24 18:06 UTC, Thiago Sousa Santos
none Details | Review
tag: xmp: Refactor buffer parsing (2.99 KB, patch)
2010-03-24 18:07 UTC, Thiago Sousa Santos
committed Details | Review

Description Thiago Sousa Santos 2010-03-23 13:03:13 UTC
xmp helper lib needs to be refactored in order to be able to support exif GPS location tags.

The problems to solve are:

1) Be able to serialize doubles into the exif GPSCoordinate format, which is 'degrees','minutes','seconds'D, where D is a char (N, S, W, E) indicating the direction.
 - The solution here is to add a serialization/deserialization pair of functions to each tag mapping so they can handle with the tags in the way it is requested. If NULL, defaults to the trivial serialization.

2) _ELEVATION tag is mapped into exif:GPSAltitude and exif:GPSAltitudeRef *at the same time*, so we need a way to have 1-n mappings and be able to serialize/deserialize it properly.


Patches follow.
Comment 1 Thiago Sousa Santos 2010-03-23 13:28:13 UTC
Created attachment 156860 [details] [review]
tag: xmp: Refactor mappings storage

This commit is only refactoring, no fetaures added.

Do not store tags in flexible arrays as it doesn't allow us
to use nested flexible arrays. This is going to be needed in the
following commits to map gst tags that are stored into
2 separate tags in xmp (Not that they are alternatives, but
they are complimentary).

For example, GST_TAG_ELEVATION is represented in the exif
schema with 2 fields: the absolute altitude and an integer
to indicate if it is above or below sea level.

The previous mappings storage wouldn't allow us to
express it.

Also store a serialization and a deserialization function
for each xmp tag as some of them require some non-trivial
convertion to its string form.

Fixes #613690
Comment 2 Thiago Sousa Santos 2010-03-23 13:28:51 UTC
Created attachment 156861 [details] [review]
tag: xmp: Refactor buffer parsing

When parsing the xmp buffer into the gst taglist store the
found tags into a list to be parsed only after finding all
tags on the buffer. This allows the parser function to search
this list for complimentary tags that should be parsed together

Fixes #613690
Comment 3 Thiago Sousa Santos 2010-03-23 13:29:36 UTC
Created attachment 156862 [details] [review]
tag: xmp: Adds mappings for LATITUDE and LONGITUDE

Adds the mappings for those tags and tests
for tags serialization.

Fixes #613690
Comment 4 Thiago Sousa Santos 2010-03-23 13:30:08 UTC
Created attachment 156863 [details] [review]
tag: xmp: Fix off by one

Avoid ignoring single char tags, like exif:GPSAltitudeRef

Fixes #613690
Comment 5 Thiago Sousa Santos 2010-03-23 13:30:40 UTC
Created attachment 156864 [details] [review]
tag: xmp: Add Elevation tag mapping

Adds a mapping to the _ELEVATION tag, this is a different
mapping as it has to be mapped into exif:GPSAltitude and
exif:GPSAltitudeRef at the same time. So we needed to refactor
a little more to be able to deserialize it properly.

Now, when parsing a xmp buffer into a taglist all tags are
added to a list before being parsed so that when one of the
altitude tags are found the deserialization function can search
for its complimentary tag to do the correct parsing

Fixes #613690
Comment 6 Stefan Sauer (gstreamer, gtkdoc dev) 2010-03-24 13:22:04 UTC
Review of attachment 156860 [details] [review]:

Looks good in general. Small comments below.

::: gst-libs/gst/tag/gstxmptag.c
@@ +89,3 @@
+  key = g_quark_from_string (gst_tag);
+
+  xmpinfo = g_new0 (XmpTag, 1);

maybe use g_slice here.

@@ +105,3 @@
+
+/* FIXME
+ * Do we need to return a shallow copy here? */

We would need the copy, if someone could add more mapping while parsing buffers. As of now adding mappings is not public, so it can't happen, right?

@@ +113,3 @@
+  XMP_TAG_MAP_LOCK;
+  ret = g_slist_copy ((GSList *) g_hash_table_lookup (__xmp_tag_map,
+          GUINT_TO_POINTER (g_quark_from_string (gst_tag))));

move the g_quark_from_string (gst_tag) to key = g_quark_from_string (gst_tag) out of the lock (for readability).

@@ +559,3 @@
+  xmptaglist = _xmp_tag_get_mapping (tag);
+  if (xmptaglist) {
+    /* FIXME - se always chose the first tag mapped on the list */

typo "se" -> "we" ?
Comment 7 Stefan Sauer (gstreamer, gtkdoc dev) 2010-03-24 13:24:47 UTC
Review of attachment 156861 [details] [review]:

::: gst-libs/gst/tag/gstxmptag.c
@@ +432,3 @@
+                  PendingXmpTag *ptag;
+
+                  ptag = g_new0 (PendingXmpTag, 1);

g_slice for efficiency, maybe a gpointerarray is even more useful (if you don't want to reorder things).
Comment 8 Stefan Sauer (gstreamer, gtkdoc dev) 2010-03-24 13:27:49 UTC
Review of attachment 156862 [details] [review]:

Looks good. Thanks!
Comment 9 Stefan Sauer (gstreamer, gtkdoc dev) 2010-03-24 13:28:52 UTC
Review of attachment 156863 [details] [review]:

Hard to see from the context. I'll trust you :)
Comment 10 Stefan Sauer (gstreamer, gtkdoc dev) 2010-03-24 13:34:53 UTC
Review of attachment 156864 [details] [review]:

If you switch to g_slice, it would also be used here. Please also use g_slice_new and not g_slice_new0 as you set all fields anyway.

::: gst-libs/gst/tag/gstxmptag.c
@@ +876,3 @@
     XmpTag *xmp_tag;
 
+

extra newline
Comment 11 Stefan Sauer (gstreamer, gtkdoc dev) 2010-03-24 13:35:14 UTC
Review of attachment 156863 [details] [review]:

Hard to see from the context. I'll trust you :)
Comment 12 Thiago Sousa Santos 2010-03-24 18:06:56 UTC
Created attachment 157000 [details] [review]
tag: xmp: Refactor mappings storage

Updated patch

Fixes #613690
Comment 13 Thiago Sousa Santos 2010-03-24 18:07:59 UTC
Created attachment 157001 [details] [review]
tag: xmp: Refactor buffer parsing

Updated patch.
Comment 14 Thiago Sousa Santos 2010-03-24 18:55:46 UTC
Module: gst-plugins-base
Branch: master
Commit: e82414643caf876f094f78a8df2293068fe11f13
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=e82414643caf876f094f78a8df2293068fe11f13

Author: Thiago Santos <thiago.sousa.santos@collabora.co.uk>
Date:   Sat Mar 20 11:17:38 2010 -0300

tag: xmp: Refactor mappings storage

This commit is only refactoring, no fetaures added.

Do not store tags in flexible arrays as it doesn't allow us
to use nested flexible arrays. This is going to be needed in the
following commits to map gst tags that are stored into
2 separate tags in xmp (Not that they are alternatives, but
they are complementary).

For example, GST_TAG_ELEVATION is represented in the exif
schema with 2 fields: the absolute altitude and an integer
to indicate if it is above or below sea level.

The previous mappings storage wouldn't allow us to
express it.

Also store a serialization and a deserialization function
for each xmp tag as some of them require some non-trivial
convertion to its string form.

Fixes #613690


Module: gst-plugins-base
Branch: master
Commit: fe1f3e35957ddae12ae662e8e950bd8eb2358520
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=fe1f3e35957ddae12ae662e8e950bd8eb2358520

Author: Thiago Santos <thiago.sousa.santos@collabora.co.uk>
Date:   Mon Mar 22 22:03:09 2010 -0300

tag: xmp: Refactor buffer parsing

When parsing the xmp buffer into the gst taglist store the
found tags into a list to be parsed only after finding all
tags on the buffer. This allows the parser function to search
this list for complimentary tags that should be parsed together

Fixes #613690


Module: gst-plugins-base
Branch: master
Commit: 7ebbfbd3a5571c0e7518c5de9e710b9b9915f91e
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=7ebbfbd3a5571c0e7518c5de9e710b9b9915f91e

Author: Thiago Santos <thiago.sousa.santos@collabora.co.uk>
Date:   Mon Mar 22 15:18:28 2010 -0300

tag: xmp: Adds mappings for LATITUDE and LONGITUDE

Adds the mappings for those tags and tests
for tags serialization.

Fixes #613690


Module: gst-plugins-base
Branch: master
Commit: e207463582cc227b73922e8d6a70a721b75baf45
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=e207463582cc227b73922e8d6a70a721b75baf45

Author: Thiago Santos <thiago.sousa.santos@collabora.co.uk>
Date:   Tue Mar 23 09:48:19 2010 -0300

tag: xmp: Fix off by one

Avoid ignoring single char tags, like exif:GPSAltitudeRef

Fixes #613690


Module: gst-plugins-base
Branch: master
Commit: 007bf4fe7cef2c911a280a8f2c5caa27f9f25c14
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=007bf4fe7cef2c911a280a8f2c5caa27f9f25c14

Author: Thiago Santos <thiago.sousa.santos@collabora.co.uk>
Date:   Tue Mar 23 09:32:40 2010 -0300

tag: xmp: Add Elevation tag mapping

Adds a mapping to the _ELEVATION tag, this is a different
mapping as it has to be mapped into exif:GPSAltitude and
exif:GPSAltitudeRef at the same time. So we needed to refactor
a little more to be able to deserialize it properly.

Now, when parsing a xmp buffer into a taglist all tags are
added to a list before being parsed so that when one of the
altitude tags are found the deserialization function can search
for its complementary tag to do the correct parsing

Fixes #613690
Comment 15 Thiago Sousa Santos 2010-03-24 18:57:19 UTC
Comment on attachment 156864 [details] [review]
tag: xmp: Add Elevation tag mapping

Obsolete this, updated version commited
Comment 16 Thiago Sousa Santos 2010-03-24 18:57:48 UTC
Comment on attachment 157000 [details] [review]
tag: xmp: Refactor mappings storage

Obsolete too, updated version committed