mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 08:46:40 +00:00
vapostproc: Traverse caps features in gst_va_vpp_caps_remove_fields()
The previous code had a potential failure for multiple caps features. Now each caps feature in each structure is reviewed, and if it has a supported feature, the structure is processed. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1024>
This commit is contained in:
parent
c00ad9e70c
commit
7e53161ea5
1 changed files with 23 additions and 16 deletions
|
@ -782,7 +782,7 @@ gst_va_vpp_caps_remove_fields (GstCaps * caps)
|
|||
GstCaps *ret;
|
||||
GstStructure *structure;
|
||||
GstCapsFeatures *features;
|
||||
gint i, n;
|
||||
gint i, j, n, m;
|
||||
|
||||
ret = gst_caps_new_empty ();
|
||||
|
||||
|
@ -798,10 +798,14 @@ gst_va_vpp_caps_remove_fields (GstCaps * caps)
|
|||
|
||||
structure = gst_structure_copy (structure);
|
||||
|
||||
if (gst_caps_features_is_equal (features,
|
||||
GST_CAPS_FEATURES_MEMORY_SYSTEM_MEMORY)
|
||||
|| gst_caps_features_contains (features, GST_CAPS_FEATURE_MEMORY_DMABUF)
|
||||
|| gst_caps_features_contains (features, GST_CAPS_FEATURE_MEMORY_VA)) {
|
||||
m = gst_caps_features_get_size (features);
|
||||
for (j = 0; j < m; j++) {
|
||||
const gchar *feature = gst_caps_features_get_nth (features, j);
|
||||
|
||||
if (g_strcmp0 (feature, GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY) == 0
|
||||
|| g_strcmp0 (feature, GST_CAPS_FEATURE_MEMORY_DMABUF) == 0
|
||||
|| g_strcmp0 (feature, GST_CAPS_FEATURE_MEMORY_VA) == 0) {
|
||||
|
||||
/* rangify frame size */
|
||||
gst_structure_set (structure, "width", GST_TYPE_INT_RANGE, 1, G_MAXINT,
|
||||
"height", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
|
||||
|
@ -815,6 +819,9 @@ gst_va_vpp_caps_remove_fields (GstCaps * caps)
|
|||
/* remove format-related fields */
|
||||
gst_structure_remove_fields (structure, "format", "colorimetry",
|
||||
"chroma-site", NULL);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
gst_caps_append_structure_full (ret, structure,
|
||||
|
|
Loading…
Reference in a new issue