summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVíctor Manuel Jáquez Leal <vjaquez@igalia.com>2019-08-20 16:50:46 +0200
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>2019-08-20 17:11:23 +0200
commitdae057588befd82fde1c11437a0c74c259a7086a (patch)
tree3519fa6364bb011836fc301a403e4e78491dfa92
parente8b52f59f54573b459ce2f00c02a0633923543a7 (diff)
downloadgstreamer-vaapi-dae057588befd82fde1c11437a0c74c259a7086a.tar.gz
libs: remove surface's parent context
In commit 18031dc6 surface's parent context is not assigned because of circular references. Since then (2013), there's has no issue with subpictures attached to a context, the current only users of this API. This patch cleans up all of related code with the unused surface's parent context.
-rw-r--r--gst-libs/gst/vaapi/gstvaapicontext.c11
-rw-r--r--gst-libs/gst/vaapi/gstvaapisurface.c46
-rw-r--r--gst-libs/gst/vaapi/gstvaapisurface.h2
-rw-r--r--gst-libs/gst/vaapi/gstvaapisurface_priv.h10
-rw-r--r--gst/vaapi/gstvaapipluginutil.c2
-rw-r--r--tests/test-subpicture.c3
6 files changed, 5 insertions, 69 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapicontext.c b/gst-libs/gst/vaapi/gstvaapicontext.c
index 61573d20..a8855e63 100644
--- a/gst-libs/gst/vaapi/gstvaapicontext.c
+++ b/gst-libs/gst/vaapi/gstvaapicontext.c
@@ -34,7 +34,6 @@
#include "gstvaapidisplay_priv.h"
#include "gstvaapiobject_priv.h"
#include "gstvaapisurface.h"
-#include "gstvaapisurface_priv.h"
#include "gstvaapisurfacepool.h"
#include "gstvaapisurfaceproxy.h"
#include "gstvaapivideopool_priv.h"
@@ -61,13 +60,6 @@ ensure_attributes (GstVaapiContext * context)
return (context->attribs != NULL);
}
-static void
-unref_surface_cb (GstVaapiSurface * surface)
-{
- gst_vaapi_surface_set_parent_context (surface, NULL);
- gst_vaapi_object_unref (surface);
-}
-
static inline gboolean
context_get_attribute (GstVaapiContext * context, VAConfigAttribType type,
guint * out_value_ptr)
@@ -141,7 +133,6 @@ context_ensure_surfaces (GstVaapiContext * context)
cip->chroma_type, cip->width, cip->height, context->attribs->formats);
if (!surface)
return FALSE;
- gst_vaapi_surface_set_parent_context (surface, context);
g_ptr_array_add (context->surfaces, surface);
if (!gst_vaapi_video_pool_add_object (context->surfaces_pool, surface))
return FALSE;
@@ -163,7 +154,7 @@ context_create_surfaces (GstVaapiContext * context)
num_surfaces = cip->ref_frames + SCRATCH_SURFACES_COUNT;
if (!context->surfaces) {
context->surfaces = g_ptr_array_new_full (num_surfaces,
- (GDestroyNotify) unref_surface_cb);
+ (GDestroyNotify) gst_vaapi_object_unref);
if (!context->surfaces)
return FALSE;
}
diff --git a/gst-libs/gst/vaapi/gstvaapisurface.c b/gst-libs/gst/vaapi/gstvaapisurface.c
index 482c9b63..d17b00e6 100644
--- a/gst-libs/gst/vaapi/gstvaapisurface.c
+++ b/gst-libs/gst/vaapi/gstvaapisurface.c
@@ -35,7 +35,6 @@
#include "gstvaapicontext.h"
#include "gstvaapiimage.h"
#include "gstvaapiimage_priv.h"
-#include "gstvaapicontext_overlay.h"
#include "gstvaapibufferproxy_priv.h"
#define DEBUG 1
@@ -78,7 +77,6 @@ gst_vaapi_surface_destroy (GstVaapiSurface * surface)
GST_DEBUG ("surface %" GST_VAAPI_ID_FORMAT, GST_VAAPI_ID_ARGS (surface_id));
gst_vaapi_surface_destroy_subpictures (surface);
- gst_vaapi_surface_set_parent_context (surface, NULL);
if (surface_id != VA_INVALID_SURFACE) {
GST_VAAPI_DISPLAY_LOCK (display);
@@ -620,42 +618,6 @@ gst_vaapi_surface_get_size (GstVaapiSurface * surface,
}
/**
- * gst_vaapi_surface_set_parent_context:
- * @surface: a #GstVaapiSurface
- * @context: a #GstVaapiContext
- *
- * Sets new parent context, or clears any parent context if @context
- * is %NULL. This function owns an extra reference to the context,
- * which will be released when the surface is destroyed.
- */
-void
-gst_vaapi_surface_set_parent_context (GstVaapiSurface * surface,
- GstVaapiContext * context)
-{
- g_return_if_fail (surface != NULL);
-
- surface->parent_context = NULL;
-}
-
-/**
- * gst_vaapi_surface_get_parent_context:
- * @surface: a #GstVaapiSurface
- *
- * Retrieves the parent #GstVaapiContext, or %NULL if there is
- * none. The surface shall still own a reference to the context.
- * i.e. the caller shall not unreference the returned context object.
- *
- * Return value: the parent context, if any.
- */
-GstVaapiContext *
-gst_vaapi_surface_get_parent_context (GstVaapiSurface * surface)
-{
- g_return_val_if_fail (surface != NULL, NULL);
-
- return surface->parent_context;
-}
-
-/**
* gst_vaapi_surface_derive_image:
* @surface: a #GstVaapiSurface
*
@@ -1026,8 +988,6 @@ gst_vaapi_surface_query_status (GstVaapiSurface * surface,
* gst_vaapi_surface_set_subpictures_from_composition:
* @surface: a #GstVaapiSurface
* @compostion: a #GstVideoOverlayCompositon
- * @propagate_context: a flag specifying whether to apply composition
- * to the parent context, if any
*
* Helper to update the subpictures from #GstVideoOverlayCompositon. Sending
* a NULL composition will clear all the current subpictures. Note that this
@@ -1037,17 +997,13 @@ gst_vaapi_surface_query_status (GstVaapiSurface * surface,
*/
gboolean
gst_vaapi_surface_set_subpictures_from_composition (GstVaapiSurface * surface,
- GstVideoOverlayComposition * composition, gboolean propagate_context)
+ GstVideoOverlayComposition * composition)
{
GstVaapiDisplay *display;
guint n, nb_rectangles;
g_return_val_if_fail (surface != NULL, FALSE);
- if (propagate_context && surface->parent_context)
- return gst_vaapi_context_apply_composition (surface->parent_context,
- composition);
-
display = GST_VAAPI_OBJECT_DISPLAY (surface);
if (!display)
return FALSE;
diff --git a/gst-libs/gst/vaapi/gstvaapisurface.h b/gst-libs/gst/vaapi/gstvaapisurface.h
index 844eaf28..c62f7bb8 100644
--- a/gst-libs/gst/vaapi/gstvaapisurface.h
+++ b/gst-libs/gst/vaapi/gstvaapisurface.h
@@ -247,7 +247,7 @@ gst_vaapi_surface_query_status (GstVaapiSurface * surface,
gboolean
gst_vaapi_surface_set_subpictures_from_composition (GstVaapiSurface * surface,
- GstVideoOverlayComposition * composition, gboolean propagate_context);
+ GstVideoOverlayComposition * composition);
void
gst_vaapi_surface_set_buffer_proxy (GstVaapiSurface * surface,
diff --git a/gst-libs/gst/vaapi/gstvaapisurface_priv.h b/gst-libs/gst/vaapi/gstvaapisurface_priv.h
index 4ac1e0c1..35ac7fa9 100644
--- a/gst-libs/gst/vaapi/gstvaapisurface_priv.h
+++ b/gst-libs/gst/vaapi/gstvaapisurface_priv.h
@@ -47,7 +47,6 @@ struct _GstVaapiSurface
guint height;
GstVaapiChromaType chroma_type;
GPtrArray *subpictures;
- GstVaapiContext *parent_context;
};
/**
@@ -109,15 +108,6 @@ struct _GstVaapiSurfaceClass
#define GST_VAAPI_SURFACE_HEIGHT(surface) \
(GST_VAAPI_SURFACE (surface)->height)
-G_GNUC_INTERNAL
-void
-gst_vaapi_surface_set_parent_context (GstVaapiSurface * surface,
- GstVaapiContext * context);
-
-G_GNUC_INTERNAL
-GstVaapiContext *
-gst_vaapi_surface_get_parent_context (GstVaapiSurface * surface);
-
G_END_DECLS
#endif /* GST_VAAPI_SURFACE_PRIV_H */
diff --git a/gst/vaapi/gstvaapipluginutil.c b/gst/vaapi/gstvaapipluginutil.c
index 3599b6a0..4ef38953 100644
--- a/gst/vaapi/gstvaapipluginutil.c
+++ b/gst/vaapi/gstvaapipluginutil.c
@@ -482,7 +482,7 @@ gst_vaapi_apply_composition (GstVaapiSurface * surface, GstBuffer * buffer)
if (cmeta)
composition = cmeta->overlay;
return gst_vaapi_surface_set_subpictures_from_composition (surface,
- composition, TRUE);
+ composition);
}
gboolean
diff --git a/tests/test-subpicture.c b/tests/test-subpicture.c
index ee000560..804f0a9e 100644
--- a/tests/test-subpicture.c
+++ b/tests/test-subpicture.c
@@ -149,8 +149,7 @@ main (int argc, char *argv[])
g_error ("could not create video overlay composition");
gst_video_overlay_rectangle_unref (overlay);
- if (!gst_vaapi_surface_set_subpictures_from_composition (surface, compo,
- FALSE))
+ if (!gst_vaapi_surface_set_subpictures_from_composition (surface, compo))
g_error ("could not create subpictures from video overlay compoition");
gst_vaapi_window_show (window);