gst_element_post_message
<SUBSECTION element-query>
-gst_element_get_query_types
gst_element_query
gst_element_query_convert
gst_element_query_position
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
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
GstPadProbeReturn
GstPadProbeType
GST_PAD_PROBE_TYPE_BLOCKING
-GST_PAD_PROBE_TYPE_DATA
GST_PAD_PROBE_TYPE_SCHEDULING
<SUBSECTION Application>
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
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
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
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)
{
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);
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);
}
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 ())
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);
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
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);
}
/**
- * 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.
* @sinkpad: the sink #GstPad to unlink.
}
}
-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
*/
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:
* @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
/* the pad capabilities */
GstPadGetCapsFunction getcapsfunc;
- GstPadFixateCapsFunction fixatecapsfunc;
GstPadActivateMode mode;
GstPadActivateFunction activatefunc;
#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)
/* 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);
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);
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,
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);
/* 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);
}
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
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);
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()");
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)) {
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);
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);
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;
}
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
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)) {
* 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
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);
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);
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.
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. */
/* 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);
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);