mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-18 05:16:05 +00:00
fakesrc: handle pts/dts
This commit is contained in:
parent
f7813b7ad9
commit
bd1566b9ae
1 changed files with 24 additions and 13 deletions
|
@ -749,12 +749,16 @@ gst_fake_src_get_times (GstBaseSrc * basesrc, GstBuffer * buffer,
|
|||
|
||||
/* sync on the timestamp of the buffer if requested. */
|
||||
if (src->sync) {
|
||||
GstClockTime timestamp = GST_BUFFER_TIMESTAMP (buffer);
|
||||
GstClockTime timestamp, duration;
|
||||
|
||||
/* first sync on DTS, else use PTS */
|
||||
timestamp = GST_BUFFER_DTS (buffer);
|
||||
if (!GST_CLOCK_TIME_IS_VALID (timestamp))
|
||||
timestamp = GST_BUFFER_PTS (buffer);
|
||||
|
||||
if (GST_CLOCK_TIME_IS_VALID (timestamp)) {
|
||||
/* get duration to calculate end time */
|
||||
GstClockTime duration = GST_BUFFER_DURATION (buffer);
|
||||
|
||||
duration = GST_BUFFER_DURATION (buffer);
|
||||
if (GST_CLOCK_TIME_IS_VALID (duration)) {
|
||||
*end = timestamp + duration;
|
||||
}
|
||||
|
@ -801,22 +805,28 @@ gst_fake_src_create (GstBaseSrc * basesrc, guint64 offset, guint length,
|
|||
time = GST_CLOCK_TIME_NONE;
|
||||
}
|
||||
|
||||
GST_BUFFER_TIMESTAMP (buf) = time;
|
||||
GST_BUFFER_DTS (buf) = time;
|
||||
GST_BUFFER_PTS (buf) = time;
|
||||
|
||||
if (!src->silent) {
|
||||
gchar ts_str[64], dur_str[64];
|
||||
gchar dts_str[64], pts_str[64], dur_str[64];
|
||||
gchar flag_str[100];
|
||||
|
||||
GST_OBJECT_LOCK (src);
|
||||
g_free (src->last_message);
|
||||
|
||||
if (GST_BUFFER_TIMESTAMP (buf) != GST_CLOCK_TIME_NONE) {
|
||||
g_snprintf (ts_str, sizeof (ts_str), "%" GST_TIME_FORMAT,
|
||||
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)));
|
||||
if (GST_BUFFER_DTS (buf) != GST_CLOCK_TIME_NONE) {
|
||||
g_snprintf (dts_str, sizeof (dts_str), "%" GST_TIME_FORMAT,
|
||||
GST_TIME_ARGS (GST_BUFFER_DTS (buf)));
|
||||
} else {
|
||||
g_strlcpy (ts_str, "none", sizeof (ts_str));
|
||||
g_strlcpy (dts_str, "none", sizeof (dts_str));
|
||||
}
|
||||
if (GST_BUFFER_PTS (buf) != GST_CLOCK_TIME_NONE) {
|
||||
g_snprintf (pts_str, sizeof (pts_str), "%" GST_TIME_FORMAT,
|
||||
GST_TIME_ARGS (GST_BUFFER_PTS (buf)));
|
||||
} else {
|
||||
g_strlcpy (pts_str, "none", sizeof (pts_str));
|
||||
}
|
||||
|
||||
if (GST_BUFFER_DURATION (buf) != GST_CLOCK_TIME_NONE) {
|
||||
g_snprintf (dur_str, sizeof (dur_str), "%" GST_TIME_FORMAT,
|
||||
GST_TIME_ARGS (GST_BUFFER_DURATION (buf)));
|
||||
|
@ -844,12 +854,13 @@ gst_fake_src_create (GstBaseSrc * basesrc, guint64 offset, guint length,
|
|||
}
|
||||
|
||||
src->last_message =
|
||||
g_strdup_printf ("create ******* (%s:%s) (%u bytes, timestamp: %s"
|
||||
g_strdup_printf ("create ******* (%s:%s) (%u bytes, dts: %s, pts:%s"
|
||||
", duration: %s, offset: %" G_GINT64_FORMAT ", offset_end: %"
|
||||
G_GINT64_FORMAT ", flags: %d %s) %p",
|
||||
GST_DEBUG_PAD_NAME (GST_BASE_SRC_CAST (src)->srcpad), (guint) size,
|
||||
ts_str, dur_str, GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET_END (buf),
|
||||
GST_MINI_OBJECT_CAST (buf)->flags, flag_str, buf);
|
||||
dts_str, pts_str, dur_str, GST_BUFFER_OFFSET (buf),
|
||||
GST_BUFFER_OFFSET_END (buf), GST_MINI_OBJECT_CAST (buf)->flags,
|
||||
flag_str, buf);
|
||||
GST_OBJECT_UNLOCK (src);
|
||||
|
||||
g_object_notify_by_pspec ((GObject *) src, pspec_last_message);
|
||||
|
|
Loading…
Reference in a new issue