mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-04 01:32:42 +00:00
info: add GstStream and GstStreamCollection support to gst_debug_print_object()
https://bugzilla.gnome.org/show_bug.cgi?id=769220
This commit is contained in:
parent
562681a1b7
commit
24a09d1b6d
1 changed files with 64 additions and 0 deletions
|
@ -732,6 +732,62 @@ gst_info_describe_query (GstQuery * query)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline gchar *
|
||||||
|
gst_info_describe_stream (GstStream * stream)
|
||||||
|
{
|
||||||
|
gchar *ret, *caps_str = NULL, *tags_str = NULL;
|
||||||
|
GstCaps *caps;
|
||||||
|
GstTagList *tags;
|
||||||
|
|
||||||
|
caps = gst_stream_get_caps (stream);
|
||||||
|
if (caps) {
|
||||||
|
caps_str = gst_caps_to_string (caps);
|
||||||
|
gst_caps_unref (caps);
|
||||||
|
}
|
||||||
|
|
||||||
|
tags = gst_stream_get_tags (stream);
|
||||||
|
if (tags) {
|
||||||
|
tags_str = gst_tag_list_to_string (tags);
|
||||||
|
gst_tag_list_unref (tags);
|
||||||
|
}
|
||||||
|
|
||||||
|
ret =
|
||||||
|
g_strdup_printf ("stream %s %p, ID %s, flags 0x%x, caps [%s], tags [%s]",
|
||||||
|
gst_stream_type_get_name (gst_stream_get_stream_type (stream)), stream,
|
||||||
|
gst_stream_get_stream_id (stream), gst_stream_get_stream_flags (stream),
|
||||||
|
caps_str ? caps_str : "", tags_str ? tags_str : "");
|
||||||
|
|
||||||
|
g_free (caps_str);
|
||||||
|
g_free (tags_str);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline gchar *
|
||||||
|
gst_info_describe_stream_collection (GstStreamCollection * collection)
|
||||||
|
{
|
||||||
|
gchar *ret;
|
||||||
|
GString *streams_str;
|
||||||
|
guint i;
|
||||||
|
|
||||||
|
streams_str = g_string_new ("<");
|
||||||
|
for (i = 0; i < gst_stream_collection_get_size (collection); i++) {
|
||||||
|
GstStream *stream = gst_stream_collection_get_stream (collection, i);
|
||||||
|
gchar *s;
|
||||||
|
|
||||||
|
s = gst_info_describe_stream (stream);
|
||||||
|
g_string_append_printf (streams_str, " %s,", s);
|
||||||
|
g_free (s);
|
||||||
|
}
|
||||||
|
g_string_append (streams_str, " >");
|
||||||
|
|
||||||
|
ret = g_strdup_printf ("collection %p (%d streams) %s", collection,
|
||||||
|
gst_stream_collection_get_size (collection), streams_str->str);
|
||||||
|
|
||||||
|
g_string_free (streams_str, TRUE);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static gchar *
|
static gchar *
|
||||||
gst_debug_print_object (gpointer ptr)
|
gst_debug_print_object (gpointer ptr)
|
||||||
{
|
{
|
||||||
|
@ -808,6 +864,14 @@ gst_debug_print_object (gpointer ptr)
|
||||||
g_free (s);
|
g_free (s);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
if (GST_IS_STREAM (object)) {
|
||||||
|
return gst_info_describe_stream (GST_STREAM_CAST (object));
|
||||||
|
}
|
||||||
|
if (GST_IS_STREAM_COLLECTION (object)) {
|
||||||
|
return
|
||||||
|
gst_info_describe_stream_collection (GST_STREAM_COLLECTION_CAST
|
||||||
|
(object));
|
||||||
|
}
|
||||||
if (GST_IS_PAD (object) && GST_OBJECT_NAME (object)) {
|
if (GST_IS_PAD (object) && GST_OBJECT_NAME (object)) {
|
||||||
return g_strdup_printf ("<%s:%s>", GST_DEBUG_PAD_NAME (object));
|
return g_strdup_printf ("<%s:%s>", GST_DEBUG_PAD_NAME (object));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue