[FFmpeg-devel] [PATCH] lavf: use a new ffio_wfourcc macro instead of put_tag() where possible

Ronald S. Bultje rsbultje
Wed Feb 23 17:16:43 CET 2011


Hi,

On Wed, Feb 23, 2011 at 10:59 AM, Anton Khirnov <anton at khirnov.net> wrote:
> ---
> ?libavformat/aiffenc.c ? ? ? | ? 11 +-
> ?libavformat/au.c ? ? ? ? ? ?| ? ?3 +-
> ?libavformat/avienc.c ? ? ? ?| ? 39 ++++----
> ?libavformat/avio_internal.h | ? ?2 +
> ?libavformat/flvenc.c ? ? ? ?| ? ?3 +-
> ?libavformat/img2.c ? ? ? ? ?| ? ?9 +-
> ?libavformat/mmf.c ? ? ? ? ? | ? ?5 +-
> ?libavformat/movenc.c ? ? ? ?| ?215 ++++++++++++++++++++++---------------------
> ?libavformat/oggenc.c ? ? ? ?| ? ?3 +-
> ?libavformat/riff.c ? ? ? ? ?| ? ?3 +-
> ?libavformat/rmenc.c ? ? ? ? | ? 13 ++-
> ?libavformat/soxenc.c ? ? ? ?| ? ?5 +-
> ?libavformat/wav.c ? ? ? ? ? | ? ?5 +-
> ?13 files changed, 165 insertions(+), 151 deletions(-)

Thanks! I really like this patch. Small nitpicks:

> diff --git a/libavformat/avienc.c b/libavformat/avienc.c
[..]
> @@ -311,7 +312,7 @@ static int avi_write_header(AVFormatContext *s)
>              avio_w8(pb, 0);          /* bIndexSubType (0 == frame index) */
>              avio_w8(pb, 0);          /* bIndexType (0 == AVI_INDEX_OF_INDEXES) */
>              avio_wl32(pb, 0);        /* nEntriesInUse (will fill out later on) */
> -            put_tag(pb, avi_stream2fourcc(&tag[0], i, stream->codec_type));
> +            ffio_wfourcc(pb, avi_stream2fourcc(&tag[0], i, stream->codec_type));

Didn't we just make fun of this? So I think you don't need a tag[5]
here, you can just return an uint32_t from avi_stream2fourcc() and
write that directly using avio_wl32(). Can be done in a separate patch
of course, shouldn't hold this back.

But please fix &tag[0]...

> @@ -413,7 +414,7 @@ static int avi_write_ix(AVFormatContext *s)
>
>           /* Writing AVI OpenDML leaf index chunk */
>           ix = url_ftell(pb);
> -         put_tag(pb, &ix_tag[0]);     /* ix?? */
> +         ffio_wfourcc(pb, &ix_tag[0]);     /* ix?? */
[..]
> @@ -421,7 +422,7 @@ static int avi_write_ix(AVFormatContext *s)
>           avio_w8(pb, 1);             /* bIndexType (1 == AVI_INDEX_OF_CHUNKS) */
>           avio_wl32(pb, avist->indexes.entry);
>                                        /* nEntriesInUse */
> -         put_tag(pb, &tag[0]);        /* dwChunkId */
> +         ffio_wfourcc(pb, &tag[0]);    /* dwChunkId */
[..]
> @@ -486,7 +487,7 @@ static int avi_write_idx1(AVFormatContext *s)
>                  avist= s->streams[stream_id]->priv_data;
>                  avi_stream2fourcc(&tag[0], stream_id,
>                                    s->streams[stream_id]->codec->codec_type);
> -                put_tag(pb, &tag[0]);
> +                ffio_wfourcc(pb, &tag[0]);

&tag[0]?

> diff --git a/libavformat/rmenc.c b/libavformat/rmenc.c
> [..]

You missed:
libavformat/rmenc.c:                put_tag(s,"VIDORV10");
libavformat/rmenc.c:                put_tag(s,"VIDORV20");

Can be split into two ffio_wfourcc()s.

Ronald



More information about the ffmpeg-devel mailing list