[FFmpeg-devel] [PATCH 1/2] ffmenc: use ffio_fill()
Michael Niedermayer
michaelni at gmx.at
Tue Jul 16 23:31:16 CEST 2013
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
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
In a rich man's house there is no place to spit but his face.
-- Diogenes of Sinope
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130716/e7d5dc10/attachment.asc>
More information about the ffmpeg-devel
mailing list