info: Add a printf extension for ClockTime/ClockTimeDiff pointers

Using both GST_TIME_FORMAT+GST_TIME_ARGS and friend is cumbersome, this
makes it sensibly more user friendly.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/535>
This commit is contained in:
Thibault Saunier 2020-06-18 13:46:29 -04:00 committed by GStreamer Merge Bot
parent a7472f30c0
commit 74d29ca771
2 changed files with 36 additions and 0 deletions

View file

@ -959,6 +959,16 @@ gst_info_printf_pointer_extension_func (const char *format, void *ptr)
case 'B': /* GST_SEGMENT_FORMAT */
s = gst_debug_print_segment (ptr);
break;
case 'T': /* GST_TIMEP_FORMAT */
if (ptr)
s = g_strdup_printf ("%" GST_TIME_FORMAT,
GST_TIME_ARGS (*(GstClockTime *) ptr));
break;
case 'S': /* GST_STIMEP_FORMAT */
if (ptr)
s = g_strdup_printf ("%" GST_STIME_FORMAT,
GST_STIME_ARGS (*(gint64 *) ptr));
break;
case 'a': /* GST_WRAPPED_PTR_FORMAT */
s = priv_gst_string_take_and_wrap (gst_debug_print_object (ptr));
break;

View file

@ -302,6 +302,32 @@ struct _GstDebugCategory {
*/
#define GST_SEGMENT_FORMAT "p\aB"
/**
* GST_TIMEP_FORMAT: (skip):
*
* printf format type used to debug GStreamer ClockTime pointers. You can use
* this in combination with GStreamer's debug logging system as well as the
* functions gst_info_vasprintf(), gst_info_strdup_vprintf() and
* gst_info_strdup_printf() to pretty-print #GstClockTime pointers. This can
* only be used on pointers to GstClockTime values.
*
* Since: 1.18
*/
#define GST_TIMEP_FORMAT "p\aT"
/**
* GST_STIMEP_FORMAT: (skip):
*
* printf format type used to debug GStreamer signed time value pointers. You
* can use this in combination with GStreamer's debug logging system as well as
* the functions gst_info_vasprintf(), gst_info_strdup_vprintf() and
* gst_info_strdup_printf() to pretty-print signed time (pointers to
* #GstClockTimeDiff or #gint64).
*
* Since: 1.18
*/
#define GST_STIMEP_FORMAT "p\aS"
typedef struct _GstDebugMessage GstDebugMessage;
/**