summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Hervey <edward@centricular.com>2015-10-26 07:59:54 +0100
committerEdward Hervey <bilboed@bilboed.com>2015-10-27 08:33:23 +0100
commit41e1bea7efb8196820539534b3d07eeb621b36c0 (patch)
treeb3ea16846b3a9fc6b3325d06ac18e1204aa33c96
parentf0ee10d77879fdf566dd640068e911adf974dc59 (diff)
buffer: Add a GST_BUFFER_DTS_OR_PTS macro
API: GST_BUFFER_DTS_OR_PTS Many scenarios/elements require dealing with streams of buffers that might have DTS set (i.e. encoded data, potentially reordered) To simplify getting the increasing "timestamp" of those buffers, create a macro that will return the DTS if valid, and if not the PTS
-rw-r--r--docs/gst/gstreamer-sections.txt1
-rw-r--r--gst/gstbuffer.h8
2 files changed, 9 insertions, 0 deletions
diff --git a/docs/gst/gstreamer-sections.txt b/docs/gst/gstreamer-sections.txt
index 444069f04..6ba325449 100644
--- a/docs/gst/gstreamer-sections.txt
+++ b/docs/gst/gstreamer-sections.txt
@@ -175,6 +175,7 @@ GST_BUFFER_FLAG_UNSET
GST_BUFFER_PTS
GST_BUFFER_DTS
+GST_BUFFER_DTS_OR_PTS
GST_BUFFER_DURATION
GST_BUFFER_OFFSET
GST_BUFFER_OFFSET_END
diff --git a/gst/gstbuffer.h b/gst/gstbuffer.h
index 20154aa72..4343b6ad1 100644
--- a/gst/gstbuffer.h
+++ b/gst/gstbuffer.h
@@ -94,6 +94,14 @@ typedef struct _GstBufferPool GstBufferPool;
*/
#define GST_BUFFER_DTS(buf) (GST_BUFFER_CAST(buf)->dts)
/**
+ * GST_BUFFER_DTS_OR_PTS:
+ * @buf: a #GstBuffer.:
+ *
+ * Returns the buffer decoding timestamp (dts) if valid, else the buffer
+ * presentation time (pts)
+ */
+#define GST_BUFFER_DTS_OR_PTS(buf) (GST_BUFFER_DTS_IS_VALID(buf) ? GST_BUFFER_DTS(buf) : GST_BUFFER_PTS (buf))
+/**
* GST_BUFFER_DURATION:
* @buf: a #GstBuffer.
*