vaapisink: Fix wrong caps advertising

The get_caps() should only report the supported formats.

https://bugzilla.gnome.org/show_bug.cgi?id=761147
This commit is contained in:
Sreerenj Balachandran 2016-02-04 10:16:00 +02:00 committed by Víctor Manuel Jáquez Leal
parent d9beeafe4b
commit 1f6d29641d

View file

@ -1206,18 +1206,32 @@ gst_vaapisink_get_caps_impl (GstBaseSink * base_sink)
{
GstVaapiSink *const sink = GST_VAAPISINK_CAST (base_sink);
GstCaps *out_caps, *raw_caps;
static const char surface_caps_str[] =
GST_VAAPI_MAKE_ENC_SURFACE_CAPS ";"
GST_VIDEO_CAPS_MAKE_WITH_FEATURES (GST_CAPS_FEATURE_MEMORY_VAAPI_SURFACE
"," GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION,
"{ ENCODED, NV12, I420, YV12 }");
out_caps = gst_static_pad_template_get_caps (&gst_vaapisink_sink_factory);
if (!out_caps)
return NULL;
GstCapsFeatures *const features =
gst_caps_features_new
(GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION, NULL);
out_caps = gst_caps_from_string (surface_caps_str);
if (GST_VAAPI_PLUGIN_BASE_DISPLAY (sink)) {
raw_caps =
gst_vaapi_plugin_base_get_allowed_raw_caps (GST_VAAPI_PLUGIN_BASE
(sink));
if (raw_caps) {
GstCaps *feature_caps;
out_caps = gst_caps_make_writable (out_caps);
gst_caps_append (out_caps, gst_caps_copy (raw_caps));
feature_caps = gst_caps_copy (raw_caps);
gst_caps_set_features (feature_caps, 0, features);
gst_caps_append (out_caps, feature_caps);
}
}
return out_caps;