aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBaptiste Coudurier <baptiste.coudurier@gmail.com>2009-01-20 09:43:58 +0000
committerBaptiste Coudurier <baptiste.coudurier@gmail.com>2009-01-20 09:43:58 +0000
commit507ff760afa91f77e82110fc6193808c5e0973bc (patch)
tree76cb4b655e77187937a86b09454e77fbae98adff
parent27052238c083e512a1aef27252c6eb537e313739 (diff)
downloadffmpeg-507ff760afa91f77e82110fc6193808c5e0973bc.tar.gz
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
-rw-r--r--libavformat/gxfenc.c9
-rw-r--r--tests/libav.regression.ref2
2 files changed, 6 insertions, 5 deletions
diff --git a/libavformat/gxfenc.c b/libavformat/gxfenc.c
index 229acc9448..77a2927447 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 43847efb98..136076f507 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