vaapivideomemory: add direction to dmabuf allocator

Add GstPadDirection param to gst_vaapi_dmabuf_allocator_new(), thus
we later could do different thing when the allocated memory is for
upstream or dowstream, as required by VA-API.

https://bugzilla.gnome.org/show_bug.cgi?id=755072
This commit is contained in:
Julien Isorce 2016-10-19 15:27:03 +01:00 committed by Víctor Manuel Jáquez Leal
parent a5650e8dc3
commit fbed3c3366
3 changed files with 11 additions and 3 deletions

View file

@ -509,7 +509,7 @@ ensure_sinkpad_allocator (GstVaapiPluginBase * plugin, GstCaps * caps,
if (has_dmabuf_capable_peer (plugin, plugin->sinkpad)) {
plugin->sinkpad_allocator =
gst_vaapi_dmabuf_allocator_new (plugin->display, &vinfo,
GST_VAAPI_SURFACE_ALLOC_FLAG_LINEAR_STORAGE);
GST_VAAPI_SURFACE_ALLOC_FLAG_LINEAR_STORAGE, GST_PAD_SINK);
goto bail;
}

View file

@ -1048,11 +1048,13 @@ gst_vaapi_dmabuf_allocator_init (GstVaapiDmaBufAllocator * allocator)
GstAllocator *const base_allocator = GST_ALLOCATOR_CAST (allocator);
base_allocator->mem_type = GST_VAAPI_DMABUF_ALLOCATOR_NAME;
allocator->direction = GST_PAD_SINK;
}
GstAllocator *
gst_vaapi_dmabuf_allocator_new (GstVaapiDisplay * display,
const GstVideoInfo * alloc_info, guint surface_alloc_flags)
const GstVideoInfo * alloc_info, guint surface_alloc_flags,
GstPadDirection direction)
{
GstVaapiDmaBufAllocator *allocator = NULL;
GstVaapiSurface *surface = NULL;
@ -1081,6 +1083,8 @@ gst_vaapi_dmabuf_allocator_new (GstVaapiDisplay * display,
gst_allocator_set_vaapi_video_info (base_allocator, &surface_info,
surface_alloc_flags);
allocator->direction = direction;
return base_allocator;
/* ERRORS */

View file

@ -243,6 +243,9 @@ gst_vaapi_dmabuf_memory_new (GstAllocator * allocator,
struct _GstVaapiDmaBufAllocator
{
GstDmaBufAllocator parent_instance;
/*< private >*/
GstPadDirection direction;
};
/**
@ -262,7 +265,8 @@ gst_vaapi_dmabuf_allocator_get_type (void) G_GNUC_CONST;
G_GNUC_INTERNAL
GstAllocator *
gst_vaapi_dmabuf_allocator_new (GstVaapiDisplay * display,
const GstVideoInfo * alloc_info, guint surface_alloc_flags);
const GstVideoInfo * alloc_info, guint surface_alloc_flags,
GstPadDirection direction);
G_GNUC_INTERNAL
const GstVideoInfo *