mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-04 22:48:54 +00:00
va: postproc: Use allocation caps when creating sink pool.
When an input buffer needs to be copied into a VA memory, it's required to create a buffer pool. This patch uses the propose_allocation() caps to instantiate the allocator and pool, instead of the negotiated caps, which rather represents the resolution to display. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2058>
This commit is contained in:
parent
ff3cce38b6
commit
b2a4e066ab
1 changed files with 28 additions and 15 deletions
|
@ -102,6 +102,7 @@ struct _GstVaVpp
|
|||
|
||||
GstCaps *incaps;
|
||||
GstCaps *outcaps;
|
||||
GstCaps *alloccaps;
|
||||
GstVideoInfo in_info;
|
||||
GstVideoInfo out_info;
|
||||
gboolean negotiated;
|
||||
|
@ -192,6 +193,7 @@ gst_va_vpp_dispose (GObject * object)
|
|||
|
||||
gst_clear_caps (&self->incaps);
|
||||
gst_clear_caps (&self->outcaps);
|
||||
gst_clear_caps (&self->alloccaps);
|
||||
|
||||
gst_clear_object (&self->filter);
|
||||
gst_clear_object (&self->display);
|
||||
|
@ -504,22 +506,24 @@ gst_va_vpp_propose_allocation (GstBaseTransform * trans,
|
|||
GstCaps *caps;
|
||||
guint size;
|
||||
|
||||
gst_clear_caps (&self->alloccaps);
|
||||
|
||||
if (!GST_BASE_TRANSFORM_CLASS (parent_class)->propose_allocation (trans,
|
||||
decide_query, query))
|
||||
return FALSE;
|
||||
|
||||
gst_query_parse_allocation (query, &caps, NULL);
|
||||
if (caps == NULL)
|
||||
return FALSE;
|
||||
if (!gst_video_info_from_caps (&info, caps))
|
||||
return FALSE;
|
||||
|
||||
self->alloccaps = gst_caps_ref (caps);
|
||||
|
||||
/* passthrough, we're done */
|
||||
if (decide_query == NULL)
|
||||
return TRUE;
|
||||
|
||||
gst_query_parse_allocation (query, &caps, NULL);
|
||||
|
||||
if (caps == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (!gst_video_info_from_caps (&info, caps))
|
||||
return FALSE;
|
||||
|
||||
size = GST_VIDEO_INFO_SIZE (&info);
|
||||
|
||||
if (gst_query_get_n_allocation_pools (query) == 0) {
|
||||
|
@ -1101,7 +1105,8 @@ _get_sinkpad_pool (GstVaVpp * self)
|
|||
{
|
||||
GstAllocator *allocator;
|
||||
GstAllocationParams params;
|
||||
GstVideoInfo alloc_info;
|
||||
GstCaps *caps;
|
||||
GstVideoInfo alloc_info, in_info;
|
||||
guint size, usage_hint = VA_SURFACE_ATTRIB_USAGE_HINT_VPP_READ;
|
||||
|
||||
if (self->sinkpad_pool)
|
||||
|
@ -1109,19 +1114,27 @@ _get_sinkpad_pool (GstVaVpp * self)
|
|||
|
||||
gst_allocation_params_init (¶ms);
|
||||
|
||||
size = GST_VIDEO_INFO_SIZE (&self->in_info);
|
||||
if (self->alloccaps) {
|
||||
caps = self->alloccaps;
|
||||
gst_video_info_from_caps (&in_info, caps);
|
||||
} else {
|
||||
caps = self->incaps;
|
||||
in_info = self->in_info;
|
||||
}
|
||||
|
||||
allocator = _create_allocator (self, self->incaps, usage_hint);
|
||||
size = GST_VIDEO_INFO_SIZE (&in_info);
|
||||
|
||||
self->sinkpad_pool = _create_sinkpad_bufferpool (self->incaps, size, 1, 0,
|
||||
usage_hint, allocator, ¶ms);
|
||||
allocator = _create_allocator (self, caps, usage_hint);
|
||||
|
||||
self->sinkpad_pool = _create_sinkpad_bufferpool (caps, size, 1, 0, usage_hint,
|
||||
allocator, ¶ms);
|
||||
|
||||
if (GST_IS_VA_DMABUF_ALLOCATOR (allocator)) {
|
||||
if (!gst_va_dmabuf_allocator_get_format (allocator, &alloc_info, NULL))
|
||||
alloc_info = self->in_info;
|
||||
alloc_info = in_info;
|
||||
} else if (GST_IS_VA_ALLOCATOR (allocator)) {
|
||||
if (!gst_va_allocator_get_format (allocator, &alloc_info, NULL))
|
||||
alloc_info = self->in_info;
|
||||
alloc_info = in_info;
|
||||
}
|
||||
|
||||
gst_object_unref (allocator);
|
||||
|
|
Loading…
Reference in a new issue