diff --git a/docs/gst/gstreamer-sections.txt b/docs/gst/gstreamer-sections.txt index 6f3b82da646981d4482d23ad3e7e5dce71f02b37..482663bcb0f521c4916c85aa4814d97856ac3a14 100644 --- a/docs/gst/gstreamer-sections.txt +++ b/docs/gst/gstreamer-sections.txt @@ -734,7 +734,6 @@ gst_element_message_full gst_element_post_message -gst_element_get_query_types gst_element_query gst_element_query_convert gst_element_query_position @@ -1044,7 +1043,6 @@ gst_ghost_pad_internal_activate_pull_default gst_proxy_pad_get_internal -gst_proxy_pad_query_type_default gst_proxy_pad_event_default gst_proxy_pad_query_default gst_proxy_pad_iterate_internal_links_default @@ -1052,8 +1050,6 @@ gst_proxy_pad_chain_default gst_proxy_pad_chain_list_default gst_proxy_pad_getrange_default gst_proxy_pad_getcaps_default -gst_proxy_pad_acceptcaps_default -gst_proxy_pad_fixatecaps_default gst_proxy_pad_unlink_default GstGhostPadClass @@ -1616,7 +1612,6 @@ GstPadActivateMode GstPadProbeReturn GstPadProbeType GST_PAD_PROBE_TYPE_BLOCKING -GST_PAD_PROBE_TYPE_DATA GST_PAD_PROBE_TYPE_SCHEDULING @@ -1684,17 +1679,11 @@ gst_pad_set_unlink_function GstPadUnlinkFunction gst_pad_accept_caps -gst_pad_set_acceptcaps_function -GstPadAcceptCapsFunction gst_pad_set_getcaps_function GstPadGetCapsFunction gst_pad_proxy_getcaps -gst_pad_fixate_caps -gst_pad_set_fixatecaps_function -GstPadFixateCapsFunction - gst_pad_peer_accept_caps gst_pad_set_activate_function @@ -1727,11 +1716,6 @@ gst_pad_query_peer_duration gst_pad_query_peer_convert gst_pad_set_query_function GstPadQueryFunction -gst_pad_set_query_type_function -GstPadQueryTypeFunction -gst_pad_get_query_types -gst_pad_get_query_types_default - gst_pad_set_iterate_internal_links_function GstPadIterIntLinkFunction gst_pad_iterate_internal_links @@ -1754,10 +1738,8 @@ gst_pad_set_active GST_PAD_GET_STREAM_LOCK GST_PAD_STREAM_LOCK -GST_PAD_STREAM_LOCK_FULL GST_PAD_STREAM_TRYLOCK GST_PAD_STREAM_UNLOCK -GST_PAD_STREAM_UNLOCK_FULL GstPadClass diff --git a/gst/gstghostpad.c b/gst/gstghostpad.c index f1489c2eddf152111869c22b672e416a6a6e7666..16a513bdbb7e1954c3dd9413f235004a3bf8a1d2 100644 --- a/gst/gstghostpad.c +++ b/gst/gstghostpad.c @@ -369,39 +369,6 @@ gst_proxy_pad_acceptcaps_default (GstPad * pad, GstCaps * caps) return res; } -/** - * gst_proxy_pad_fixatecaps_default: - * @pad: a #GstPad to fixate - * @caps: the #GstCaps to fixate - * - * Invoke the default fixatecaps function of the proxy pad. - * - * Since: 0.10.36 - */ -void -gst_proxy_pad_fixatecaps_default (GstPad * pad, GstCaps * caps) -{ - GstPad *target; - - g_return_if_fail (GST_IS_PROXY_PAD (pad)); - g_return_if_fail (GST_IS_CAPS (caps)); - - if (!(target = gst_proxy_pad_get_target (pad))) - goto no_target; - - gst_pad_fixate_caps (target, caps); - gst_object_unref (target); - - return; - - /* ERRORS */ -no_target: - { - GST_DEBUG_OBJECT (pad, "no target"); - return; - } -} - static GstPad * gst_proxy_pad_get_target (GstPad * pad) { @@ -472,7 +439,6 @@ gst_proxy_pad_class_init (GstProxyPadClass * klass) GST_DEBUG_REGISTER_FUNCPTR (gst_proxy_pad_iterate_internal_links_default); GST_DEBUG_REGISTER_FUNCPTR (gst_proxy_pad_getcaps_default); GST_DEBUG_REGISTER_FUNCPTR (gst_proxy_pad_acceptcaps_default); - GST_DEBUG_REGISTER_FUNCPTR (gst_proxy_pad_fixatecaps_default); GST_DEBUG_REGISTER_FUNCPTR (gst_proxy_pad_unlink_default); GST_DEBUG_REGISTER_FUNCPTR (gst_proxy_pad_chain_default); GST_DEBUG_REGISTER_FUNCPTR (gst_proxy_pad_chain_list_default); @@ -493,7 +459,6 @@ gst_proxy_pad_init (GstProxyPad * ppad) gst_proxy_pad_iterate_internal_links_default); gst_pad_set_getcaps_function (pad, gst_proxy_pad_getcaps_default); - gst_pad_set_fixatecaps_function (pad, gst_proxy_pad_fixatecaps_default); gst_pad_set_unlink_function (pad, gst_proxy_pad_unlink_default); } diff --git a/gst/gstghostpad.h b/gst/gstghostpad.h index 6ace9946bcb4a064639322c8aab3487e4f886cbe..2cfc36ac5512e78751168d582e61ada0cb74b526 100644 --- a/gst/gstghostpad.h +++ b/gst/gstghostpad.h @@ -70,7 +70,6 @@ GstFlowReturn gst_proxy_pad_chain_list_default (GstPad *pad, G GstFlowReturn gst_proxy_pad_getrange_default (GstPad *pad, guint64 offset, guint size, GstBuffer **buffer); GstCaps* gst_proxy_pad_getcaps_default (GstPad *pad, GstCaps * filter); gboolean gst_proxy_pad_acceptcaps_default (GstPad *pad, GstCaps *caps); -void gst_proxy_pad_fixatecaps_default (GstPad *pad, GstCaps *caps); void gst_proxy_pad_unlink_default (GstPad * pad); #define GST_TYPE_GHOST_PAD (gst_ghost_pad_get_type ()) diff --git a/gst/gstpad.c b/gst/gstpad.c index 8ac8d98e5e59c4ad4b81a4970b045369b521e845..2b807630fa4ba3e89f7de6685bf6e78cf6bd5843 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -142,7 +142,6 @@ static void gst_pad_get_property (GObject * object, guint prop_id, static GstCaps *gst_pad_get_caps_unlocked (GstPad * pad, GstCaps * filter); static void gst_pad_set_pad_template (GstPad * pad, GstPadTemplate * templ); static gboolean gst_pad_activate_default (GstPad * pad); -static void gst_pad_fixate_caps_default (GstPad * pad, GstCaps * caps); static GstFlowReturn gst_pad_chain_list_default (GstPad * pad, GstBufferList * list); @@ -302,7 +301,6 @@ gst_pad_class_init (GstPadClass * klass) GST_DEBUG_REGISTER_FUNCPTR (gst_pad_query_default); GST_DEBUG_REGISTER_FUNCPTR (gst_pad_iterate_internal_links_default); GST_DEBUG_REGISTER_FUNCPTR (gst_pad_chain_list_default); - GST_DEBUG_REGISTER_FUNCPTR (gst_pad_fixate_caps_default); } static void @@ -316,7 +314,6 @@ gst_pad_init (GstPad * pad) GST_PAD_EVENTFUNC (pad) = gst_pad_event_default; GST_PAD_QUERYFUNC (pad) = gst_pad_query_default; GST_PAD_ITERINTLINKFUNC (pad) = gst_pad_iterate_internal_links_default; - GST_PAD_FIXATECAPSFUNC (pad) = gst_pad_fixate_caps_default; GST_PAD_CHAINLISTFUNC (pad) = gst_pad_chain_list_default; GST_PAD_SET_FLUSHING (pad); @@ -1542,26 +1539,6 @@ gst_pad_set_getcaps_function (GstPad * pad, GstPadGetCapsFunction getcaps) GST_DEBUG_FUNCPTR_NAME (getcaps)); } -/** - * gst_pad_set_fixatecaps_function: - * @pad: a #GstPad. - * @fixatecaps: the #GstPadFixateCapsFunction to set. - * - * Sets the given fixatecaps function for the pad. The fixatecaps function - * will be called whenever the default values for a GstCaps needs to be - * filled in. - */ -void -gst_pad_set_fixatecaps_function (GstPad * pad, - GstPadFixateCapsFunction fixatecaps) -{ - g_return_if_fail (GST_IS_PAD (pad)); - - GST_PAD_FIXATECAPSFUNC (pad) = fixatecaps; - GST_CAT_DEBUG_OBJECT (GST_CAT_PADS, pad, "fixatecapsfunc set to %s", - GST_DEBUG_FUNCPTR_NAME (fixatecaps)); -} - /** * gst_pad_unlink: * @srcpad: the source #GstPad to unlink. @@ -2389,40 +2366,6 @@ no_peer: } } -static void -gst_pad_fixate_caps_default (GstPad * pad, GstCaps * caps) -{ - /* default fixation */ - gst_caps_fixate (caps); -} - -/** - * gst_pad_fixate_caps: - * @pad: a #GstPad to fixate - * @caps: the #GstCaps to fixate - * - * Fixate a caps on the given pad. Modifies the caps in place, so you should - * make sure that the caps are actually writable (see gst_caps_make_writable()). - */ -void -gst_pad_fixate_caps (GstPad * pad, GstCaps * caps) -{ - GstPadFixateCapsFunction fixatefunc; - - g_return_if_fail (GST_IS_PAD (pad)); - g_return_if_fail (caps != NULL); - g_return_if_fail (!gst_caps_is_empty (caps)); - g_return_if_fail (!gst_caps_is_any (caps)); - - if (gst_caps_is_fixed (caps) || gst_caps_is_any (caps)) - return; - - g_return_if_fail (gst_caps_is_writable (caps)); - - if (G_LIKELY ((fixatefunc = GST_PAD_FIXATECAPSFUNC (pad)))) - fixatefunc (pad, caps); -} - /** * gst_pad_accept_caps: * @pad: a #GstPad to check diff --git a/gst/gstpad.h b/gst/gstpad.h index 5670196dfddf391426ff134e10d3bdd6450a928a..9fcc91ba232f5c5f467eb96b3d98aa7590bea981 100644 --- a/gst/gstpad.h +++ b/gst/gstpad.h @@ -418,18 +418,6 @@ typedef void (*GstPadUnlinkFunction) (GstPad *pad); */ typedef GstCaps* (*GstPadGetCapsFunction) (GstPad *pad, GstCaps *filter); -/** - * GstPadFixateCapsFunction: - * @pad: a #GstPad - * @caps: the #GstCaps to fixate - * - * Given possibly unfixed caps @caps, let @pad use its default preferred - * format to make a fixed caps. @caps should be writable. By default this - * function will pick the first value of any ranges or lists in the caps but - * elements can override this function to perform other behaviour. - */ -typedef void (*GstPadFixateCapsFunction) (GstPad *pad, GstCaps *caps); - /* misc */ /** * GstPadForwardFunction: @@ -614,7 +602,6 @@ typedef enum { * @block_cond: conditional to signal pad block * @probes: installed probes * @getcapsfunc: function to get caps of the pad - * @fixatecapsfunc: function to fixate caps * @mode: current activation mode of the pad * @activatefunc: pad activation function * @activatepushfunc: function to activate/deactivate pad in push mode @@ -655,7 +642,6 @@ struct _GstPad { /* the pad capabilities */ GstPadGetCapsFunction getcapsfunc; - GstPadFixateCapsFunction fixatecapsfunc; GstPadActivateMode mode; GstPadActivateFunction activatefunc; @@ -729,7 +715,6 @@ struct _GstPadClass { #define GST_PAD_UNLINKFUNC(pad) (GST_PAD_CAST(pad)->unlinkfunc) #define GST_PAD_GETCAPSFUNC(pad) (GST_PAD_CAST(pad)->getcapsfunc) -#define GST_PAD_FIXATECAPSFUNC(pad) (GST_PAD_CAST(pad)->fixatecapsfunc) #define GST_PAD_IS_SRC(pad) (GST_PAD_DIRECTION(pad) == GST_PAD_SRC) #define GST_PAD_IS_SINK(pad) (GST_PAD_DIRECTION(pad) == GST_PAD_SINK) @@ -865,7 +850,6 @@ GstPad* gst_pad_get_peer (GstPad *pad); /* capsnego functions */ void gst_pad_set_getcaps_function (GstPad *pad, GstPadGetCapsFunction getcaps); -void gst_pad_set_fixatecaps_function (GstPad *pad, GstPadFixateCapsFunction fixatecaps); GstCaps* gst_pad_get_pad_template_caps (GstPad *pad); @@ -873,7 +857,6 @@ GstCaps* gst_pad_get_pad_template_caps (GstPad *pad); 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); -void gst_pad_fixate_caps (GstPad * pad, GstCaps *caps); gboolean gst_pad_accept_caps (GstPad * pad, GstCaps *caps); gboolean gst_pad_set_caps (GstPad * pad, GstCaps *caps); diff --git a/libs/gst/base/gstbasesink.c b/libs/gst/base/gstbasesink.c index 79dbca1b73826a32ca6eac6fd46f7327ae67ba53..b2c9d170b9f907f8e6d195c83323b93d126e6a47 100644 --- a/libs/gst/base/gstbasesink.c +++ b/libs/gst/base/gstbasesink.c @@ -400,7 +400,8 @@ static gboolean default_sink_query (GstBaseSink * sink, GstQuery * query); static gboolean gst_base_sink_negotiate_pull (GstBaseSink * basesink); static GstCaps *gst_base_sink_pad_getcaps (GstPad * pad, GstCaps * filter); -static void gst_base_sink_pad_fixate (GstPad * pad, GstCaps * caps); +static void gst_base_sink_default_fixate (GstBaseSink * bsink, GstCaps * caps); +static void gst_base_sink_fixate (GstBaseSink * bsink, GstCaps * caps); /* check if an object was too late */ static gboolean gst_base_sink_is_too_late (GstBaseSink * basesink, @@ -543,6 +544,7 @@ gst_base_sink_class_init (GstBaseSinkClass * klass) gstelement_class->send_event = GST_DEBUG_FUNCPTR (gst_base_sink_send_event); gstelement_class->query = GST_DEBUG_FUNCPTR (default_element_query); + klass->fixate = GST_DEBUG_FUNCPTR (gst_base_sink_default_fixate); klass->get_caps = GST_DEBUG_FUNCPTR (gst_base_sink_get_caps); klass->set_caps = GST_DEBUG_FUNCPTR (gst_base_sink_set_caps); klass->get_times = GST_DEBUG_FUNCPTR (gst_base_sink_get_times); @@ -552,7 +554,7 @@ gst_base_sink_class_init (GstBaseSinkClass * klass) /* Registering debug symbols for function pointers */ GST_DEBUG_REGISTER_FUNCPTR (gst_base_sink_pad_getcaps); - GST_DEBUG_REGISTER_FUNCPTR (gst_base_sink_pad_fixate); + GST_DEBUG_REGISTER_FUNCPTR (gst_base_sink_fixate); GST_DEBUG_REGISTER_FUNCPTR (gst_base_sink_pad_activate); GST_DEBUG_REGISTER_FUNCPTR (gst_base_sink_pad_activate_push); GST_DEBUG_REGISTER_FUNCPTR (gst_base_sink_pad_activate_pull); @@ -606,18 +608,21 @@ gst_base_sink_pad_getcaps (GstPad * pad, GstCaps * filter) } static void -gst_base_sink_pad_fixate (GstPad * pad, GstCaps * caps) +gst_base_sink_default_fixate (GstBaseSink * bsink, GstCaps * caps) +{ + GST_DEBUG_OBJECT (bsink, "using default caps fixate function"); + gst_caps_fixate (caps); +} + +static void +gst_base_sink_fixate (GstBaseSink * bsink, GstCaps * caps) { GstBaseSinkClass *bclass; - GstBaseSink *bsink; - bsink = GST_BASE_SINK (gst_pad_get_parent (pad)); bclass = GST_BASE_SINK_GET_CLASS (bsink); if (bclass->fixate) bclass->fixate (bsink, caps); - - gst_object_unref (bsink); } static void @@ -635,7 +640,6 @@ gst_base_sink_init (GstBaseSink * basesink, gpointer g_class) basesink->sinkpad = gst_pad_new_from_template (pad_template, "sink"); gst_pad_set_getcaps_function (basesink->sinkpad, gst_base_sink_pad_getcaps); - gst_pad_set_fixatecaps_function (basesink->sinkpad, gst_base_sink_pad_fixate); gst_pad_set_activate_function (basesink->sinkpad, gst_base_sink_pad_activate); gst_pad_set_activatepush_function (basesink->sinkpad, gst_base_sink_pad_activate_push); @@ -4243,12 +4247,6 @@ gst_base_sink_negotiate_pull (GstBaseSink * basesink) GST_DEBUG_OBJECT (basesink, "allowed caps: %" GST_PTR_FORMAT, caps); - caps = gst_caps_make_writable (caps); - /* get the first (preferred) format */ - gst_caps_truncate (caps); - - GST_DEBUG_OBJECT (basesink, "have caps: %" GST_PTR_FORMAT, caps); - if (gst_caps_is_any (caps)) { GST_DEBUG_OBJECT (basesink, "caps were ANY after fixating, " "allowing pull()"); @@ -4256,8 +4254,9 @@ gst_base_sink_negotiate_pull (GstBaseSink * basesink) pull() without setcaps() */ result = TRUE; } else { + caps = gst_caps_make_writable (caps); /* try to fixate */ - gst_pad_fixate_caps (GST_BASE_SINK_PAD (basesink), caps); + gst_base_sink_fixate (basesink, caps); GST_DEBUG_OBJECT (basesink, "fixated to: %" GST_PTR_FORMAT, caps); if (gst_caps_is_fixed (caps)) { diff --git a/libs/gst/base/gstbasesrc.c b/libs/gst/base/gstbasesrc.c index b2b7f2fa605c8cb6f1ea52def95601068c4527d6..0fc4a6cace0dd6e028a7a9c8dd903310a6faedfd 100644 --- a/libs/gst/base/gstbasesrc.c +++ b/libs/gst/base/gstbasesrc.c @@ -280,7 +280,7 @@ gst_base_src_get_type (void) static GstCaps *gst_base_src_getcaps (GstPad * pad, GstCaps * filter); static void gst_base_src_default_fixate (GstBaseSrc * src, GstCaps * caps); -static void gst_base_src_fixate (GstPad * pad, GstCaps * caps); +static void gst_base_src_fixate (GstBaseSrc * src, GstCaps * caps); static gboolean gst_base_src_is_random_access (GstBaseSrc * src); static gboolean gst_base_src_activate_push (GstPad * pad, gboolean active); @@ -368,12 +368,12 @@ gst_base_src_class_init (GstBaseSrcClass * klass) gstelement_class->send_event = GST_DEBUG_FUNCPTR (gst_base_src_send_event); klass->negotiate = GST_DEBUG_FUNCPTR (gst_base_src_default_negotiate); - klass->event = GST_DEBUG_FUNCPTR (gst_base_src_default_event); - klass->do_seek = GST_DEBUG_FUNCPTR (gst_base_src_default_do_seek); - klass->query = GST_DEBUG_FUNCPTR (gst_base_src_default_query); + klass->fixate = GST_DEBUG_FUNCPTR (gst_base_src_default_fixate); klass->prepare_seek_segment = GST_DEBUG_FUNCPTR (gst_base_src_default_prepare_seek_segment); - klass->fixate = GST_DEBUG_FUNCPTR (gst_base_src_default_fixate); + klass->do_seek = GST_DEBUG_FUNCPTR (gst_base_src_default_do_seek); + klass->query = GST_DEBUG_FUNCPTR (gst_base_src_default_query); + klass->event = GST_DEBUG_FUNCPTR (gst_base_src_default_event); klass->create = GST_DEBUG_FUNCPTR (gst_base_src_default_create); klass->alloc = GST_DEBUG_FUNCPTR (gst_base_src_default_alloc); @@ -417,7 +417,6 @@ gst_base_src_init (GstBaseSrc * basesrc, gpointer g_class) gst_pad_set_query_function (pad, gst_base_src_query); gst_pad_set_getrange_function (pad, gst_base_src_pad_get_range); gst_pad_set_getcaps_function (pad, gst_base_src_getcaps); - gst_pad_set_fixatecaps_function (pad, gst_base_src_fixate); /* hold pointer to pad */ basesrc->srcpad = pad; @@ -841,25 +840,21 @@ gst_base_src_getcaps (GstPad * pad, GstCaps * filter) } static void -gst_base_src_default_fixate (GstBaseSrc * src, GstCaps * caps) +gst_base_src_default_fixate (GstBaseSrc * bsrc, GstCaps * caps) { - GST_DEBUG_OBJECT (src, "using default caps fixate function"); + GST_DEBUG_OBJECT (bsrc, "using default caps fixate function"); gst_caps_fixate (caps); } static void -gst_base_src_fixate (GstPad * pad, GstCaps * caps) +gst_base_src_fixate (GstBaseSrc * bsrc, GstCaps * caps) { GstBaseSrcClass *bclass; - GstBaseSrc *bsrc; - bsrc = GST_BASE_SRC (gst_pad_get_parent (pad)); bclass = GST_BASE_SRC_GET_CLASS (bsrc); if (bclass->fixate) bclass->fixate (bsrc, caps); - - gst_object_unref (bsrc); } static gboolean @@ -2767,11 +2762,6 @@ gst_base_src_default_negotiate (GstBaseSrc * basesrc) caps = thiscaps; } if (caps && !gst_caps_is_empty (caps)) { - caps = gst_caps_make_writable (caps); - - /* take first (and best, since they are sorted) possibility */ - gst_caps_truncate (caps); - /* now fixate */ GST_DEBUG_OBJECT (basesrc, "have caps: %" GST_PTR_FORMAT, caps); if (gst_caps_is_any (caps)) { @@ -2780,7 +2770,8 @@ gst_base_src_default_negotiate (GstBaseSrc * basesrc) * nego is not needed */ result = TRUE; } else { - gst_pad_fixate_caps (GST_BASE_SRC_PAD (basesrc), caps); + caps = gst_caps_make_writable (caps); + gst_base_src_fixate (basesrc, caps); GST_DEBUG_OBJECT (basesrc, "fixated to: %" GST_PTR_FORMAT, caps); if (gst_caps_is_fixed (caps)) { /* yay, fixed caps, use those then, it's possible that the subclass does diff --git a/libs/gst/base/gstbasetransform.c b/libs/gst/base/gstbasetransform.c index 198a4c2946e4bcbba12ef622ba158be1c173e199..5fe3a6b2e7d39eeeb49b99c9f9e0b55e77ad19c0 100644 --- a/libs/gst/base/gstbasetransform.c +++ b/libs/gst/base/gstbasetransform.c @@ -317,6 +317,8 @@ static GstFlowReturn gst_base_transform_getrange (GstPad * pad, guint64 offset, guint length, GstBuffer ** buffer); static GstFlowReturn gst_base_transform_chain (GstPad * pad, GstBuffer * buffer); +static void gst_base_transform_default_fixate (GstBaseTransform * trans, + GstPadDirection direction, GstCaps * caps, GstCaps * othercaps); static GstCaps *gst_base_transform_getcaps (GstPad * pad, GstCaps * filter); static gboolean gst_base_transform_acceptcaps_default (GstBaseTransform * trans, GstPadDirection direction, GstCaps * caps); @@ -371,6 +373,7 @@ gst_base_transform_class_init (GstBaseTransformClass * klass) gobject_class->finalize = gst_base_transform_finalize; + klass->fixate_caps = GST_DEBUG_FUNCPTR (gst_base_transform_default_fixate); klass->passthrough_on_same_caps = FALSE; klass->sink_event = GST_DEBUG_FUNCPTR (gst_base_transform_sink_eventfunc); klass->src_event = GST_DEBUG_FUNCPTR (gst_base_transform_src_eventfunc); @@ -889,6 +892,14 @@ gst_base_transform_configure_caps (GstBaseTransform * trans, GstCaps * in, return ret; } +static void +gst_base_transform_default_fixate (GstBaseTransform * trans, + GstPadDirection direction, GstCaps * caps, GstCaps * othercaps) +{ + GST_DEBUG_OBJECT (trans, "using default caps fixate function"); + gst_caps_fixate (othercaps); +} + /* given a fixed @caps on @pad, create the best possible caps for the * other pad. * @caps must be fixed when calling this function. @@ -1002,52 +1013,22 @@ gst_base_transform_find_transform (GstBaseTransform * trans, GstPad * pad, if (gst_caps_is_empty (othercaps)) goto no_transform_possible; - /* second attempt at fixation, call the fixate vmethod and - * ultimately call the pad fixate function. */ - if (!is_fixed) { - GST_DEBUG_OBJECT (trans, - "trying to fixate %" GST_PTR_FORMAT " on pad %s:%s", - othercaps, GST_DEBUG_PAD_NAME (otherpad)); - - /* since we have no other way to fixate left, we might as well just take - * the first of the caps list and fixate that */ - - /* FIXME: when fixating using the vmethod, it might make sense to fixate - * each of the caps; but Wim doesn't see a use case for that yet */ - gst_caps_truncate (othercaps); - - if (klass->fixate_caps) { - GST_DEBUG_OBJECT (trans, "trying to fixate %" GST_PTR_FORMAT - " using caps %" GST_PTR_FORMAT - " on pad %s:%s using fixate_caps vmethod", othercaps, caps, - GST_DEBUG_PAD_NAME (otherpad)); - klass->fixate_caps (trans, GST_PAD_DIRECTION (pad), caps, othercaps); - is_fixed = gst_caps_is_fixed (othercaps); - } - /* if still not fixed, no other option but to let the default pad fixate - * function do its job */ - if (!is_fixed) { - GST_DEBUG_OBJECT (trans, "trying to fixate %" GST_PTR_FORMAT - " on pad %s:%s using gst_pad_fixate_caps", othercaps, - GST_DEBUG_PAD_NAME (otherpad)); - gst_pad_fixate_caps (otherpad, othercaps); - is_fixed = gst_caps_is_fixed (othercaps); - } + GST_DEBUG ("have %sfixed caps %" GST_PTR_FORMAT, (is_fixed ? "" : "non-"), + othercaps); + + /* second attempt at fixation, call the fixate vmethod */ + /* caps could be fixed but the subclass may want to add fields */ + if (klass->fixate_caps) { + othercaps = gst_caps_make_writable (othercaps); + + GST_DEBUG_OBJECT (trans, "calling faxate_caps for %" GST_PTR_FORMAT + " using caps %" GST_PTR_FORMAT " on pad %s:%s", othercaps, caps, + GST_DEBUG_PAD_NAME (otherpad)); + /* note that we pass the complete array of structures to the fixate + * function, it needs to truncate itself */ + klass->fixate_caps (trans, GST_PAD_DIRECTION (pad), caps, othercaps); + is_fixed = gst_caps_is_fixed (othercaps); GST_DEBUG_OBJECT (trans, "after fixating %" GST_PTR_FORMAT, othercaps); - } else { - GST_DEBUG ("caps are fixed"); - /* else caps are fixed but the subclass may want to add fields */ - if (klass->fixate_caps) { - othercaps = gst_caps_make_writable (othercaps); - - GST_DEBUG_OBJECT (trans, "doing fixate %" GST_PTR_FORMAT - " using caps %" GST_PTR_FORMAT - " on pad %s:%s using fixate_caps vmethod", othercaps, caps, - GST_DEBUG_PAD_NAME (otherpad)); - - klass->fixate_caps (trans, GST_PAD_DIRECTION (pad), caps, othercaps); - is_fixed = gst_caps_is_fixed (othercaps); - } } /* caps should be fixed now, if not we have to fail. */ diff --git a/tests/check/gst/gstpad.c b/tests/check/gst/gstpad.c index 935742c25c19e80e029a9301842082e7379ed359..e70ebc6a8cd2b874699ec512c7ba32e113463a93 100644 --- a/tests/check/gst/gstpad.c +++ b/tests/check/gst/gstpad.c @@ -127,11 +127,15 @@ GST_START_TEST (test_refcount) /* one for me */ ASSERT_CAPS_REFCOUNT (caps, "caps", 1); - fail_unless (gst_pad_set_caps (src, caps) == TRUE); /* can't set caps on flushing sinkpad */ + fail_if (gst_pad_set_caps (src, caps) == TRUE); fail_if (gst_pad_set_caps (sink, caps) == TRUE); /* one for me and one for each set_caps */ - ASSERT_CAPS_REFCOUNT (caps, "caps", 3); + ASSERT_CAPS_REFCOUNT (caps, "caps", 1); + + gst_pad_set_active (src, TRUE); + fail_unless (gst_pad_set_caps (src, caps) == TRUE); + ASSERT_CAPS_REFCOUNT (caps, "caps", 2); gst_pad_set_active (sink, TRUE); fail_unless (gst_pad_set_caps (sink, caps) == TRUE); diff --git a/tools/gst-inspect.c b/tools/gst-inspect.c index 1d7519f34d6ae04008876374c619366a606a2032..53da01e8180698247c551560270870fabcacda01 100644 --- a/tools/gst-inspect.c +++ b/tools/gst-inspect.c @@ -810,10 +810,6 @@ print_pad_info (GstElement * element) if (pad->getcapsfunc) n_print (" Has getcapsfunc(): %s\n", GST_DEBUG_FUNCPTR_NAME (pad->getcapsfunc)); - if (pad->fixatecapsfunc) - n_print (" Has fixatecapsfunc(): %s\n", - GST_DEBUG_FUNCPTR_NAME (pad->fixatecapsfunc)); - if (pad->padtemplate) n_print (" Pad Template: '%s'\n", pad->padtemplate->name_template);