mem->meta = meta ? gst_vaapi_video_meta_ref (meta) : NULL;
mem->map_type = 0;
mem->map_count = 0;
+ mem->map_surface_id = VA_INVALID_ID;
mem->usage_flag = allocator->usage_flag;
g_mutex_init (&mem->lock);
g_mutex_lock (&mem->lock);
if (mem->map_count == 0) {
- switch (flags & GST_MAP_READWRITE) {
+ switch (flags & (GST_MAP_READWRITE | GST_MAP_VAAPI)) {
case 0:
+ case GST_MAP_VAAPI:
// No flags set: return a GstVaapiSurfaceProxy
gst_vaapi_surface_proxy_replace (&mem->proxy,
gst_vaapi_video_meta_get_surface_proxy (mem->meta));
case GST_VAAPI_VIDEO_MEMORY_MAP_TYPE_SURFACE:
if (!mem->proxy)
goto error_no_surface_proxy;
- data = mem->proxy;
+
+ if (flags == GST_MAP_VAAPI) {
+ mem->map_surface_id = GST_VAAPI_SURFACE_PROXY_SURFACE_ID (mem->proxy);
+ if (mem->map_surface_id == VA_INVALID_ID)
+ goto error_no_current_surface;
+
+ data = &mem->map_surface_id;
+ } else {
+ data = mem->proxy;
+ }
break;
case GST_VAAPI_VIDEO_MEMORY_MAP_TYPE_LINEAR:
if (!mem->image)
if (mem->map_count == 1) {
switch (mem->map_type) {
case GST_VAAPI_VIDEO_MEMORY_MAP_TYPE_SURFACE:
+ mem->map_surface_id = VA_INVALID_ID;
gst_vaapi_surface_proxy_replace (&mem->proxy, NULL);
break;
case GST_VAAPI_VIDEO_MEMORY_MAP_TYPE_LINEAR:
GstVaapiVideoMeta *meta;
guint map_type;
gint map_count;
+ VASurfaceID map_surface_id;
GstVaapiImageUsageFlags usage_flag;
GMutex lock;
};
/* ------------------------------------------------------------------------ */
/* --- GstVaapiVideoAllocator --- */
/* ------------------------------------------------------------------------ */
+#define GST_MAP_VAAPI (GST_MAP_FLAG_LAST << 1)
#define GST_VAAPI_VIDEO_ALLOCATOR_CAST(allocator) \
((GstVaapiVideoAllocator *) (allocator))