[FFmpeg-devel] [PATCH 5/5] mp3enc: support for id3v2.3 tags using a per-muxer AVOption

Måns Rullgård mans
Fri Jan 21 15:51:54 CET 2011


Anton Khirnov <anton at khirnov.net> writes:

> @@ -175,7 +195,9 @@ static int mp3_write_header(struct AVFormatContext *s)
>      put_be32(s->pb, 0);
>
>      ff_metadata_conv(&s->metadata, ff_id3v2_34_metadata_conv, NULL);
> -    ff_metadata_conv(&s->metadata, ff_id3v2_4_metadata_conv, NULL);
> +    if (mp3->id3v2_version == 4)
> +        ff_metadata_conv(&s->metadata, ff_id3v2_4_metadata_conv, NULL);
> +

What about v2.3-only tags, or are there none that need processing here?

>      while ((t = av_metadata_get(s->metadata, "", t, AV_METADATA_IGNORE_SUFFIX))) {
>          int ret;
>
> @@ -183,7 +205,13 @@ static int mp3_write_header(struct AVFormatContext *s)
>              totlen += ret;
>              continue;
>          }
> -        if ((ret = id3v2_check_write_tag(s, t, ff_id3v2_4_tags)) > 0) {
> +        if (mp3->id3v2_version == 4 &&
> +            (ret = id3v2_check_write_tag(s, t, ff_id3v2_4_tags)) > 0) {
> +            totlen += ret;
> +            continue;
> +        }
> +        if (mp3->id3v2_version == 3 &&
> +            (ret = id3v2_check_write_tag(s, t, ff_id3v2_3_tags)) > 0) {
>              totlen += ret;
>              continue;
>          }

Perhaps this would be nicer as a single call with the last argument
determined by the version.

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list