mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
pad: remove GstPadFixateCapsFunction
The fixate caps function was not used externally and we have vmethods in the base classes where it is needed. Update some docs. simplify some fixate functions in the base classes. Also pass the untruncated caps to the vmethod.
This commit is contained in:
parent
b133bea426
commit
37318a8cd2
10 changed files with 54 additions and 211 deletions
|
@ -734,7 +734,6 @@ gst_element_message_full
|
|||
gst_element_post_message
|
||||
|
||||
<SUBSECTION element-query>
|
||||
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
|
||||
<SUBSECTION Standard>
|
||||
GstGhostPadClass
|
||||
|
@ -1616,7 +1612,6 @@ GstPadActivateMode
|
|||
GstPadProbeReturn
|
||||
GstPadProbeType
|
||||
GST_PAD_PROBE_TYPE_BLOCKING
|
||||
GST_PAD_PROBE_TYPE_DATA
|
||||
GST_PAD_PROBE_TYPE_SCHEDULING
|
||||
|
||||
<SUBSECTION Application>
|
||||
|
@ -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
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GstPadClass
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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 ())
|
||||
|
|
57
gst/gstpad.c
57
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
|
||||
|
|
17
gst/gstpad.h
17
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);
|
||||
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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));
|
||||
GST_DEBUG ("have %sfixed caps %" GST_PTR_FORMAT, (is_fixed ? "" : "non-"),
|
||||
othercaps);
|
||||
|
||||
/* since we have no other way to fixate left, we might as well just take
|
||||
* the first of the caps list and fixate that */
|
||||
/* 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);
|
||||
|
||||
/* 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_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. */
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue