mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-21 21:46:22 +00:00
surfaceproxy: add helper to create a wrapped surface object.
Add new gst_vaapi_surface_proxy_new() helper to wrap a surface into a proxy. The main use case for that is to convey additional information at the proxy level that would not be suitable to the plain surface.
This commit is contained in:
parent
1810a41c68
commit
568a62ae1e
2 changed files with 50 additions and 5 deletions
|
@ -62,6 +62,51 @@ gst_vaapi_surface_proxy_class (void)
|
||||||
return &GstVaapiSurfaceProxyClass;
|
return &GstVaapiSurfaceProxyClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_vaapi_surface_proxy_init_properties (GstVaapiSurfaceProxy * proxy)
|
||||||
|
{
|
||||||
|
proxy->view_id = 0;
|
||||||
|
proxy->timestamp = GST_CLOCK_TIME_NONE;
|
||||||
|
proxy->duration = GST_CLOCK_TIME_NONE;
|
||||||
|
proxy->has_crop_rect = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_vaapi_surface_proxy_new:
|
||||||
|
* @surface: a #GstVaapiSurface
|
||||||
|
*
|
||||||
|
* Creates a new #GstVaapiSurfaceProxy with the specified
|
||||||
|
* surface. This allows for transporting additional information that
|
||||||
|
* are not to be attached to the @surface directly.
|
||||||
|
*
|
||||||
|
* Return value: the newly allocated #GstVaapiSurfaceProxy object
|
||||||
|
*/
|
||||||
|
GstVaapiSurfaceProxy *
|
||||||
|
gst_vaapi_surface_proxy_new (GstVaapiSurface * surface)
|
||||||
|
{
|
||||||
|
GstVaapiSurfaceProxy *proxy;
|
||||||
|
|
||||||
|
g_return_val_if_fail (surface != NULL, NULL);
|
||||||
|
|
||||||
|
proxy = (GstVaapiSurfaceProxy *)
|
||||||
|
gst_vaapi_mini_object_new (gst_vaapi_surface_proxy_class ());
|
||||||
|
if (!proxy)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
proxy->parent = NULL;
|
||||||
|
proxy->destroy_func = NULL;
|
||||||
|
proxy->pool = NULL;
|
||||||
|
proxy->surface = gst_vaapi_object_ref (surface);
|
||||||
|
if (!proxy->surface)
|
||||||
|
goto error;
|
||||||
|
gst_vaapi_surface_proxy_init_properties (proxy);
|
||||||
|
return proxy;
|
||||||
|
|
||||||
|
error:
|
||||||
|
gst_vaapi_surface_proxy_unref (proxy);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_vaapi_surface_proxy_new_from_pool:
|
* gst_vaapi_surface_proxy_new_from_pool:
|
||||||
* @pool: a #GstVaapiSurfacePool
|
* @pool: a #GstVaapiSurfacePool
|
||||||
|
@ -91,11 +136,8 @@ gst_vaapi_surface_proxy_new_from_pool (GstVaapiSurfacePool * pool)
|
||||||
proxy->surface = gst_vaapi_video_pool_get_object (proxy->pool);
|
proxy->surface = gst_vaapi_video_pool_get_object (proxy->pool);
|
||||||
if (!proxy->surface)
|
if (!proxy->surface)
|
||||||
goto error;
|
goto error;
|
||||||
proxy->view_id = 0;
|
|
||||||
proxy->timestamp = GST_CLOCK_TIME_NONE;
|
|
||||||
proxy->duration = GST_CLOCK_TIME_NONE;
|
|
||||||
proxy->has_crop_rect = FALSE;
|
|
||||||
gst_vaapi_object_ref (proxy->surface);
|
gst_vaapi_object_ref (proxy->surface);
|
||||||
|
gst_vaapi_surface_proxy_init_properties (proxy);
|
||||||
return proxy;
|
return proxy;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
@ -132,7 +174,7 @@ gst_vaapi_surface_proxy_copy (GstVaapiSurfaceProxy * proxy)
|
||||||
|
|
||||||
copy->parent = gst_vaapi_surface_proxy_ref (proxy->parent ?
|
copy->parent = gst_vaapi_surface_proxy_ref (proxy->parent ?
|
||||||
proxy->parent : proxy);
|
proxy->parent : proxy);
|
||||||
copy->pool = gst_vaapi_video_pool_ref (proxy->pool);
|
copy->pool = proxy->pool ? gst_vaapi_video_pool_ref (proxy->pool) : NULL;
|
||||||
copy->surface = gst_vaapi_object_ref (proxy->surface);
|
copy->surface = gst_vaapi_object_ref (proxy->surface);
|
||||||
copy->view_id = proxy->view_id;
|
copy->view_id = proxy->view_id;
|
||||||
copy->timestamp = proxy->timestamp;
|
copy->timestamp = proxy->timestamp;
|
||||||
|
|
|
@ -101,6 +101,9 @@ typedef enum
|
||||||
#define GST_VAAPI_SURFACE_PROXY_DURATION(proxy) \
|
#define GST_VAAPI_SURFACE_PROXY_DURATION(proxy) \
|
||||||
gst_vaapi_surface_proxy_get_duration (proxy)
|
gst_vaapi_surface_proxy_get_duration (proxy)
|
||||||
|
|
||||||
|
GstVaapiSurfaceProxy *
|
||||||
|
gst_vaapi_surface_proxy_new (GstVaapiSurface * surface);
|
||||||
|
|
||||||
GstVaapiSurfaceProxy *
|
GstVaapiSurfaceProxy *
|
||||||
gst_vaapi_surface_proxy_new_from_pool (GstVaapiSurfacePool * pool);
|
gst_vaapi_surface_proxy_new_from_pool (GstVaapiSurfacePool * pool);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue