mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 23:06:49 +00:00
info: add buffer list support to GST_PTR_FORMAT
This commit is contained in:
parent
6b71877692
commit
4febebb962
2 changed files with 46 additions and 0 deletions
|
@ -607,6 +607,31 @@ gst_info_describe_buffer (GstBuffer * buffer)
|
|||
GST_BUFFER_FLAGS (buffer));
|
||||
}
|
||||
|
||||
static inline gchar *
|
||||
gst_info_describe_buffer_list (GstBufferList * list)
|
||||
{
|
||||
GstClockTime pts = GST_CLOCK_TIME_NONE;
|
||||
GstClockTime dts = GST_CLOCK_TIME_NONE;
|
||||
gsize total_size = 0;
|
||||
guint n, i;
|
||||
|
||||
n = gst_buffer_list_length (list);
|
||||
for (i = 0; i < n; ++i) {
|
||||
GstBuffer *buf = gst_buffer_list_get (list, i);
|
||||
|
||||
if (i == 0) {
|
||||
pts = GST_BUFFER_PTS (buf);
|
||||
dts = GST_BUFFER_DTS (buf);
|
||||
}
|
||||
|
||||
total_size += gst_buffer_get_size (buf);
|
||||
}
|
||||
|
||||
return g_strdup_printf ("bufferlist: %p, %u buffers, pts %" GST_TIME_FORMAT
|
||||
", dts %" GST_TIME_FORMAT ", size %" G_GSIZE_FORMAT, list, n,
|
||||
GST_TIME_ARGS (pts), GST_TIME_ARGS (dts), total_size);
|
||||
}
|
||||
|
||||
static inline gchar *
|
||||
gst_info_describe_event (GstEvent * event)
|
||||
{
|
||||
|
@ -693,6 +718,9 @@ gst_debug_print_object (gpointer ptr)
|
|||
if (GST_IS_BUFFER (ptr)) {
|
||||
return gst_info_describe_buffer (GST_BUFFER_CAST (ptr));
|
||||
}
|
||||
if (GST_IS_BUFFER_LIST (ptr)) {
|
||||
return gst_info_describe_buffer_list (GST_BUFFER_LIST_CAST (ptr));
|
||||
}
|
||||
#ifdef USE_POISONING
|
||||
if (*(guint32 *) ptr == 0xffffffff) {
|
||||
return g_strdup_printf ("<poisoned@%p>", ptr);
|
||||
|
|
|
@ -89,6 +89,24 @@ GST_START_TEST (info_ptr_format_printf_extension)
|
|||
gst_message_unref (msg);
|
||||
}
|
||||
|
||||
/* buffer and buffer list */
|
||||
{
|
||||
GstBufferList *list;
|
||||
GstBuffer *buf;
|
||||
|
||||
buf = gst_buffer_new_allocate (NULL, 42, NULL);
|
||||
GST_BUFFER_PTS (buf) = 5 * GST_SECOND;
|
||||
GST_BUFFER_DURATION (buf) = GST_SECOND;
|
||||
GST_LOG ("BUFFER: %" GST_PTR_FORMAT, buf);
|
||||
|
||||
list = gst_buffer_list_new ();
|
||||
gst_buffer_list_add (list, buf);
|
||||
buf = gst_buffer_new_allocate (NULL, 58, NULL);
|
||||
gst_buffer_list_add (list, buf);
|
||||
GST_LOG ("BUFFERLIST: %" GST_PTR_FORMAT, list);
|
||||
gst_buffer_list_unref (list);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* TODO: GObject */
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue