decodebin: Pass the element in the autoplug-query signal too

This commit is contained in:
Sebastian Dröge 2013-05-28 12:03:49 +02:00
parent 730e633d58
commit 9513b770f4
3 changed files with 28 additions and 17 deletions

View file

@ -800,6 +800,7 @@ gst_decode_bin_class_init (GstDecodeBinClass * klass)
* @bin: The decodebin. * @bin: The decodebin.
* @child: The child element doing the query * @child: The child element doing the query
* @pad: The #GstPad. * @pad: The #GstPad.
* @element: The #GstElement.
* @query: The #GstQuery. * @query: The #GstQuery.
* *
* This signal is emitted whenever an autoplugged element that is * This signal is emitted whenever an autoplugged element that is
@ -813,7 +814,7 @@ gst_decode_bin_class_init (GstDecodeBinClass * klass)
g_signal_new ("autoplug-query", G_TYPE_FROM_CLASS (klass), g_signal_new ("autoplug-query", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstDecodeBinClass, autoplug_query), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstDecodeBinClass, autoplug_query),
_gst_boolean_or_accumulator, NULL, g_cclosure_marshal_generic, _gst_boolean_or_accumulator, NULL, g_cclosure_marshal_generic,
G_TYPE_BOOLEAN, 2, GST_TYPE_PAD, G_TYPE_BOOLEAN, 3, GST_TYPE_PAD, GST_TYPE_ELEMENT,
GST_TYPE_QUERY | G_SIGNAL_TYPE_STATIC_SCOPE); GST_TYPE_QUERY | G_SIGNAL_TYPE_STATIC_SCOPE);
/** /**
@ -4241,9 +4242,18 @@ gst_decode_pad_query (GstPad * pad, GstObject * parent, GstQuery * query)
CHAIN_MUTEX_LOCK (dpad->chain); CHAIN_MUTEX_LOCK (dpad->chain);
if (!dpad->exposed && !dpad->chain->deadend) { if (!dpad->exposed && !dpad->chain->deadend) {
GstDecodeElement *delem =
(dpad->chain->elements ? dpad->chain->elements->data : NULL);
ret = FALSE; ret = FALSE;
GST_DEBUG_OBJECT (dpad->dbin,
"calling autoplug-query for %s (element %s): %" GST_PTR_FORMAT,
GST_PAD_NAME (dpad), delem ? GST_ELEMENT_NAME (delem->element) : NULL,
query);
g_signal_emit (G_OBJECT (dpad->dbin), g_signal_emit (G_OBJECT (dpad->dbin),
gst_decode_bin_signals[SIGNAL_AUTOPLUG_QUERY], 0, dpad, query, &ret); gst_decode_bin_signals[SIGNAL_AUTOPLUG_QUERY], 0, dpad, delem->element,
query, &ret);
GST_DEBUG_OBJECT (dpad->dbin, "autoplug-query returned %d", ret); GST_DEBUG_OBJECT (dpad->dbin, "autoplug-query returned %d", ret);
if (ret) { if (ret) {
GstCaps *result, *filter; GstCaps *result, *filter;

View file

@ -4080,8 +4080,8 @@ autoplug_select_cb (GstElement * decodebin, GstPad * pad,
} }
static gboolean static gboolean
autoplug_query_caps (GstElement * uridecodebin, GstPad * pad, GstQuery * query, autoplug_query_caps (GstElement * uridecodebin, GstPad * pad,
GstSourceGroup * group) GstElement * element, GstQuery * query, GstSourceGroup * group)
{ {
GstCaps *filter, *result = NULL; GstCaps *filter, *result = NULL;
GstElement *sink; GstElement *sink;
@ -4241,13 +4241,13 @@ done:
} }
static gboolean static gboolean
autoplug_query_cb (GstElement * uridecodebin, GstPad * pad, GstQuery * query, autoplug_query_cb (GstElement * uridecodebin, GstPad * pad,
GstSourceGroup * group) GstElement * element, GstQuery * query, GstSourceGroup * group)
{ {
switch (GST_QUERY_TYPE (query)) { switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_CAPS: case GST_QUERY_CAPS:
return autoplug_query_caps (uridecodebin, pad, query, group); return autoplug_query_caps (uridecodebin, pad, element, query, group);
default: default:
return FALSE; return FALSE;
} }

View file

@ -658,7 +658,7 @@ gst_uri_decode_bin_class_init (GstURIDecodeBinClass * klass)
g_signal_new ("autoplug-query", G_TYPE_FROM_CLASS (klass), g_signal_new ("autoplug-query", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstURIDecodeBinClass, autoplug_query), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstURIDecodeBinClass, autoplug_query),
_gst_boolean_or_accumulator, NULL, g_cclosure_marshal_generic, _gst_boolean_or_accumulator, NULL, g_cclosure_marshal_generic,
G_TYPE_BOOLEAN, 2, GST_TYPE_PAD, G_TYPE_BOOLEAN, 3, GST_TYPE_PAD, GST_TYPE_ELEMENT,
GST_TYPE_QUERY | G_SIGNAL_TYPE_STATIC_SCOPE); GST_TYPE_QUERY | G_SIGNAL_TYPE_STATIC_SCOPE);
/** /**
@ -1642,7 +1642,7 @@ remove_decoders (GstURIDecodeBin * bin, gboolean force)
} }
static void static void
proxy_unknown_type_signal (GstElement * element, GstPad * pad, GstCaps * caps, proxy_unknown_type_signal (GstElement * decodebin, GstPad * pad, GstCaps * caps,
GstURIDecodeBin * dec) GstURIDecodeBin * dec)
{ {
GST_DEBUG_OBJECT (dec, "unknown-type signaled"); GST_DEBUG_OBJECT (dec, "unknown-type signaled");
@ -1652,7 +1652,7 @@ proxy_unknown_type_signal (GstElement * element, GstPad * pad, GstCaps * caps,
} }
static gboolean static gboolean
proxy_autoplug_continue_signal (GstElement * element, GstPad * pad, proxy_autoplug_continue_signal (GstElement * decodebin, GstPad * pad,
GstCaps * caps, GstURIDecodeBin * dec) GstCaps * caps, GstURIDecodeBin * dec)
{ {
gboolean result; gboolean result;
@ -1667,7 +1667,7 @@ proxy_autoplug_continue_signal (GstElement * element, GstPad * pad,
} }
static GValueArray * static GValueArray *
proxy_autoplug_factories_signal (GstElement * element, GstPad * pad, proxy_autoplug_factories_signal (GstElement * decodebin, GstPad * pad,
GstCaps * caps, GstURIDecodeBin * dec) GstCaps * caps, GstURIDecodeBin * dec)
{ {
GValueArray *result; GValueArray *result;
@ -1682,7 +1682,7 @@ proxy_autoplug_factories_signal (GstElement * element, GstPad * pad,
} }
static GValueArray * static GValueArray *
proxy_autoplug_sort_signal (GstElement * element, GstPad * pad, proxy_autoplug_sort_signal (GstElement * decodebin, GstPad * pad,
GstCaps * caps, GValueArray * factories, GstURIDecodeBin * dec) GstCaps * caps, GValueArray * factories, GstURIDecodeBin * dec)
{ {
GValueArray *result; GValueArray *result;
@ -1697,7 +1697,7 @@ proxy_autoplug_sort_signal (GstElement * element, GstPad * pad,
} }
static GstAutoplugSelectResult static GstAutoplugSelectResult
proxy_autoplug_select_signal (GstElement * element, GstPad * pad, proxy_autoplug_select_signal (GstElement * decodebin, GstPad * pad,
GstCaps * caps, GstElementFactory * factory, GstURIDecodeBin * dec) GstCaps * caps, GstElementFactory * factory, GstURIDecodeBin * dec)
{ {
GstAutoplugSelectResult result; GstAutoplugSelectResult result;
@ -1712,13 +1712,14 @@ proxy_autoplug_select_signal (GstElement * element, GstPad * pad,
} }
static gboolean static gboolean
proxy_autoplug_query_signal (GstElement * element, GstPad * pad, proxy_autoplug_query_signal (GstElement * decodebin, GstPad * pad,
GstQuery * query, GstURIDecodeBin * dec) GstElement * element, GstQuery * query, GstURIDecodeBin * dec)
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
g_signal_emit (dec, g_signal_emit (dec,
gst_uri_decode_bin_signals[SIGNAL_AUTOPLUG_QUERY], 0, pad, query, &ret); gst_uri_decode_bin_signals[SIGNAL_AUTOPLUG_QUERY], 0, pad, element, query,
&ret);
GST_DEBUG_OBJECT (dec, "autoplug-query returned %d", ret); GST_DEBUG_OBJECT (dec, "autoplug-query returned %d", ret);
@ -1726,7 +1727,7 @@ proxy_autoplug_query_signal (GstElement * element, GstPad * pad,
} }
static void static void
proxy_drained_signal (GstElement * element, GstURIDecodeBin * dec) proxy_drained_signal (GstElement * decodebin, GstURIDecodeBin * dec)
{ {
GST_DEBUG_OBJECT (dec, "drained signaled"); GST_DEBUG_OBJECT (dec, "drained signaled");