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)
Aurel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: md_mp3.diff
Type: text/x-diff
Size: 9924 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090201/3aa6d7b7/attachment.diff>