mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-21 07:46:38 +00:00
capsfilter: Properly reset the capsfilter when setting caps ANY.
This commit is contained in:
parent
013f4a58d5
commit
69b8a22ffa
1 changed files with 22 additions and 16 deletions
|
@ -165,26 +165,32 @@ gst_capsfilter_set_property (GObject * object, guint prop_id,
|
||||||
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_CAPS (GST_BASE_TRANSFORM_SINK_PAD (object));
|
||||||
if (nego) {
|
if (nego) {
|
||||||
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);
|
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (capsfilter, "we had negotiated caps %" GST_PTR_FORMAT,
|
GST_DEBUG_OBJECT (capsfilter, "we had negotiated caps %" GST_PTR_FORMAT,
|
||||||
nego);
|
nego);
|
||||||
|
|
||||||
if (gst_structure_get_name_id (s1) == gst_structure_get_name_id (s2)) {
|
if (G_UNLIKELY (gst_caps_is_any (new_caps))) {
|
||||||
/* same name, copy all fields from the new caps into the previously
|
GST_DEBUG_OBJECT (capsfilter, "not settings any suggestion");
|
||||||
* negotiated caps */
|
|
||||||
suggest = gst_caps_copy (nego);
|
suggest = NULL;
|
||||||
s1 = gst_caps_get_structure (suggest, 0);
|
|
||||||
gst_structure_foreach (s2, (GstStructureForeachFunc) copy_func, s1);
|
|
||||||
GST_DEBUG_OBJECT (capsfilter, "copied structure fields");
|
|
||||||
} else {
|
} else {
|
||||||
GST_DEBUG_OBJECT (capsfilter, "different structure names");
|
GstStructure *s1, *s2;
|
||||||
/* different names, we can only suggest the complete caps */
|
|
||||||
suggest = gst_caps_copy (new_caps);
|
/* 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
GST_DEBUG_OBJECT (capsfilter, "no negotiated caps");
|
GST_DEBUG_OBJECT (capsfilter, "no negotiated caps");
|
||||||
|
|
Loading…
Reference in a new issue