* is typically done before pushing out a buffer using gst_pad_push() so that
* the downstream element knows the type of the buffer.
*
- * A buffer will usually have a timestamp, and a duration, but neither of these
+ * A buffer will usually have timestamps, and a duration, but neither of these
* are guaranteed (they may be set to #GST_CLOCK_TIME_NONE). Whenever a
- * meaningful value can be given for these, they should be set. The timestamp
+ * meaningful value can be given for these, they should be set. The timestamps
* and duration are measured in nanoseconds (they are #GstClockTime values).
*
* A buffer can also have one or both of a start and an end offset. These are
if (flags & GST_BUFFER_COPY_TIMESTAMPS) {
if (offset == 0) {
- GST_BUFFER_TIMESTAMP (dest) = GST_BUFFER_TIMESTAMP (src);
+ GST_BUFFER_PTS (dest) = GST_BUFFER_PTS (src);
+ GST_BUFFER_DTS (dest) = GST_BUFFER_DTS (src);
GST_BUFFER_OFFSET (dest) = GST_BUFFER_OFFSET (src);
if (size == bufsize) {
GST_BUFFER_DURATION (dest) = GST_BUFFER_DURATION (src);
GST_BUFFER_OFFSET_END (dest) = GST_BUFFER_OFFSET_END (src);
}
} else {
- GST_BUFFER_TIMESTAMP (dest) = GST_CLOCK_TIME_NONE;
+ GST_BUFFER_PTS (dest) = GST_CLOCK_TIME_NONE;
+ GST_BUFFER_DTS (dest) = GST_CLOCK_TIME_NONE;
GST_BUFFER_DURATION (dest) = GST_CLOCK_TIME_NONE;
GST_BUFFER_OFFSET (dest) = GST_BUFFER_OFFSET_NONE;
GST_BUFFER_OFFSET_END (dest) = GST_BUFFER_OFFSET_NONE;
(GstMiniObjectFreeFunction) _gst_buffer_free;
GST_BUFFER (buffer)->pool = NULL;
- GST_BUFFER_TIMESTAMP (buffer) = GST_CLOCK_TIME_NONE;
+ GST_BUFFER_PTS (buffer) = GST_CLOCK_TIME_NONE;
+ GST_BUFFER_DTS (buffer) = GST_CLOCK_TIME_NONE;
GST_BUFFER_DURATION (buffer) = GST_CLOCK_TIME_NONE;
GST_BUFFER_OFFSET (buffer) = GST_BUFFER_OFFSET_NONE;
GST_BUFFER_OFFSET_END (buffer) = GST_BUFFER_OFFSET_NONE;
/* if the offset is 0, the new buffer has the same timestamp as buf1 */
if (offset == 0) {
GST_BUFFER_OFFSET (newbuf) = GST_BUFFER_OFFSET (buf1);
- GST_BUFFER_TIMESTAMP (newbuf) = GST_BUFFER_TIMESTAMP (buf1);
+ GST_BUFFER_PTS (newbuf) = GST_BUFFER_PTS (buf1);
+ GST_BUFFER_DTS (newbuf) = GST_BUFFER_DTS (buf1);
/* if we completely merged the two buffers (appended), we can
* calculate the duration too. Also make sure we's not messing with
*/
#define GST_BUFFER_FLAG_UNSET(buf,flag) GST_MINI_OBJECT_FLAG_UNSET (buf, flag)
+
/**
- * GST_BUFFER_TIMESTAMP:
+ * GST_BUFFER_PTS:
* @buf: a #GstBuffer.:
*
- * The timestamp in nanoseconds (as a #GstClockTime) of the data in the buffer.
- * Value will be %GST_CLOCK_TIME_NONE if the timestamp is unknown.
+ * The presentation timestamp (pts) in nanoseconds (as a #GstClockTime)
+ * of the data in the buffer. This is the timestamp when the media should be
+ * presented to the user.
+ * Value will be %GST_CLOCK_TIME_NONE if the pts is unknown.
+ */
+#define GST_BUFFER_PTS(buf) (GST_BUFFER_CAST(buf)->pts)
+/**
+ * GST_BUFFER_DTS:
+ * @buf: a #GstBuffer.:
*
+ * The decoding timestamp (dts) in nanoseconds (as a #GstClockTime)
+ * of the data in the buffer. This is the timestamp when the media should be
+ * decoded or processed otherwise.
+ * Value will be %GST_CLOCK_TIME_NONE if the dts is unknown.
*/
-#define GST_BUFFER_TIMESTAMP(buf) (GST_BUFFER_CAST(buf)->timestamp)
+#define GST_BUFFER_DTS(buf) (GST_BUFFER_CAST(buf)->dts)
/**
* GST_BUFFER_DURATION:
* @buf: a #GstBuffer.
*/
#define GST_BUFFER_DURATION_IS_VALID(buffer) (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_DURATION (buffer)))
/**
- * GST_BUFFER_TIMESTAMP_IS_VALID:
+ * GST_BUFFER_PTS_IS_VALID:
+ * @buffer: a #GstBuffer
+ *
+ * Tests if the pts is known.
+ */
+#define GST_BUFFER_PTS_IS_VALID(buffer) (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_PTS (buffer)))
+/**
+ * GST_BUFFER_DTS_IS_VALID:
* @buffer: a #GstBuffer
*
- * Tests if the timestamp is known.
+ * Tests if the dts is known.
*/
-#define GST_BUFFER_TIMESTAMP_IS_VALID(buffer) (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_TIMESTAMP (buffer)))
+#define GST_BUFFER_DTS_IS_VALID(buffer) (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_DTS (buffer)))
/**
* GST_BUFFER_OFFSET_IS_VALID:
* @buffer: a #GstBuffer
GstBufferPool *pool;
/* timestamp */
- GstClockTime timestamp;
+ GstClockTime pts;
+ GstClockTime dts;
GstClockTime duration;
/* media specific offset */
* GstBufferCopyFlags:
* @GST_BUFFER_COPY_NONE: copy nothing
* @GST_BUFFER_COPY_FLAGS: flag indicating that buffer flags should be copied
- * @GST_BUFFER_COPY_TIMESTAMPS: flag indicating that buffer timestamp, duration,
- * offset and offset_end should be copied
+ * @GST_BUFFER_COPY_TIMESTAMPS: flag indicating that buffer pts, dts,
+ * duration, offset and offset_end should be copied
* @GST_BUFFER_COPY_MEMORY: flag indicating that buffer memory should be copied
* and appended to already existing memory
* @GST_BUFFER_COPY_MERGE: flag indicating that buffer memory should be
{
GST_BUFFER_FLAGS (buffer) = 0;
- GST_BUFFER_TIMESTAMP (buffer) = GST_CLOCK_TIME_NONE;
+ GST_BUFFER_PTS (buffer) = GST_CLOCK_TIME_NONE;
+ GST_BUFFER_DTS (buffer) = GST_CLOCK_TIME_NONE;
GST_BUFFER_DURATION (buffer) = GST_CLOCK_TIME_NONE;
GST_BUFFER_OFFSET (buffer) = GST_BUFFER_OFFSET_NONE;
GST_BUFFER_OFFSET_END (buffer) = GST_BUFFER_OFFSET_NONE;
gchar *ret;
ret =
- g_strdup_printf ("%p, ts %" GST_TIME_FORMAT
+ g_strdup_printf ("%p, pts %" GST_TIME_FORMAT ", dts %" GST_TIME_FORMAT
", dur %" GST_TIME_FORMAT ", size %" G_GSIZE_FORMAT ", offset %"
G_GUINT64_FORMAT ", offset_end %" G_GUINT64_FORMAT, buf,
- GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)),
+ GST_TIME_ARGS (GST_BUFFER_PTS (buf)),
+ GST_TIME_ARGS (GST_BUFFER_DTS (buf)),
GST_TIME_ARGS (GST_BUFFER_DURATION (buf)), gst_buffer_get_size (buf),
GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET_END (buf));
return ret;