From 507ff760afa91f77e82110fc6193808c5e0973bc Mon Sep 17 00:00:00 2001 From: Baptiste Coudurier <baptiste.coudurier@gmail.com> Date: Tue, 20 Jan 2009 09:43:58 +0000 Subject: [PATCH] Do not use avctx->frame_number which might not be set, this also fixes a side effect where its value was one too much. Originally committed as revision 16701 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavformat/gxfenc.c | 9 +++++---- tests/libav.regression.ref | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/libavformat/gxfenc.c b/libavformat/gxfenc.c index 229acc94487..77a2927447a 100644 --- a/libavformat/gxfenc.c +++ b/libavformat/gxfenc.c @@ -693,11 +693,8 @@ static int gxf_write_trailer(AVFormatContext *s) int i; for (i = 0; i < s->nb_streams; ++i) { - if (s->streams[i]->codec->codec_type == CODEC_TYPE_AUDIO) { + if (s->streams[i]->codec->codec_type == CODEC_TYPE_AUDIO) av_fifo_free(&gxf->streams[i].audio_buffer); - } else if (s->streams[i]->codec->codec_type == CODEC_TYPE_VIDEO) { - gxf->nb_frames = 2 * s->streams[i]->codec->frame_number; - } } gxf_write_eos_packet(pb, gxf); @@ -772,6 +769,10 @@ static int gxf_write_media_packet(ByteIOContext *pb, GXFContext *ctx, AVPacket * gxf_write_media_preamble(pb, ctx, pkt, pkt->size + padding); put_buffer(pb, pkt->data, pkt->size); gxf_write_padding(pb, padding); + + if (sc->codec->codec_type == CODEC_TYPE_VIDEO) + ctx->nb_frames += 2; // count fields + return updatePacketSize(pb, pos); } diff --git a/tests/libav.regression.ref b/tests/libav.regression.ref index 43847efb985..136076f5071 100644 --- a/tests/libav.regression.ref +++ b/tests/libav.regression.ref @@ -27,7 +27,7 @@ af78858062599fcbba049e4a02588a15 *./tests/data/b-libav.mov 913b6199765b1dcba196706574621c2f *./tests/data/b-libav.dv 3600000 ./tests/data/b-libav.dv ./tests/data/b-libav.dv CRC=0x7787e173 -ae41914d985979a7f28a286c3689fae1 *./tests/data/b-libav.gxf +ede81f26a3a68228d01124def788549d *./tests/data/b-libav.gxf 805996 ./tests/data/b-libav.gxf ./tests/data/b-libav.gxf CRC=0x9c06676e 66a6584f9e83e8ea3af822a3ba71fbbe *./tests/data/b-libav.nut -- GitLab