[FFmpeg-devel] [PATCH] av_metadata_count()

Michael Niedermayer michaelni
Sun Feb 1 02:06:21 CET 2009


On Sun, Feb 01, 2009 at 02:00:12AM +0100, Aurelien Jacobs wrote:
> On Fri, 30 Jan 2009 17:33:02 +0100
> Michael Niedermayer <michaelni at gmx.at> wrote:
> 
> > On Fri, Jan 30, 2009 at 01:43:34AM +0100, Aurelien Jacobs wrote:
> > > Hi,
> > > 
> > > Attached patch adds a new metadata API func to get the number of
> > > available tags among a list of keys. This func will be useful
> > > at least for the following muxers: asf, mov, mp3.
> > > It can also be quite handy for a user application.
> > 
> > i cant see this to be that usefull, please first show the code
> > that would benefit from this.
> 
> OK. As an example, here is a snipet from movenc:
>     // only save meta tag if required
>     if (s->title[0] || s->author[0] || s->album[0] || s->year ||
>         s->comment[0] || s->genre[0] || s->track) {
> It could be replaced by something very ugly:
>     // only save meta tag if required
>     if (av_metadata_get(s->metadata, "title"  , NULL, 0) ||
>         av_metadata_get(s->metadata, "author" , NULL, 0) ||
>         av_metadata_get(s->metadata, "album"  , NULL, 0) ||
>         av_metadata_get(s->metadata, "year"   , NULL, 0) ||
>         av_metadata_get(s->metadata, "comment", NULL, 0) ||
>         av_metadata_get(s->metadata, "genre"  , NULL, 0) ||
>         av_metadata_get(s->metadata, "track"  , NULL, 0)) {
> Or by something simpler like:
>     static const char const *mov_tags[] = {
>         "title", "author", "album", "year", "copyright", "comment",
>         "genre", "track", NULL
>     };
>     // only save meta tag if required
>     if (av_metadata_count(s->metadata, mov_tags, 0)) {
> 
> We have something similar in the mp3 muxer, except that it currently
> only check the presence of title to deceide whether it should mux
> metadata or not (this is wrong and it should really check for the
> presence of any supported tag).
> Attached is a patch to use new metadata API in mp3 (de)muxer, which
> make use of av_metadata_count(). (I have not yet finalized patch
> for the mov muxer, but it will use something similar, twice)

url_open_dyn_buf(&bc)
write title
write author
...

if bc is not empty write it out

am i missing something?

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Awnsering whenever a program halts or runs forever is
On a turing machine, in general impossible (turings halting problem).
On any real computer, always possible as a real computer has a finite number
of states N, and will either halt in less than N cycles or never halt.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090201/7b435382/attachment.pgp>



More information about the ffmpeg-devel mailing list