X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=plugins%2Felements%2Fgstcapsfilter.c;h=685e04dbcdeac862bf88b3ebb54e9d7303f9cf32;hb=9cdbffea9474d8cd5a810ab536af65ec00a37a36;hp=67eca31c10f7050e156b77eadafc245f049c1d99;hpb=a767bf2bf92f41ea9310b67a77fbc7413ee9d0ec;p=platform%2Fupstream%2Fgstreamer.git diff --git a/plugins/elements/gstcapsfilter.c b/plugins/elements/gstcapsfilter.c index 67eca31..685e04d 100644 --- a/plugins/elements/gstcapsfilter.c +++ b/plugins/elements/gstcapsfilter.c @@ -82,7 +82,7 @@ static gboolean gst_capsfilter_accept_caps (GstBaseTransform * base, static GstFlowReturn gst_capsfilter_transform_ip (GstBaseTransform * base, GstBuffer * buf); static GstFlowReturn gst_capsfilter_prepare_buf (GstBaseTransform * trans, - GstBuffer * input, gint size, GstCaps * caps, GstBuffer ** buf); + GstBuffer * input, GstBuffer ** buf); static void gst_capsfilter_class_init (GstCapsFilterClass * klass) @@ -131,14 +131,6 @@ gst_capsfilter_init (GstCapsFilter * filter) filter->filter_caps = gst_caps_new_any (); } -static gboolean -copy_func (GQuark field_id, const GValue * value, GstStructure * dest) -{ - gst_structure_id_set_value (dest, field_id, value); - - return TRUE; -} - static void gst_capsfilter_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) @@ -148,7 +140,7 @@ gst_capsfilter_set_property (GObject * object, guint prop_id, switch (prop_id) { case PROP_FILTER_CAPS:{ GstCaps *new_caps; - GstCaps *old_caps, *suggest, *nego; + GstCaps *old_caps; const GstCaps *new_caps_val = gst_value_get_caps (value); if (new_caps_val == NULL) { @@ -167,50 +159,7 @@ gst_capsfilter_set_property (GObject * object, guint prop_id, GST_DEBUG_OBJECT (capsfilter, "set new caps %" GST_PTR_FORMAT, new_caps); - /* filter the currently negotiated format against the new caps */ - 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); - - if (G_UNLIKELY (gst_caps_is_any (new_caps))) { - GST_DEBUG_OBJECT (capsfilter, "not settings any suggestion"); - - suggest = NULL; - } else { - GstStructure *s1, *s2; - - /* first check if the name is the same */ - s1 = gst_caps_get_structure (nego, 0); - s2 = gst_caps_get_structure (new_caps, 0); - - if (gst_structure_get_name_id (s1) == gst_structure_get_name_id (s2)) { - /* same name, copy all fields from the new caps into the previously - * negotiated caps */ - suggest = gst_caps_copy (nego); - s1 = gst_caps_get_structure (suggest, 0); - gst_structure_foreach (s2, (GstStructureForeachFunc) copy_func, s1); - GST_DEBUG_OBJECT (capsfilter, "copied structure fields"); - } else { - GST_DEBUG_OBJECT (capsfilter, "different structure names"); - /* different names, we can only suggest the complete caps */ - 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 - * caps */ - suggest = NULL; - } - - GST_DEBUG_OBJECT (capsfilter, "suggesting new caps %" GST_PTR_FORMAT, - suggest); - gst_base_transform_suggest (GST_BASE_TRANSFORM (object), suggest, 0); - if (suggest) - gst_caps_unref (suggest); - + gst_base_transform_reconfigure_sink (GST_BASE_TRANSFORM (object)); break; } default: @@ -295,9 +244,13 @@ gst_capsfilter_accept_caps (GstBaseTransform * base, if (ret) { /* if we can intersect, see if the other end also accepts */ if (direction == GST_PAD_SRC) - ret = gst_pad_peer_accept_caps (GST_BASE_TRANSFORM_SINK_PAD (base), caps); + ret = + gst_pad_peer_query_accept_caps (GST_BASE_TRANSFORM_SINK_PAD (base), + caps); else - ret = gst_pad_peer_accept_caps (GST_BASE_TRANSFORM_SRC_PAD (base), caps); + ret = + gst_pad_peer_query_accept_caps (GST_BASE_TRANSFORM_SRC_PAD (base), + caps); GST_DEBUG_OBJECT (capsfilter, "peer accept: %d", ret); } @@ -326,13 +279,12 @@ gst_capsfilter_transform_ip (GstBaseTransform * base, GstBuffer * buf) */ static GstFlowReturn gst_capsfilter_prepare_buf (GstBaseTransform * trans, GstBuffer * input, - gint size, GstCaps * caps, GstBuffer ** buf) + GstBuffer ** buf) { GstFlowReturn ret = GST_FLOW_OK; - /* always ref input as output buffer */ + /* always return the input as output buffer */ *buf = input; - gst_buffer_ref (input); if (!gst_pad_has_current_caps (trans->sinkpad)) { /* Buffer has no caps. See if the output pad only supports fixed caps */ @@ -346,8 +298,7 @@ gst_capsfilter_prepare_buf (GstBaseTransform * trans, GstBuffer * input, g_return_val_if_fail (out_caps != NULL, GST_FLOW_ERROR); } - out_caps = gst_caps_make_writable (out_caps); - gst_caps_do_simplify (out_caps); + out_caps = gst_caps_do_simplify (out_caps); if (gst_caps_is_fixed (out_caps) && !gst_caps_is_empty (out_caps)) { GST_DEBUG_OBJECT (trans, "Have fixed output caps %" @@ -355,6 +306,7 @@ gst_capsfilter_prepare_buf (GstBaseTransform * trans, GstBuffer * input, if (!gst_pad_has_current_caps (trans->srcpad)) gst_pad_push_event (trans->srcpad, gst_event_new_caps (out_caps)); + gst_caps_unref (out_caps); } else { gchar *caps_str = gst_caps_to_string (out_caps);