Commit 507ff760 authored by Baptiste Coudurier's avatar Baptiste Coudurier

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
parent 27052238
......@@ -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);
}
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment