elements: Update for negotiation related API changes

The filter caps are only forwarded and returned instead
of ANY caps in the core elements because they don't do
anything caps specific.
This commit is contained in:
Sebastian Dröge 2011-05-11 15:38:09 +02:00
parent bdf9022861
commit 43e165c93c
8 changed files with 47 additions and 43 deletions

View file

@ -76,7 +76,7 @@ static void gst_capsfilter_get_property (GObject * object, guint prop_id,
static void gst_capsfilter_dispose (GObject * object);
static GstCaps *gst_capsfilter_transform_caps (GstBaseTransform * base,
GstPadDirection direction, GstCaps * caps);
GstPadDirection direction, GstCaps * caps, GstCaps * filter);
static gboolean gst_capsfilter_accept_caps (GstBaseTransform * base,
GstPadDirection direction, GstCaps * caps);
static GstFlowReturn gst_capsfilter_transform_ip (GstBaseTransform * base,
@ -249,18 +249,22 @@ gst_capsfilter_dispose (GObject * object)
static GstCaps *
gst_capsfilter_transform_caps (GstBaseTransform * base,
GstPadDirection direction, GstCaps * caps)
GstPadDirection direction, GstCaps * caps, GstCaps * filter)
{
GstCapsFilter *capsfilter = GST_CAPSFILTER (base);
GstCaps *ret, *filter_caps;
GstCaps *ret, *filter_caps, *tmp;
GST_OBJECT_LOCK (capsfilter);
filter_caps = gst_caps_ref (capsfilter->filter_caps);
GST_OBJECT_UNLOCK (capsfilter);
ret = gst_caps_intersect (caps, filter_caps);
tmp = gst_caps_intersect_full (filter, filter_caps, GST_CAPS_INTERSECT_FIRST);
ret = gst_caps_intersect_full (tmp, caps, GST_CAPS_INTERSECT_FIRST);
GST_DEBUG_OBJECT (capsfilter, "input: %" GST_PTR_FORMAT, caps);
GST_DEBUG_OBJECT (capsfilter, "filter: %" GST_PTR_FORMAT, filter_caps);
GST_DEBUG_OBJECT (capsfilter, "filter: %" GST_PTR_FORMAT, filter);
GST_DEBUG_OBJECT (capsfilter, "caps filter: %" GST_PTR_FORMAT,
filter_caps);
GST_DEBUG_OBJECT (capsfilter, "intersect: %" GST_PTR_FORMAT, ret);
gst_caps_unref (filter_caps);

View file

@ -118,7 +118,7 @@ static void gst_funnel_release_pad (GstElement * element, GstPad * pad);
static GstFlowReturn gst_funnel_sink_chain (GstPad * pad, GstBuffer * buffer);
static gboolean gst_funnel_sink_event (GstPad * pad, GstEvent * event);
static GstCaps *gst_funnel_sink_getcaps (GstPad * pad);
static GstCaps *gst_funnel_sink_getcaps (GstPad * pad, GstCaps * filter);
static gboolean gst_funnel_src_event (GstPad * pad, GstEvent * event);
@ -212,7 +212,7 @@ gst_funnel_release_pad (GstElement * element, GstPad * pad)
}
static GstCaps *
gst_funnel_sink_getcaps (GstPad * pad)
gst_funnel_sink_getcaps (GstPad * pad, GstCaps * filter)
{
GstFunnel *funnel = GST_FUNNEL (gst_pad_get_parent (pad));
GstCaps *caps;
@ -220,9 +220,9 @@ gst_funnel_sink_getcaps (GstPad * pad)
if (G_UNLIKELY (funnel == NULL))
return gst_caps_new_any ();
caps = gst_pad_peer_get_caps_reffed (funnel->srcpad);
caps = gst_pad_peer_get_caps (funnel->srcpad, filter);
if (caps == NULL)
caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
caps = (filter ? gst_caps_ref (filter) : gst_caps_new_any ());
gst_object_unref (funnel);

View file

@ -173,7 +173,7 @@ static void gst_selector_pad_set_property (GObject * object,
static gint64 gst_selector_pad_get_running_time (GstSelectorPad * pad);
static void gst_selector_pad_reset (GstSelectorPad * pad);
static gboolean gst_selector_pad_event (GstPad * pad, GstEvent * event);
static GstCaps *gst_selector_pad_getcaps (GstPad * pad);
static GstCaps *gst_selector_pad_getcaps (GstPad * pad, GstCaps * filter);
static gboolean gst_selector_pad_acceptcaps (GstPad * pad, GstCaps * caps);
static GstIterator *gst_selector_pad_iterate_linked_pads (GstPad * pad);
static GstFlowReturn gst_selector_pad_chain (GstPad * pad, GstBuffer * buf);
@ -471,19 +471,19 @@ gst_selector_pad_event (GstPad * pad, GstEvent * event)
}
static GstCaps *
gst_selector_pad_getcaps (GstPad * pad)
gst_selector_pad_getcaps (GstPad * pad, GstCaps * filter)
{
GstInputSelector *sel;
GstCaps *caps;
sel = GST_INPUT_SELECTOR (gst_pad_get_parent (pad));
if (G_UNLIKELY (sel == NULL))
return gst_caps_new_any ();
return (filter ? gst_caps_ref (filter) : gst_caps_new_any ());
GST_DEBUG_OBJECT (sel, "Getting caps of srcpad peer");
caps = gst_pad_peer_get_caps_reffed (sel->srcpad);
caps = gst_pad_peer_get_caps (sel->srcpad, filter);
if (caps == NULL)
caps = gst_caps_new_any ();
caps = (filter ? gst_caps_ref (filter) : gst_caps_new_any ());
gst_object_unref (sel);
@ -661,7 +661,7 @@ static void gst_input_selector_release_pad (GstElement * element, GstPad * pad);
static GstStateChangeReturn gst_input_selector_change_state (GstElement *
element, GstStateChange transition);
static GstCaps *gst_input_selector_getcaps (GstPad * pad);
static GstCaps *gst_input_selector_getcaps (GstPad * pad, GstCaps * filter);
static gboolean gst_input_selector_event (GstPad * pad, GstEvent * event);
static gboolean gst_input_selector_query (GstPad * pad, GstQuery ** query);
static gint64 gst_input_selector_block (GstInputSelector * self);
@ -1162,7 +1162,7 @@ gst_input_selector_query (GstPad * pad, GstQuery ** query)
}
static GstCaps *
gst_input_selector_getcaps (GstPad * pad)
gst_input_selector_getcaps (GstPad * pad, GstCaps * filter)
{
GstPad *otherpad;
GstInputSelector *sel;
@ -1170,20 +1170,20 @@ gst_input_selector_getcaps (GstPad * pad)
sel = GST_INPUT_SELECTOR (gst_pad_get_parent (pad));
if (G_UNLIKELY (sel == NULL))
return gst_caps_new_any ();
return (filter ? gst_caps_ref (filter) : gst_caps_new_any ());
otherpad = gst_input_selector_get_linked_pad (sel, pad, FALSE);
if (!otherpad) {
GST_DEBUG_OBJECT (pad, "Pad not linked, returning ANY");
caps = gst_caps_new_any ();
caps = (filter ? gst_caps_ref (filter) : gst_caps_new_any ());
} else {
GST_DEBUG_OBJECT (pad, "Pad is linked (to %s:%s), returning peer caps",
GST_DEBUG_PAD_NAME (otherpad));
/* if the peer has caps, use those. If the pad is not linked, this function
* returns NULL and we return ANY */
if (!(caps = gst_pad_peer_get_caps_reffed (otherpad)))
caps = gst_caps_new_any ();
if (!(caps = gst_pad_peer_get_caps (otherpad, filter)))
caps = (filter ? gst_caps_ref (filter) : gst_caps_new_any ());
gst_object_unref (otherpad);
}

View file

@ -1390,7 +1390,7 @@ was_eos:
}
static GstCaps *
gst_multi_queue_getcaps (GstPad * pad)
gst_multi_queue_getcaps (GstPad * pad, GstCaps * filter)
{
GstSingleQueue *sq = gst_pad_get_element_private (pad);
GstPad *otherpad;
@ -1400,9 +1400,9 @@ gst_multi_queue_getcaps (GstPad * pad)
GST_LOG_OBJECT (otherpad, "Getting caps from the peer of this pad");
result = gst_pad_peer_get_caps (otherpad);
result = gst_pad_peer_get_caps (otherpad, filter);
if (result == NULL)
result = gst_caps_new_any ();
result = (filter ? gst_caps_ref (filter) : gst_caps_new_any ());
return result;
}

View file

@ -281,14 +281,14 @@ gst_output_selector_get_property (GObject * object, guint prop_id,
}
static GstCaps *
gst_output_selector_sink_getcaps (GstPad * pad)
gst_output_selector_sink_getcaps (GstPad * pad, GstCaps * filter)
{
GstOutputSelector *sel = GST_OUTPUT_SELECTOR (gst_pad_get_parent (pad));
GstPad *active = NULL;
GstCaps *caps = NULL;
if (G_UNLIKELY (sel == NULL))
return gst_caps_new_any ();
return (filter ? gst_caps_ref (filter) : gst_caps_new_any ());
GST_OBJECT_LOCK (sel);
if (sel->pending_srcpad)
@ -298,11 +298,11 @@ gst_output_selector_sink_getcaps (GstPad * pad)
GST_OBJECT_UNLOCK (sel);
if (active) {
caps = gst_pad_peer_get_caps_reffed (active);
caps = gst_pad_peer_get_caps (active, filter);
gst_object_unref (active);
}
if (caps == NULL) {
caps = gst_caps_new_any ();
caps = (filter ? gst_caps_ref (filter) : gst_caps_new_any ());
}
gst_object_unref (sel);

View file

@ -202,7 +202,7 @@ static gboolean gst_queue_handle_src_event (GstPad * pad, GstEvent * event);
static gboolean gst_queue_handle_src_query (GstPad * pad, GstQuery ** query);
static gboolean gst_queue_acceptcaps (GstPad * pad, GstCaps * caps);
static GstCaps *gst_queue_getcaps (GstPad * pad);
static GstCaps *gst_queue_getcaps (GstPad * pad, GstCaps * filter);
static GstPadLinkReturn gst_queue_link_sink (GstPad * pad, GstPad * peer);
static GstPadLinkReturn gst_queue_link_src (GstPad * pad, GstPad * peer);
static void gst_queue_locked_flush (GstQueue * queue);
@ -475,7 +475,7 @@ gst_queue_acceptcaps (GstPad * pad, GstCaps * caps)
}
static GstCaps *
gst_queue_getcaps (GstPad * pad)
gst_queue_getcaps (GstPad * pad, GstCaps * filter)
{
GstQueue *queue;
GstPad *otherpad;
@ -483,12 +483,12 @@ gst_queue_getcaps (GstPad * pad)
queue = GST_QUEUE (gst_pad_get_parent (pad));
if (G_UNLIKELY (queue == NULL))
return gst_caps_new_any ();
return (filter ? gst_caps_ref (filter) : gst_caps_new_any ());
otherpad = (pad == queue->srcpad ? queue->sinkpad : queue->srcpad);
result = gst_pad_peer_get_caps (otherpad);
result = gst_pad_peer_get_caps (otherpad, filter);
if (result == NULL)
result = gst_caps_new_any ();
result = (filter ? gst_caps_ref (filter) : gst_caps_new_any ());
gst_object_unref (queue);

View file

@ -234,7 +234,7 @@ static gboolean gst_queue2_handle_src_query (GstPad * pad, GstQuery ** query);
static gboolean gst_queue2_handle_query (GstElement * element,
GstQuery ** query);
static GstCaps *gst_queue2_getcaps (GstPad * pad);
static GstCaps *gst_queue2_getcaps (GstPad * pad, GstCaps * filter);
static gboolean gst_queue2_acceptcaps (GstPad * pad, GstCaps * caps);
static GstFlowReturn gst_queue2_get_range (GstPad * pad, guint64 offset,
@ -630,7 +630,7 @@ gst_queue2_acceptcaps (GstPad * pad, GstCaps * caps)
}
static GstCaps *
gst_queue2_getcaps (GstPad * pad)
gst_queue2_getcaps (GstPad * pad, GstCaps * filter)
{
GstQueue2 *queue;
GstPad *otherpad;
@ -638,12 +638,12 @@ gst_queue2_getcaps (GstPad * pad)
queue = GST_QUEUE2 (gst_pad_get_parent (pad));
if (G_UNLIKELY (queue == NULL))
return gst_caps_new_any ();
return (filter ? gst_caps_ref (filter) : gst_caps_new_any ());
otherpad = (pad == queue->srcpad ? queue->sinkpad : queue->srcpad);
result = gst_pad_peer_get_caps (otherpad);
result = gst_pad_peer_get_caps (otherpad, filter);
if (result == NULL)
result = gst_caps_new_any ();
result = (filter ? gst_caps_ref (filter) : gst_caps_new_any ());
gst_object_unref (queue);
@ -2792,7 +2792,7 @@ gst_queue2_src_activate_pull (GstPad * pad, gboolean active)
result = gst_queue2_open_temp_location_file (queue);
} else if (!queue->ring_buffer) {
queue->ring_buffer = g_malloc (queue->ring_buffer_max_size);
result = !!queue->ring_buffer;
result = ! !queue->ring_buffer;
} else {
result = TRUE;
}

View file

@ -74,7 +74,7 @@ static void gst_valve_get_property (GObject * object,
static gboolean gst_valve_event (GstPad * pad, GstEvent * event);
static GstFlowReturn gst_valve_chain (GstPad * pad, GstBuffer * buffer);
static GstCaps *gst_valve_getcaps (GstPad * pad);
static GstCaps *gst_valve_getcaps (GstPad * pad, GstCaps * filter);
#define _do_init \
GST_DEBUG_CATEGORY_INIT (valve_debug, "valve", 0, "Valve");
@ -214,18 +214,18 @@ gst_valve_event (GstPad * pad, GstEvent * event)
}
static GstCaps *
gst_valve_getcaps (GstPad * pad)
gst_valve_getcaps (GstPad * pad, GstCaps * filter)
{
GstValve *valve = GST_VALVE (gst_pad_get_parent (pad));
GstCaps *caps;
if (pad == valve->sinkpad)
caps = gst_pad_peer_get_caps (valve->srcpad);
caps = gst_pad_peer_get_caps (valve->srcpad, filter);
else
caps = gst_pad_peer_get_caps (valve->sinkpad);
caps = gst_pad_peer_get_caps (valve->sinkpad, filter);
if (caps == NULL)
caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
caps = (filter ? gst_caps_ref (filter) : gst_caps_new_any ());
gst_object_unref (valve);