summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.com>2015-02-16 19:24:44 +0000
committerTim-Philipp Müller <tim@centricular.com>2015-02-16 19:36:11 +0000
commit9f58aa080a41759462ff5771cb259ee64a7ea51e (patch)
treeabe020b524c32e722a19c0633b62ee9eb04f72d8
parent9107a5e041acbad8b16242e73a233fc08f0eecb1 (diff)
info: nicer buffer offset printing when offsets are not set
Print unset offsets as 'none' instead of humongous numbers, for better readability.
-rw-r--r--gst/gstinfo.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/gst/gstinfo.c b/gst/gstinfo.c
index ffff06d6d..b2a3005a9 100644
--- a/gst/gstinfo.c
+++ b/gst/gstinfo.c
@@ -593,14 +593,29 @@ gst_info_structure_to_string (const GstStructure * s)
static inline gchar *
gst_info_describe_buffer (GstBuffer * buffer)
{
+ const gchar *offset_str = "none";
+ const gchar *offset_end_str = "none";
+ gchar offset_buf[32], offset_end_buf[32];
+
+ if (GST_BUFFER_OFFSET_IS_VALID (buffer)) {
+ g_snprintf (offset_buf, sizeof (offset_buf), "%" G_GUINT64_FORMAT,
+ GST_BUFFER_OFFSET (buffer));
+ offset_str = offset_buf;
+ }
+ if (GST_BUFFER_OFFSET_END_IS_VALID (buffer)) {
+ g_snprintf (offset_end_buf, sizeof (offset_end_buf), "%" G_GUINT64_FORMAT,
+ GST_BUFFER_OFFSET_END (buffer));
+ offset_end_str = offset_end_buf;
+ }
+
return g_strdup_printf ("buffer: %p, pts %" GST_TIME_FORMAT ", dts %"
GST_TIME_FORMAT ", dur %" GST_TIME_FORMAT ", size %" G_GSIZE_FORMAT
- ", offset %" G_GUINT64_FORMAT ", offset_end %" G_GUINT64_FORMAT
- ", flags 0x%x", buffer, GST_TIME_ARGS (GST_BUFFER_PTS (buffer)),
+ ", offset %s, offset_end %s, flags 0x%x", buffer,
+ GST_TIME_ARGS (GST_BUFFER_PTS (buffer)),
GST_TIME_ARGS (GST_BUFFER_DTS (buffer)),
GST_TIME_ARGS (GST_BUFFER_DURATION (buffer)),
- gst_buffer_get_size (buffer), GST_BUFFER_OFFSET (buffer),
- GST_BUFFER_OFFSET_END (buffer), GST_BUFFER_FLAGS (buffer));
+ gst_buffer_get_size (buffer), offset_str, offset_end_str,
+ GST_BUFFER_FLAGS (buffer));
}
static inline gchar *