diff mbox

[FFmpeg-devel] avformat/ivfenc: Change the length fields to 32 bits

Message ID 20191002130459.4695-1-rzumer@tebako.net
State Accepted
Commit d3807467b2587ea720f32933d44b9dac5ecda66b
Headers show

Commit Message

rzumer@tebako.net Oct. 2, 2019, 1:04 p.m. UTC
There is no change in the encoded bitstream, but this
ensures that the written field length is consistent
with the reference implementation.

Unused bytes are zeroed out for backwards compatibility.

Signed-off-by: Raphaël Zumer <rzumer@tebako.net>
---
 libavformat/ivfenc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

rzumer@tebako.net Oct. 7, 2019, 3:10 p.m. UTC | #1
Just sending a reminder for my set of patches (the set of v2 patches up
in the thread and this one). Are there any further comments?

Thanks
Raphaël Zumer

On Wed, 2019-10-02 at 09:04 -0400, Raphaël Zumer wrote:
> There is no change in the encoded bitstream, but this
> ensures that the written field length is consistent
> with the reference implementation.
> 
> Unused bytes are zeroed out for backwards compatibility.
> 
> Signed-off-by: Raphaël Zumer <rzumer@tebako.net>
> ---
>  libavformat/ivfenc.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/ivfenc.c b/libavformat/ivfenc.c
> index ae461a872b..eb70421c44 100644
> --- a/libavformat/ivfenc.c
> +++ b/libavformat/ivfenc.c
> @@ -84,7 +84,8 @@ static int ivf_write_trailer(AVFormatContext *s)
>  
>          avio_seek(pb, 24, SEEK_SET);
>          // overwrite the "length" field (duration)
> -        avio_wl64(pb, ctx->frame_cnt * ctx->sum_delta_pts / (ctx-
> >frame_cnt - 1));
> +        avio_wl32(pb, ctx->frame_cnt * ctx->sum_delta_pts / (ctx-
> >frame_cnt - 1));
> +        avio_wl32(pb, 0); // zero out unused bytes
>          avio_seek(pb, end, SEEK_SET);
>      }
>
Vittorio Giovara Oct. 7, 2019, 9:13 p.m. UTC | #2
this seems good to me, unless objections i'll merge it in 24h

On Mon, Oct 7, 2019 at 11:10 AM Raphaël Zumer <rzumer@tebako.net> wrote:

> Just sending a reminder for my set of patches (the set of v2 patches up
> in the thread and this one). Are there any further comments?
>
> Thanks
> Raphaël Zumer
>
> On Wed, 2019-10-02 at 09:04 -0400, Raphaël Zumer wrote:
> > There is no change in the encoded bitstream, but this
> > ensures that the written field length is consistent
> > with the reference implementation.
> >
> > Unused bytes are zeroed out for backwards compatibility.
> >
> > Signed-off-by: Raphaël Zumer <rzumer@tebako.net>
> > ---
> >  libavformat/ivfenc.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/libavformat/ivfenc.c b/libavformat/ivfenc.c
> > index ae461a872b..eb70421c44 100644
> > --- a/libavformat/ivfenc.c
> > +++ b/libavformat/ivfenc.c
> > @@ -84,7 +84,8 @@ static int ivf_write_trailer(AVFormatContext *s)
> >
> >          avio_seek(pb, 24, SEEK_SET);
> >          // overwrite the "length" field (duration)
> > -        avio_wl64(pb, ctx->frame_cnt * ctx->sum_delta_pts / (ctx-
> > >frame_cnt - 1));
> > +        avio_wl32(pb, ctx->frame_cnt * ctx->sum_delta_pts / (ctx-
> > >frame_cnt - 1));
> > +        avio_wl32(pb, 0); // zero out unused bytes
> >          avio_seek(pb, end, SEEK_SET);
> >      }
> >
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox

Patch

diff --git a/libavformat/ivfenc.c b/libavformat/ivfenc.c
index ae461a872b..eb70421c44 100644
--- a/libavformat/ivfenc.c
+++ b/libavformat/ivfenc.c
@@ -84,7 +84,8 @@  static int ivf_write_trailer(AVFormatContext *s)
 
         avio_seek(pb, 24, SEEK_SET);
         // overwrite the "length" field (duration)
-        avio_wl64(pb, ctx->frame_cnt * ctx->sum_delta_pts / (ctx->frame_cnt - 1));
+        avio_wl32(pb, ctx->frame_cnt * ctx->sum_delta_pts / (ctx->frame_cnt - 1));
+        avio_wl32(pb, 0); // zero out unused bytes
         avio_seek(pb, end, SEEK_SET);
     }