mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-30 12:10:37 +00:00
plugins: simplify VA video meta to only reference surface proxies.
Simplify GstVaapiVideoMeta to only hold a surface proxy, which is now allocated from a surface pool. This also means that the local reference to the VA surface is also gone, as it could be extracted from the associated surface proxy.
This commit is contained in:
parent
d45658ba5a
commit
3324cdfb61
1 changed files with 12 additions and 36 deletions
|
@ -43,8 +43,6 @@ struct _GstVaapiVideoMeta {
|
||||||
GstVaapiDisplay *display;
|
GstVaapiDisplay *display;
|
||||||
GstVaapiVideoPool *image_pool;
|
GstVaapiVideoPool *image_pool;
|
||||||
GstVaapiImage *image;
|
GstVaapiImage *image;
|
||||||
GstVaapiVideoPool *surface_pool;
|
|
||||||
GstVaapiSurface *surface;
|
|
||||||
GstVaapiSurfaceProxy *proxy;
|
GstVaapiSurfaceProxy *proxy;
|
||||||
GFunc converter;
|
GFunc converter;
|
||||||
guint render_flags;
|
guint render_flags;
|
||||||
|
@ -73,18 +71,12 @@ set_image_from_pool(GstVaapiVideoMeta *meta, GstVaapiVideoPool *pool)
|
||||||
image = gst_vaapi_video_pool_get_object(pool);
|
image = gst_vaapi_video_pool_get_object(pool);
|
||||||
if (!image)
|
if (!image)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
set_image(meta, image);
|
set_image(meta, image);
|
||||||
meta->image_pool = gst_vaapi_video_pool_ref(pool);
|
meta->image_pool = gst_vaapi_video_pool_ref(pool);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
|
||||||
set_surface(GstVaapiVideoMeta *meta, GstVaapiSurface *surface)
|
|
||||||
{
|
|
||||||
meta->surface = gst_vaapi_object_ref(surface);
|
|
||||||
set_display(meta, gst_vaapi_object_get_display(GST_VAAPI_OBJECT(surface)));
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
set_surface_proxy(GstVaapiVideoMeta *meta, GstVaapiSurfaceProxy *proxy)
|
set_surface_proxy(GstVaapiVideoMeta *meta, GstVaapiSurfaceProxy *proxy)
|
||||||
{
|
{
|
||||||
|
@ -94,8 +86,8 @@ set_surface_proxy(GstVaapiVideoMeta *meta, GstVaapiSurfaceProxy *proxy)
|
||||||
if (!surface)
|
if (!surface)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
set_surface(meta, surface);
|
|
||||||
meta->proxy = gst_vaapi_surface_proxy_ref(proxy);
|
meta->proxy = gst_vaapi_surface_proxy_ref(proxy);
|
||||||
|
set_display(meta, gst_vaapi_object_get_display(GST_VAAPI_OBJECT(surface)));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,11 +103,7 @@ set_surface_proxy_from_pool(GstVaapiVideoMeta *meta, GstVaapiVideoPool *pool)
|
||||||
|
|
||||||
success = set_surface_proxy(meta, proxy);
|
success = set_surface_proxy(meta, proxy);
|
||||||
gst_vaapi_surface_proxy_unref(proxy);
|
gst_vaapi_surface_proxy_unref(proxy);
|
||||||
if (!success)
|
return success;
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
meta->surface_pool = gst_vaapi_video_pool_ref(pool);
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -130,18 +118,10 @@ gst_vaapi_video_meta_destroy_image(GstVaapiVideoMeta *meta)
|
||||||
gst_vaapi_video_pool_replace(&meta->image_pool, NULL);
|
gst_vaapi_video_pool_replace(&meta->image_pool, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static inline void
|
||||||
gst_vaapi_video_meta_destroy_surface(GstVaapiVideoMeta *meta)
|
gst_vaapi_video_meta_destroy_proxy(GstVaapiVideoMeta *meta)
|
||||||
{
|
{
|
||||||
gst_vaapi_surface_proxy_replace(&meta->proxy, NULL);
|
gst_vaapi_surface_proxy_replace(&meta->proxy, NULL);
|
||||||
|
|
||||||
if (meta->surface) {
|
|
||||||
if (meta->surface_pool)
|
|
||||||
gst_vaapi_video_pool_put_object(meta->surface_pool, meta->surface);
|
|
||||||
gst_vaapi_object_unref(meta->surface);
|
|
||||||
meta->surface = NULL;
|
|
||||||
}
|
|
||||||
gst_vaapi_video_pool_replace(&meta->surface_pool, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !GST_CHECK_VERSION(1,0,0)
|
#if !GST_CHECK_VERSION(1,0,0)
|
||||||
|
@ -166,7 +146,7 @@ static void
|
||||||
gst_vaapi_video_meta_finalize(GstVaapiVideoMeta *meta)
|
gst_vaapi_video_meta_finalize(GstVaapiVideoMeta *meta)
|
||||||
{
|
{
|
||||||
gst_vaapi_video_meta_destroy_image(meta);
|
gst_vaapi_video_meta_destroy_image(meta);
|
||||||
gst_vaapi_video_meta_destroy_surface(meta);
|
gst_vaapi_video_meta_destroy_proxy(meta);
|
||||||
gst_vaapi_display_replace(&meta->display, NULL);
|
gst_vaapi_display_replace(&meta->display, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,8 +157,6 @@ gst_vaapi_video_meta_init(GstVaapiVideoMeta *meta)
|
||||||
meta->display = NULL;
|
meta->display = NULL;
|
||||||
meta->image_pool = NULL;
|
meta->image_pool = NULL;
|
||||||
meta->image = NULL;
|
meta->image = NULL;
|
||||||
meta->surface_pool = NULL;
|
|
||||||
meta->surface = NULL;
|
|
||||||
meta->proxy = NULL;
|
meta->proxy = NULL;
|
||||||
meta->converter = NULL;
|
meta->converter = NULL;
|
||||||
meta->render_flags = 0;
|
meta->render_flags = 0;
|
||||||
|
@ -237,7 +215,7 @@ gst_vaapi_video_meta_copy(GstVaapiVideoMeta *meta)
|
||||||
|
|
||||||
g_return_val_if_fail(GST_VAAPI_IS_VIDEO_META(meta), NULL);
|
g_return_val_if_fail(GST_VAAPI_IS_VIDEO_META(meta), NULL);
|
||||||
|
|
||||||
if (meta->image_pool || meta->surface_pool)
|
if (meta->image_pool)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
copy = _gst_vaapi_video_meta_create();
|
copy = _gst_vaapi_video_meta_create();
|
||||||
|
@ -248,10 +226,8 @@ gst_vaapi_video_meta_copy(GstVaapiVideoMeta *meta)
|
||||||
copy->display = gst_vaapi_display_ref(meta->display);
|
copy->display = gst_vaapi_display_ref(meta->display);
|
||||||
copy->image_pool = NULL;
|
copy->image_pool = NULL;
|
||||||
copy->image = meta->image ? gst_vaapi_object_ref(meta->image) : NULL;
|
copy->image = meta->image ? gst_vaapi_object_ref(meta->image) : NULL;
|
||||||
copy->surface_pool = NULL;
|
|
||||||
copy->surface = meta->surface ? gst_vaapi_object_ref(meta->surface) : NULL;
|
|
||||||
copy->proxy = meta->proxy ?
|
copy->proxy = meta->proxy ?
|
||||||
gst_vaapi_surface_proxy_ref(meta->proxy) : NULL;
|
gst_vaapi_surface_proxy_copy(meta->proxy) : NULL;
|
||||||
copy->converter = meta->converter;
|
copy->converter = meta->converter;
|
||||||
copy->render_flags = meta->render_flags;
|
copy->render_flags = meta->render_flags;
|
||||||
|
|
||||||
|
@ -550,7 +526,7 @@ gst_vaapi_video_meta_get_surface(GstVaapiVideoMeta *meta)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail(GST_VAAPI_IS_VIDEO_META(meta), NULL);
|
g_return_val_if_fail(GST_VAAPI_IS_VIDEO_META(meta), NULL);
|
||||||
|
|
||||||
return meta->surface;
|
return meta->proxy ? GST_VAAPI_SURFACE_PROXY_SURFACE(meta->proxy) : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -589,7 +565,7 @@ gst_vaapi_video_meta_set_surface_proxy(GstVaapiVideoMeta *meta,
|
||||||
|
|
||||||
g_return_if_fail(GST_VAAPI_IS_VIDEO_META(meta));
|
g_return_if_fail(GST_VAAPI_IS_VIDEO_META(meta));
|
||||||
|
|
||||||
gst_vaapi_video_meta_destroy_surface(meta);
|
gst_vaapi_video_meta_destroy_proxy(meta);
|
||||||
|
|
||||||
if (proxy) {
|
if (proxy) {
|
||||||
if (!set_surface_proxy(meta, proxy))
|
if (!set_surface_proxy(meta, proxy))
|
||||||
|
@ -644,7 +620,7 @@ guint
|
||||||
gst_vaapi_video_meta_get_render_flags(GstVaapiVideoMeta *meta)
|
gst_vaapi_video_meta_get_render_flags(GstVaapiVideoMeta *meta)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail(GST_VAAPI_IS_VIDEO_META(meta), 0);
|
g_return_val_if_fail(GST_VAAPI_IS_VIDEO_META(meta), 0);
|
||||||
g_return_val_if_fail(meta->surface != NULL, 0);
|
g_return_val_if_fail(meta->proxy != NULL, 0);
|
||||||
|
|
||||||
return meta->render_flags;
|
return meta->render_flags;
|
||||||
}
|
}
|
||||||
|
@ -660,7 +636,7 @@ void
|
||||||
gst_vaapi_video_meta_set_render_flags(GstVaapiVideoMeta *meta, guint flags)
|
gst_vaapi_video_meta_set_render_flags(GstVaapiVideoMeta *meta, guint flags)
|
||||||
{
|
{
|
||||||
g_return_if_fail(GST_VAAPI_IS_VIDEO_META(meta));
|
g_return_if_fail(GST_VAAPI_IS_VIDEO_META(meta));
|
||||||
g_return_if_fail(meta->surface != NULL);
|
g_return_if_fail(meta->proxy != NULL);
|
||||||
|
|
||||||
meta->render_flags = flags;
|
meta->render_flags = flags;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue