summaryrefslogtreecommitdiff
path: root/gst
diff options
context:
space:
mode:
authorVíctor Manuel Jáquez Leal <vjaquez@igalia.com>2020-07-29 13:39:44 +0200
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>2020-07-29 16:41:58 +0000
commit80b1e53cccfe91e96c17d2015918b565b4315eb5 (patch)
tree49319e69eb167b8d0aa10bd7927ee9bb04d475e3 /gst
parentcf3b0120cb349e954230266c095fa71c12353488 (diff)
downloadgstreamer-vaapi-80b1e53cccfe91e96c17d2015918b565b4315eb5.tar.gz
vaapipluginutil: simplify gst_vaapi_find_preferred_caps_feature()
Generalize the way how the preferred color format is chosen. Also use new GStreamre API as syntatic sugar. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/370>
Diffstat (limited to 'gst')
-rw-r--r--gst/vaapi/gstvaapipluginutil.c30
1 files changed, 10 insertions, 20 deletions
diff --git a/gst/vaapi/gstvaapipluginutil.c b/gst/vaapi/gstvaapipluginutil.c
index aa485314..f5eb6d56 100644
--- a/gst/vaapi/gstvaapipluginutil.c
+++ b/gst/vaapi/gstvaapipluginutil.c
@@ -683,7 +683,7 @@ gst_vaapi_find_preferred_caps_feature (GstPad * pad, GstCaps * allowed_caps,
caps = gst_caps_new_full (gst_structure_copy (structure), NULL);
if (!caps)
continue;
- gst_caps_set_features (caps, 0, gst_caps_features_copy (features));
+ gst_caps_set_features_simple (caps, gst_caps_features_copy (features));
for (j = 0; j < G_N_ELEMENTS (feature_list); j++) {
if (gst_vaapi_caps_feature_contains (caps, feature_list[j])
@@ -699,33 +699,23 @@ gst_vaapi_find_preferred_caps_feature (GstPad * pad, GstCaps * allowed_caps,
break;
}
+find_format:
if (!caps)
- goto cleanup;
+ caps = gst_caps_ref (out_caps);
-find_format:
if (out_format_ptr) {
GstVideoFormat out_format;
GstStructure *structure = NULL;
const GValue *format_list;
- GstCapsFeatures *features;
-
- /* if the best feature is SystemMemory, we should choose the
- * vidoe/x-raw caps in the filtered peer caps set. If not, use
- * the first caps, which is the preferred by downstream. */
- if (feature == GST_VAAPI_CAPS_FEATURE_SYSTEM_MEMORY) {
- gst_caps_replace (&caps, out_caps);
- num_structures = gst_caps_get_size (caps);
- for (i = 0; i < num_structures; i++) {
+
+ num_structures = gst_caps_get_size (caps);
+ for (i = 0; i < num_structures; i++) {
+ GstCapsFeatures *const features = gst_caps_get_features (caps, i);
+ if (gst_caps_features_contains (features,
+ gst_vaapi_caps_feature_to_string (feature))) {
structure = gst_caps_get_structure (caps, i);
- features = gst_caps_get_features (caps, i);
- if (!gst_caps_features_is_any (features)
- && gst_caps_features_contains (features,
- gst_vaapi_caps_feature_to_string
- (GST_VAAPI_CAPS_FEATURE_SYSTEM_MEMORY)))
- break;
+ break;
}
- } else {
- structure = gst_caps_get_structure (caps, 0);
}
if (!structure)
goto cleanup;