[FFmpeg-devel] [PATCH 1/2] ffmenc: use ffio_fill()

Paul B Mahol onemda at gmail.com
Tue Jul 16 12:53:09 CEST 2013


On 7/15/13, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Mon, Jul 15, 2013 at 08:27:41PM +0000, Paul B Mahol wrote:
>> Signed-off-by: Paul B Mahol <onemda at gmail.com>
>> ---
>>  libavformat/ffmenc.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/libavformat/ffmenc.c b/libavformat/ffmenc.c
>> index eb809eb..41f148e 100644
>> --- a/libavformat/ffmenc.c
>> +++ b/libavformat/ffmenc.c
>> @@ -24,6 +24,7 @@
>>  #include "libavutil/avassert.h"
>>  #include "libavutil/parseutils.h"
>>  #include "avformat.h"
>> +#include "avio_internal.h"
>>  #include "internal.h"
>>  #include "ffm.h"
>>
>> @@ -213,8 +214,7 @@ static int ffm_write_header(AVFormatContext *s)
>>      avio_wb64(pb, 0); // end of header
>>
>>      /* flush until end of block reached */
>> -    while ((avio_tell(pb) % ffm->packet_size) != 0)
>> -        avio_w8(pb, 0);
>> +    ffio_fill(pb, 0, ffm->packet_size - avio_tell(pb));
>
> this is not the same as the code before


What about:
ffio_fill(pb, 0, FFALIGN(avio_tell(pb), ffm->packet_size) - avio_tell(pb));

This assumes that packet_size will always be power or 2.


More information about the ffmpeg-devel mailing list