ext/ffmpeg/gstffmpegdemux.c: Fix timestamps. Quite some of the gaming formats work...
authorRonald S. Bultje <rbultje@ronald.bitfreak.net>
Sat, 2 Oct 2004 21:17:26 +0000 (21:17 +0000)
committerRonald S. Bultje <rbultje@ronald.bitfreak.net>
Sat, 2 Oct 2004 21:17:26 +0000 (21:17 +0000)
Original commit message from CVS:
* ext/ffmpeg/gstffmpegdemux.c: (gst_ffmpegdemux_loop):
Fix timestamps. Quite some of the gaming formats work now. :).

ChangeLog
ext/ffmpeg/gstffmpegdemux.c

index 2281c595065a57aa6c20e96e4fde426458300f0a..cf3a215a1dad90054e0878b2d7a97fc529c6f452 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2004-10-02  Ronald S. Bultje  <rbultje@ronald.bitfreak.net>
+
+       * ext/ffmpeg/gstffmpegdemux.c: (gst_ffmpegdemux_loop):
+         Fix timestamps. Quite some of the gaming formats work now. :).
+
 2004-10-02  Ronald S. Bultje  <rbultje@ronald.bitfreak.net>
 
        * ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_codecid_to_caps),
index 9833a76816df1600bd7b1f3630d70193baff57be..84dc6d233c2564c8c8df16cff764a1920f78d5cd 100644 (file)
@@ -617,15 +617,16 @@ gst_ffmpegdemux_loop (GstElement * element)
 
   /* and handle the data by pushing it forward... */
   if (pad && GST_PAD_IS_USABLE (pad)) {
+    AVStream *stream = gst_ffmpegdemux_stream_from_pad (pad);
     GstBuffer *outbuf;
 
     outbuf = gst_buffer_new_and_alloc (pkt.size);
     memcpy (GST_BUFFER_DATA (outbuf), pkt.data, pkt.size);
     GST_BUFFER_SIZE (outbuf) = pkt.size;
 
-    if (pkt.pts != AV_NOPTS_VALUE && demux->context->pts_den) {
-      GST_BUFFER_TIMESTAMP (outbuf) = (double) pkt.pts * GST_SECOND *
-          demux->context->pts_num / demux->context->pts_den;
+    if (pkt.pts != AV_NOPTS_VALUE) {
+      GST_BUFFER_TIMESTAMP (outbuf) = (gdouble) (pkt.pts +
+          stream->start_time) * GST_SECOND / AV_TIME_BASE;
     }
 
     if (pkt.flags & PKT_FLAG_KEY) {