changeset 3310:66d5e19f7b77 libavformat

use duration from pkt
author bcoudurier
date Wed, 21 May 2008 22:52:21 +0000
parents a1cfa9c6e399
children c603ff471631
files ffm.c
diffstat 1 files changed, 1 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/ffm.c	Wed May 21 22:49:48 2008 +0000
+++ b/ffm.c	Wed May 21 22:52:21 2008 +0000
@@ -247,16 +247,8 @@
     FFMStream *fst = st->priv_data;
     int64_t pts;
     uint8_t header[FRAME_HEADER_SIZE];
-    int duration;
     int size= pkt->size;
 
-    //XXX/FIXME use duration from pkt
-    if (st->codec->codec_type == CODEC_TYPE_AUDIO) {
-        duration = ((float)st->codec->frame_size / st->codec->sample_rate * 1000000.0);
-    } else {
-        duration = (1000000.0 * st->codec->time_base.num / (float)st->codec->time_base.den);
-    }
-
     pts = fst->pts;
     /* packet size & key_frame */
     header[0] = pkt->stream_index;
@@ -264,7 +256,7 @@
     if (pkt->flags & PKT_FLAG_KEY)
         header[1] |= FLAG_KEY_FRAME;
     AV_WB24(header+2, size);
-    AV_WB24(header+5, duration);
+    AV_WB24(header+5, pkt->duration);
     ffm_write_data(s, header, FRAME_HEADER_SIZE, pts, 1);
     ffm_write_data(s, pkt->data, size, pts, 0);