diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2015-06-29 12:53:52 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2015-06-29 12:53:52 +0200 |
commit | 3cbe35813a6d3ecbe72691528ef7e00f38d5bee7 (patch) | |
tree | b7d3dba93baf83e41404c2582a6d359771510963 | |
parent | dc0ec2dfe67f3587ed11f26401acb1fd5f40855f (diff) |
WIP: print wallclock meta in basesink, create it in basesrcwallclock-meta
-rw-r--r-- | libs/gst/base/gstbasesink.c | 34 | ||||
-rw-r--r-- | libs/gst/base/gstbasesrc.c | 2 |
2 files changed, 36 insertions, 0 deletions
diff --git a/libs/gst/base/gstbasesink.c b/libs/gst/base/gstbasesink.c index d44e8fc7f..6f776b848 100644 --- a/libs/gst/base/gstbasesink.c +++ b/libs/gst/base/gstbasesink.c @@ -3655,6 +3655,26 @@ wrong_mode: } } +static void +print_wallclock_meta (GstBaseSink * basesink, GstBuffer * buffer) +{ + gpointer iter = NULL; + GstMeta *meta; + gint64 now = g_get_real_time (); + + while ((meta = gst_buffer_iterate_meta (buffer, &iter))) { + if (meta->info->api == GST_WALLCLOCK_META_API_TYPE) { + GstWallclockMeta *wmeta = (GstWallclockMeta *) meta; + + g_print ("%s: got meta %" G_GUINT64_FORMAT " %" GST_TIME_FORMAT " at %" + GST_TIME_FORMAT " (diff: %" GST_STIME_FORMAT ")\n", + GST_OBJECT_NAME (basesink), wmeta->id, GST_TIME_ARGS (wmeta->time), + GST_TIME_ARGS (now), GST_STIME_ARGS (GST_CLOCK_DIFF (wmeta->time, + now))); + } + } +} + static GstFlowReturn gst_base_sink_chain (GstPad * pad, GstObject * parent, GstBuffer * buf) { @@ -3662,6 +3682,8 @@ gst_base_sink_chain (GstPad * pad, GstObject * parent, GstBuffer * buf) basesink = GST_BASE_SINK (parent); + print_wallclock_meta (basesink, buf); + return gst_base_sink_chain_main (basesink, pad, buf, FALSE); } @@ -3676,6 +3698,18 @@ gst_base_sink_chain_list (GstPad * pad, GstObject * parent, basesink = GST_BASE_SINK (parent); bclass = GST_BASE_SINK_GET_CLASS (basesink); + { + guint i, len; + GstBuffer *buffer; + + len = gst_buffer_list_length (list); + + for (i = 0; i < len; i++) { + buffer = gst_buffer_list_get (list, i); + print_wallclock_meta (basesink, buffer); + } + } + if (G_LIKELY (bclass->render_list)) { result = gst_base_sink_chain_main (basesink, pad, list, TRUE); } else { diff --git a/libs/gst/base/gstbasesrc.c b/libs/gst/base/gstbasesrc.c index 6ab481604..755abc79f 100644 --- a/libs/gst/base/gstbasesrc.c +++ b/libs/gst/base/gstbasesrc.c @@ -2842,6 +2842,8 @@ gst_base_src_loop (GstPad * pad) } GST_LIVE_UNLOCK (src); + gst_buffer_add_wallclock_meta (buf, (guint64) src, g_get_real_time ()); + ret = gst_pad_push (pad, buf); if (G_UNLIKELY (ret != GST_FLOW_OK)) { if (ret == GST_FLOW_NOT_NEGOTIATED) { |