pad: _get_caps() -> _query_caps()

This commit is contained in:
Wim Taymans 2011-11-15 16:46:37 +01:00
parent 28b14092d2
commit d805f0f034
13 changed files with 40 additions and 41 deletions

View file

@ -1589,8 +1589,7 @@ gst_pad_unlink
gst_pad_is_linked
gst_pad_can_link
gst_pad_get_caps
gst_pad_get_caps_reffed
gst_pad_query_caps
gst_pad_get_allowed_caps
gst_pad_get_current_caps
gst_pad_get_pad_template_caps

View file

@ -344,7 +344,7 @@ cb_newpad (GstElement *element,
{
GstCaps *caps;
caps = gst_pad_get_caps (pad, NULL);
caps = gst_pad_query_caps (pad, NULL);
try_to_plug (pad, caps);
gst_caps_unref (caps);
}
@ -389,7 +389,7 @@ close_link (GstPad *srcpad,
switch (templ->presence) {
case GST_PAD_ALWAYS: {
GstPad *pad = gst_element_get_static_pad (sinkelement, templ->name_template);
GstCaps *caps = gst_pad_get_caps (pad, NULL);
GstCaps *caps = gst_pad_query_caps (pad, NULL);
/* link */
try_to_plug (pad, caps);
@ -436,7 +436,7 @@ try_to_plug (GstPad *pad,
}
/* can it link to the audiopad? */
audiocaps = gst_pad_get_caps (gst_element_get_static_pad (audiosink, "sink"),
audiocaps = gst_pad_query_caps (gst_element_get_static_pad (audiosink, "sink"),
NULL);
res = gst_caps_intersect (caps, audiocaps);
if (res && !gst_caps_is_empty (res)) {

View file

@ -253,7 +253,7 @@ cb_newpad (GstElement *decodebin,
}
/* check media type */
caps = gst_pad_get_caps (pad, NULL);
caps = gst_pad_query_caps (pad, NULL);
str = gst_caps_get_structure (caps, 0);
if (!g_strrstr (gst_structure_get_name (str), "audio")) {
gst_caps_unref (caps);

View file

@ -36,7 +36,7 @@
* gst_pad_new_from_template().
*
* Pads have #GstCaps attached to it to describe the media type they are
* capable of dealing with. gst_pad_get_caps() and gst_pad_set_caps() are
* capable of dealing with. gst_pad_query_caps() and gst_pad_set_caps() are
* used to manipulate the caps of the pads.
* Pads created from a pad template cannot set capabilities that are
* incompatible with the pad template capabilities.
@ -1643,10 +1643,10 @@ gst_pad_link_check_compatible_unlocked (GstPad * src, GstPad * sink,
/* Doing the expensive caps checking takes priority over only checking the template caps */
if (flags & GST_PAD_LINK_CHECK_CAPS) {
GST_OBJECT_UNLOCK (src);
srccaps = gst_pad_get_caps (src, NULL);
srccaps = gst_pad_query_caps (src, NULL);
GST_OBJECT_LOCK (src);
GST_OBJECT_UNLOCK (sink);
sinkcaps = gst_pad_get_caps (sink, NULL);
sinkcaps = gst_pad_query_caps (sink, NULL);
GST_OBJECT_LOCK (sink);
} else {
/* If one of the two pads doesn't have a template, consider the intersection
@ -2107,14 +2107,14 @@ gst_pad_get_current_caps (GstPad * pad)
}
/**
* gst_pad_get_caps:
* gst_pad_query_caps:
* @pad: a #GstPad to get the capabilities of.
* @filter: suggested #GstCaps.
*
* Gets the capabilities this pad can produce or consume.
* Note that this method doesn't necessarily return the caps set by
* gst_pad_set_caps() - use gst_pad_get_current_caps() for that instead.
* gst_pad_get_caps returns all possible caps a pad can operate with, using
* gst_pad_query_caps returns all possible caps a pad can operate with, using
* the pad's CAPS query function, If the query fails, this function will return
* @filter, if not #NULL, otherwise ANY.
*
@ -2130,7 +2130,7 @@ gst_pad_get_current_caps (GstPad * pad)
* Returns: (transfer full): the caps of the pad with incremented ref-count.
*/
GstCaps *
gst_pad_get_caps (GstPad * pad, GstCaps * filter)
gst_pad_query_caps (GstPad * pad, GstCaps * filter)
{
GstCaps *result = NULL;
GstQuery *query;
@ -2162,7 +2162,7 @@ gst_pad_get_caps (GstPad * pad, GstCaps * filter)
* @filter: a #GstCaps filter.
*
* Gets the capabilities of the peer connected to this pad. Similar to
* gst_pad_get_caps().
* gst_pad_query_caps().
*
* When called on srcpads @filter contains the caps that
* upstream could produce in the order preferred by upstream. When
@ -2462,7 +2462,7 @@ gst_pad_get_peer (GstPad * pad)
* @pad and its peer.
*
* The allowed capabilities is calculated as the intersection of the results of
* calling gst_pad_get_caps() on @pad and its peer. The caller owns a reference
* calling gst_pad_query_caps() on @pad and its peer. The caller owns a reference
* on the resulting caps.
*
* Returns: (transfer full): the allowed #GstCaps of the pad link. Unref the
@ -2490,9 +2490,9 @@ gst_pad_get_allowed_caps (GstPad * pad)
gst_object_ref (peer);
GST_OBJECT_UNLOCK (pad);
mycaps = gst_pad_get_caps (pad, NULL);
mycaps = gst_pad_query_caps (pad, NULL);
peercaps = gst_pad_get_caps (peer, NULL);
peercaps = gst_pad_query_caps (peer, NULL);
gst_object_unref (peer);
caps = gst_caps_intersect (mycaps, peercaps);
@ -2790,7 +2790,7 @@ gst_pad_query_accept_caps_default (GstPad * pad, GstQuery * query)
}
}
allowed = gst_pad_get_caps (pad, NULL);
allowed = gst_pad_query_caps (pad, NULL);
gst_query_parse_accept_caps (query, &caps);
if (allowed) {

View file

@ -178,7 +178,7 @@ GQuark gst_flow_to_quark (GstFlowReturn ret);
* their template caps. This is much faster than @GST_PAD_LINK_CHECK_CAPS, but
* would be unsafe e.g. if one pad has %GST_CAPS_ANY.
* @GST_PAD_LINK_CHECK_CAPS: Check if the pads are compatible by comparing the
* caps returned by gst_pad_get_caps().
* caps returned by gst_pad_query_caps().
*
* The amount of checking to be done when linking pads. @GST_PAD_LINK_CHECK_CAPS
* and @GST_PAD_LINK_CHECK_TEMPLATE_CAPS are mutually exclusive. If both are
@ -834,7 +834,7 @@ GstCaps* gst_pad_get_pad_template_caps (GstPad *pad);
/* capsnego function for linked/unlinked pads */
GstCaps * gst_pad_get_current_caps (GstPad * pad);
gboolean gst_pad_has_current_caps (GstPad * pad);
GstCaps * gst_pad_get_caps (GstPad * pad, GstCaps *filter);
GstCaps * gst_pad_query_caps (GstPad * pad, GstCaps *filter);
gboolean gst_pad_accept_caps (GstPad * pad, GstCaps *caps);
gboolean gst_pad_set_caps (GstPad * pad, GstCaps *caps);

View file

@ -1140,7 +1140,7 @@ gst_element_get_compatible_pad (GstElement * element, GstPad * pad,
gboolean compatible;
/* Now check if the two pads' caps are compatible */
temp = gst_pad_get_caps (pad, NULL);
temp = gst_pad_query_caps (pad, NULL);
if (caps) {
intersection = gst_caps_intersect (temp, caps);
gst_caps_unref (temp);
@ -1148,7 +1148,7 @@ gst_element_get_compatible_pad (GstElement * element, GstPad * pad,
intersection = temp;
}
temp = gst_pad_get_caps (current, NULL);
temp = gst_pad_query_caps (current, NULL);
compatible = gst_caps_can_intersect (temp, intersection);
gst_caps_unref (temp);
gst_caps_unref (intersection);
@ -1198,7 +1198,7 @@ gst_element_get_compatible_pad (GstElement * element, GstPad * pad,
/* try to create a new one */
/* requesting is a little crazy, we need a template. Let's create one */
/* FIXME: why not gst_pad_get_pad_template (pad); */
templcaps = gst_pad_get_caps (pad, NULL);
templcaps = gst_pad_query_caps (pad, NULL);
templ = gst_pad_template_new ((gchar *) GST_PAD_NAME (pad),
GST_PAD_DIRECTION (pad), GST_PAD_ALWAYS, templcaps);
gst_caps_unref (templcaps);
@ -2798,7 +2798,7 @@ query_caps_func (GstPad * pad, QueryCapsData * data)
* @pad: a #GstPad to proxy.
* @query: a CAPS #GstQuery.
*
* Calls gst_pad_get_caps() for all internally linked pads fof @pad and returns
* Calls gst_pad_query_caps() for all internally linked pads fof @pad and returns
* the intersection of the results.
*
* This function is useful as a default caps query function for an element

View file

@ -891,12 +891,12 @@ void gst_element_class_install_std_props (GstElementClass * k
/* pad functions */
void gst_pad_use_fixed_caps (GstPad *pad);
gboolean gst_pad_proxy_query_accept_caps (GstPad *pad, GstQuery *query);
gboolean gst_pad_proxy_query_caps (GstPad *pad, GstQuery *query);
GstElement* gst_pad_get_parent_element (GstPad *pad);
/* util query functions */
gboolean gst_pad_proxy_query_accept_caps (GstPad *pad, GstQuery *query);
gboolean gst_pad_proxy_query_caps (GstPad *pad, GstQuery *query);
gboolean gst_pad_query_position (GstPad *pad, GstFormat format, gint64 *cur);
gboolean gst_pad_query_duration (GstPad *pad, GstFormat format, gint64 *duration);
gboolean gst_pad_query_convert (GstPad *pad, GstFormat src_format, gint64 src_val,

View file

@ -2750,7 +2750,7 @@ gst_base_src_default_negotiate (GstBaseSrc * basesrc)
gboolean result = FALSE;
/* first see what is possible on our source pad */
thiscaps = gst_pad_get_caps (GST_BASE_SRC_PAD (basesrc), NULL);
thiscaps = gst_pad_query_caps (GST_BASE_SRC_PAD (basesrc), NULL);
GST_DEBUG_OBJECT (basesrc, "caps of src: %" GST_PTR_FORMAT, thiscaps);
/* nothing or anything is allowed, we're done */
if (thiscaps == NULL || gst_caps_is_any (thiscaps))

View file

@ -997,7 +997,7 @@ gst_base_transform_find_transform (GstBaseTransform * trans, GstPad * pad,
GST_DEBUG_OBJECT (trans,
"Checking peer caps with filter %" GST_PTR_FORMAT, othercaps);
peercaps = gst_pad_get_caps (otherpeer, othercaps);
peercaps = gst_pad_query_caps (otherpeer, othercaps);
GST_DEBUG_OBJECT (trans, "Resulted in %" GST_PTR_FORMAT, peercaps);
templ_caps = gst_pad_get_pad_template_caps (otherpad);
@ -1126,12 +1126,12 @@ gst_base_transform_acceptcaps_default (GstBaseTransform * trans,
/* get all the formats we can handle on this pad */
if (direction == GST_PAD_SRC)
allowed = gst_pad_get_caps (trans->srcpad, NULL);
allowed = gst_pad_query_caps (trans->srcpad, NULL);
else
allowed = gst_pad_get_caps (trans->sinkpad, NULL);
allowed = gst_pad_query_caps (trans->sinkpad, NULL);
if (!allowed) {
GST_DEBUG_OBJECT (trans, "gst_pad_get_caps() failed");
GST_DEBUG_OBJECT (trans, "gst_pad_query_caps() failed");
goto no_transform_possible;
}

View file

@ -397,7 +397,7 @@ GST_START_TEST (test_output_selector_no_srcpad_negotiation);
* setcaps should accept any caps when there are no srcpads */
g_object_set (sel, "pad-negotiation-mode", i, NULL);
caps = gst_pad_get_caps (pad, NULL);
caps = gst_pad_query_caps (pad, NULL);
fail_unless (gst_caps_is_any (caps));
gst_caps_unref (caps);

View file

@ -70,7 +70,7 @@ GST_START_TEST (test_valve_basic)
fail_unless (gst_pad_push (src, gst_buffer_new ()) == GST_FLOW_OK);
fail_unless (gst_pad_push (src, gst_buffer_new ()) == GST_FLOW_OK);
fail_unless (g_list_length (buffers) == 2);
caps = gst_pad_get_caps (src, NULL);
caps = gst_pad_query_caps (src, NULL);
templ_caps = gst_pad_get_pad_template_caps (src);
fail_unless (caps && gst_caps_is_equal (caps, templ_caps));
gst_caps_unref (templ_caps);
@ -85,7 +85,7 @@ GST_START_TEST (test_valve_basic)
fail_unless (gst_pad_push (src, gst_buffer_new ()) == GST_FLOW_OK);
fail_unless (gst_pad_push (src, gst_buffer_new ()) == GST_FLOW_OK);
fail_unless (buffers == NULL);
caps = gst_pad_get_caps (src, NULL);
caps = gst_pad_query_caps (src, NULL);
templ_caps = gst_pad_get_pad_template_caps (src);
fail_unless (caps && gst_caps_is_equal (caps, templ_caps));
gst_caps_unref (templ_caps);

View file

@ -190,7 +190,7 @@ GST_START_TEST (test_ghost_pads_notarget)
/* check caps, untargetted pad should return ANY or the padtemplate caps
* when it was created from a template */
caps = gst_pad_get_caps (srcpad, NULL);
caps = gst_pad_query_caps (srcpad, NULL);
fail_unless (gst_caps_is_any (caps));
gst_caps_unref (caps);
@ -602,7 +602,7 @@ GST_START_TEST (test_ghost_pads_new_from_template)
fail_unless (GST_PAD_PAD_TEMPLATE (ghostpad) == ghosttempl);
/* check ghostpad caps are from the sinkpad */
newcaps = gst_pad_get_caps (ghostpad, NULL);
newcaps = gst_pad_query_caps (ghostpad, NULL);
fail_unless (newcaps != NULL);
fail_unless (gst_caps_is_equal (newcaps, padcaps));
gst_caps_unref (newcaps);
@ -645,7 +645,7 @@ GST_START_TEST (test_ghost_pads_new_no_target_from_template)
fail_unless (GST_PAD_PAD_TEMPLATE (ghostpad) == ghosttempl);
/* check ghostpad caps are from the ghostpad template */
newcaps = gst_pad_get_caps (ghostpad, NULL);
newcaps = gst_pad_query_caps (ghostpad, NULL);
fail_unless (newcaps != NULL);
fail_unless (gst_caps_is_equal (newcaps, ghostcaps));
gst_caps_unref (newcaps);
@ -653,7 +653,7 @@ GST_START_TEST (test_ghost_pads_new_no_target_from_template)
fail_unless (gst_ghost_pad_set_target ((GstGhostPad *) ghostpad, sinkpad));
/* check ghostpad caps are now from the target pad */
newcaps = gst_pad_get_caps (ghostpad, NULL);
newcaps = gst_pad_query_caps (ghostpad, NULL);
fail_unless (newcaps != NULL);
fail_unless (gst_caps_is_equal (newcaps, padcaps));
gst_caps_unref (newcaps);

View file

@ -1000,7 +1000,7 @@ GST_START_TEST (test_pad_proxy_query_caps_aggregation)
gst_element_set_state (tee, GST_STATE_PAUSED);
/* by default, ANY caps should intersect to ANY */
caps = gst_pad_get_caps (tee_sink, NULL);
caps = gst_pad_query_caps (tee_sink, NULL);
GST_INFO ("got caps: %" GST_PTR_FORMAT, caps);
fail_unless (caps != NULL);
fail_unless (gst_caps_is_any (caps));
@ -1017,7 +1017,7 @@ GST_START_TEST (test_pad_proxy_query_caps_aggregation)
gst_pad_use_fixed_caps (sink2_sink);
gst_caps_unref (caps);
caps = gst_pad_get_caps (tee_sink, NULL);
caps = gst_pad_query_caps (tee_sink, NULL);
GST_INFO ("got caps: %" GST_PTR_FORMAT, caps);
fail_unless (caps != NULL);
fail_unless (gst_caps_is_empty (caps));
@ -1029,7 +1029,7 @@ GST_START_TEST (test_pad_proxy_query_caps_aggregation)
gst_pad_use_fixed_caps (sink2_sink);
gst_caps_unref (caps);
caps = gst_pad_get_caps (tee_sink, NULL);
caps = gst_pad_query_caps (tee_sink, NULL);
GST_INFO ("got caps: %" GST_PTR_FORMAT, caps);
fail_unless (caps != NULL);
fail_if (gst_caps_is_empty (caps));