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

Paul B Mahol onemda at gmail.com
Tue Jul 16 23:43:14 CEST 2013


On 7/16/13, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Tue, Jul 16, 2013 at 10:53:09AM +0000, Paul B Mahol wrote:
>> 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.
>
> i suggest:
> (avio_tell(pb) + ffm->packet_size - 1)/ ffm->packet_size * ffm->packet_size
> - avio_tell(pb)
> or some variant of it

Bah, I will just leave it as is, I don't care much about ffm.


More information about the ffmpeg-devel mailing list