vaapidecode: fix srcpad caps for GStreamer 1.2.

The srcpad caps exposed for GStreamer 1.2 were missing any useful info
like framerate, pixel-aspect-ratio, interlace-mode et al. Not to mention
that it relied on possibly un-initialized data. Fix srcpad caps to be
initialized from a sanitized copy of GstVideoDecoder output state caps.

Note: the correct way to expose the srcpad caps triggers an additional
issue in core GStreamer auto-plugging capabilities as the correct caps
to be exposed should be format=ENCODED with memory:VASurface caps feature
at the minimum. In some situations, we could determine the underlying
VA surface format, but this is not always possible. e.g. cases where it
is not allowed to expose the underlying VA surface data, or when the
VA driver implementation cannot actually provide such information.
This commit is contained in:
Gwenole Beauchesne 2013-11-20 10:56:28 +01:00
parent d556c0a37a
commit 7e8470e1ec

View file

@ -191,6 +191,15 @@ gst_vaapidecode_update_src_caps(GstVaapiDecode *decode,
gst_video_codec_state_unref(state);
#if GST_CHECK_VERSION(1,1,0)
vis = *vi;
if (GST_VIDEO_INFO_FORMAT(vi) == GST_VIDEO_FORMAT_ENCODED) {
/* XXX: this is a workaround until auto-plugging is fixed when
format=ENCODED + memory:VASurface caps feature are provided.
Meanwhile, providing a random format here works but this is
a terribly wrong thing per se. */
gst_video_info_set_format(&vis, GST_VIDEO_FORMAT_NV12,
GST_VIDEO_INFO_WIDTH(vi), GST_VIDEO_INFO_HEIGHT(vi));
}
state->caps = gst_video_info_to_caps(&vis);
#else
/* XXX: gst_video_info_to_caps() from GStreamer 0.10 does not