[FFmpeg-devel] [PATCH] metadata API is now ready to be part of public API

Aurelien Jacobs aurel
Sun Mar 1 17:18:55 CET 2009


On Sun, 01 Mar 2009 11:02:17 -0500
Justin Ruggles <justin.ruggles at gmail.com> wrote:

> Aurelien Jacobs wrote:
> > On Sat, 28 Feb 2009 18:56:21 -0500
> > Justin Ruggles <justin.ruggles at gmail.com> wrote:
> > 
> >> Aurelien Jacobs wrote:
> >>> Hi,
> >>>
> >>> I think the new metadata API is now ready to be used in the wild.
> >>> So attached patch makes it officially part of public API.
> >>> Note that all (de)muxers are now using this new API.
> >>>
> >>> The only step left for this transition is to disable old API for
> >>> next major version, and to document this deprecation.
> >> What do you think about adding a generic api function to append to an
> >> existing entry instead of replacing it?  I'm thinking in terms of
> >> formats like vorbiscomment which explicitly allow duplicate entries for
> >> the same key.  Something like:
> >>
> >> int av_metadata_append(AVMetadata **pm, const char *key, const char
> >> *value, const char *separator);
> > 
> > The whole metadata API is based on the concept that there can't be
> > several keys with the same semantic. Please read the API doc,
> > especially point 1:
> > 
> >  * Important concepts to keep in mind:
> >  * 1. Keys are unique; there can never be 2 tags with the same key. This is
> >  *    also meant semantically, i.e., a demuxer should not knowingly produce
> >  *    several keys that are literally different but semantically identical.
> >  *    E.g., key=Author5, key=Author6. In this example, all authors must be
> >  *    placed in the same tag.
> > 
> > If we wanted to allow several keys with the same name, we would have to
> > change *every* muxer so that for *every* key it iterates to see if there
> > isn't several keys with the same name. And if they are several, every
> > muxer would have to handle this and "concatenate" the values.
> > With the restriction of point 1 cited above, only the very few format
> > which support repeated use of the same key need some special code to
> > handle it.
> > Oh, and patch welcome for the ogg demuxer to concatenate all the fields
> > with the same key name in a single metadata tag.
> 
> Yes, I understand the API and agree with the concept. I don't think I
> explained my thoughts well enough. My idea was that such a function
> would concatenate the values within the same tag.  I just thought it
> might be a useful thing to have _because_ our API doesn't allow multiple
> entries for the same key.

Ahh, OK. Got it.
That suddenly becomes a much more acceptable idea :-)

> Yes, it can of course just be done within the ogg demuxer, but if there
> was a single shared function to do that, it could be utilized by users
> or by other formats as well.  That said, it could just as easily be done
> without putting it in the external API.

I'm not sure it's really worth to export it in public API for now.
Feel free to implement this in ogg demuxer, or in metadata.c as a
private API if several demuxers need it.
We can always move it to public API later if the need arise.

Oh, and maybe a name such as ff_metadata_cat() would make it clearer
what this function does (by analogy to strcat()).

Aurel




More information about the ffmpeg-devel mailing list