[FFmpeg-devel] [PATCH v2 5/5] avformat: add amv muxer

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Tue Nov 3 04:26:38 EET 2020


Zane van Iperen:
> 
> 
> On 3/11/20 10:44 am, Andreas Rheinhardt wrote:
>>> +static void amv_write_vlist(AVFormatContext *s, AVCodecParameters *par)
>>> +{
>>> +    uint8_t buf[FFMAX(AMV_VIDEO_STRH_SIZE, AMV_VIDEO_STRF_SIZE)] = { 0 };
>>> +    int64_t tag_list, tag_str;
>>> +
>>> +    av_assert0(par->codec_id == AV_CODEC_ID_AMV);
>>> +
>>> +    tag_list = amv_start_tag(s->pb, "LIST");
>>> +    ffio_wfourcc(s->pb, "strl");
>>> +    tag_str = ff_start_tag(s->pb, "strh");
>>> +    avio_write(s->pb, buf, AMV_VIDEO_STRH_SIZE);
>>
>> Use ffio_fill() here and in the two other places where you use write
>> zeroes; this also allows to no longer initialize the buf below.
>>
> 
> Ah, I was wondering if something like that existed. Didn't consider the 
> ffio_ prefix. Reckon I should just get rid of all the buffers and change 
> everything to avio_wlXX?
> 
Using a temporary buffer might be better because it avoids function call
overhead.

- Andreas


More information about the ffmpeg-devel mailing list