gst-validate: port to 1.0

This commit is contained in:
Thiago Santos 2013-08-15 01:46:27 -03:00
parent 70cfe7a7b2
commit 25688f4e50
9 changed files with 191 additions and 222 deletions

View file

@ -36,7 +36,7 @@ m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])],
dnl our libraries and install dirs use major.minor as a version
dnl GST_API_VERSION=$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR
dnl we override it here if we need to for the release candidate of new series
GST_API_VERSION=0.10
GST_API_VERSION=1.0
AC_SUBST(GST_API_VERSION)
AC_DEFINE_UNQUOTED(GST_API_VERSION, "$GST_API_VERSION",
[GStreamer API Version])
@ -44,8 +44,8 @@ AC_DEFINE_UNQUOTED(GST_API_VERSION, "$GST_API_VERSION",
AS_LIBTOOL(GST, 0, 0, 0)
dnl *** required versions of GStreamer stuff ***
GST_REQ=0.10.0
GSTPB_REQ=0.10.0
GST_REQ=1.0.0
GSTPB_REQ=1.0.0
dnl *** autotools stuff ****

View file

@ -152,10 +152,13 @@ gst_validate_bin_monitor_setup (GstValidateMonitor * monitor)
iterator = gst_bin_iterate_elements (bin);
done = FALSE;
while (!done) {
switch (gst_iterator_next (iterator, (gpointer *) & element)) {
GValue value = { 0, };
switch (gst_iterator_next (iterator, &value)) {
case GST_ITERATOR_OK:
element = g_value_get_object (&value);
gst_validate_bin_monitor_wrap_element (bin_monitor, element);
gst_object_unref (element);
g_value_reset (&value);
break;
case GST_ITERATOR_RESYNC:
/* TODO how to handle this? */

View file

@ -126,12 +126,16 @@ gst_validate_element_monitor_inspect (GstValidateElementMonitor * monitor)
{
GstElement *element;
GstElementClass *klass;
const gchar *klassname;
element = GST_VALIDATE_ELEMENT_MONITOR_GET_ELEMENT (monitor);
klass = GST_ELEMENT_CLASS (G_OBJECT_GET_CLASS (element));
monitor->is_decoder = strstr (klass->details.klass, "Decoder") != NULL;
monitor->is_encoder = strstr (klass->details.klass, "Encoder") != NULL;
klassname =
gst_element_class_get_metadata (klass, GST_ELEMENT_METADATA_KLASS);
monitor->is_decoder = strstr (klassname, "Decoder") != NULL;
monitor->is_encoder = strstr (klassname, "Encoder") != NULL;
}
static gboolean
@ -163,10 +167,13 @@ gst_validate_element_monitor_do_setup (GstValidateMonitor * monitor)
iterator = gst_element_iterate_pads (element);
done = FALSE;
while (!done) {
switch (gst_iterator_next (iterator, (gpointer *) & pad)) {
GValue value = { 0, };
switch (gst_iterator_next (iterator, &value)) {
case GST_ITERATOR_OK:
pad = g_value_get_object (&value);
gst_validate_element_monitor_wrap_pad (elem_monitor, pad);
gst_object_unref (pad);
g_value_reset (&value);
break;
case GST_ITERATOR_RESYNC:
/* TODO how to handle this? */

View file

@ -120,7 +120,7 @@ gst_validate_file_checker_class_init (GstValidateFileCheckerClass * klass)
NULL, G_PARAM_READWRITE | G_PARAM_STATIC_NAME));
g_object_class_install_property (gobject_class, PROP_PROFILE,
gst_param_spec_mini_object ("profile", "Profile",
g_param_spec_boxed ("profile", "Profile",
"The GstEncodingProfile " "that should match what the file contains",
GST_TYPE_ENCODING_PROFILE, G_PARAM_READWRITE | G_PARAM_STATIC_NAME));
@ -197,7 +197,7 @@ gst_validate_file_checker_set_property (GObject * object, guint prop_id,
case PROP_PROFILE:
if (fc->profile)
gst_encoding_profile_unref (fc->profile);
fc->profile = (GstEncodingProfile *) gst_value_dup_mini_object (value);
fc->profile = (GstEncodingProfile *) g_value_dup_boxed (value);
break;
case PROP_DURATION:
fc->duration = g_value_get_uint64 (value);
@ -243,7 +243,7 @@ gst_validate_file_checker_get_property (GObject * object, guint prop_id,
g_value_set_string (value, fc->uri);
break;
case PROP_PROFILE:
gst_value_set_mini_object (value, GST_MINI_OBJECT_CAST (fc->profile));
g_value_set_boxed (value, fc->profile);
break;
case PROP_DURATION:
g_value_set_uint64 (value, fc->duration);

View file

@ -165,17 +165,22 @@ static void
GList *iter;
GstElement *element;
GstElementClass *klass;
const gchar *klassname;
element = gst_validate_monitor_get_element (monitor);
if (!element)
return;
klass = GST_ELEMENT_GET_CLASS (element);
klassname =
gst_element_class_get_metadata (klass, GST_ELEMENT_METADATA_KLASS);
for (iter = registry->name_overrides.head; iter; iter = g_list_next (iter)) {
entry = iter->data;
/* TODO It would be more correct to split it before comparing */
if (strstr (klass->details.klass, entry->name) != NULL) {
if (strstr (klassname, entry->name) != NULL) {
gst_validate_monitor_attach_override (monitor, entry->override);
}
}

View file

@ -46,7 +46,6 @@ GST_DEBUG_CATEGORY_STATIC (gst_validate_pad_monitor_debug);
G_DEFINE_TYPE_WITH_CODE (GstValidatePadMonitor, gst_validate_pad_monitor,
GST_TYPE_VALIDATE_MONITOR, _do_init);
#define PAD_IS_IN_PUSH_MODE(p) ((p)->mode == GST_ACTIVATE_PUSH)
#define PENDING_FIELDS "pending-fields"
/*
@ -103,56 +102,26 @@ static gboolean gst_validate_pad_monitor_do_setup (GstValidateMonitor *
monitor);
static GstElement *gst_validate_pad_monitor_get_element (GstValidateMonitor *
monitor);
static void
gst_validate_pad_monitor_setcaps_pre (GstValidatePadMonitor * pad_monitor,
GstCaps * caps);
static void gst_validate_pad_monitor_setcaps_post (GstValidatePadMonitor *
pad_monitor, GstCaps * caps, gboolean ret);
/* This was copied from gstpad.c and might need
* updating whenever it changes in core */
static GstCaps *
_gst_pad_get_caps_default (GstPad * pad)
{
GstCaps *result = NULL;
GstPadTemplate *templ;
if ((templ = GST_PAD_PAD_TEMPLATE (pad))) {
result = GST_PAD_TEMPLATE_CAPS (templ);
GST_DEBUG_OBJECT (pad, "using pad template %p with caps %p %"
GST_PTR_FORMAT, templ, result, result);
result = gst_caps_ref (result);
goto done;
}
if ((result = GST_PAD_CAPS (pad))) {
GST_DEBUG_OBJECT (pad, "using pad caps %p %" GST_PTR_FORMAT, result,
result);
result = gst_caps_ref (result);
goto done;
}
/* this almost never happens */
GST_DEBUG_OBJECT (pad, "pad has no caps");
result = gst_caps_new_empty ();
done:
return result;
}
#define PAD_IS_IN_PUSH_MODE(p) ((p)->mode == GST_PAD_MODE_PUSH)
static gboolean
_structure_is_raw_video (GstStructure * structure)
{
return gst_structure_has_name (structure, "video/x-raw-yuv")
|| gst_structure_has_name (structure, "video/x-raw-rgb")
|| gst_structure_has_name (structure, "video/x-raw-gray");
return gst_structure_has_name (structure, "video/x-raw");
}
static gboolean
_structure_is_raw_audio (GstStructure * structure)
{
return gst_structure_has_name (structure, "audio/x-raw-int")
|| gst_structure_has_name (structure, "audio/x-raw-float");
return gst_structure_has_name (structure, "audio/x-raw");
}
static void
_check_field_type (GstValidatePadMonitor * monitor, GstStructure * structure,
const gchar * field, ...)
@ -204,19 +173,8 @@ gst_validate_pad_monitor_check_raw_video_caps_complete (GstValidatePadMonitor *
GST_TYPE_FRACTION_RANGE, 0);
_check_field_type (monitor, structure, "pixel-aspect-ratio",
GST_TYPE_FRACTION, GST_TYPE_FRACTION_RANGE, 0);
if (gst_structure_has_name (structure, "video/x-raw-yuv")) {
_check_field_type (monitor, structure, "format", GST_TYPE_FOURCC,
GST_TYPE_LIST);
} else if (gst_structure_has_name (structure, "video/x-raw-rgb")) {
_check_field_type (monitor, structure, "bpp", G_TYPE_INT, GST_TYPE_LIST, 0);
_check_field_type (monitor, structure, "depth", G_TYPE_INT, GST_TYPE_LIST,
0);
_check_field_type (monitor, structure, "endianness", G_TYPE_INT,
GST_TYPE_LIST, 0);
}
_check_field_type (monitor, structure, "format", G_TYPE_STRING,
GST_TYPE_LIST);
}
static void
@ -268,16 +226,18 @@ gst_validate_pad_monitor_get_othercaps (GstValidatePadMonitor * monitor)
(monitor));
done = FALSE;
while (!done) {
switch (gst_iterator_next (iter, (gpointer *) & otherpad)) {
GValue value = { 0, };
switch (gst_iterator_next (iter, &value)) {
case GST_ITERATOR_OK:
otherpad = g_value_get_object (&value);
/* TODO What would be the correct caps operation to merge the caps in
* case one sink is internally linked to multiple srcs? */
peercaps = gst_pad_peer_get_caps_reffed (otherpad);
peercaps = gst_pad_peer_query_caps (otherpad, NULL);
if (peercaps)
gst_caps_merge (caps, peercaps);
gst_object_unref (otherpad);
caps = gst_caps_merge (caps, peercaps);
g_value_reset (&value);
break;
case GST_ITERATOR_RESYNC:
gst_iterator_resync (iter);
@ -510,10 +470,8 @@ gst_validate_pad_monitor_dispose (GObject * object)
GstPad *pad = GST_VALIDATE_PAD_MONITOR_GET_PAD (monitor);
if (pad) {
if (monitor->buffer_probe_id)
gst_pad_remove_data_probe (pad, monitor->buffer_probe_id);
if (monitor->event_probe_id)
gst_pad_remove_data_probe (pad, monitor->event_probe_id);
if (monitor->pad_probe_id)
gst_pad_remove_probe (pad, monitor->pad_probe_id);
g_signal_handlers_disconnect_by_func (pad, (GCallback) _parent_set_cb,
monitor);
@ -547,7 +505,7 @@ static void
gst_validate_pad_monitor_init (GstValidatePadMonitor * pad_monitor)
{
pad_monitor->pending_setcaps_fields =
gst_structure_empty_new (PENDING_FIELDS);
gst_structure_new_empty (PENDING_FIELDS);
pad_monitor->serialized_events =
g_ptr_array_new_with_free_func ((GDestroyNotify)
_serialized_event_data_free);
@ -653,23 +611,6 @@ gst_validate_pad_monitor_query_overrides (GstValidatePadMonitor * pad_monitor,
GST_VALIDATE_MONITOR_OVERRIDES_UNLOCK (pad_monitor);
}
static void
gst_validate_pad_monitor_getcaps_overrides (GstValidatePadMonitor * pad_monitor,
GstCaps * caps)
{
GList *iter;
GST_VALIDATE_MONITOR_OVERRIDES_LOCK (pad_monitor);
for (iter = GST_VALIDATE_MONITOR_OVERRIDES (pad_monitor).head; iter;
iter = g_list_next (iter)) {
GstValidateOverride *override = iter->data;
gst_validate_override_getcaps_handler (override,
GST_VALIDATE_MONITOR_CAST (pad_monitor), caps);
}
GST_VALIDATE_MONITOR_OVERRIDES_UNLOCK (pad_monitor);
}
static void
gst_validate_pad_monitor_setcaps_overrides (GstValidatePadMonitor * pad_monitor,
GstCaps * caps)
@ -733,8 +674,10 @@ static void
(monitor));
done = FALSE;
while (!done) {
switch (gst_iterator_next (iter, (gpointer *) & otherpad)) {
GValue value = { 0, };
switch (gst_iterator_next (iter, &value)) {
case GST_ITERATOR_OK:
otherpad = g_value_get_object (&value);
GST_DEBUG_OBJECT (monitor, "Checking pad %s:%s input timestamps",
GST_DEBUG_PAD_NAME (otherpad));
othermonitor = g_object_get_data ((GObject *) otherpad, "qa-monitor");
@ -748,7 +691,7 @@ static void
found = TRUE;
}
GST_VALIDATE_MONITOR_UNLOCK (othermonitor);
gst_object_unref (otherpad);
g_value_reset (&value);
has_one = TRUE;
break;
case GST_ITERATOR_RESYNC:
@ -871,8 +814,10 @@ gst_validate_pad_monitor_check_aggregated_return (GstValidatePadMonitor *
(monitor));
done = FALSE;
while (!done) {
switch (gst_iterator_next (iter, (gpointer *) & otherpad)) {
GValue value = { 0, };
switch (gst_iterator_next (iter, &value)) {
case GST_ITERATOR_OK:
otherpad = g_value_get_object (&value);
peerpad = gst_pad_get_peer (otherpad);
if (peerpad) {
othermonitor = g_object_get_data ((GObject *) peerpad, "qa-monitor");
@ -886,7 +831,7 @@ gst_validate_pad_monitor_check_aggregated_return (GstValidatePadMonitor *
gst_object_unref (peerpad);
}
gst_object_unref (otherpad);
g_value_reset (&value);
break;
case GST_ITERATOR_RESYNC:
gst_iterator_resync (iter);
@ -905,7 +850,7 @@ gst_validate_pad_monitor_check_aggregated_return (GstValidatePadMonitor *
/* no peer pad found, nothing to do */
return;
}
if (monitor->is_eos && ret == GST_FLOW_UNEXPECTED) {
if (monitor->is_eos && ret == GST_FLOW_EOS) {
/* this is acceptable */
return;
}
@ -934,8 +879,10 @@ static void
(monitor));
done = FALSE;
while (!done) {
switch (gst_iterator_next (iter, (gpointer *) & otherpad)) {
GValue value = { 0, };
switch (gst_iterator_next (iter, &value)) {
case GST_ITERATOR_OK:
otherpad = g_value_get_object (&value);
othermonitor = g_object_get_data ((GObject *) otherpad, "qa-monitor");
if (othermonitor) {
SerializedEventData *data = g_slice_new0 (SerializedEventData);
@ -945,6 +892,7 @@ static void
g_ptr_array_add (othermonitor->serialized_events, data);
GST_VALIDATE_MONITOR_UNLOCK (othermonitor);
}
g_value_reset (&value);
break;
case GST_ITERATOR_RESYNC:
gst_iterator_resync (iter);
@ -983,8 +931,10 @@ gst_validate_pad_monitor_otherpad_add_pending_field (GstValidatePadMonitor *
(monitor));
done = FALSE;
while (!done) {
switch (gst_iterator_next (iter, (gpointer *) & otherpad)) {
GValue value = { 0, };
switch (gst_iterator_next (iter, &value)) {
case GST_ITERATOR_OK:
otherpad = g_value_get_object (&value);
othermonitor = g_object_get_data ((GObject *) otherpad, "qa-monitor");
if (othermonitor) {
GST_VALIDATE_MONITOR_LOCK (othermonitor);
@ -993,6 +943,7 @@ gst_validate_pad_monitor_otherpad_add_pending_field (GstValidatePadMonitor *
field, v);
GST_VALIDATE_MONITOR_UNLOCK (othermonitor);
}
g_value_reset (&value);
break;
case GST_ITERATOR_RESYNC:
gst_iterator_resync (iter);
@ -1023,17 +974,20 @@ gst_validate_pad_monitor_otherpad_clear_pending_fields (GstValidatePadMonitor *
(monitor));
done = FALSE;
while (!done) {
switch (gst_iterator_next (iter, (gpointer *) & otherpad)) {
GValue value = { 0, };
switch (gst_iterator_next (iter, &value)) {
case GST_ITERATOR_OK:
otherpad = g_value_get_object (&value);
othermonitor = g_object_get_data ((GObject *) otherpad, "qa-monitor");
if (othermonitor) {
GST_VALIDATE_MONITOR_LOCK (othermonitor);
g_assert (othermonitor->pending_setcaps_fields != NULL);
gst_structure_free (othermonitor->pending_setcaps_fields);
othermonitor->pending_setcaps_fields =
gst_structure_empty_new (PENDING_FIELDS);
gst_structure_new_empty (PENDING_FIELDS);
GST_VALIDATE_MONITOR_UNLOCK (othermonitor);
}
g_value_reset (&value);
break;
case GST_ITERATOR_RESYNC:
gst_iterator_resync (iter);
@ -1064,8 +1018,10 @@ gst_validate_pad_monitor_add_expected_newsegment (GstValidatePadMonitor *
(monitor));
done = FALSE;
while (!done) {
switch (gst_iterator_next (iter, (gpointer *) & otherpad)) {
GValue value = { 0, };
switch (gst_iterator_next (iter, &value)) {
case GST_ITERATOR_OK:
otherpad = g_value_get_object (&value);
othermonitor = g_object_get_data ((GObject *) otherpad, "qa-monitor");
GST_VALIDATE_MONITOR_LOCK (othermonitor);
if (othermonitor->expected_segment) {
@ -1075,7 +1031,7 @@ gst_validate_pad_monitor_add_expected_newsegment (GstValidatePadMonitor *
}
othermonitor->expected_segment = gst_event_ref (event);
GST_VALIDATE_MONITOR_UNLOCK (othermonitor);
gst_object_unref (otherpad);
g_value_reset (&value);
break;
case GST_ITERATOR_RESYNC:
gst_iterator_resync (iter);
@ -1117,8 +1073,7 @@ gst_validate_pad_monitor_common_event_check (GstValidatePadMonitor *
if (pad_monitor->pending_flush_stop) {
GST_VALIDATE_REPORT (pad_monitor,
GST_VALIDATE_ISSUE_ID_EVENT_FLUSH_START_UNEXPECTED,
"Received flush-start from %" GST_PTR_FORMAT
" when flush-stop was expected", GST_EVENT_SRC (event));
"Received flush-start from " " when flush-stop was expected");
}
pad_monitor->pending_flush_stop = TRUE;
}
@ -1140,8 +1095,7 @@ gst_validate_pad_monitor_common_event_check (GstValidatePadMonitor *
if (!pad_monitor->pending_flush_stop) {
GST_VALIDATE_REPORT (pad_monitor,
GST_VALIDATE_ISSUE_ID_EVENT_FLUSH_STOP_UNEXPECTED,
"Unexpected flush-stop %p from %" GST_PTR_FORMAT, event,
GST_EVENT_SRC (event));
"Unexpected flush-stop %p" GST_PTR_FORMAT, event);
}
pad_monitor->pending_flush_stop = FALSE;
}
@ -1153,13 +1107,10 @@ gst_validate_pad_monitor_common_event_check (GstValidatePadMonitor *
static gboolean
gst_validate_pad_monitor_sink_event_check (GstValidatePadMonitor * pad_monitor,
GstEvent * event, GstPadEventFunction handler)
GstObject * parent, GstEvent * event, GstPadEventFunction handler)
{
gboolean ret = TRUE;
gboolean update;
gdouble rate, applied_rate;
GstFormat format;
gint64 start, stop, position;
const GstSegment *segment;
guint32 seqnum = gst_event_get_seqnum (event);
GstPad *pad = GST_VALIDATE_PAD_MONITOR_GET_PAD (pad_monitor);
@ -1167,10 +1118,16 @@ gst_validate_pad_monitor_sink_event_check (GstValidatePadMonitor * pad_monitor,
/* pre checks */
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_NEWSEGMENT:
/* parse newsegment data to be used if event is handled */
gst_event_parse_new_segment_full (event, &update, &rate, &applied_rate,
&format, &start, &stop, &position);
case GST_EVENT_CAPS:{
GstCaps *caps;
gst_event_parse_caps (event, &caps);
gst_validate_pad_monitor_setcaps_pre (pad_monitor, caps);
break;
}
case GST_EVENT_SEGMENT:
/* parse segment data to be used if event is handled */
gst_event_parse_segment (event, &segment);
if (pad_monitor->pending_newsegment_seqnum) {
if (pad_monitor->pending_newsegment_seqnum == seqnum) {
@ -1186,21 +1143,17 @@ gst_validate_pad_monitor_sink_event_check (GstValidatePadMonitor * pad_monitor,
} else {
/* check if this segment is the expected one */
if (pad_monitor->expected_segment) {
gint64 exp_start, exp_stop, exp_position;
gdouble exp_rate, exp_applied_rate;
gboolean exp_update;
GstFormat exp_format;
const GstSegment *exp_segment;
if (pad_monitor->expected_segment != event) {
gst_event_parse_new_segment_full (pad_monitor->expected_segment,
&exp_update, &exp_rate,
&exp_applied_rate, &exp_format, &exp_start, &exp_stop,
&exp_position);
if (format == exp_format) {
if (update != exp_update
|| (exp_rate * exp_applied_rate != rate * applied_rate)
|| exp_start != start || exp_stop != stop
|| exp_position != position) {
gst_event_parse_segment (pad_monitor->expected_segment,
&exp_segment);
if (segment->format == exp_segment->format) {
if ((exp_segment->rate * exp_segment->applied_rate !=
segment->rate * segment->applied_rate)
|| exp_segment->start != segment->start
|| exp_segment->stop != segment->stop
|| exp_segment->position != segment->position) {
GST_VALIDATE_REPORT (pad_monitor,
GST_VALIDATE_ISSUE_ID_EVENT_NEW_SEGMENT_MISMATCH,
"Expected segment didn't match received segment event");
@ -1235,20 +1188,27 @@ gst_validate_pad_monitor_sink_event_check (GstValidatePadMonitor * pad_monitor,
gst_validate_pad_monitor_event_overrides (pad_monitor, event);
if (handler) {
gst_event_ref (event);
ret = pad_monitor->event_func (pad, event);
ret = pad_monitor->event_func (pad, parent, event);
}
GST_VALIDATE_PAD_MONITOR_PARENT_LOCK (pad_monitor);
GST_VALIDATE_MONITOR_LOCK (pad_monitor);
/* post checks */
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_NEWSEGMENT:
case GST_EVENT_CAPS:{
GstCaps *caps;
gst_event_parse_caps (event, &caps);
gst_validate_pad_monitor_setcaps_post (pad_monitor, caps, ret);
break;
}
case GST_EVENT_SEGMENT:
if (ret) {
if (!pad_monitor->has_segment && pad_monitor->segment.format != format) {
gst_segment_init (&pad_monitor->segment, format);
if (!pad_monitor->has_segment
&& pad_monitor->segment.format != segment->format) {
gst_segment_init (&pad_monitor->segment, segment->format);
}
gst_segment_set_newsegment_full (&pad_monitor->segment, update, rate,
applied_rate, format, start, stop, position);
gst_segment_copy_into (segment, &pad_monitor->segment);
pad_monitor->has_segment = TRUE;
}
break;
@ -1268,7 +1228,7 @@ gst_validate_pad_monitor_sink_event_check (GstValidatePadMonitor * pad_monitor,
static gboolean
gst_validate_pad_monitor_src_event_check (GstValidatePadMonitor * pad_monitor,
GstEvent * event, GstPadEventFunction handler)
GstObject * parent, GstEvent * event, GstPadEventFunction handler)
{
gboolean ret = TRUE;
gdouble rate;
@ -1313,7 +1273,7 @@ gst_validate_pad_monitor_src_event_check (GstValidatePadMonitor * pad_monitor,
if (handler) {
GST_VALIDATE_MONITOR_UNLOCK (pad_monitor);
gst_event_ref (event);
ret = pad_monitor->event_func (pad, event);
ret = pad_monitor->event_func (pad, parent, event);
GST_VALIDATE_MONITOR_LOCK (pad_monitor);
}
@ -1336,7 +1296,8 @@ gst_validate_pad_monitor_src_event_check (GstValidatePadMonitor * pad_monitor,
}
static GstFlowReturn
gst_validate_pad_monitor_chain_func (GstPad * pad, GstBuffer * buffer)
gst_validate_pad_monitor_chain_func (GstPad * pad, GstObject * parent,
GstBuffer * buffer)
{
GstValidatePadMonitor *pad_monitor =
g_object_get_data ((GObject *) pad, "qa-monitor");
@ -1353,7 +1314,7 @@ gst_validate_pad_monitor_chain_func (GstPad * pad, GstBuffer * buffer)
gst_validate_pad_monitor_buffer_overrides (pad_monitor, buffer);
ret = pad_monitor->chain_func (pad, buffer);
ret = pad_monitor->chain_func (pad, parent, buffer);
GST_VALIDATE_PAD_MONITOR_PARENT_LOCK (pad_monitor);
GST_VALIDATE_MONITOR_LOCK (pad_monitor);
@ -1368,7 +1329,8 @@ gst_validate_pad_monitor_chain_func (GstPad * pad, GstBuffer * buffer)
}
static gboolean
gst_validate_pad_monitor_sink_event_func (GstPad * pad, GstEvent * event)
gst_validate_pad_monitor_sink_event_func (GstPad * pad, GstObject * parent,
GstEvent * event)
{
GstValidatePadMonitor *pad_monitor =
g_object_get_data ((GObject *) pad, "qa-monitor");
@ -1391,7 +1353,7 @@ gst_validate_pad_monitor_sink_event_func (GstPad * pad, GstEvent * event)
event, last_ts);
}
ret = gst_validate_pad_monitor_sink_event_check (pad_monitor, event,
ret = gst_validate_pad_monitor_sink_event_check (pad_monitor, parent, event,
pad_monitor->event_func);
GST_VALIDATE_MONITOR_UNLOCK (pad_monitor);
@ -1400,21 +1362,23 @@ gst_validate_pad_monitor_sink_event_func (GstPad * pad, GstEvent * event)
}
static gboolean
gst_validate_pad_monitor_src_event_func (GstPad * pad, GstEvent * event)
gst_validate_pad_monitor_src_event_func (GstPad * pad, GstObject * parent,
GstEvent * event)
{
GstValidatePadMonitor *pad_monitor =
g_object_get_data ((GObject *) pad, "qa-monitor");
gboolean ret;
GST_VALIDATE_MONITOR_LOCK (pad_monitor);
ret = gst_validate_pad_monitor_src_event_check (pad_monitor, event,
ret = gst_validate_pad_monitor_src_event_check (pad_monitor, parent, event,
pad_monitor->event_func);
GST_VALIDATE_MONITOR_UNLOCK (pad_monitor);
return ret;
}
static gboolean
gst_validate_pad_monitor_query_func (GstPad * pad, GstQuery * query)
gst_validate_pad_monitor_query_func (GstPad * pad, GstObject * parent,
GstQuery * query)
{
GstValidatePadMonitor *pad_monitor =
g_object_get_data ((GObject *) pad, "qa-monitor");
@ -1422,29 +1386,39 @@ gst_validate_pad_monitor_query_func (GstPad * pad, GstQuery * query)
gst_validate_pad_monitor_query_overrides (pad_monitor, query);
ret = pad_monitor->query_func (pad, query);
ret = pad_monitor->query_func (pad, parent, query);
if (ret) {
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_CAPS:{
GstCaps *res;
/* We shouldn't need to lock the parent as this doesn't modify
* other monitors, just does some peer_pad_caps */
GST_VALIDATE_MONITOR_LOCK (pad_monitor);
gst_query_parse_caps_result (query, &res);
if (GST_PAD_DIRECTION (pad) == GST_PAD_SINK) {
gst_validate_pad_monitor_check_caps_fields_proxied (pad_monitor, res);
}
GST_VALIDATE_MONITOR_UNLOCK (pad_monitor);
break;
}
default:
break;
}
}
return ret;
}
static gboolean
gst_validate_pad_buffer_alloc_func (GstPad * pad, guint64 offset, guint size,
GstCaps * caps, GstBuffer ** buffer)
gst_validate_pad_get_range_func (GstPad * pad, GstObject * parent,
guint64 offset, guint size, GstBuffer ** buffer)
{
GstValidatePadMonitor *pad_monitor =
g_object_get_data ((GObject *) pad, "qa-monitor");
gboolean ret;
ret = pad_monitor->bufferalloc_func (pad, offset, size, caps, buffer);
return ret;
}
static gboolean
gst_validate_pad_get_range_func (GstPad * pad, guint64 offset, guint size,
GstBuffer ** buffer)
{
GstValidatePadMonitor *pad_monitor =
g_object_get_data ((GObject *) pad, "qa-monitor");
gboolean ret;
ret = pad_monitor->getrange_func (pad, offset, size, buffer);
ret = pad_monitor->getrange_func (pad, parent, offset, size, buffer);
return ret;
}
@ -1535,48 +1509,35 @@ gst_validate_pad_monitor_event_probe (GstPad * pad, GstEvent * event,
/* This so far is just like an event that is flowing downstream,
* so we do the same checks as a sinkpad event handler */
ret = gst_validate_pad_monitor_sink_event_check (monitor, event, NULL);
ret = gst_validate_pad_monitor_sink_event_check (monitor, NULL, event, NULL);
GST_VALIDATE_MONITOR_UNLOCK (monitor);
GST_VALIDATE_PAD_MONITOR_PARENT_UNLOCK (monitor);
return ret;
}
static GstCaps *
gst_validate_pad_monitor_getcaps_func (GstPad * pad)
static GstPadProbeReturn
gst_validate_pad_monitor_pad_probe (GstPad * pad, GstPadProbeInfo * info,
gpointer udata)
{
GstValidatePadMonitor *pad_monitor =
g_object_get_data ((GObject *) pad, "qa-monitor");
GstCaps *ret = NULL;
if (pad_monitor->getcaps_func) {
ret = pad_monitor->getcaps_func (pad);
} else {
ret = _gst_pad_get_caps_default (pad);
switch (info->type) {
case GST_PAD_PROBE_TYPE_BUFFER:
gst_validate_pad_monitor_buffer_probe (pad, info->data, udata);
break;
case GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM:
gst_validate_pad_monitor_event_probe (pad, info->data, udata);
break;
default:
break;
}
if (ret) {
/* We shouldn't need to lock the parent as this doesn't modify
* other monitors, just does some peer_pad_caps */
GST_VALIDATE_MONITOR_LOCK (pad_monitor);
if (GST_PAD_DIRECTION (pad) == GST_PAD_SINK) {
gst_validate_pad_monitor_check_caps_fields_proxied (pad_monitor, ret);
}
GST_VALIDATE_MONITOR_UNLOCK (pad_monitor);
}
gst_validate_pad_monitor_getcaps_overrides (pad_monitor, ret);
return ret;
return GST_PAD_PROBE_OK;
}
static gboolean
gst_validate_pad_monitor_setcaps_func (GstPad * pad, GstCaps * caps)
static void
gst_validate_pad_monitor_setcaps_pre (GstValidatePadMonitor * pad_monitor,
GstCaps * caps)
{
GstValidatePadMonitor *pad_monitor =
g_object_get_data ((GObject *) pad, "qa-monitor");
gboolean ret = TRUE;
GstStructure *structure;
GST_VALIDATE_PAD_MONITOR_PARENT_LOCK (pad_monitor);
@ -1634,23 +1595,22 @@ gst_validate_pad_monitor_setcaps_func (GstPad * pad, GstCaps * caps)
gst_structure_free (pad_monitor->pending_setcaps_fields);
pad_monitor->pending_setcaps_fields =
gst_structure_empty_new (PENDING_FIELDS);
gst_structure_new_empty (PENDING_FIELDS);
GST_VALIDATE_MONITOR_UNLOCK (pad_monitor);
GST_VALIDATE_PAD_MONITOR_PARENT_UNLOCK (pad_monitor);
gst_validate_pad_monitor_setcaps_overrides (pad_monitor, caps);
}
if (pad_monitor->setcaps_func) {
ret = pad_monitor->setcaps_func (pad, caps);
}
static void
gst_validate_pad_monitor_setcaps_post (GstValidatePadMonitor * pad_monitor,
GstCaps * caps, gboolean ret)
{
GST_VALIDATE_PAD_MONITOR_PARENT_LOCK (pad_monitor);
if (!ret)
gst_validate_pad_monitor_otherpad_clear_pending_fields (pad_monitor);
GST_VALIDATE_PAD_MONITOR_PARENT_UNLOCK (pad_monitor);
return ret;
}
static gboolean
@ -1675,13 +1635,7 @@ gst_validate_pad_monitor_do_setup (GstValidateMonitor * monitor)
pad_monitor->event_func = GST_PAD_EVENTFUNC (pad);
pad_monitor->query_func = GST_PAD_QUERYFUNC (pad);
pad_monitor->setcaps_func = GST_PAD_SETCAPSFUNC (pad);
pad_monitor->getcaps_func = GST_PAD_GETCAPSFUNC (pad);
if (GST_PAD_DIRECTION (pad) == GST_PAD_SINK) {
pad_monitor->bufferalloc_func = GST_PAD_BUFFERALLOCFUNC (pad);
if (pad_monitor->bufferalloc_func)
gst_pad_set_bufferalloc_function (pad,
gst_validate_pad_buffer_alloc_func);
pad_monitor->chain_func = GST_PAD_CHAINFUNC (pad);
if (pad_monitor->chain_func)
@ -1696,14 +1650,13 @@ gst_validate_pad_monitor_do_setup (GstValidateMonitor * monitor)
gst_pad_set_event_function (pad, gst_validate_pad_monitor_src_event_func);
/* add buffer/event probes */
pad_monitor->buffer_probe_id = gst_pad_add_buffer_probe (pad,
(GCallback) gst_validate_pad_monitor_buffer_probe, pad_monitor);
pad_monitor->event_probe_id = gst_pad_add_event_probe (pad,
(GCallback) gst_validate_pad_monitor_event_probe, pad_monitor);
pad_monitor->pad_probe_id =
gst_pad_add_probe (pad,
GST_PAD_PROBE_TYPE_BUFFER | GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM,
(GstPadProbeCallback) gst_validate_pad_monitor_pad_probe, pad_monitor,
NULL);
}
gst_pad_set_query_function (pad, gst_validate_pad_monitor_query_func);
gst_pad_set_getcaps_function (pad, gst_validate_pad_monitor_getcaps_func);
gst_pad_set_setcaps_function (pad, gst_validate_pad_monitor_setcaps_func);
gst_validate_reporter_set_name (GST_VALIDATE_REPORTER (monitor),
g_strdup_printf ("%s:%s", GST_DEBUG_PAD_NAME (pad)));

View file

@ -62,16 +62,12 @@ struct _GstValidatePadMonitor {
gboolean setup;
GstPad *pad;
GstPadBufferAllocFunction bufferalloc_func;
GstPadChainFunction chain_func;
GstPadEventFunction event_func;
GstPadGetRangeFunction getrange_func;
GstPadQueryFunction query_func;
GstPadSetCapsFunction setcaps_func;
GstPadGetCapsFunction getcaps_func;
gulong buffer_probe_id;
gulong event_probe_id;
gulong pad_probe_id;
/*< private >*/
gboolean first_buffer;

View file

@ -444,7 +444,7 @@ get_position (GstValidateScenario * scenario)
GstValidateScenarioPrivate *priv = scenario->priv;
GstElement *pipeline = scenario->priv->pipeline;
gst_element_query_position (pipeline, &format, &position);
gst_element_query_position (pipeline, format, &position);
GST_LOG ("Current position: %" GST_TIME_FORMAT, GST_TIME_ARGS (position));
for (tmp = scenario->priv->seeks; tmp; tmp = g_list_next (tmp)) {
@ -482,7 +482,7 @@ async_done_cb (GstBus * bus, GstMessage * message,
gint64 position;
GstFormat format = GST_FORMAT_TIME;
gst_element_query_position (priv->pipeline, &format, &position);
gst_element_query_position (priv->pipeline, format, &position);
if (position > (priv->seeked_position + priv->seek_pos_tol) ||
position < (MAX (0,
((gint64) (priv->seeked_position - priv->seek_pos_tol))))) {

View file

@ -67,12 +67,11 @@ pad_added_cb (GstElement * uridecodebin, GstPad * pad, GstElement * encodebin)
GstCaps *caps;
GstPad *sinkpad = NULL;
GST_DEBUG_OBJECT (uridecodebin, "Pad added, caps: %" GST_PTR_FORMAT,
gst_pad_get_caps (pad));
caps = gst_pad_get_current_caps (pad);
/* Ask encodebin for a compatible pad */
caps = gst_pad_get_caps_reffed (pad);
GST_DEBUG_OBJECT (uridecodebin, "Pad added, caps: %" GST_PTR_FORMAT, caps);
g_signal_emit_by_name (encodebin, "request-pad", caps, &sinkpad);
if (caps)
gst_caps_unref (caps);
@ -83,10 +82,16 @@ pad_added_cb (GstElement * uridecodebin, GstPad * pad, GstElement * encodebin)
return;
}
if (G_UNLIKELY (gst_pad_link (pad, sinkpad) != GST_PAD_LINK_OK))
if (G_UNLIKELY (gst_pad_link (pad, sinkpad) != GST_PAD_LINK_OK)) {
GstCaps *othercaps = gst_pad_get_current_caps (sinkpad);
caps = gst_pad_get_current_caps (pad);
GST_ERROR ("Couldn't link pads \n\n%" GST_PTR_FORMAT "\n\n and \n\n %"
GST_PTR_FORMAT "\n\n", gst_pad_get_caps (pad),
gst_pad_get_caps (sinkpad));
GST_PTR_FORMAT "\n\n", caps, othercaps);
gst_caps_unref (caps);
gst_caps_unref (othercaps);
}
return;
}
@ -102,7 +107,7 @@ create_transcoding_pipeline (gchar * uri, gchar * outuri)
src = gst_element_factory_make ("uridecodebin", NULL);
ebin = gst_element_factory_make ("encodebin", NULL);
sink = gst_element_make_from_uri (GST_URI_SINK, outuri, "sink");
sink = gst_element_make_from_uri (GST_URI_SINK, outuri, "sink", NULL);
g_assert (sink);
g_object_set (src, "uri", uri, NULL);