summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authororestisf <orestisf1993@gmail.com>2017-07-25 22:25:10 +0300
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>2017-08-03 17:07:22 +0200
commitd4b6459bb2242c446d29eff7b86ea8f3a8ec1c72 (patch)
tree2056fbc57737778306ba99f50c116b9d28167ac5
parentac9ddc5e8daa9e48a48dd56fdaef869f1f8cc65c (diff)
vaapidecode: force add h264 MVC profiles in caps
When vaapih264dec's base-only profile is set to TRUE, fake MVC profile support in caps. https://bugzilla.gnome.org/show_bug.cgi?id=732265
-rw-r--r--gst/vaapi/gstvaapidecode.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/gst/vaapi/gstvaapidecode.c b/gst/vaapi/gstvaapidecode.c
index a0fd4b47..e1ac44f4 100644
--- a/gst/vaapi/gstvaapidecode.c
+++ b/gst/vaapi/gstvaapidecode.c
@@ -1154,11 +1154,29 @@ gst_vaapidecode_parse (GstVideoDecoder * vdec,
}
static gboolean
+is_mvc_profile (GstVaapiProfile profile)
+{
+ return profile == GST_VAAPI_PROFILE_H264_MULTIVIEW_HIGH
+ || profile == GST_VAAPI_PROFILE_H264_STEREO_HIGH;
+}
+
+static GstCaps *
+add_h264_profile_in_caps (GstCaps * caps, const gchar * profile_name)
+{
+ GstCaps *caps_new =
+ gst_caps_new_simple ("video/x-h264", "profile", profile_name, NULL);
+ return gst_caps_merge (caps_new, caps);
+}
+
+static gboolean
gst_vaapidecode_ensure_allowed_sinkpad_caps (GstVaapiDecode * decode)
{
GstCaps *caps, *allowed_sinkpad_caps;
GArray *profiles;
guint i;
+ gboolean base_only;
+ gboolean have_high = FALSE;
+ gboolean have_mvc = FALSE;
profiles =
gst_vaapi_display_get_decode_profiles (GST_VAAPI_PLUGIN_BASE_DISPLAY
@@ -1170,6 +1188,10 @@ gst_vaapidecode_ensure_allowed_sinkpad_caps (GstVaapiDecode * decode)
if (!allowed_sinkpad_caps)
goto error_no_memory;
+ if (g_object_class_find_property (G_OBJECT_GET_CLASS (decode), "base-only")) {
+ g_object_get (decode, "base-only", &base_only, NULL);
+ }
+
for (i = 0; i < profiles->len; i++) {
const GstVaapiProfile profile =
g_array_index (profiles, GstVaapiProfile, i);
@@ -1192,6 +1214,17 @@ gst_vaapidecode_ensure_allowed_sinkpad_caps (GstVaapiDecode * decode)
profile_name, NULL);
allowed_sinkpad_caps = gst_caps_merge (allowed_sinkpad_caps, caps);
+ have_mvc |= is_mvc_profile (profile);
+ have_high |= profile == GST_VAAPI_PROFILE_H264_HIGH;
+ }
+
+ if (base_only && !have_mvc && have_high) {
+ GST_DEBUG ("base_only: Force adding MVC profiles in caps");
+
+ allowed_sinkpad_caps =
+ add_h264_profile_in_caps (allowed_sinkpad_caps, "multiview-high");
+ allowed_sinkpad_caps =
+ add_h264_profile_in_caps (allowed_sinkpad_caps, "stereo-high");
}
decode->allowed_sinkpad_caps = gst_caps_simplify (allowed_sinkpad_caps);