validate: Do not use GST_PTR_FORMAT when reporting

It will not work now that we have our own implementation of printf for that in Gst and
thus provide us with pretty useless infos
This commit is contained in:
Thibault Saunier 2014-04-22 11:10:01 +02:00
parent 02abb60a67
commit 279625a541

View File

@ -153,6 +153,17 @@ _structure_is_raw_audio (GstStructure * structure)
return gst_structure_has_name (structure, "audio/x-raw"); return gst_structure_has_name (structure, "audio/x-raw");
} }
static gchar *
_get_event_string (GstEvent *event)
{
const GstStructure *st;
if ((st = gst_event_get_structure (event)))
return gst_structure_to_string (st);
else
return g_strdup_printf ("%s", GST_EVENT_TYPE_NAME (event));
}
static void static void
_check_field_type (GstValidatePadMonitor * monitor, GstStructure * structure, _check_field_type (GstValidatePadMonitor * monitor, GstStructure * structure,
const gchar * field, ...) const gchar * field, ...)
@ -162,13 +173,13 @@ _check_field_type (GstValidatePadMonitor * monitor, GstStructure * structure,
gchar *joined_types = NULL; gchar *joined_types = NULL;
const gchar *rejected_types[5]; const gchar *rejected_types[5];
gint rejected_types_index = 0; gint rejected_types_index = 0;
gchar *struct_str;
if (!gst_structure_has_field (structure, field)) { if (!gst_structure_has_field (structure, field)) {
gchar *str = gst_structure_to_string (structure); gchar *str = gst_structure_to_string (structure);
GST_VALIDATE_REPORT (monitor, CAPS_IS_MISSING_FIELD, GST_VALIDATE_REPORT (monitor, CAPS_IS_MISSING_FIELD,
"Field '%s' is missing from structure: %" GST_PTR_FORMAT, field, "Field '%s' is missing from structure: %s", field, str);
str);
g_free (str); g_free (str);
return; return;
} }
@ -185,12 +196,13 @@ _check_field_type (GstValidatePadMonitor * monitor, GstStructure * structure,
va_end (var_args); va_end (var_args);
joined_types = g_strjoinv (" / ", (gchar **) rejected_types); joined_types = g_strjoinv (" / ", (gchar **) rejected_types);
struct_str = gst_structure_to_string (structure);
GST_VALIDATE_REPORT (monitor, CAPS_FIELD_HAS_BAD_TYPE, GST_VALIDATE_REPORT (monitor, CAPS_FIELD_HAS_BAD_TYPE,
"Field '%s' has wrong type %s in structure '%" GST_PTR_FORMAT "Field '%s' has wrong type %s in structure '%s'. Expected: %s", field,
"'. Expected: %s", field, g_type_name (gst_structure_get_field_type (structure, field)), struct_str,
g_type_name (gst_structure_get_field_type (structure, field)), structure,
joined_types); joined_types);
g_free (joined_types); g_free (joined_types);
g_free (struct_str);
} }
static void static void
@ -466,9 +478,15 @@ gst_validate_pad_monitor_check_caps_fields_proxied (GstValidatePadMonitor *
} }
if (type_match && !found) { if (type_match && !found) {
gchar *otherstruct_str = gst_structure_to_string (otherstructure),
*caps_str = gst_caps_to_string (caps);
GST_VALIDATE_REPORT (monitor, GET_CAPS_NOT_PROXYING_FIELDS, GST_VALIDATE_REPORT (monitor, GET_CAPS_NOT_PROXYING_FIELDS,
"Peer pad structure '%" GST_PTR_FORMAT "' has no similar version " "Peer pad structure '%s' has no similar version "
"on pad's caps '%" GST_PTR_FORMAT "'", otherstructure, caps); "on pad's caps '%s'", otherstruct_str, caps_str);
g_free (otherstruct_str);
g_free (caps_str);
} }
} }
} }
@ -493,11 +511,15 @@ gst_validate_pad_monitor_check_late_serialized_events (GstValidatePadMonitor *
i, GST_EVENT_TYPE_NAME (data->event), GST_TIME_ARGS (data->timestamp)); i, GST_EVENT_TYPE_NAME (data->event), GST_TIME_ARGS (data->timestamp));
if (GST_CLOCK_TIME_IS_VALID (data->timestamp) && data->timestamp < ts) { if (GST_CLOCK_TIME_IS_VALID (data->timestamp) && data->timestamp < ts) {
gchar *event_str = _get_event_string (data->event);
GST_VALIDATE_REPORT (monitor, SERIALIZED_EVENT_WASNT_PUSHED_IN_TIME, GST_VALIDATE_REPORT (monitor, SERIALIZED_EVENT_WASNT_PUSHED_IN_TIME,
"Serialized event %" GST_PTR_FORMAT " wasn't pushed before expected " "Serialized event %s wasn't pushed before expected " "timestamp %"
"timestamp %" GST_TIME_FORMAT " on pad %s:%s", data->event, GST_TIME_FORMAT " on pad %s:%s", event_str,
GST_TIME_ARGS (data->timestamp), GST_TIME_ARGS (data->timestamp),
GST_DEBUG_PAD_NAME (GST_VALIDATE_PAD_MONITOR_GET_PAD (monitor))); GST_DEBUG_PAD_NAME (GST_VALIDATE_PAD_MONITOR_GET_PAD (monitor)));
g_free (event_str);
} else { } else {
/* events should be ordered by ts */ /* events should be ordered by ts */
break; break;
@ -1194,8 +1216,11 @@ gst_validate_pad_monitor_common_event_check (GstValidatePadMonitor *
} }
if (!pad_monitor->pending_flush_stop) { if (!pad_monitor->pending_flush_stop) {
gchar *event_str = _get_event_string (event);
GST_VALIDATE_REPORT (pad_monitor, EVENT_FLUSH_STOP_UNEXPECTED, GST_VALIDATE_REPORT (pad_monitor, EVENT_FLUSH_STOP_UNEXPECTED,
"Unexpected flush-stop %p" GST_PTR_FORMAT, event); "Unexpected flush-stop %s", event_str);
g_free (event_str);
} }
pad_monitor->pending_flush_stop = FALSE; pad_monitor->pending_flush_stop = FALSE;
@ -1684,11 +1709,14 @@ gst_validate_pad_monitor_event_probe (GstPad * pad, GstEvent * event,
*/ */
if (g_list_find (monitor->expired_events, event)) { if (g_list_find (monitor->expired_events, event)) {
gchar *event_str = _get_event_string (event);
/* If it's the expired events, we've failed */ /* If it's the expired events, we've failed */
GST_WARNING_OBJECT (pad, "Did not expect event %p %s", event, GST_WARNING_OBJECT (pad, "Did not expect event %p %s", event,
GST_EVENT_TYPE_NAME (event)); GST_EVENT_TYPE_NAME (event));
GST_VALIDATE_REPORT (monitor, EVENT_SERIALIZED_OUT_OF_ORDER, GST_VALIDATE_REPORT (monitor, EVENT_SERIALIZED_OUT_OF_ORDER,
"Serialized event was pushed out of order: %" GST_PTR_FORMAT, event); "Serialized event was pushed out of order: %s", event_str);
g_free (event_str);
monitor->expired_events = g_list_remove (monitor->expired_events, event); monitor->expired_events = g_list_remove (monitor->expired_events, event);
gst_event_unref (event); /* remove the ref that was on the list */ gst_event_unref (event); /* remove the ref that was on the list */
} else if (monitor->serialized_events->len) { } else if (monitor->serialized_events->len) {
@ -1783,8 +1811,11 @@ gst_validate_pad_monitor_setcaps_pre (GstValidatePadMonitor * pad_monitor,
if (GST_PAD_IS_SINK (GST_VALIDATE_PAD_MONITOR_GET_PAD (pad_monitor)) && if (GST_PAD_IS_SINK (GST_VALIDATE_PAD_MONITOR_GET_PAD (pad_monitor)) &&
pad_monitor->last_caps pad_monitor->last_caps
&& gst_caps_is_equal (caps, pad_monitor->last_caps)) { && gst_caps_is_equal (caps, pad_monitor->last_caps)) {
GST_VALIDATE_REPORT (pad_monitor, EVENT_CAPS_DUPLICATE, "%" GST_PTR_FORMAT, gchar *caps_str = gst_caps_to_string (caps);
caps);
GST_VALIDATE_REPORT (pad_monitor, EVENT_CAPS_DUPLICATE, "%s", caps_str);
g_free (caps_str);
} }
gst_validate_pad_monitor_check_caps_complete (pad_monitor, caps); gst_validate_pad_monitor_check_caps_complete (pad_monitor, caps);
@ -1804,14 +1835,24 @@ gst_validate_pad_monitor_setcaps_pre (GstValidatePadMonitor * pad_monitor,
gst_structure_get_value (pad_monitor->pending_setcaps_fields, name); gst_structure_get_value (pad_monitor->pending_setcaps_fields, name);
if (v == NULL) { if (v == NULL) {
gchar *caps_str = gst_caps_to_string (caps);
GST_VALIDATE_REPORT (pad_monitor, CAPS_EXPECTED_FIELD_NOT_FOUND, GST_VALIDATE_REPORT (pad_monitor, CAPS_EXPECTED_FIELD_NOT_FOUND,
"Field %s is missing from setcaps caps '%" GST_PTR_FORMAT "'", "Field %s is missing from setcaps caps '%s'", name, caps_str);
name, caps); g_free (caps_str);
} else if (gst_value_compare (v, otherv) != GST_VALUE_EQUAL) { } else if (gst_value_compare (v, otherv) != GST_VALUE_EQUAL) {
gchar *caps_str = gst_caps_to_string (caps),
*pending_setcaps_fields_str =
gst_structure_to_string (pad_monitor->pending_setcaps_fields);
GST_VALIDATE_REPORT (pad_monitor, CAPS_FIELD_UNEXPECTED_VALUE, GST_VALIDATE_REPORT (pad_monitor, CAPS_FIELD_UNEXPECTED_VALUE,
"Field %s from setcaps caps '%" GST_PTR_FORMAT "' is different " "Field %s from setcaps caps '%s' is different "
"from expected value in caps '%" GST_PTR_FORMAT "'", name, caps, "from expected value in caps '%s'", name, caps_str,
pad_monitor->pending_setcaps_fields); pending_setcaps_fields_str);
g_free (pending_setcaps_fields_str);
g_free (caps_str);
} }
} }
} }