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 623799 - tagsetter: Configurable metadata output
tagsetter: Configurable metadata output
Status: RESOLVED WONTFIX
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other All
: Normal enhancement
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2010-07-08 00:28 UTC by Thiago Sousa Santos
Modified: 2013-07-24 11:15 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
tag: Adds GstTagFormatConfig (6.16 KB, patch)
2010-10-07 01:43 UTC, Thiago Sousa Santos
none Details | Review
tagsetter: Adds new API for configuring metadata formats (6.24 KB, patch)
2010-10-07 01:44 UTC, Thiago Sousa Santos
none Details | Review
tagsetter: Adds a virtual function for supported formats (2.04 KB, patch)
2010-10-07 01:45 UTC, Thiago Sousa Santos
none Details | Review
tests: Remove GstTagSetter from ABI checks (4.08 KB, patch)
2010-10-19 22:22 UTC, Thiago Sousa Santos
committed Details | Review
tag: Adds GstTagFormatConfig (7.02 KB, patch)
2010-10-19 22:22 UTC, Thiago Sousa Santos
rejected Details | Review
tagsetter: Adds new API for configuring metadata formats (7.31 KB, patch)
2010-10-19 22:22 UTC, Thiago Sousa Santos
rejected Details | Review
xmp: Add new function that has a configuration struct (8.55 KB, patch)
2010-10-19 22:32 UTC, Thiago Sousa Santos
needs-work Details | Review
examples: Adds a jifmux-tagsetter example (5.65 KB, patch)
2010-10-19 22:42 UTC, Thiago Sousa Santos
rejected Details | Review
jifmux: Implement the new GstTagSetter configuration bits (7.86 KB, patch)
2010-10-19 22:42 UTC, Thiago Sousa Santos
rejected Details | Review
qtmux: Implement new GstTagSetter bits (9.28 KB, patch)
2010-10-19 22:42 UTC, Thiago Sousa Santos
rejected Details | Review

Description Thiago Sousa Santos 2010-07-08 00:28:41 UTC
XMP spec aggregates multiple tag systems/groups, called schemas. Examples: exif, iptc, photoshop, dublin core...

One use case that isn't covered is to allow applications to select which ones should be used when serializing a taglist to the streams. This requires working at 2 levels.

1) Implement a configuration struct/parameter for the xmp lib in -base/gst-libs/tag, allowing elements to inform which schemas should be used.

2) Implement a way for elements to expose this API to applications.

I haven't started working on this (yet), but I thought it would be nice to start discussing here so I can start on the correct direction.

The xmp schemas are represented by strings, here are some:
* dc
* xap
* photoshop
* tiff
* iptc

Check http://www.adobe.com/devnet/xmp/pdfs/XMPSpecificationPart2.pdf for more information.

So I was thinking to have some API to blacklist/whitelist what schemas to use, this is simple (from the API point of view) of adding to the taglib, but how should we expose it from elements?

As I don't know any other specs similar to XMP, I think an specific interface would be nice for configuring it, rather than going the generic way. Do we have any other options here?

We could also create a GstTagSetter2, but I really can't think of a nice API that would be able to handle all this generically. Maybe someone out there has a better idea?
Comment 1 Edward Hervey 2010-07-08 09:06:49 UTC
Aren't you going to only use one schema per format using xmp ?

i.e. For jpeg/tiff files you'd only use one format, no ?

