changeset 4262:f146ce39977a libavformat

Do not use avctx->frame_number which might not be set, this also fixes a side effect where its value was one too much.
author bcoudurier
date Tue, 20 Jan 2009 09:43:58 +0000
parents af29578c3d77
children 06e2069d3b10
files gxfenc.c
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/gxfenc.c	Tue Jan 20 09:25:50 2009 +0000
+++ b/gxfenc.c	Tue Jan 20 09:43:58 2009 +0000
@@ -693,11 +693,8 @@
     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 @@
     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);
 }