ext/mpeg2dec/gstmpeg2dec.*: Add some debugging to timestamp handling.
authorWim Taymans <wim.taymans@gmail.com>
Tue, 10 Oct 2006 16:58:32 +0000 (16:58 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Tue, 10 Oct 2006 16:58:32 +0000 (16:58 +0000)
Original commit message from CVS:
* ext/mpeg2dec/gstmpeg2dec.c: (handle_slice):
* ext/mpeg2dec/gstmpeg2dec.h:
Add some debugging to timestamp handling.
Make sure we don't convert invalid timestamps.

ChangeLog
ext/mpeg2dec/gstmpeg2dec.c
ext/mpeg2dec/gstmpeg2dec.h

index 20b1031..7283590 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-10-10  Wim Taymans  <wim@fluendo.com>
+
+       * ext/mpeg2dec/gstmpeg2dec.c: (handle_slice):
+       * ext/mpeg2dec/gstmpeg2dec.h:
+       Add some debugging to timestamp handling.
+       Make sure we don't convert invalid timestamps.
+
 2006-10-09  Tim-Philipp Müller  <tim at centricular dot net>
 
        * gst/asfdemux/gstasfdemux.c: (gst_asf_demux_sink_event),
index 217e976..7a91b24 100644 (file)
@@ -774,12 +774,19 @@ handle_slice (GstMpeg2dec * mpeg2dec, const mpeg2_info_t * info)
   time = GST_CLOCK_TIME_NONE;
 
 #if MPEG2_RELEASE < MPEG2_VERSION(0,4,0)
-  if (picture->flags & PIC_FLAG_PTS)
+  if (picture->flags & PIC_FLAG_PTS) {
     time = MPEG_TIME_TO_GST_TIME (picture->pts);
+    GST_DEBUG_OBJECT (mpeg2dec, "picture pts %" G_GUINT64_FORMAT
+        ", time %" GST_TIME_FORMAT, picture->pts, GST_TIME_ARGS (time));
+  }
 #else
-  if (picture->flags & PIC_FLAG_TAGS)
-    time = MPEG_TIME_TO_GST_TIME ((GstClockTime) (picture->
-            tag2) << 32 | picture->tag);
+  if (picture->flags & PIC_FLAG_TAGS) {
+    guint64 pts = (((guint64) picture->tag2) << 32) | picture->tag;
+
+    time = MPEG_TIME_TO_GST_TIME (pts);
+    GST_DEBUG_OBJECT (mpeg2dec, "picture tags %" G_GUINT64_FORMAT
+        ", time %" GST_TIME_FORMAT, pts, GST_TIME_ARGS (time));
+  }
 #endif
 
   if (time == GST_CLOCK_TIME_NONE) {
index 318ac4a..c85f750 100644 (file)
@@ -38,8 +38,8 @@ G_BEGIN_DECLS
 #define GST_IS_MPEG2DEC_CLASS(klass) \
   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MPEG2DEC))
 
-#define MPEG_TIME_TO_GST_TIME(time) (((time) * (GST_MSECOND/10)) / 9LL)
-#define GST_TIME_TO_MPEG_TIME(time) (((time) * 9LL) / (GST_MSECOND/10))
+#define MPEG_TIME_TO_GST_TIME(time) ((time) == -1 ? -1 : ((time) * (GST_MSECOND/10)) / 9LL)
+#define GST_TIME_TO_MPEG_TIME(time) ((time) == -1 ? -1 : ((time) * 9LL) / (GST_MSECOND/10))
 
 typedef struct _GstMpeg2dec GstMpeg2dec;
 typedef struct _GstMpeg2decClass GstMpeg2decClass;