diff --git a/docs/reference/libs/libs-sections.txt b/docs/reference/libs/libs-sections.txt index fcb701ec69..33f645b556 100644 --- a/docs/reference/libs/libs-sections.txt +++ b/docs/reference/libs/libs-sections.txt @@ -402,10 +402,7 @@ gst_vaapi_context_set_profile gst_vaapi_context_get_entrypoint gst_vaapi_context_get_size gst_vaapi_context_get_surface_proxy -gst_vaapi_context_get_surface gst_vaapi_context_get_surface_count -gst_vaapi_context_put_surface -gst_vaapi_context_find_surface_by_id gst_vaapi_context_apply_composition GST_VAAPI_CONTEXT @@ -524,16 +521,12 @@ GST_VAAPI_DECODER_VC1_GET_CLASS
gstvaapisurfaceproxy GstVaapiSurfaceProxy -gst_vaapi_surface_proxy_get_context gst_vaapi_surface_proxy_get_surface gst_vaapi_surface_proxy_get_surface_id gst_vaapi_surface_proxy_get_user_data -gst_vaapi_surface_proxy_new gst_vaapi_surface_proxy_new_from_pool gst_vaapi_surface_proxy_ref gst_vaapi_surface_proxy_replace -gst_vaapi_surface_proxy_set_context -gst_vaapi_surface_proxy_set_surface gst_vaapi_surface_proxy_set_user_data gst_vaapi_surface_proxy_unref diff --git a/gst-libs/gst/vaapi/gstvaapicontext.c b/gst-libs/gst/vaapi/gstvaapicontext.c index 44cafc469a..d9ee4cddbe 100644 --- a/gst-libs/gst/vaapi/gstvaapicontext.c +++ b/gst-libs/gst/vaapi/gstvaapicontext.c @@ -1024,25 +1024,6 @@ gst_vaapi_context_get_surface_proxy(GstVaapiContext *context) GST_VAAPI_SURFACE_POOL(context->priv->surfaces_pool)); } -/** - * gst_vaapi_context_get_surface: - * @context: a #GstVaapiContext - * - * Acquires a free surface. The returned surface but be released with - * gst_vaapi_context_put_surface(). This function returns %NULL if - * there is no free surface available in the pool. The surfaces are - * pre-allocated during context creation though. - * - * Return value: a free surface, or %NULL if none is available - */ -GstVaapiSurface * -gst_vaapi_context_get_surface(GstVaapiContext *context) -{ - g_return_val_if_fail(GST_VAAPI_IS_CONTEXT(context), NULL); - - return gst_vaapi_video_pool_get_object(context->priv->surfaces_pool); -} - /** * gst_vaapi_context_get_surface_count: * @context: a #GstVaapiContext @@ -1059,52 +1040,6 @@ gst_vaapi_context_get_surface_count(GstVaapiContext *context) return gst_vaapi_video_pool_get_size(context->priv->surfaces_pool); } -/** - * gst_vaapi_context_put_surface: - * @context: a #GstVaapiContext - * @surface: the #GstVaapiSurface to release - * - * Releases a surface acquired by gst_vaapi_context_get_surface(). - */ -void -gst_vaapi_context_put_surface(GstVaapiContext *context, GstVaapiSurface *surface) -{ - g_return_if_fail(GST_VAAPI_IS_CONTEXT(context)); - g_return_if_fail(GST_VAAPI_IS_SURFACE(surface)); - - gst_vaapi_video_pool_put_object(context->priv->surfaces_pool, surface); -} - -/** - * gst_vaapi_context_find_surface_by_id: - * @context: a #GstVaapiContext - * @id: the VA surface id to find - * - * Finds VA surface by @id in the list of surfaces attached to the @context. - * - * Return value: the matching #GstVaapiSurface object, or %NULL if - * none was found - */ -GstVaapiSurface * -gst_vaapi_context_find_surface_by_id(GstVaapiContext *context, GstVaapiID id) -{ - GstVaapiContextPrivate *priv; - GstVaapiSurface *surface; - guint i; - - g_return_val_if_fail(GST_VAAPI_IS_CONTEXT(context), NULL); - - priv = context->priv; - g_return_val_if_fail(priv->surfaces, NULL); - - for (i = 0; i < priv->surfaces->len; i++) { - surface = g_ptr_array_index(priv->surfaces, i); - if (GST_VAAPI_OBJECT_ID(surface) == id) - return surface; - } - return NULL; -} - /** * gst_vaapi_context_apply_composition: * @context: a #GstVaapiContext diff --git a/gst-libs/gst/vaapi/gstvaapicontext.h b/gst-libs/gst/vaapi/gstvaapicontext.h index 11c38ffc9a..208a4381e7 100644 --- a/gst-libs/gst/vaapi/gstvaapicontext.h +++ b/gst-libs/gst/vaapi/gstvaapicontext.h @@ -146,18 +146,9 @@ gst_vaapi_context_get_size( GstVaapiSurfaceProxy * gst_vaapi_context_get_surface_proxy(GstVaapiContext *context); -GstVaapiSurface * -gst_vaapi_context_get_surface(GstVaapiContext *context); - guint gst_vaapi_context_get_surface_count(GstVaapiContext *context); -void -gst_vaapi_context_put_surface(GstVaapiContext *context, GstVaapiSurface *surface); - -GstVaapiSurface * -gst_vaapi_context_find_surface_by_id(GstVaapiContext *context, GstVaapiID id); - gboolean gst_vaapi_context_apply_composition( GstVaapiContext *context, diff --git a/gst-libs/gst/vaapi/gstvaapisurfaceproxy.c b/gst-libs/gst/vaapi/gstvaapisurfaceproxy.c index 84b4256c64..e802eab40e 100644 --- a/gst-libs/gst/vaapi/gstvaapisurfaceproxy.c +++ b/gst-libs/gst/vaapi/gstvaapisurfaceproxy.c @@ -44,15 +44,19 @@ struct _GstVaapiSurfaceProxy { GstVaapiMiniObject parent_instance; GstVaapiVideoPool *pool; - GstVaapiContext *context; GstVaapiSurface *surface; }; static void gst_vaapi_surface_proxy_finalize(GstVaapiSurfaceProxy *proxy) { - gst_vaapi_surface_proxy_set_surface(proxy, NULL); - gst_vaapi_surface_proxy_set_context(proxy, NULL); + if (proxy->surface) { + if (proxy->pool) + gst_vaapi_video_pool_put_object(proxy->pool, proxy->surface); + g_object_unref(proxy->surface); + proxy->surface = NULL; + } + g_clear_object(&proxy->pool); } static inline const GstVaapiMiniObjectClass * @@ -65,35 +69,6 @@ gst_vaapi_surface_proxy_class(void) return &GstVaapiSurfaceProxyClass; } -/** - * gst_vaapi_surface_proxy_new: - * @context: a #GstVaapiContext - * @surface: a #GstVaapiSurface - * - * Creates a new #GstVaapiSurfaceProxy with the specified context and - * surface. - * - * Return value: the newly allocated #GstVaapiSurfaceProxy object - */ -GstVaapiSurfaceProxy * -gst_vaapi_surface_proxy_new(GstVaapiContext *context, GstVaapiSurface *surface) -{ - GstVaapiSurfaceProxy *proxy; - - g_return_val_if_fail(GST_VAAPI_IS_CONTEXT(context), NULL); - g_return_val_if_fail(GST_VAAPI_IS_SURFACE(surface), NULL); - - proxy = (GstVaapiSurfaceProxy *) - gst_vaapi_mini_object_new(gst_vaapi_surface_proxy_class()); - if (!proxy) - return NULL; - - proxy->pool = NULL; - proxy->context = g_object_ref(context); - proxy->surface = g_object_ref(surface); - return proxy; -} - GstVaapiSurfaceProxy * gst_vaapi_surface_proxy_new_from_pool(GstVaapiSurfacePool *pool) { @@ -107,7 +82,6 @@ gst_vaapi_surface_proxy_new_from_pool(GstVaapiSurfacePool *pool) return NULL; proxy->pool = g_object_ref(pool); - proxy->context = NULL; proxy->surface = gst_vaapi_video_pool_get_object(proxy->pool); if (!proxy->surface) goto error; @@ -209,45 +183,6 @@ gst_vaapi_surface_proxy_set_user_data(GstVaapiSurfaceProxy *proxy, user_data, destroy_notify); } -/** - * gst_vaapi_surface_proxy_get_context: - * @proxy: a #GstVaapiSurfaceProxy - * - * Returns the #GstVaapiContext stored in the @proxy. - * - * Return value: the #GstVaapiContext - */ -GstVaapiContext * -gst_vaapi_surface_proxy_get_context(GstVaapiSurfaceProxy *proxy) -{ - g_return_val_if_fail(GST_VAAPI_IS_SURFACE_PROXY(proxy), NULL); - - return proxy->context; -} - -/** - * gst_vaapi_surface_proxy_set_context: - * @proxy: a #GstVaapiSurfaceProxy - * @context: the new #GstVaapiContext to be stored in @proxy - * - * Stores a new @context into the @proxy. The proxy releases the - * previous reference, if any, and then holds a reference to the new - * @context. - */ -void -gst_vaapi_surface_proxy_set_context( - GstVaapiSurfaceProxy *proxy, - GstVaapiContext *context -) -{ - g_return_if_fail(GST_VAAPI_IS_SURFACE_PROXY(proxy)); - - g_clear_object(&proxy->context); - - if (context) - proxy->context = g_object_ref(context); -} - /** * gst_vaapi_surface_proxy_get_surface: * @proxy: a #GstVaapiSurfaceProxy @@ -280,35 +215,3 @@ gst_vaapi_surface_proxy_get_surface_id(GstVaapiSurfaceProxy *proxy) return GST_VAAPI_OBJECT_ID(proxy->surface); } - -/** - * gst_vaapi_surface_proxy_set_surface: - * @proxy: a #GstVaapiSurfaceProxy - * @surface: the new #GstVaapiSurface to be stored in @proxy - * - * Stores a new @surface into the @proxy. The proxy releases the - * previous reference, if any, and then holds a reference to the new - * @surface. - */ -void -gst_vaapi_surface_proxy_set_surface( - GstVaapiSurfaceProxy *proxy, - GstVaapiSurface *surface -) -{ - g_return_if_fail(GST_VAAPI_IS_SURFACE_PROXY(proxy)); - - if (proxy->surface) { - if (proxy->pool) - gst_vaapi_video_pool_put_object(proxy->pool, proxy->surface); - else if (proxy->context) - gst_vaapi_context_put_surface(proxy->context, proxy->surface); - g_object_unref(proxy->surface); - proxy->surface = NULL; - } - - g_clear_object(&proxy->pool); - - if (surface) - proxy->surface = g_object_ref(surface); -} diff --git a/gst-libs/gst/vaapi/gstvaapisurfaceproxy.h b/gst-libs/gst/vaapi/gstvaapisurfaceproxy.h index 15a933a5b9..467699dace 100644 --- a/gst-libs/gst/vaapi/gstvaapisurfaceproxy.h +++ b/gst-libs/gst/vaapi/gstvaapisurfaceproxy.h @@ -23,7 +23,6 @@ #ifndef GST_VAAPI_SURFACE_PROXY_H #define GST_VAAPI_SURFACE_PROXY_H -#include #include #include @@ -38,9 +37,6 @@ G_BEGIN_DECLS #define GST_VAAPI_SURFACE_PROXY_SURFACE(surface) \ gst_vaapi_surface_proxy_get_surface(surface) -GstVaapiSurfaceProxy * -gst_vaapi_surface_proxy_new(GstVaapiContext *context, GstVaapiSurface *surface); - GstVaapiSurfaceProxy * gst_vaapi_surface_proxy_new_from_pool(GstVaapiSurfacePool *pool); @@ -61,27 +57,12 @@ void gst_vaapi_surface_proxy_set_user_data(GstVaapiSurfaceProxy *proxy, gpointer user_data, GDestroyNotify destroy_notify); -GstVaapiContext * -gst_vaapi_surface_proxy_get_context(GstVaapiSurfaceProxy *proxy); - -void -gst_vaapi_surface_proxy_set_context( - GstVaapiSurfaceProxy *proxy, - GstVaapiContext *context -); - GstVaapiSurface * gst_vaapi_surface_proxy_get_surface(GstVaapiSurfaceProxy *proxy); GstVaapiID gst_vaapi_surface_proxy_get_surface_id(GstVaapiSurfaceProxy *proxy); -void -gst_vaapi_surface_proxy_set_surface( - GstVaapiSurfaceProxy *proxy, - GstVaapiSurface *surface -); - G_END_DECLS #endif /* GST_VAAPI_SURFACE_PROXY_H */