plugins: update the src pad allocator video info

Update the size, stride and offset of the source pad allocator video
info, so the pool could set the correct GstVideoMeta

https://bugzilla.gnome.org/show_bug.cgi?id=774782
This commit is contained in:
Víctor Manuel Jáquez Leal 2016-11-21 12:51:25 +01:00
parent 432731e636
commit d799bb3041

View file

@ -559,8 +559,6 @@ ensure_srcpad_allocator (GstVaapiPluginBase * plugin, GstVideoInfo * vinfo,
if (different_caps) { if (different_caps) {
vi = plugin->srcpad_info; vi = plugin->srcpad_info;
/* let's keep the size of the allocation info */
GST_VIDEO_INFO_SIZE (&vi) = GST_VIDEO_INFO_SIZE (vinfo);
} else { } else {
vi = *vinfo; vi = *vinfo;
} }
@ -579,8 +577,23 @@ ensure_srcpad_allocator (GstVaapiPluginBase * plugin, GstVideoInfo * vinfo,
if (!plugin->srcpad_allocator) if (!plugin->srcpad_allocator)
goto error_create_allocator; goto error_create_allocator;
if (different_caps) if (different_caps) {
gst_allocator_set_vaapi_video_info (plugin->srcpad_allocator, &vi, 0); guint i, flags = 0;
const GstVideoInfo *alloc_vi =
gst_allocator_get_vaapi_video_info (plugin->srcpad_allocator, &flags);
/* update the planes and the size with the allocator image info,
* but not the resolution */
if (alloc_vi) {
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (alloc_vi); i++) {
GST_VIDEO_INFO_PLANE_OFFSET (&vi, i) =
GST_VIDEO_INFO_PLANE_OFFSET (alloc_vi, i);
GST_VIDEO_INFO_PLANE_STRIDE (&vi, i) =
GST_VIDEO_INFO_PLANE_STRIDE (alloc_vi, i);
}
GST_VIDEO_INFO_SIZE (&vi) = GST_VIDEO_INFO_SIZE (alloc_vi);
gst_allocator_set_vaapi_video_info (plugin->srcpad_allocator, &vi, flags);
}
}
return TRUE; return TRUE;