mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-18 04:05:34 +00:00
fakesink, identity: print metas attached to buffer in silent=false mode
This commit is contained in:
parent
e02405b284
commit
cf7cfb0a0e
4 changed files with 37 additions and 8 deletions
|
@ -52,7 +52,7 @@
|
||||||
G_STATIC_ASSERT ((1 << BUFFER_FLAG_SHIFT) == GST_MINI_OBJECT_FLAG_LAST);
|
G_STATIC_ASSERT ((1 << BUFFER_FLAG_SHIFT) == GST_MINI_OBJECT_FLAG_LAST);
|
||||||
|
|
||||||
/* Returns a newly allocated string describing the flags on this buffer */
|
/* Returns a newly allocated string describing the flags on this buffer */
|
||||||
char *
|
gchar *
|
||||||
gst_buffer_get_flags_string (GstBuffer * buffer)
|
gst_buffer_get_flags_string (GstBuffer * buffer)
|
||||||
{
|
{
|
||||||
static const char flag_strings[] =
|
static const char flag_strings[] =
|
||||||
|
@ -84,6 +84,28 @@ gst_buffer_get_flags_string (GstBuffer * buffer)
|
||||||
return flag_str;
|
return flag_str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Returns a newly-allocated string describing the metas on this buffer, or NULL */
|
||||||
|
gchar *
|
||||||
|
gst_buffer_get_meta_string (GstBuffer * buffer)
|
||||||
|
{
|
||||||
|
gpointer state = NULL;
|
||||||
|
GstMeta *meta;
|
||||||
|
GString *s = NULL;
|
||||||
|
|
||||||
|
while ((meta = gst_buffer_iterate_meta (buffer, &state))) {
|
||||||
|
const gchar *desc = g_type_name (meta->info->type);
|
||||||
|
|
||||||
|
if (s == NULL)
|
||||||
|
s = g_string_new (NULL);
|
||||||
|
else
|
||||||
|
g_string_append (s, ", ");
|
||||||
|
|
||||||
|
g_string_append (s, desc);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (s != NULL) ? g_string_free (s, FALSE) : NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* Define our own iovec structure here, so that we can use it unconditionally
|
/* Define our own iovec structure here, so that we can use it unconditionally
|
||||||
* in the code below and use almost the same code path for systems where
|
* in the code below and use almost the same code path for systems where
|
||||||
* writev() is supported and those were it's not supported */
|
* writev() is supported and those were it's not supported */
|
||||||
|
|
|
@ -28,7 +28,10 @@
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
char * gst_buffer_get_flags_string (GstBuffer *buffer);
|
gchar * gst_buffer_get_flags_string (GstBuffer *buffer);
|
||||||
|
|
||||||
|
G_GNUC_INTERNAL
|
||||||
|
gchar * gst_buffer_get_meta_string (GstBuffer * buffer);
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
GstFlowReturn gst_writev_buffers (GstObject * sink, gint fd, GstPoll * fdset,
|
GstFlowReturn gst_writev_buffers (GstObject * sink, gint fd, GstPoll * fdset,
|
||||||
|
|
|
@ -448,7 +448,7 @@ gst_fake_sink_render (GstBaseSink * bsink, GstBuffer * buf)
|
||||||
|
|
||||||
if (!sink->silent) {
|
if (!sink->silent) {
|
||||||
gchar dts_str[64], pts_str[64], dur_str[64];
|
gchar dts_str[64], pts_str[64], dur_str[64];
|
||||||
gchar *flag_str;
|
gchar *flag_str, *meta_str;
|
||||||
|
|
||||||
GST_OBJECT_LOCK (sink);
|
GST_OBJECT_LOCK (sink);
|
||||||
g_free (sink->last_message);
|
g_free (sink->last_message);
|
||||||
|
@ -475,16 +475,19 @@ gst_fake_sink_render (GstBaseSink * bsink, GstBuffer * buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
flag_str = gst_buffer_get_flags_string (buf);
|
flag_str = gst_buffer_get_flags_string (buf);
|
||||||
|
meta_str = gst_buffer_get_meta_string (buf);
|
||||||
|
|
||||||
sink->last_message =
|
sink->last_message =
|
||||||
g_strdup_printf ("chain ******* (%s:%s) (%u bytes, dts: %s, pts: %s"
|
g_strdup_printf ("chain ******* (%s:%s) (%u bytes, dts: %s, pts: %s"
|
||||||
", duration: %s, offset: %" G_GINT64_FORMAT ", offset_end: %"
|
", duration: %s, offset: %" G_GINT64_FORMAT ", offset_end: %"
|
||||||
G_GINT64_FORMAT ", flags: %08x %s) %p",
|
G_GINT64_FORMAT ", flags: %08x %s, meta: %s) %p",
|
||||||
GST_DEBUG_PAD_NAME (GST_BASE_SINK_CAST (sink)->sinkpad),
|
GST_DEBUG_PAD_NAME (GST_BASE_SINK_CAST (sink)->sinkpad),
|
||||||
(guint) gst_buffer_get_size (buf), dts_str, pts_str,
|
(guint) gst_buffer_get_size (buf), dts_str, pts_str,
|
||||||
dur_str, GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET_END (buf),
|
dur_str, GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET_END (buf),
|
||||||
GST_MINI_OBJECT_CAST (buf)->flags, flag_str, buf);
|
GST_MINI_OBJECT_CAST (buf)->flags, flag_str,
|
||||||
|
meta_str ? meta_str : "none", buf);
|
||||||
g_free (flag_str);
|
g_free (flag_str);
|
||||||
|
g_free (meta_str);
|
||||||
GST_OBJECT_UNLOCK (sink);
|
GST_OBJECT_UNLOCK (sink);
|
||||||
|
|
||||||
gst_fake_sink_notify_last_message (sink);
|
gst_fake_sink_notify_last_message (sink);
|
||||||
|
|
|
@ -537,23 +537,24 @@ gst_identity_update_last_message_for_buffer (GstIdentity * identity,
|
||||||
const gchar * action, GstBuffer * buf, gsize size)
|
const gchar * action, GstBuffer * buf, gsize size)
|
||||||
{
|
{
|
||||||
gchar dts_str[64], pts_str[64], dur_str[64];
|
gchar dts_str[64], pts_str[64], dur_str[64];
|
||||||
gchar *flag_str;
|
gchar *flag_str, *meta_str;
|
||||||
|
|
||||||
GST_OBJECT_LOCK (identity);
|
GST_OBJECT_LOCK (identity);
|
||||||
|
|
||||||
flag_str = gst_buffer_get_flags_string (buf);
|
flag_str = gst_buffer_get_flags_string (buf);
|
||||||
|
meta_str = gst_buffer_get_meta_string (buf);
|
||||||
|
|
||||||
g_free (identity->last_message);
|
g_free (identity->last_message);
|
||||||
identity->last_message = g_strdup_printf ("%s ******* (%s:%s) "
|
identity->last_message = g_strdup_printf ("%s ******* (%s:%s) "
|
||||||
"(%" G_GSIZE_FORMAT " bytes, dts: %s, pts: %s, duration: %s, offset: %"
|
"(%" G_GSIZE_FORMAT " bytes, dts: %s, pts: %s, duration: %s, offset: %"
|
||||||
G_GINT64_FORMAT ", " "offset_end: % " G_GINT64_FORMAT
|
G_GINT64_FORMAT ", " "offset_end: % " G_GINT64_FORMAT
|
||||||
", flags: %08x %s) %p", action,
|
", flags: %08x %s, meta: %s) %p", action,
|
||||||
GST_DEBUG_PAD_NAME (GST_BASE_TRANSFORM_CAST (identity)->sinkpad), size,
|
GST_DEBUG_PAD_NAME (GST_BASE_TRANSFORM_CAST (identity)->sinkpad), size,
|
||||||
print_pretty_time (dts_str, sizeof (dts_str), GST_BUFFER_DTS (buf)),
|
print_pretty_time (dts_str, sizeof (dts_str), GST_BUFFER_DTS (buf)),
|
||||||
print_pretty_time (pts_str, sizeof (pts_str), GST_BUFFER_PTS (buf)),
|
print_pretty_time (pts_str, sizeof (pts_str), GST_BUFFER_PTS (buf)),
|
||||||
print_pretty_time (dur_str, sizeof (dur_str), GST_BUFFER_DURATION (buf)),
|
print_pretty_time (dur_str, sizeof (dur_str), GST_BUFFER_DURATION (buf)),
|
||||||
GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET_END (buf),
|
GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET_END (buf),
|
||||||
GST_BUFFER_FLAGS (buf), flag_str, buf);
|
GST_BUFFER_FLAGS (buf), flag_str, meta_str ? meta_str : "none", buf);
|
||||||
g_free (flag_str);
|
g_free (flag_str);
|
||||||
|
|
||||||
GST_OBJECT_UNLOCK (identity);
|
GST_OBJECT_UNLOCK (identity);
|
||||||
|
|
Loading…
Reference in a new issue