mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +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
|
||||
on_int_notify (GstPad * internal, GParamSpec * unused, GstGhostPad * pad)
|
||||
{
|
||||
#if 0
|
||||
GstCaps *caps;
|
||||
gboolean changed;
|
||||
|
||||
|
@ -649,6 +650,7 @@ on_int_notify (GstPad * internal, GParamSpec * unused, GstGhostPad * pad)
|
|||
|
||||
if (caps)
|
||||
gst_caps_unref (caps);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -657,7 +659,9 @@ on_src_target_notify (GstPad * target, GParamSpec * unused, gpointer user_data)
|
|||
GstProxyPad *proxypad;
|
||||
GstGhostPad *gpad;
|
||||
GstCaps *caps;
|
||||
#if 0
|
||||
gboolean changed;
|
||||
#endif
|
||||
|
||||
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_OBJECT_UNLOCK (target);
|
||||
|
||||
#if 0
|
||||
GST_OBJECT_LOCK (gpad);
|
||||
|
||||
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");
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
g_object_unref (gpad);
|
||||
|
||||
|
|
|
@ -1519,7 +1519,7 @@ gst_base_parse_check_media (GstBaseParse * parse)
|
|||
GstCaps *caps;
|
||||
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))) {
|
||||
parse->priv->is_video =
|
||||
g_str_has_prefix (gst_structure_get_name (s), "video");
|
||||
|
@ -1527,6 +1527,8 @@ gst_base_parse_check_media (GstBaseParse * parse)
|
|||
/* historical default */
|
||||
parse->priv->is_video = FALSE;
|
||||
}
|
||||
if (caps)
|
||||
gst_caps_unref (caps);
|
||||
|
||||
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;
|
||||
|
||||
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_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);
|
||||
|
||||
/* 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 */
|
||||
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 */
|
||||
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 &&
|
||||
!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 we are operating in pull mode we only accept the negotiated caps */
|
||||
GST_OBJECT_LOCK (pad);
|
||||
if ((caps = GST_PAD_CAPS (pad)))
|
||||
gst_caps_ref (caps);
|
||||
GST_OBJECT_UNLOCK (pad);
|
||||
caps = gst_pad_get_current_caps (pad);
|
||||
}
|
||||
if (caps == NULL) {
|
||||
if (bclass->get_caps)
|
||||
|
|
|
@ -2161,12 +2161,6 @@ again:
|
|||
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 */
|
||||
status = gst_base_src_do_sync (src, *buf);
|
||||
|
||||
|
|
|
@ -763,6 +763,7 @@ gst_base_transform_configure_caps (GstBaseTransform * trans, GstCaps * in,
|
|||
return ret;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* 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
|
||||
* efficient check for this.
|
||||
|
@ -810,6 +811,7 @@ no_subset:
|
|||
return FALSE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* given a fixed @caps on @pad, create the best possible caps for the
|
||||
* other pad.
|
||||
|
@ -1303,6 +1305,7 @@ gst_base_transform_query_type (GstPad * pad)
|
|||
return types;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void
|
||||
compute_upstream_suggestion (GstBaseTransform * trans, gsize expsize,
|
||||
GstCaps * caps)
|
||||
|
@ -1348,6 +1351,7 @@ compute_upstream_suggestion (GstBaseTransform * trans, gsize expsize,
|
|||
gst_caps_unref (othercaps);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Allocate a buffer using gst_pad_alloc_buffer
|
||||
*
|
||||
|
@ -1364,9 +1368,9 @@ gst_base_transform_prepare_output_buffer (GstBaseTransform * trans,
|
|||
GstBaseTransformClass *bclass;
|
||||
GstBaseTransformPrivate *priv;
|
||||
GstFlowReturn ret = GST_FLOW_OK;
|
||||
gsize insize, outsize, newsize, expsize;
|
||||
gboolean discard, setcaps, copymeta;
|
||||
GstCaps *incaps, *oldcaps, *newcaps, *outcaps;
|
||||
gboolean discard, copymeta;
|
||||
gsize insize, outsize;
|
||||
GstCaps *incaps, *outcaps;
|
||||
|
||||
bclass = GST_BASE_TRANSFORM_GET_CLASS (trans);
|
||||
|
||||
|
@ -1374,6 +1378,9 @@ gst_base_transform_prepare_output_buffer (GstBaseTransform * trans,
|
|||
|
||||
*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);
|
||||
|
||||
/* 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");
|
||||
/* copy transform, figure out the output size */
|
||||
if (!gst_base_transform_transform_size (trans,
|
||||
GST_PAD_SINK, GST_PAD_CAPS (trans->sinkpad),
|
||||
insize, GST_PAD_CAPS (trans->srcpad), &outsize)) {
|
||||
GST_PAD_SINK, incaps, insize, outcaps, &outsize)) {
|
||||
goto unknown_size;
|
||||
}
|
||||
/* 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) {
|
||||
GST_DEBUG_OBJECT (trans,
|
||||
"calling prepare buffer with caps %p %" GST_PTR_FORMAT, oldcaps,
|
||||
oldcaps);
|
||||
"calling prepare buffer with caps %p %" GST_PTR_FORMAT, outcaps,
|
||||
outcaps);
|
||||
ret =
|
||||
bclass->prepare_output_buffer (trans, in_buf, outsize, oldcaps,
|
||||
bclass->prepare_output_buffer (trans, in_buf, outsize, outcaps,
|
||||
out_buf);
|
||||
|
||||
/* get a new ref to the srcpad caps, the prepare_output_buffer function can
|
||||
* 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:
|
||||
* 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);
|
||||
} else {
|
||||
GST_DEBUG_OBJECT (trans, "doing alloc with caps %" GST_PTR_FORMAT,
|
||||
oldcaps);
|
||||
outcaps);
|
||||
|
||||
*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)
|
||||
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;
|
||||
if (*out_buf == NULL) {
|
||||
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,
|
||||
* passthrough is not used and the gap flag is set */
|
||||
copymeta |= !trans->priv->gap_aware && !trans->passthrough
|
||||
&& (GST_MINI_OBJECT_FLAGS (*out_buf) & GST_BUFFER_FLAG_GAP);
|
||||
|
||||
if (setcaps || copymeta) {
|
||||
GST_DEBUG_OBJECT (trans, "setcaps %d, copymeta %d", setcaps, copymeta);
|
||||
if (copymeta) {
|
||||
GST_DEBUG_OBJECT (trans, "copymeta %d", copymeta);
|
||||
if (!gst_buffer_is_writable (*out_buf)) {
|
||||
GST_DEBUG_OBJECT (trans, "buffer %p not writable", *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);
|
||||
}
|
||||
/* when we get here, the metadata should be writable */
|
||||
if (setcaps)
|
||||
gst_buffer_set_caps (*out_buf, outcaps);
|
||||
if (copymeta)
|
||||
gst_buffer_copy_into (*out_buf, in_buf,
|
||||
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);
|
||||
}
|
||||
|
||||
done:
|
||||
if (incaps)
|
||||
gst_caps_unref (incaps);
|
||||
if (outcaps)
|
||||
gst_caps_unref (outcaps);
|
||||
|
||||
return ret;
|
||||
|
||||
/* ERRORS */
|
||||
alloc_failed:
|
||||
{
|
||||
GST_WARNING_OBJECT (trans, "pad-alloc failed: %s", gst_flow_get_name (ret));
|
||||
return ret;
|
||||
goto done;
|
||||
}
|
||||
no_buffer:
|
||||
{
|
||||
GST_ELEMENT_ERROR (trans, STREAM, NOT_IMPLEMENTED,
|
||||
("Sub-class failed to provide an output buffer"), (NULL));
|
||||
return GST_FLOW_ERROR;
|
||||
ret = GST_FLOW_ERROR;
|
||||
goto done;
|
||||
}
|
||||
unknown_size:
|
||||
{
|
||||
GST_ERROR_OBJECT (trans, "unknown output size");
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
failed_configure:
|
||||
{
|
||||
GST_WARNING_OBJECT (trans, "failed to configure caps");
|
||||
return GST_FLOW_NOT_NEGOTIATED;
|
||||
ret = GST_FLOW_ERROR;
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2272,15 +2157,18 @@ gst_base_transform_activate (GstBaseTransform * trans, gboolean active)
|
|||
bclass = GST_BASE_TRANSFORM_GET_CLASS (trans);
|
||||
|
||||
if (active) {
|
||||
GstCaps *incaps, *outcaps;
|
||||
|
||||
if (trans->priv->pad_mode == GST_ACTIVATE_NONE && bclass->start)
|
||||
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 =
|
||||
gst_caps_is_equal (GST_PAD_CAPS (trans->sinkpad),
|
||||
GST_PAD_CAPS (trans->srcpad)) || trans->passthrough;
|
||||
gst_caps_is_equal (incaps, outcaps) || trans->passthrough;
|
||||
else
|
||||
trans->have_same_caps = trans->passthrough;
|
||||
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->dropped = 0;
|
||||
trans->priv->force_alloc = TRUE;
|
||||
|
||||
GST_OBJECT_UNLOCK (trans);
|
||||
|
||||
if (incaps)
|
||||
gst_caps_unref (incaps);
|
||||
if (outcaps)
|
||||
gst_caps_unref (outcaps);
|
||||
} else {
|
||||
/* We must make sure streaming has finished before resetting things
|
||||
* 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 */
|
||||
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) {
|
||||
GST_DEBUG_OBJECT (capsfilter, "we had negotiated caps %" GST_PTR_FORMAT,
|
||||
nego);
|
||||
|
@ -198,6 +198,7 @@ gst_capsfilter_set_property (GObject * object, guint prop_id,
|
|||
suggest = gst_caps_copy (new_caps);
|
||||
}
|
||||
}
|
||||
gst_caps_unref (nego);
|
||||
} else {
|
||||
GST_DEBUG_OBJECT (capsfilter, "no negotiated caps");
|
||||
/* 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 */
|
||||
GstCaps *out_caps;
|
||||
|
||||
out_caps = GST_PAD_CAPS (trans->srcpad);
|
||||
|
||||
if (out_caps != NULL) {
|
||||
gst_caps_ref (out_caps);
|
||||
} else {
|
||||
out_caps = gst_pad_get_current_caps (trans->srcpad);
|
||||
if (out_caps == NULL) {
|
||||
out_caps = gst_pad_get_allowed_caps (trans->srcpad);
|
||||
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;
|
||||
|
||||
if (GST_PAD_CAPS (trans->srcpad) == NULL)
|
||||
if (!gst_pad_has_current_caps (trans->srcpad))
|
||||
gst_pad_set_caps (trans->srcpad, out_caps);
|
||||
} else {
|
||||
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);
|
||||
GstEvent *event = NULL;
|
||||
GstClockTime newts;
|
||||
#if 0
|
||||
GstCaps *padcaps;
|
||||
#endif
|
||||
|
||||
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))
|
||||
GST_WARNING_OBJECT (funnel, "Could not push out newsegment event");
|
||||
}
|
||||
|
||||
#if 0
|
||||
GST_OBJECT_LOCK (pad);
|
||||
padcaps = GST_PAD_CAPS (funnel->srcpad);
|
||||
GST_OBJECT_UNLOCK (pad);
|
||||
|
@ -282,12 +284,15 @@ gst_funnel_sink_chain (GstPad * pad, GstBuffer * buffer)
|
|||
goto out;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
res = gst_pad_push (funnel->srcpad, buffer);
|
||||
|
||||
GST_LOG_OBJECT (funnel, "handled buffer %s", gst_flow_get_name (res));
|
||||
|
||||
#if 0
|
||||
out:
|
||||
#endif
|
||||
gst_object_unref (funnel);
|
||||
|
||||
return res;
|
||||
|
|
|
@ -544,7 +544,9 @@ gst_selector_pad_chain (GstPad * pad, GstBuffer * buf)
|
|||
GstClockTime start_time;
|
||||
GstSegment *seg;
|
||||
GstEvent *close_event = NULL, *start_event = NULL;
|
||||
#if 0
|
||||
GstCaps *caps;
|
||||
#endif
|
||||
|
||||
sel = GST_INPUT_SELECTOR (gst_pad_get_parent (pad));
|
||||
selpad = GST_SELECTOR_PAD_CAST (pad);
|
||||
|
@ -633,10 +635,12 @@ gst_selector_pad_chain (GstPad * pad, GstBuffer * buf)
|
|||
/* forward */
|
||||
GST_LOG_OBJECT (pad, "Forwarding buffer %p", buf);
|
||||
|
||||
#if 0
|
||||
if ((caps = GST_BUFFER_CAPS (buf))) {
|
||||
if (GST_PAD_CAPS (sel->srcpad) != caps)
|
||||
gst_pad_set_caps (sel->srcpad, caps);
|
||||
}
|
||||
#endif
|
||||
|
||||
res = gst_pad_push (sel->srcpad, buf);
|
||||
selpad->pushed = TRUE;
|
||||
|
|
|
@ -952,12 +952,16 @@ gst_single_queue_push_one (GstMultiQueue * mq, GstSingleQueue * sq,
|
|||
if (GST_IS_BUFFER (object)) {
|
||||
GstBuffer *buffer;
|
||||
GstClockTime timestamp, duration;
|
||||
#if 0
|
||||
GstCaps *caps;
|
||||
#endif
|
||||
|
||||
buffer = GST_BUFFER_CAST (object);
|
||||
timestamp = GST_BUFFER_TIMESTAMP (buffer);
|
||||
duration = GST_BUFFER_DURATION (buffer);
|
||||
#if 0
|
||||
caps = GST_BUFFER_CAPS (buffer);
|
||||
#endif
|
||||
|
||||
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,
|
||||
sq->id, buffer, GST_TIME_ARGS (timestamp));
|
||||
|
||||
#if 0
|
||||
/* Set caps on pad before pushing, this avoids core calling the acceptcaps
|
||||
* function on the srcpad, which will call acceptcaps upstream, which might
|
||||
* not accept these caps (anymore). */
|
||||
if (caps && caps != GST_PAD_CAPS (sq->srcpad))
|
||||
gst_pad_set_caps (sq->srcpad, caps);
|
||||
#endif
|
||||
|
||||
result = gst_pad_push (sq->srcpad, buffer);
|
||||
} else if (GST_IS_EVENT (object)) {
|
||||
|
|
|
@ -1094,7 +1094,9 @@ gst_queue_push_one (GstQueue * queue)
|
|||
next:
|
||||
if (is_buffer) {
|
||||
GstBuffer *buffer;
|
||||
#if 0
|
||||
GstCaps *caps;
|
||||
#endif
|
||||
|
||||
buffer = GST_BUFFER_CAST (data);
|
||||
|
||||
|
@ -1109,10 +1111,12 @@ next:
|
|||
}
|
||||
queue->head_needs_discont = FALSE;
|
||||
}
|
||||
|
||||
#if 0
|
||||
caps = GST_BUFFER_CAPS (buffer);
|
||||
#endif
|
||||
|
||||
GST_QUEUE_MUTEX_UNLOCK (queue);
|
||||
#if 0
|
||||
/* 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
|
||||
* 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. */
|
||||
if (caps && caps != GST_PAD_CAPS (queue->srcpad))
|
||||
gst_pad_set_caps (queue->srcpad, caps);
|
||||
#endif
|
||||
|
||||
if (queue->push_newsegment) {
|
||||
gst_queue_push_newsegment (queue);
|
||||
|
|
|
@ -2204,15 +2204,21 @@ next:
|
|||
|
||||
if (is_buffer) {
|
||||
GstBuffer *buffer;
|
||||
#if 0
|
||||
GstCaps *caps;
|
||||
#endif
|
||||
|
||||
buffer = GST_BUFFER_CAST (data);
|
||||
#if 0
|
||||
caps = GST_BUFFER_CAPS (buffer);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/* set caps before pushing the buffer so that core does not try to do
|
||||
* something fancy to check if this is possible. */
|
||||
if (caps && caps != GST_PAD_CAPS (queue->srcpad))
|
||||
gst_pad_set_caps (queue->srcpad, caps);
|
||||
#endif
|
||||
|
||||
result = gst_pad_push (queue->srcpad, buffer);
|
||||
|
||||
|
|
Loading…
Reference in a new issue