If so, one would only need to modify the xmp helper functions to specify the xmp format one want depending on who's calling it (i.e. qtmux would use a different format than another container format).
Comment 2 Stefan Sauer (gstreamer, gtkdoc dev) 2010-07-09 14:16:26 UTC
Thiago, the api could also be used to select between different id3-tag schemas (not sure if that is a good idea, but I think people have asked for it, but we don't have an api for it).

It seems we can't add vmethods to GstTagSetterIFace as it never ever had padding :/. Not sure if we can't just add it, as I am sure nobody subclassed that iface yet. Anyone against that?

Edward, the schemas are kind of namesspaces of metadata owned by different authorities. It totally makes sense to use multiple of them at the same time.
Comment 3 Marco Ballesio 2010-07-12 10:18:46 UTC
(In reply to comment #1)
> Aren't you going to only use one schema per format using xmp ?
> 
> i.e. For jpeg/tiff files you'd only use one format, no ?
> 
> If so, one would only need to modify the xmp helper functions to specify the
> xmp format one want depending on who's calling it (i.e. qtmux would use a
> different format than another container format).

Imo qtmux-like elements are differentiating only the atoms (or boxes) written to the file so that the same metadata informations (e.g. location infos) can be stored in different ways for different formats.

I like the idea to use the same approach for this feature, but it would work without too many messes in the code only if we there aren't too many overlapping tags between the different specialized "formats" (e.g. like for 3gp and mp4).
Comment 4 Thiago Sousa Santos 2010-07-12 19:53:28 UTC
(In reply to comment #3)
> (In reply to comment #1)
> > Aren't you going to only use one schema per format using xmp ?
> > 
> > i.e. For jpeg/tiff files you'd only use one format, no ?
> > 
> > If so, one would only need to modify the xmp helper functions to specify the
> > xmp format one want depending on who's calling it (i.e. qtmux would use a
> > different format than another container format).
> 
> Imo qtmux-like elements are differentiating only the atoms (or boxes) written
> to the file so that the same metadata informations (e.g. location infos) can be
> stored in different ways for different formats.

Exactly, this happens because the specs dictates the 'native' formats for them, but there is no relation between these specs to xmp schemas. (at least, not that I know of)

> 
> I like the idea to use the same approach for this feature, but it would work
> without too many messes in the code only if we there aren't too many
> overlapping tags between the different specialized "formats" (e.g. like for 3gp
> and mp4).

Either I don't get how exactly this would work, or this makes no sense IMO.

Hardcoding schemas to muxers is not a good solution, this schema selection is application specific IMHO and should be handled as such.


My idea is that applications would call something like this:

gst_xmp_serializer_configure (my_element_that_writes_xmp, GST_TAG_XMP_ASSOCIATE_FIRST/ALL,
    "dc", "xap", "iptc", ..., NULL);

GST_TAG_XMP_ASSOCIATE_FIRST/ALL would make the tag association from a GST_TAG_* to a xmp one stop at the first mapping found or to map to all different schemas that contain that mapping.

The list of strings would define what schemas are to be used and their order of priority.
Comment 5 Marco Ballesio 2010-07-13 06:53:08 UTC
(In reply to comment #4)
> 
> My idea is that applications would call something like this:
> 
> gst_xmp_serializer_configure (my_element_that_writes_xmp,
> GST_TAG_XMP_ASSOCIATE_FIRST/ALL,
>     "dc", "xap", "iptc", ..., NULL);
> 
> GST_TAG_XMP_ASSOCIATE_FIRST/ALL would make the tag association from a GST_TAG_*
> to a xmp one stop at the first mapping found or to map to all different schemas
> that contain that mapping.
> 
> The list of strings would define what schemas are to be used and their order of
> priority.

This is the best approach in case of many possible combinations. Duplications for the same XMP tag in more than one schema would be another good reason for this solution, so I guess we're actually in such a case. A confirmation will make me silent on this bug, at least for a while :) .
Comment 6 Thiago Sousa Santos 2010-08-02 13:23:01 UTC
I just started implementing this. Starting by the library and adding configuration parameters in new functions for serialization.

Then I should start the GstXmpConfigurationInterface, do we have a better option/idea to solve this for the elements?
Comment 7 Stefan Sauer (gstreamer, gtkdoc dev) 2010-08-02 16:38:38 UTC
Thiago, as I said in comment #2, I wonder if we could keep more generic. We could have an iface with methods to query what variants of the metadata standard the element supports and then select a combination of them. Then people can select which metadata formats they want at all. 
Like in mp4mux, people could select between native metadata, xmp and id3. That would need some recursive mechanism to handle the 'subformats'=schemas for xmp and 'subformats'=id3-versions for id3 (just one of them). This can be solved using a hierarchic structure for query and selection. Not sure if this is getting too complex ...
Comment 8 Tim-Philipp Müller 2010-08-02 21:10:21 UTC
> It seems we can't add vmethods to GstTagSetterIFace as it never ever had
> padding :/. Not sure if we can't just add it, as I am sure nobody subclassed
> that iface yet.

That's not a problem. Interfaces don't need padding, we can add additional vmethods without breaking ABI or API. (This is not to say that I think it's a good idea to add this to the existing GstTagSetter interface, just that it's possible.)
Comment 9 Thiago Sousa Santos 2010-08-03 10:25:32 UTC
If we were to create a generic interface and add it to GstTagSetter, I can think of the following methods:

* const gchar** _get_supported_formats () - returns the list of supported formats: e.g. native, xmp, exif, id3...

* const gchar** _get_supported_sub_formats (major-format) - returns the list of subformats supported for the specific major-format

* void _set_enabled_formats (hashtable of major-format to subformat list)

* hashtable _get_enabled_formats ()

This looks like it would work, don't know how worth would be doing that and if there is a good generic way of handling subformats.
Comment 10 Tim-Philipp Müller 2010-08-03 10:34:20 UTC
Exposing hash tables directly in the API is not very nice, and also not very bindings/introspection friendly.
Comment 11 Stefan Sauer (gstreamer, gtkdoc dev) 2010-08-04 12:19:17 UTC
Thiago, I was suggesting a GstStructure. Do you see any problem with that?
Comment 12 Thiago Sousa Santos 2010-10-07 01:43:53 UTC
Created attachment 171868 [details] [review]
tag: Adds GstTagFormatConfig

Adds structure to represent a configuration of tag formats
to be serialized by a tagsetter

API: gst_tag_formats_config_new
API: gst_tag_formats_config_free
API: gst_tag_formats_config_add_format
API: gst_tag_formats_config_get_nth_format
API: gst_tag_formats_config_get_size
Comment 13 Thiago Sousa Santos 2010-10-07 01:44:08 UTC
Created attachment 171869 [details] [review]
tagsetter: Adds new API for configuring metadata formats

Adds new functions for querying and configuring metadata
formats to be serialized. This allows application to select
which metadata formats (exif/xmp/native/id3) should be
written to the streams. The configuration is done through a
GstStructure and allow selecting 'subformats' as well.

For example, xmp has lots of different schemes, each scheme
is considered a subformat. id3 versions are also subformats
of id3.

API: gst_tag_setter_get_supported_formats
API: gst_tag_setter_get_config
API: gst_tag_setter_set_config

Fixes #623799
Comment 14 Thiago Sousa Santos 2010-10-07 01:45:37 UTC
Created attachment 171870 [details] [review]
tagsetter: Adds a virtual function for supported formats

This is not correct as it breaks ABI, can someone think of an alternative?

Those 3 patches add the basis for configuring metadata formats, once we agree
this is on the right track I'll implement it on qtmux and jifmux as test
cases to see what we could improve or helper functions to provide.
Comment 15 Thiago Sousa Santos 2010-10-19 22:22:07 UTC
Created attachment 172772 [details] [review]
tests: Remove GstTagSetter from ABI checks

Interfaces can have new members added without breaking ABI, so
remove it from the check.
Comment 16 Thiago Sousa Santos 2010-10-19 22:22:29 UTC
Created attachment 172773 [details] [review]
tag: Adds GstTagFormatConfig

Adds structure to represent a configuration of tag formats
to be serialized by a tagsetter

API: gst_tag_formats_config_new
API: gst_tag_formats_config_free
API: gst_tag_formats_config_add_format
API: gst_tag_formats_config_get_nth_format
API: gst_tag_formats_config_get_size
Comment 17 Thiago Sousa Santos 2010-10-19 22:22:53 UTC
Created attachment 172774 [details] [review]
tagsetter: Adds new API for configuring metadata formats

Adds new functions for querying and configuring metadata
formats to be serialized. This allows application to select
which metadata formats (exif/xmp/native/id3) should be
written to the streams. The configuration is done through a
GstStructure and allow selecting 'subformats' as well.

For example, xmp has lots of different schemes, each scheme
is considered a subformat. id3 versions are also subformats
of id3.

API: gst_tag_setter_get_supported_formats
API: gst_tag_setter_get_config
API: gst_tag_setter_set_config

Fixes #623799
Comment 18 Thiago Sousa Santos 2010-10-19 22:32:00 UTC
Created attachment 172775 [details] [review]
xmp: Add new function that has a configuration struct

Adds a new function that accepts a GstStructure as a configuration
for the xmp serialization. This GstStructure is the same used
in the GstTagSetter configuration.

It is now possible to specify which schemas should be used in
xmp.

API: gst_tag_list_to_xmp_buffer_full
Comment 19 Thiago Sousa Santos 2010-10-19 22:42:40 UTC
Created attachment 172776 [details] [review]
examples: Adds a jifmux-tagsetter example

Adds an example showing the new configuration API
for GstTagSetter using jifmux
Comment 20 Thiago Sousa Santos 2010-10-19 22:42:48 UTC
Created attachment 172777 [details] [review]
jifmux: Implement the new GstTagSetter configuration bits

Use GstTagSetter configuration API to select which metadata
formats are put into resulting jpegs
Comment 21 Thiago Sousa Santos 2010-10-19 22:42:58 UTC
Created attachment 172778 [details] [review]
qtmux: Implement new GstTagSetter bits

Implement new tagsetter interface methods to allow configuration of
the metadata formats to be used
Comment 22 Thiago Sousa Santos 2010-10-19 22:45:37 UTC
Moving to core as the most important bits for this are there.

2 open points in these patches:

* Should we add a get mapped subformats to our xmp lib to provide a more complete supported formats description?

* As we're adding a gst_tag_list_to_xmp_buffer_full I wonder if that should also include the GstCaps for the format as I've seen some exif tags that are for data that is usually on caps on gstreamer. The same might happen for xmp as well.
Comment 23 Thiago Sousa Santos 2010-12-29 13:00:09 UTC
Anyone got time to review this? :)
Comment 24 Stefan Sauer (gstreamer, gtkdoc dev) 2011-03-04 12:57:57 UTC
Comment on attachment 172772 [details] [review]
tests: Remove GstTagSetter from ABI checks

looks good to me
Comment 25 Tim-Philipp Müller 2011-03-04 15:43:28 UTC
I can't help but feel this is a bit overdesigned. And the API doesn't look very nice to use tbh, judging by the example in the GstTagFormatsConfig docs.

Also, when it comes to subformats, there seems to be two types, which are mixed up here API-wise if I'm not mistaken: mutually-exclusive subformats (pick one) like ID3 versions, and options (pick any) like XMP namespaces.

I guess we could just assume apps know what to do for each format, but it still doesn't feel right to me.

I'll see if I have ideas for an alternative API.
Comment 26 Stefan Sauer (gstreamer, gtkdoc dev) 2011-03-04 16:16:09 UTC
Comment on attachment 172773 [details] [review]
tag: Adds GstTagFormatConfig

I also think we better hide the fact that we use a structure.
Comment 27 Stefan Sauer (gstreamer, gtkdoc dev) 2011-03-04 16:22:15 UTC
Review of attachment 172775 [details] [review]:

::: gst-libs/gst/tag/gstxmptag.c
@@ +1593,1 @@
 

what about keeping the local data var abd just assigning it here?
write_data.data = data;
then you have less changes below and not pointer deref.
Comment 28 Tim-Philipp Müller 2011-03-29 22:46:40 UTC
There's now a GstTagXmpWriter interface which does exactly what it's supposed to. I don't really see any major use cases remaining, nor do I have better ideas how to approach this with generic API, so I think we should just close this bug or rename it back to 'configurable xmp output', unless someone wants to pursue the generic approach further.
Comment 29 Stefan Sauer (gstreamer, gtkdoc dev) 2011-03-31 21:05:51 UTC
(In reply to comment #28)
> There's now a GstTagXmpWriter interface which does exactly what it's supposed
> to. I don't really see any major use cases remaining, nor do I have better
> ideas how to approach this with generic API, so I think we should just close
> this bug or rename it back to 'configurable xmp output', unless someone wants
> to pursue the generic approach further.

I just now saw that plan b was done in bug #645167. Whats is the issue with a more generic API? Elements that implement tagsetter would need two extra methods:
GList *gst_tag_setter_get_variants(GstTagSetter *ts)
 if return list is NULL -> no variants
gst_tag_setter_set_variants(GstTagSetter *ts, GList *variants)
 set the variants to use, all unknown variants are ignored. one should really use 
 _get_variants(), filter and call _set_variants()

Each variant would be a group in the sense of a pick one or pick any. The group would be a list of string and description.

Basically what thiago did, but hiding the structure from the api if that is desired.

I really thing the XmpConfig is not something we want to have in a release.
Comment 30 Tim-Philipp Müller 2011-03-31 22:26:55 UTC
> Whats is the issue with a more generic API?

See comment #25: I think the current proposal is overdesigned, convoluted, and confused. And I think other than XMP the use cases mentioned a re rather unconvincing and can easily be handled differently in better ways.

 
> I really thin[k] the XmpConfig is not something we want to have in a release.

I think it's fine. It does exactly what it's supposed to do with straight-forward API. It solves a real problem that can't easily be solved better in another way.

It's not that I wouldn't prefer a generic API, I just can't think of such an API that makes sense to me and doesn't have the issues mentioned above.
Comment 31 Sebastian Dröge (slomo) 2011-04-05 12:44:18 UTC
I think you're both right ;)

GstXmpConfig is only solving part of the problem and a more generic GstTagSetter configuration system would be better. But OTOH it seems to be complicated to define a nice interface for this and the need for GstXmpConfig is there *now*. We can still remove GstXmpConfig from 0.11 and replace it with something more generic, 0.11 will be there soon.
Comment 32 Sebastian Dröge (slomo) 2013-07-24 08:31:12 UTC
Comment on attachment 172772 [details] [review]
tests: Remove GstTagSetter from ABI checks

commit 6da1778dad88777b19265a257c1121af4917e230
Author: Thiago Santos <thiago.sousa.santos@collabora.co.uk>
Date:   Fri Oct 15 13:16:59 2010 -0300

    tests: Remove GstTagSetter from ABI checks
    
    Interfaces can have new members added without breaking ABI, so
    remove it from the check.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=623799
Comment 33 Sebastian Dröge (slomo) 2013-07-24 08:31:53 UTC
What's the plan here now? Any interest still or just forget it?
Comment 34 Tim-Philipp Müller 2013-07-24 11:01:45 UTC
I refer to my comment #25 and comment #28 :)
Comment 35 Sebastian Dröge (slomo) 2013-07-24 11:15:34 UTC
Let's close it then