[FFmpeg-devel] [PATCH] movenc: convert put_tag() into ffio_wfourcc().

Ronald S. Bultje rsbultje
Sat Feb 26 12:42:55 CET 2011


Hi,

On Sat, Feb 26, 2011 at 5:03 AM, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Fri, Feb 25, 2011 at 04:10:26PM -0800, Baptiste Coudurier wrote:
>> Hi,
>>
>> On 02/25/2011 02:36 PM, Ronald S. Bultje wrote:
>>> ---
>>> ? libavformat/movenc.c | ? ?6 +++---
>>> ? 1 files changed, 3 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/libavformat/movenc.c b/libavformat/movenc.c
>>> index 93d6ce9..57a6d11 100644
>>> --- a/libavformat/movenc.c
>>> +++ b/libavformat/movenc.c
>>> @@ -1241,16 +1241,16 @@ static int mov_write_tapt_tag(ByteIOContext *pb, MOVTrack *track)
>>> ? ? ? int64_t pos = url_ftell(pb);
>>>
>>> ? ? ? avio_wb32(pb, 0); /* size */
>>> - ? ?put_tag(pb, "tapt");
>>> + ? ?ffio_wfourcc(pb, "tapt");
>>>
>>> ? ? ? avio_wb32(pb, 20);
>>> - ? ?put_tag(pb, "clef");
>>> + ? ?ffio_wfourcc(pb, "clef");
>>> ? ? ? avio_wb32(pb, 0);
>>> ? ? ? avio_wb32(pb, width<< ?16);
>>> ? ? ? avio_wb32(pb, track->enc->height<< ?16);
>>>
>>> ? ? ? avio_wb32(pb, 20);
>>> - ? ?put_tag(pb, "enof");
>>> + ? ?ffio_wfourcc(pb, "enof");
>>> ? ? ? avio_wb32(pb, 0);
>>> ? ? ? avio_wb32(pb, track->enc->width<< ?16);
>>> ? ? ? avio_wb32(pb, track->enc->height<< ?16);
>>
>> This name is extremely ugly.
>
> yes, the API is also worse
>
> put_tag() worked with things that had length different from 4
> sane thing would have been to make it ffio_put_tag() with put_tag() API
> I tried to participate in the renamings

I'd like to see the part where you participated in the renaming of
put_tag(), I don't remember any such an occurance. You participated in
the renaming of another symbol, I think ByteIOContext -> AVIOContext.
Several people prefered AVIOContext, you wanted AVBIOContext, there
was a majority for AVIOContext so we went with that.

Re put_tag, I opposed the presence of the function because it doesn't
do anything useful that avio_write() itself doesn't do. The part where
I see it being used is as a convenient way to write fourccs, where
performance could be optimized because the amount of bytes is always
4. We therefore made it a macro that calls avio_wl32() using MKTAG().
Once we implement AV_WL32() in that function, I/O performance may
actually improve a little. Other than that, avio_write() does the same
as put_tag(), so we use that now. If you opposed this concept, I
emailed this to the list several days before I applied that patch, and
nobody replied to it.

Ronald



More information about the ffmpeg-devel mailing list