mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 07:58:51 +00:00
pad: avoid using the old GST_PAD_CAPS
Don't use GST_PAD_CAPS but instead use the new gst_pad_get_current_caps() method. Avoid setting caps on buffers.
This commit is contained in:
parent
62b1a5a7be
commit
02e5feb2bf
11 changed files with 88 additions and 179 deletions
|
@ -626,6 +626,7 @@ gst_ghost_pad_do_unlink (GstPad * pad)
|
||||||
static void
|
static void
|
||||||
on_int_notify (GstPad * internal, GParamSpec * unused, GstGhostPad * pad)
|
on_int_notify (GstPad * internal, GParamSpec * unused, GstGhostPad * pad)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
gboolean changed;
|
gboolean changed;
|
||||||
|
|
||||||
|
@ -649,6 +650,7 @@ on_int_notify (GstPad * internal, GParamSpec * unused, GstGhostPad * pad)
|
||||||
|
|
||||||
if (caps)
|
if (caps)
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -657,7 +659,9 @@ on_src_target_notify (GstPad * target, GParamSpec * unused, gpointer user_data)
|
||||||
GstProxyPad *proxypad;
|
GstProxyPad *proxypad;
|
||||||
GstGhostPad *gpad;
|
GstGhostPad *gpad;
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
|
#if 0
|
||||||
gboolean changed;
|
gboolean changed;
|
||||||
|
#endif
|
||||||
|
|
||||||
g_object_get (target, "caps", &caps, NULL);
|
g_object_get (target, "caps", &caps, NULL);
|
||||||
|
|
||||||
|
@ -683,6 +687,7 @@ on_src_target_notify (GstPad * target, GParamSpec * unused, gpointer user_data)
|
||||||
GST_PROXY_UNLOCK (proxypad);
|
GST_PROXY_UNLOCK (proxypad);
|
||||||
GST_OBJECT_UNLOCK (target);
|
GST_OBJECT_UNLOCK (target);
|
||||||
|
|
||||||
|
#if 0
|
||||||
GST_OBJECT_LOCK (gpad);
|
GST_OBJECT_LOCK (gpad);
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (gpad, "notified %p %" GST_PTR_FORMAT, caps, caps);
|
GST_DEBUG_OBJECT (gpad, "notified %p %" GST_PTR_FORMAT, caps, caps);
|
||||||
|
@ -699,6 +704,7 @@ on_src_target_notify (GstPad * target, GParamSpec * unused, gpointer user_data)
|
||||||
g_object_notify ((GObject *) gpad, "caps");
|
g_object_notify ((GObject *) gpad, "caps");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
g_object_unref (gpad);
|
g_object_unref (gpad);
|
||||||
|
|
||||||
|
|
|
@ -1519,7 +1519,7 @@ gst_base_parse_check_media (GstBaseParse * parse)
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
GstStructure *s;
|
GstStructure *s;
|
||||||
|
|
||||||
caps = GST_PAD_CAPS (parse->srcpad);
|
caps = gst_pad_get_current_caps (parse->srcpad);
|
||||||
if (G_LIKELY (caps) && (s = gst_caps_get_structure (caps, 0))) {
|
if (G_LIKELY (caps) && (s = gst_caps_get_structure (caps, 0))) {
|
||||||
parse->priv->is_video =
|
parse->priv->is_video =
|
||||||
g_str_has_prefix (gst_structure_get_name (s), "video");
|
g_str_has_prefix (gst_structure_get_name (s), "video");
|
||||||
|
@ -1527,6 +1527,8 @@ gst_base_parse_check_media (GstBaseParse * parse)
|
||||||
/* historical default */
|
/* historical default */
|
||||||
parse->priv->is_video = FALSE;
|
parse->priv->is_video = FALSE;
|
||||||
}
|
}
|
||||||
|
if (caps)
|
||||||
|
gst_caps_unref (caps);
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (parse, "media is video == %d", parse->priv->is_video);
|
GST_DEBUG_OBJECT (parse, "media is video == %d", parse->priv->is_video);
|
||||||
}
|
}
|
||||||
|
@ -1667,9 +1669,6 @@ gst_base_parse_handle_and_push_frame (GstBaseParse * parse,
|
||||||
GstBaseParseFrame *queued_frame;
|
GstBaseParseFrame *queued_frame;
|
||||||
|
|
||||||
while ((queued_frame = g_queue_pop_head (&parse->priv->queued_frames))) {
|
while ((queued_frame = g_queue_pop_head (&parse->priv->queued_frames))) {
|
||||||
queued_frame->buffer = gst_buffer_make_writable (queued_frame->buffer);
|
|
||||||
gst_buffer_set_caps (queued_frame->buffer,
|
|
||||||
GST_PAD_CAPS (GST_BASE_PARSE_SRC_PAD (parse)));
|
|
||||||
gst_base_parse_push_frame (parse, queued_frame);
|
gst_base_parse_push_frame (parse, queued_frame);
|
||||||
gst_base_parse_frame_free (queued_frame);
|
gst_base_parse_frame_free (queued_frame);
|
||||||
}
|
}
|
||||||
|
@ -1740,7 +1739,8 @@ gst_base_parse_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
|
||||||
last_stop = last_start + GST_BUFFER_DURATION (buffer);
|
last_stop = last_start + GST_BUFFER_DURATION (buffer);
|
||||||
|
|
||||||
/* should have caps by now */
|
/* should have caps by now */
|
||||||
g_return_val_if_fail (GST_PAD_CAPS (parse->srcpad), GST_FLOW_ERROR);
|
g_return_val_if_fail (gst_pad_has_current_caps (parse->srcpad),
|
||||||
|
GST_FLOW_ERROR);
|
||||||
|
|
||||||
/* segment adjustment magic; only if we are running the whole show */
|
/* segment adjustment magic; only if we are running the whole show */
|
||||||
if (!parse->priv->passthrough && parse->segment.rate > 0.0 &&
|
if (!parse->priv->passthrough && parse->segment.rate > 0.0 &&
|
||||||
|
@ -1856,10 +1856,6 @@ gst_base_parse_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
|
||||||
/* subclass must play nice */
|
/* subclass must play nice */
|
||||||
g_return_val_if_fail (buffer != NULL, GST_FLOW_ERROR);
|
g_return_val_if_fail (buffer != NULL, GST_FLOW_ERROR);
|
||||||
|
|
||||||
/* decorate */
|
|
||||||
buffer = gst_buffer_make_writable (buffer);
|
|
||||||
gst_buffer_set_caps (buffer, GST_PAD_CAPS (parse->srcpad));
|
|
||||||
|
|
||||||
parse->priv->seen_keyframe |= parse->priv->is_video &&
|
parse->priv->seen_keyframe |= parse->priv->is_video &&
|
||||||
!GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT);
|
!GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT);
|
||||||
|
|
||||||
|
|
|
@ -575,10 +575,7 @@ gst_base_sink_pad_getcaps (GstPad * pad)
|
||||||
|
|
||||||
if (bsink->pad_mode == GST_ACTIVATE_PULL) {
|
if (bsink->pad_mode == GST_ACTIVATE_PULL) {
|
||||||
/* if we are operating in pull mode we only accept the negotiated caps */
|
/* if we are operating in pull mode we only accept the negotiated caps */
|
||||||
GST_OBJECT_LOCK (pad);
|
caps = gst_pad_get_current_caps (pad);
|
||||||
if ((caps = GST_PAD_CAPS (pad)))
|
|
||||||
gst_caps_ref (caps);
|
|
||||||
GST_OBJECT_UNLOCK (pad);
|
|
||||||
}
|
}
|
||||||
if (caps == NULL) {
|
if (caps == NULL) {
|
||||||
if (bclass->get_caps)
|
if (bclass->get_caps)
|
||||||
|
|
|
@ -2161,12 +2161,6 @@ again:
|
||||||
GST_BUFFER_TIMESTAMP (*buf) = 0;
|
GST_BUFFER_TIMESTAMP (*buf) = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set pad caps on the buffer if the buffer had no caps */
|
|
||||||
if (GST_BUFFER_CAPS (*buf) == NULL) {
|
|
||||||
*buf = gst_buffer_make_writable (*buf);
|
|
||||||
gst_buffer_set_caps (*buf, GST_PAD_CAPS (src->srcpad));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* now sync before pushing the buffer */
|
/* now sync before pushing the buffer */
|
||||||
status = gst_base_src_do_sync (src, *buf);
|
status = gst_base_src_do_sync (src, *buf);
|
||||||
|
|
||||||
|
|
|
@ -763,6 +763,7 @@ gst_base_transform_configure_caps (GstBaseTransform * trans, GstCaps * in,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
/* check if caps @in on @pad can be transformed to @out on the other pad.
|
/* check if caps @in on @pad can be transformed to @out on the other pad.
|
||||||
* We don't have a vmethod to test this yet so we have to do a somewhat less
|
* We don't have a vmethod to test this yet so we have to do a somewhat less
|
||||||
* efficient check for this.
|
* efficient check for this.
|
||||||
|
@ -810,6 +811,7 @@ no_subset:
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* given a fixed @caps on @pad, create the best possible caps for the
|
/* given a fixed @caps on @pad, create the best possible caps for the
|
||||||
* other pad.
|
* other pad.
|
||||||
|
@ -1303,6 +1305,7 @@ gst_base_transform_query_type (GstPad * pad)
|
||||||
return types;
|
return types;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
static void
|
static void
|
||||||
compute_upstream_suggestion (GstBaseTransform * trans, gsize expsize,
|
compute_upstream_suggestion (GstBaseTransform * trans, gsize expsize,
|
||||||
GstCaps * caps)
|
GstCaps * caps)
|
||||||
|
@ -1348,6 +1351,7 @@ compute_upstream_suggestion (GstBaseTransform * trans, gsize expsize,
|
||||||
gst_caps_unref (othercaps);
|
gst_caps_unref (othercaps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Allocate a buffer using gst_pad_alloc_buffer
|
/* Allocate a buffer using gst_pad_alloc_buffer
|
||||||
*
|
*
|
||||||
|
@ -1364,9 +1368,9 @@ gst_base_transform_prepare_output_buffer (GstBaseTransform * trans,
|
||||||
GstBaseTransformClass *bclass;
|
GstBaseTransformClass *bclass;
|
||||||
GstBaseTransformPrivate *priv;
|
GstBaseTransformPrivate *priv;
|
||||||
GstFlowReturn ret = GST_FLOW_OK;
|
GstFlowReturn ret = GST_FLOW_OK;
|
||||||
gsize insize, outsize, newsize, expsize;
|
gboolean discard, copymeta;
|
||||||
gboolean discard, setcaps, copymeta;
|
gsize insize, outsize;
|
||||||
GstCaps *incaps, *oldcaps, *newcaps, *outcaps;
|
GstCaps *incaps, *outcaps;
|
||||||
|
|
||||||
bclass = GST_BASE_TRANSFORM_GET_CLASS (trans);
|
bclass = GST_BASE_TRANSFORM_GET_CLASS (trans);
|
||||||
|
|
||||||
|
@ -1374,6 +1378,9 @@ gst_base_transform_prepare_output_buffer (GstBaseTransform * trans,
|
||||||
|
|
||||||
*out_buf = NULL;
|
*out_buf = NULL;
|
||||||
|
|
||||||
|
incaps = gst_pad_get_current_caps (trans->sinkpad);
|
||||||
|
outcaps = gst_pad_get_current_caps (trans->srcpad);
|
||||||
|
|
||||||
insize = gst_buffer_get_size (in_buf);
|
insize = gst_buffer_get_size (in_buf);
|
||||||
|
|
||||||
/* figure out how to allocate a buffer based on the current configuration */
|
/* figure out how to allocate a buffer based on the current configuration */
|
||||||
|
@ -1401,8 +1408,7 @@ gst_base_transform_prepare_output_buffer (GstBaseTransform * trans,
|
||||||
GST_DEBUG_OBJECT (trans, "getting output size for copy transform");
|
GST_DEBUG_OBJECT (trans, "getting output size for copy transform");
|
||||||
/* copy transform, figure out the output size */
|
/* copy transform, figure out the output size */
|
||||||
if (!gst_base_transform_transform_size (trans,
|
if (!gst_base_transform_transform_size (trans,
|
||||||
GST_PAD_SINK, GST_PAD_CAPS (trans->sinkpad),
|
GST_PAD_SINK, incaps, insize, outcaps, &outsize)) {
|
||||||
insize, GST_PAD_CAPS (trans->srcpad), &outsize)) {
|
|
||||||
goto unknown_size;
|
goto unknown_size;
|
||||||
}
|
}
|
||||||
/* never discard this buffer, we need it for storing the output */
|
/* never discard this buffer, we need it for storing the output */
|
||||||
|
@ -1410,19 +1416,19 @@ gst_base_transform_prepare_output_buffer (GstBaseTransform * trans,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
oldcaps = GST_PAD_CAPS (trans->srcpad);
|
|
||||||
|
|
||||||
if (bclass->prepare_output_buffer) {
|
if (bclass->prepare_output_buffer) {
|
||||||
GST_DEBUG_OBJECT (trans,
|
GST_DEBUG_OBJECT (trans,
|
||||||
"calling prepare buffer with caps %p %" GST_PTR_FORMAT, oldcaps,
|
"calling prepare buffer with caps %p %" GST_PTR_FORMAT, outcaps,
|
||||||
oldcaps);
|
outcaps);
|
||||||
ret =
|
ret =
|
||||||
bclass->prepare_output_buffer (trans, in_buf, outsize, oldcaps,
|
bclass->prepare_output_buffer (trans, in_buf, outsize, outcaps,
|
||||||
out_buf);
|
out_buf);
|
||||||
|
|
||||||
/* get a new ref to the srcpad caps, the prepare_output_buffer function can
|
/* get a new ref to the srcpad caps, the prepare_output_buffer function can
|
||||||
* update the pad caps if it wants */
|
* update the pad caps if it wants */
|
||||||
oldcaps = GST_PAD_CAPS (trans->srcpad);
|
if (outcaps)
|
||||||
|
gst_caps_unref (outcaps);
|
||||||
|
outcaps = gst_pad_get_current_caps (trans->srcpad);
|
||||||
|
|
||||||
/* FIXME 0.11:
|
/* FIXME 0.11:
|
||||||
* decrease refcount again if vmethod returned refcounted in_buf. This
|
* decrease refcount again if vmethod returned refcounted in_buf. This
|
||||||
|
@ -1446,16 +1452,9 @@ gst_base_transform_prepare_output_buffer (GstBaseTransform * trans,
|
||||||
*out_buf = gst_buffer_ref (in_buf);
|
*out_buf = gst_buffer_ref (in_buf);
|
||||||
} else {
|
} else {
|
||||||
GST_DEBUG_OBJECT (trans, "doing alloc with caps %" GST_PTR_FORMAT,
|
GST_DEBUG_OBJECT (trans, "doing alloc with caps %" GST_PTR_FORMAT,
|
||||||
oldcaps);
|
outcaps);
|
||||||
|
|
||||||
*out_buf = gst_buffer_new_and_alloc (outsize);
|
*out_buf = gst_buffer_new_and_alloc (outsize);
|
||||||
gst_buffer_set_caps (*out_buf, oldcaps);
|
|
||||||
#if 0
|
|
||||||
ret = gst_pad_alloc_buffer (trans->srcpad,
|
|
||||||
GST_BUFFER_OFFSET (in_buf), outsize, oldcaps, out_buf);
|
|
||||||
if (ret != GST_FLOW_OK)
|
|
||||||
goto alloc_failed;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1463,112 +1462,6 @@ gst_base_transform_prepare_output_buffer (GstBaseTransform * trans,
|
||||||
if (*out_buf == NULL)
|
if (*out_buf == NULL)
|
||||||
goto no_buffer;
|
goto no_buffer;
|
||||||
|
|
||||||
/* check if we got different caps on this new output buffer */
|
|
||||||
newcaps = GST_BUFFER_CAPS (*out_buf);
|
|
||||||
newsize = gst_buffer_get_size (*out_buf);
|
|
||||||
|
|
||||||
if (newcaps && !gst_caps_is_equal (newcaps, oldcaps)) {
|
|
||||||
GstCaps *othercaps;
|
|
||||||
gboolean can_convert;
|
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (trans, "received new caps %" GST_PTR_FORMAT, newcaps);
|
|
||||||
|
|
||||||
incaps = GST_PAD_CAPS (trans->sinkpad);
|
|
||||||
|
|
||||||
/* check if we can convert the current incaps to the new target caps */
|
|
||||||
can_convert =
|
|
||||||
gst_base_transform_can_transform (trans, trans->sinkpad, incaps,
|
|
||||||
newcaps);
|
|
||||||
|
|
||||||
if (!can_convert) {
|
|
||||||
GST_DEBUG_OBJECT (trans, "cannot perform transform on current buffer");
|
|
||||||
|
|
||||||
gst_base_transform_transform_size (trans,
|
|
||||||
GST_PAD_SINK, incaps, insize, newcaps, &expsize);
|
|
||||||
|
|
||||||
compute_upstream_suggestion (trans, expsize, newcaps);
|
|
||||||
|
|
||||||
/* we got a suggested caps but we can't transform to it. See if there is
|
|
||||||
* another downstream format that we can transform to */
|
|
||||||
othercaps =
|
|
||||||
gst_base_transform_find_transform (trans, trans->sinkpad, incaps,
|
|
||||||
TRUE);
|
|
||||||
|
|
||||||
if (othercaps && !gst_caps_is_empty (othercaps)) {
|
|
||||||
GST_DEBUG_OBJECT (trans, "we found target caps %" GST_PTR_FORMAT,
|
|
||||||
othercaps);
|
|
||||||
*out_buf = gst_buffer_make_writable (*out_buf);
|
|
||||||
gst_buffer_set_caps (*out_buf, othercaps);
|
|
||||||
gst_caps_unref (othercaps);
|
|
||||||
newcaps = GST_BUFFER_CAPS (*out_buf);
|
|
||||||
can_convert = TRUE;
|
|
||||||
} else if (othercaps)
|
|
||||||
gst_caps_unref (othercaps);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* it's possible that the buffer we got is of the wrong size, get the
|
|
||||||
* expected size here, we will check the size if we are going to use the
|
|
||||||
* buffer later on. */
|
|
||||||
gst_base_transform_transform_size (trans,
|
|
||||||
GST_PAD_SINK, incaps, insize, newcaps, &expsize);
|
|
||||||
|
|
||||||
if (can_convert) {
|
|
||||||
GST_DEBUG_OBJECT (trans, "reconfigure transform for current buffer");
|
|
||||||
|
|
||||||
/* subclass might want to add fields to the caps */
|
|
||||||
if (bclass->fixate_caps != NULL) {
|
|
||||||
newcaps = gst_caps_copy (newcaps);
|
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (trans, "doing fixate %" GST_PTR_FORMAT
|
|
||||||
" using caps %" GST_PTR_FORMAT
|
|
||||||
" on pad %s:%s using fixate_caps vmethod", newcaps, incaps,
|
|
||||||
GST_DEBUG_PAD_NAME (trans->srcpad));
|
|
||||||
bclass->fixate_caps (trans, GST_PAD_SINK, incaps, newcaps);
|
|
||||||
|
|
||||||
*out_buf = gst_buffer_make_writable (*out_buf);
|
|
||||||
gst_buffer_set_caps (*out_buf, newcaps);
|
|
||||||
gst_caps_unref (newcaps);
|
|
||||||
newcaps = GST_BUFFER_CAPS (*out_buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* caps not empty, try to renegotiate to the new format */
|
|
||||||
if (!gst_base_transform_configure_caps (trans, incaps, newcaps)) {
|
|
||||||
/* not sure we need to fail hard here, we can simply continue our
|
|
||||||
* conversion with what we negotiated before */
|
|
||||||
goto failed_configure;
|
|
||||||
}
|
|
||||||
/* new format configure, and use the new output buffer */
|
|
||||||
gst_pad_set_caps (trans->srcpad, newcaps);
|
|
||||||
discard = FALSE;
|
|
||||||
/* clear previous cached sink-pad caps, so buffer_alloc knows that
|
|
||||||
* it needs to revisit the decision about whether to proxy or not: */
|
|
||||||
gst_caps_replace (&priv->sink_alloc, NULL);
|
|
||||||
/* if we got a buffer of the wrong size, discard it now and make sure we
|
|
||||||
* allocate a propertly sized buffer later. */
|
|
||||||
if (newsize != expsize) {
|
|
||||||
if (in_buf != *out_buf)
|
|
||||||
gst_buffer_unref (*out_buf);
|
|
||||||
*out_buf = NULL;
|
|
||||||
}
|
|
||||||
outsize = expsize;
|
|
||||||
} else {
|
|
||||||
compute_upstream_suggestion (trans, expsize, newcaps);
|
|
||||||
|
|
||||||
if (in_buf != *out_buf)
|
|
||||||
gst_buffer_unref (*out_buf);
|
|
||||||
*out_buf = NULL;
|
|
||||||
}
|
|
||||||
} else if (outsize != newsize) {
|
|
||||||
GST_WARNING_OBJECT (trans, "Caps did not change but allocated size does "
|
|
||||||
"not match expected size (%d != %d)", newsize, outsize);
|
|
||||||
if (in_buf != *out_buf)
|
|
||||||
gst_buffer_unref (*out_buf);
|
|
||||||
*out_buf = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* these are the final output caps */
|
|
||||||
outcaps = GST_PAD_CAPS (trans->srcpad);
|
|
||||||
|
|
||||||
copymeta = FALSE;
|
copymeta = FALSE;
|
||||||
if (*out_buf == NULL) {
|
if (*out_buf == NULL) {
|
||||||
if (!discard) {
|
if (!discard) {
|
||||||
|
@ -1618,22 +1511,13 @@ gst_base_transform_prepare_output_buffer (GstBaseTransform * trans,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check if we need to make things writable. We need this when we need to
|
|
||||||
* update the caps or the metadata on the output buffer. */
|
|
||||||
newcaps = GST_BUFFER_CAPS (*out_buf);
|
|
||||||
/* we check the pointers as a quick check and then go to the more involved
|
|
||||||
* check. This is needed when we receive different pointers on the sinkpad
|
|
||||||
* that mean the same caps. What we then want to do is prefer those caps over
|
|
||||||
* the ones on the srcpad and set the srcpad caps to the buffer caps */
|
|
||||||
setcaps = !newcaps || ((newcaps != outcaps)
|
|
||||||
&& (!gst_caps_is_equal (newcaps, outcaps)));
|
|
||||||
/* we need to modify the metadata when the element is not gap aware,
|
/* we need to modify the metadata when the element is not gap aware,
|
||||||
* passthrough is not used and the gap flag is set */
|
* passthrough is not used and the gap flag is set */
|
||||||
copymeta |= !trans->priv->gap_aware && !trans->passthrough
|
copymeta |= !trans->priv->gap_aware && !trans->passthrough
|
||||||
&& (GST_MINI_OBJECT_FLAGS (*out_buf) & GST_BUFFER_FLAG_GAP);
|
&& (GST_MINI_OBJECT_FLAGS (*out_buf) & GST_BUFFER_FLAG_GAP);
|
||||||
|
|
||||||
if (setcaps || copymeta) {
|
if (copymeta) {
|
||||||
GST_DEBUG_OBJECT (trans, "setcaps %d, copymeta %d", setcaps, copymeta);
|
GST_DEBUG_OBJECT (trans, "copymeta %d", copymeta);
|
||||||
if (!gst_buffer_is_writable (*out_buf)) {
|
if (!gst_buffer_is_writable (*out_buf)) {
|
||||||
GST_DEBUG_OBJECT (trans, "buffer %p not writable", *out_buf);
|
GST_DEBUG_OBJECT (trans, "buffer %p not writable", *out_buf);
|
||||||
if (in_buf == *out_buf)
|
if (in_buf == *out_buf)
|
||||||
|
@ -1642,8 +1526,6 @@ gst_base_transform_prepare_output_buffer (GstBaseTransform * trans,
|
||||||
*out_buf = gst_buffer_make_writable (*out_buf);
|
*out_buf = gst_buffer_make_writable (*out_buf);
|
||||||
}
|
}
|
||||||
/* when we get here, the metadata should be writable */
|
/* when we get here, the metadata should be writable */
|
||||||
if (setcaps)
|
|
||||||
gst_buffer_set_caps (*out_buf, outcaps);
|
|
||||||
if (copymeta)
|
if (copymeta)
|
||||||
gst_buffer_copy_into (*out_buf, in_buf,
|
gst_buffer_copy_into (*out_buf, in_buf,
|
||||||
GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS, 0, -1);
|
GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS, 0, -1);
|
||||||
|
@ -1652,29 +1534,32 @@ gst_base_transform_prepare_output_buffer (GstBaseTransform * trans,
|
||||||
GST_BUFFER_FLAG_UNSET (*out_buf, GST_BUFFER_FLAG_GAP);
|
GST_BUFFER_FLAG_UNSET (*out_buf, GST_BUFFER_FLAG_GAP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
done:
|
||||||
|
if (incaps)
|
||||||
|
gst_caps_unref (incaps);
|
||||||
|
if (outcaps)
|
||||||
|
gst_caps_unref (outcaps);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
alloc_failed:
|
alloc_failed:
|
||||||
{
|
{
|
||||||
GST_WARNING_OBJECT (trans, "pad-alloc failed: %s", gst_flow_get_name (ret));
|
GST_WARNING_OBJECT (trans, "pad-alloc failed: %s", gst_flow_get_name (ret));
|
||||||
return ret;
|
goto done;
|
||||||
}
|
}
|
||||||
no_buffer:
|
no_buffer:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (trans, STREAM, NOT_IMPLEMENTED,
|
GST_ELEMENT_ERROR (trans, STREAM, NOT_IMPLEMENTED,
|
||||||
("Sub-class failed to provide an output buffer"), (NULL));
|
("Sub-class failed to provide an output buffer"), (NULL));
|
||||||
return GST_FLOW_ERROR;
|
ret = GST_FLOW_ERROR;
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
unknown_size:
|
unknown_size:
|
||||||
{
|
{
|
||||||
GST_ERROR_OBJECT (trans, "unknown output size");
|
GST_ERROR_OBJECT (trans, "unknown output size");
|
||||||
return GST_FLOW_ERROR;
|
ret = GST_FLOW_ERROR;
|
||||||
}
|
goto done;
|
||||||
failed_configure:
|
|
||||||
{
|
|
||||||
GST_WARNING_OBJECT (trans, "failed to configure caps");
|
|
||||||
return GST_FLOW_NOT_NEGOTIATED;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2272,15 +2157,18 @@ gst_base_transform_activate (GstBaseTransform * trans, gboolean active)
|
||||||
bclass = GST_BASE_TRANSFORM_GET_CLASS (trans);
|
bclass = GST_BASE_TRANSFORM_GET_CLASS (trans);
|
||||||
|
|
||||||
if (active) {
|
if (active) {
|
||||||
|
GstCaps *incaps, *outcaps;
|
||||||
|
|
||||||
if (trans->priv->pad_mode == GST_ACTIVATE_NONE && bclass->start)
|
if (trans->priv->pad_mode == GST_ACTIVATE_NONE && bclass->start)
|
||||||
result &= bclass->start (trans);
|
result &= bclass->start (trans);
|
||||||
|
|
||||||
GST_OBJECT_LOCK (trans);
|
incaps = gst_pad_get_current_caps (trans->sinkpad);
|
||||||
|
outcaps = gst_pad_get_current_caps (trans->srcpad);
|
||||||
|
|
||||||
if (GST_PAD_CAPS (trans->sinkpad) && GST_PAD_CAPS (trans->srcpad))
|
GST_OBJECT_LOCK (trans);
|
||||||
|
if (incaps && outcaps)
|
||||||
trans->have_same_caps =
|
trans->have_same_caps =
|
||||||
gst_caps_is_equal (GST_PAD_CAPS (trans->sinkpad),
|
gst_caps_is_equal (incaps, outcaps) || trans->passthrough;
|
||||||
GST_PAD_CAPS (trans->srcpad)) || trans->passthrough;
|
|
||||||
else
|
else
|
||||||
trans->have_same_caps = trans->passthrough;
|
trans->have_same_caps = trans->passthrough;
|
||||||
GST_DEBUG_OBJECT (trans, "have_same_caps %d", trans->have_same_caps);
|
GST_DEBUG_OBJECT (trans, "have_same_caps %d", trans->have_same_caps);
|
||||||
|
@ -2295,8 +2183,12 @@ gst_base_transform_activate (GstBaseTransform * trans, gboolean active)
|
||||||
trans->priv->processed = 0;
|
trans->priv->processed = 0;
|
||||||
trans->priv->dropped = 0;
|
trans->priv->dropped = 0;
|
||||||
trans->priv->force_alloc = TRUE;
|
trans->priv->force_alloc = TRUE;
|
||||||
|
|
||||||
GST_OBJECT_UNLOCK (trans);
|
GST_OBJECT_UNLOCK (trans);
|
||||||
|
|
||||||
|
if (incaps)
|
||||||
|
gst_caps_unref (incaps);
|
||||||
|
if (outcaps)
|
||||||
|
gst_caps_unref (outcaps);
|
||||||
} else {
|
} else {
|
||||||
/* We must make sure streaming has finished before resetting things
|
/* We must make sure streaming has finished before resetting things
|
||||||
* and calling the ::stop vfunc */
|
* and calling the ::stop vfunc */
|
||||||
|
|
|
@ -169,7 +169,7 @@ gst_capsfilter_set_property (GObject * object, guint prop_id,
|
||||||
|
|
||||||
/* filter the currently negotiated format against the new caps */
|
/* filter the currently negotiated format against the new caps */
|
||||||
GST_OBJECT_LOCK (GST_BASE_TRANSFORM_SINK_PAD (object));
|
GST_OBJECT_LOCK (GST_BASE_TRANSFORM_SINK_PAD (object));
|
||||||
nego = GST_PAD_CAPS (GST_BASE_TRANSFORM_SINK_PAD (object));
|
nego = gst_pad_get_current_caps (GST_BASE_TRANSFORM_SINK_PAD (object));
|
||||||
if (nego) {
|
if (nego) {
|
||||||
GST_DEBUG_OBJECT (capsfilter, "we had negotiated caps %" GST_PTR_FORMAT,
|
GST_DEBUG_OBJECT (capsfilter, "we had negotiated caps %" GST_PTR_FORMAT,
|
||||||
nego);
|
nego);
|
||||||
|
@ -198,6 +198,7 @@ gst_capsfilter_set_property (GObject * object, guint prop_id,
|
||||||
suggest = gst_caps_copy (new_caps);
|
suggest = gst_caps_copy (new_caps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
gst_caps_unref (nego);
|
||||||
} else {
|
} else {
|
||||||
GST_DEBUG_OBJECT (capsfilter, "no negotiated caps");
|
GST_DEBUG_OBJECT (capsfilter, "no negotiated caps");
|
||||||
/* no previous caps, the getcaps function will be used to find suitable
|
/* no previous caps, the getcaps function will be used to find suitable
|
||||||
|
@ -349,11 +350,8 @@ gst_capsfilter_prepare_buf (GstBaseTransform * trans, GstBuffer * input,
|
||||||
/* Buffer has no caps. See if the output pad only supports fixed caps */
|
/* Buffer has no caps. See if the output pad only supports fixed caps */
|
||||||
GstCaps *out_caps;
|
GstCaps *out_caps;
|
||||||
|
|
||||||
out_caps = GST_PAD_CAPS (trans->srcpad);
|
out_caps = gst_pad_get_current_caps (trans->srcpad);
|
||||||
|
if (out_caps == NULL) {
|
||||||
if (out_caps != NULL) {
|
|
||||||
gst_caps_ref (out_caps);
|
|
||||||
} else {
|
|
||||||
out_caps = gst_pad_get_allowed_caps (trans->srcpad);
|
out_caps = gst_pad_get_allowed_caps (trans->srcpad);
|
||||||
g_return_val_if_fail (out_caps != NULL, GST_FLOW_ERROR);
|
g_return_val_if_fail (out_caps != NULL, GST_FLOW_ERROR);
|
||||||
}
|
}
|
||||||
|
@ -373,7 +371,7 @@ gst_capsfilter_prepare_buf (GstBaseTransform * trans, GstBuffer * input,
|
||||||
}
|
}
|
||||||
GST_BUFFER_CAPS (*buf) = out_caps;
|
GST_BUFFER_CAPS (*buf) = out_caps;
|
||||||
|
|
||||||
if (GST_PAD_CAPS (trans->srcpad) == NULL)
|
if (!gst_pad_has_current_caps (trans->srcpad))
|
||||||
gst_pad_set_caps (trans->srcpad, out_caps);
|
gst_pad_set_caps (trans->srcpad, out_caps);
|
||||||
} else {
|
} else {
|
||||||
gchar *caps_str = gst_caps_to_string (out_caps);
|
gchar *caps_str = gst_caps_to_string (out_caps);
|
||||||
|
|
|
@ -237,7 +237,9 @@ gst_funnel_sink_chain (GstPad * pad, GstBuffer * buffer)
|
||||||
GstFunnelPad *fpad = GST_FUNNEL_PAD_CAST (pad);
|
GstFunnelPad *fpad = GST_FUNNEL_PAD_CAST (pad);
|
||||||
GstEvent *event = NULL;
|
GstEvent *event = NULL;
|
||||||
GstClockTime newts;
|
GstClockTime newts;
|
||||||
|
#if 0
|
||||||
GstCaps *padcaps;
|
GstCaps *padcaps;
|
||||||
|
#endif
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (funnel, "received buffer %p", buffer);
|
GST_DEBUG_OBJECT (funnel, "received buffer %p", buffer);
|
||||||
|
|
||||||
|
@ -271,7 +273,7 @@ gst_funnel_sink_chain (GstPad * pad, GstBuffer * buffer)
|
||||||
if (!gst_pad_push_event (funnel->srcpad, event))
|
if (!gst_pad_push_event (funnel->srcpad, event))
|
||||||
GST_WARNING_OBJECT (funnel, "Could not push out newsegment event");
|
GST_WARNING_OBJECT (funnel, "Could not push out newsegment event");
|
||||||
}
|
}
|
||||||
|
#if 0
|
||||||
GST_OBJECT_LOCK (pad);
|
GST_OBJECT_LOCK (pad);
|
||||||
padcaps = GST_PAD_CAPS (funnel->srcpad);
|
padcaps = GST_PAD_CAPS (funnel->srcpad);
|
||||||
GST_OBJECT_UNLOCK (pad);
|
GST_OBJECT_UNLOCK (pad);
|
||||||
|
@ -282,12 +284,15 @@ gst_funnel_sink_chain (GstPad * pad, GstBuffer * buffer)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
res = gst_pad_push (funnel->srcpad, buffer);
|
res = gst_pad_push (funnel->srcpad, buffer);
|
||||||
|
|
||||||
GST_LOG_OBJECT (funnel, "handled buffer %s", gst_flow_get_name (res));
|
GST_LOG_OBJECT (funnel, "handled buffer %s", gst_flow_get_name (res));
|
||||||
|
|
||||||
|
#if 0
|
||||||
out:
|
out:
|
||||||
|
#endif
|
||||||
gst_object_unref (funnel);
|
gst_object_unref (funnel);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
|
|
@ -544,7 +544,9 @@ gst_selector_pad_chain (GstPad * pad, GstBuffer * buf)
|
||||||
GstClockTime start_time;
|
GstClockTime start_time;
|
||||||
GstSegment *seg;
|
GstSegment *seg;
|
||||||
GstEvent *close_event = NULL, *start_event = NULL;
|
GstEvent *close_event = NULL, *start_event = NULL;
|
||||||
|
#if 0
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
|
#endif
|
||||||
|
|
||||||
sel = GST_INPUT_SELECTOR (gst_pad_get_parent (pad));
|
sel = GST_INPUT_SELECTOR (gst_pad_get_parent (pad));
|
||||||
selpad = GST_SELECTOR_PAD_CAST (pad);
|
selpad = GST_SELECTOR_PAD_CAST (pad);
|
||||||
|
@ -633,10 +635,12 @@ gst_selector_pad_chain (GstPad * pad, GstBuffer * buf)
|
||||||
/* forward */
|
/* forward */
|
||||||
GST_LOG_OBJECT (pad, "Forwarding buffer %p", buf);
|
GST_LOG_OBJECT (pad, "Forwarding buffer %p", buf);
|
||||||
|
|
||||||
|
#if 0
|
||||||
if ((caps = GST_BUFFER_CAPS (buf))) {
|
if ((caps = GST_BUFFER_CAPS (buf))) {
|
||||||
if (GST_PAD_CAPS (sel->srcpad) != caps)
|
if (GST_PAD_CAPS (sel->srcpad) != caps)
|
||||||
gst_pad_set_caps (sel->srcpad, caps);
|
gst_pad_set_caps (sel->srcpad, caps);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
res = gst_pad_push (sel->srcpad, buf);
|
res = gst_pad_push (sel->srcpad, buf);
|
||||||
selpad->pushed = TRUE;
|
selpad->pushed = TRUE;
|
||||||
|
|
|
@ -952,12 +952,16 @@ gst_single_queue_push_one (GstMultiQueue * mq, GstSingleQueue * sq,
|
||||||
if (GST_IS_BUFFER (object)) {
|
if (GST_IS_BUFFER (object)) {
|
||||||
GstBuffer *buffer;
|
GstBuffer *buffer;
|
||||||
GstClockTime timestamp, duration;
|
GstClockTime timestamp, duration;
|
||||||
|
#if 0
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
|
#endif
|
||||||
|
|
||||||
buffer = GST_BUFFER_CAST (object);
|
buffer = GST_BUFFER_CAST (object);
|
||||||
timestamp = GST_BUFFER_TIMESTAMP (buffer);
|
timestamp = GST_BUFFER_TIMESTAMP (buffer);
|
||||||
duration = GST_BUFFER_DURATION (buffer);
|
duration = GST_BUFFER_DURATION (buffer);
|
||||||
|
#if 0
|
||||||
caps = GST_BUFFER_CAPS (buffer);
|
caps = GST_BUFFER_CAPS (buffer);
|
||||||
|
#endif
|
||||||
|
|
||||||
apply_buffer (mq, sq, timestamp, duration, &sq->src_segment);
|
apply_buffer (mq, sq, timestamp, duration, &sq->src_segment);
|
||||||
|
|
||||||
|
@ -968,11 +972,13 @@ gst_single_queue_push_one (GstMultiQueue * mq, GstSingleQueue * sq,
|
||||||
"SingleQueue %d : Pushing buffer %p with ts %" GST_TIME_FORMAT,
|
"SingleQueue %d : Pushing buffer %p with ts %" GST_TIME_FORMAT,
|
||||||
sq->id, buffer, GST_TIME_ARGS (timestamp));
|
sq->id, buffer, GST_TIME_ARGS (timestamp));
|
||||||
|
|
||||||
|
#if 0
|
||||||
/* Set caps on pad before pushing, this avoids core calling the acceptcaps
|
/* Set caps on pad before pushing, this avoids core calling the acceptcaps
|
||||||
* function on the srcpad, which will call acceptcaps upstream, which might
|
* function on the srcpad, which will call acceptcaps upstream, which might
|
||||||
* not accept these caps (anymore). */
|
* not accept these caps (anymore). */
|
||||||
if (caps && caps != GST_PAD_CAPS (sq->srcpad))
|
if (caps && caps != GST_PAD_CAPS (sq->srcpad))
|
||||||
gst_pad_set_caps (sq->srcpad, caps);
|
gst_pad_set_caps (sq->srcpad, caps);
|
||||||
|
#endif
|
||||||
|
|
||||||
result = gst_pad_push (sq->srcpad, buffer);
|
result = gst_pad_push (sq->srcpad, buffer);
|
||||||
} else if (GST_IS_EVENT (object)) {
|
} else if (GST_IS_EVENT (object)) {
|
||||||
|
|
|
@ -1094,7 +1094,9 @@ gst_queue_push_one (GstQueue * queue)
|
||||||
next:
|
next:
|
||||||
if (is_buffer) {
|
if (is_buffer) {
|
||||||
GstBuffer *buffer;
|
GstBuffer *buffer;
|
||||||
|
#if 0
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
|
#endif
|
||||||
|
|
||||||
buffer = GST_BUFFER_CAST (data);
|
buffer = GST_BUFFER_CAST (data);
|
||||||
|
|
||||||
|
@ -1109,10 +1111,12 @@ next:
|
||||||
}
|
}
|
||||||
queue->head_needs_discont = FALSE;
|
queue->head_needs_discont = FALSE;
|
||||||
}
|
}
|
||||||
|
#if 0
|
||||||
caps = GST_BUFFER_CAPS (buffer);
|
caps = GST_BUFFER_CAPS (buffer);
|
||||||
|
#endif
|
||||||
|
|
||||||
GST_QUEUE_MUTEX_UNLOCK (queue);
|
GST_QUEUE_MUTEX_UNLOCK (queue);
|
||||||
|
#if 0
|
||||||
/* set the right caps on the pad now. We do this before pushing the buffer
|
/* set the right caps on the pad now. We do this before pushing the buffer
|
||||||
* because the pad_push call will check (using acceptcaps) if the buffer can
|
* because the pad_push call will check (using acceptcaps) if the buffer can
|
||||||
* be set on the pad, which might fail because this will be propagated
|
* be set on the pad, which might fail because this will be propagated
|
||||||
|
@ -1120,6 +1124,7 @@ next:
|
||||||
* caps did not change, so we don't have to change caps on the pad. */
|
* caps did not change, so we don't have to change caps on the pad. */
|
||||||
if (caps && caps != GST_PAD_CAPS (queue->srcpad))
|
if (caps && caps != GST_PAD_CAPS (queue->srcpad))
|
||||||
gst_pad_set_caps (queue->srcpad, caps);
|
gst_pad_set_caps (queue->srcpad, caps);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (queue->push_newsegment) {
|
if (queue->push_newsegment) {
|
||||||
gst_queue_push_newsegment (queue);
|
gst_queue_push_newsegment (queue);
|
||||||
|
|
|
@ -2204,15 +2204,21 @@ next:
|
||||||
|
|
||||||
if (is_buffer) {
|
if (is_buffer) {
|
||||||
GstBuffer *buffer;
|
GstBuffer *buffer;
|
||||||
|
#if 0
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
|
#endif
|
||||||
|
|
||||||
buffer = GST_BUFFER_CAST (data);
|
buffer = GST_BUFFER_CAST (data);
|
||||||
|
#if 0
|
||||||
caps = GST_BUFFER_CAPS (buffer);
|
caps = GST_BUFFER_CAPS (buffer);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if 0
|
||||||
/* set caps before pushing the buffer so that core does not try to do
|
/* set caps before pushing the buffer so that core does not try to do
|
||||||
* something fancy to check if this is possible. */
|
* something fancy to check if this is possible. */
|
||||||
if (caps && caps != GST_PAD_CAPS (queue->srcpad))
|
if (caps && caps != GST_PAD_CAPS (queue->srcpad))
|
||||||
gst_pad_set_caps (queue->srcpad, caps);
|
gst_pad_set_caps (queue->srcpad, caps);
|
||||||
|
#endif
|
||||||
|
|
||||||
result = gst_pad_push (queue->srcpad, buffer);
|
result = gst_pad_push (queue->srcpad, buffer);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue