diff --git a/gst-libs/gst/vaapi/gstvaapiimage.c b/gst-libs/gst/vaapi/gstvaapiimage.c index a2a626800d..9349af44d3 100644 --- a/gst-libs/gst/vaapi/gstvaapiimage.c +++ b/gst-libs/gst/vaapi/gstvaapiimage.c @@ -32,7 +32,6 @@ #include "gstvaapiutils.h" #include "gstvaapiimage.h" #include "gstvaapiimage_priv.h" -#include "gstvaapiobject_priv.h" #define DEBUG 1 #include "gstvaapidebug.h" @@ -114,15 +113,15 @@ vaapi_image_is_linear (const VAImage * va_image) } static void -gst_vaapi_image_destroy (GstVaapiImage * image) +gst_vaapi_image_free (GstVaapiImage * image) { - GstVaapiDisplay *const display = GST_VAAPI_OBJECT_DISPLAY (image); + GstVaapiDisplay *const display = GST_VAAPI_IMAGE_DISPLAY (image); VAImageID image_id; VAStatus status; _gst_vaapi_image_unmap (image); - image_id = GST_VAAPI_OBJECT_ID (image); + image_id = GST_VAAPI_IMAGE_ID (image); GST_DEBUG ("image %" GST_VAAPI_ID_FORMAT, GST_VAAPI_ID_ARGS (image_id)); if (image_id != VA_INVALID_ID) { @@ -132,14 +131,18 @@ gst_vaapi_image_destroy (GstVaapiImage * image) if (!vaapi_check_status (status, "vaDestroyImage()")) GST_WARNING ("failed to destroy image %" GST_VAAPI_ID_FORMAT, GST_VAAPI_ID_ARGS (image_id)); - GST_VAAPI_OBJECT_ID (image) = VA_INVALID_ID; + GST_VAAPI_IMAGE_ID (image) = VA_INVALID_ID; } + + gst_vaapi_display_replace (&GST_VAAPI_IMAGE_DISPLAY (image), NULL); + + g_slice_free1 (sizeof (GstVaapiImage), image); } static gboolean _gst_vaapi_image_create (GstVaapiImage * image, GstVideoFormat format) { - GstVaapiDisplay *const display = GST_VAAPI_OBJECT_DISPLAY (image); + GstVaapiDisplay *const display = GST_VAAPI_IMAGE_DISPLAY (image); const VAImageFormat *va_format; VAStatus status; @@ -210,31 +213,44 @@ gst_vaapi_image_create (GstVaapiImage * image, GstVideoFormat format, image->is_linear = vaapi_image_is_linear (&image->image); GST_DEBUG ("image %" GST_VAAPI_ID_FORMAT, GST_VAAPI_ID_ARGS (image_id)); - GST_VAAPI_OBJECT_ID (image) = image_id; + GST_VAAPI_IMAGE_ID (image) = image_id; return TRUE; } static void -gst_vaapi_image_init (GstVaapiImage * image) +gst_vaapi_image_init (GstVaapiImage * image, GstVaapiDisplay * display) { + /* TODO(victor): implement image copy mechanism, it's almost + * there */ + gst_mini_object_init (GST_MINI_OBJECT_CAST (image), 0, + GST_TYPE_VAAPI_IMAGE, NULL, NULL, + (GstMiniObjectFreeFunction) gst_vaapi_image_free); + + GST_VAAPI_IMAGE_DISPLAY (image) = gst_object_ref (display); + GST_VAAPI_IMAGE_ID (image) = VA_INVALID_ID; image->internal_image.image_id = VA_INVALID_ID; image->internal_image.buf = VA_INVALID_ID; image->image.image_id = VA_INVALID_ID; image->image.buf = VA_INVALID_ID; } -static void -gst_vaapi_image_class_init (GstVaapiImageClass * klass) +GST_DEFINE_MINI_OBJECT_TYPE (GstVaapiImage, gst_vaapi_image); + +/** + * gst_vaapi_image_get_display: + * @image: a #GstVaapiImage + * + * Returns the #GstVaapiDisplay this @image is bound to. + * + * Return value: the parent #GstVaapiDisplay object + */ +GstVaapiDisplay * +gst_vaapi_image_get_display (GstVaapiImage * image) { - GstVaapiObjectClass *const object_class = GST_VAAPI_OBJECT_CLASS (klass); - - object_class->init = (GstVaapiObjectInitFunc) gst_vaapi_image_init; + g_return_val_if_fail (image != NULL, NULL); + return GST_VAAPI_IMAGE_DISPLAY (image); } -#define gst_vaapi_image_finalize gst_vaapi_image_destroy -GST_VAAPI_OBJECT_DEFINE_CLASS_WITH_CODE (GstVaapiImage, - gst_vaapi_image, gst_vaapi_image_class_init (&g_class)) - /** * gst_vaapi_image_new: * @display: a #GstVaapiDisplay @@ -247,7 +263,8 @@ GST_VAAPI_OBJECT_DEFINE_CLASS_WITH_CODE (GstVaapiImage, * * Return value: the newly allocated #GstVaapiImage object */ - GstVaapiImage *gst_vaapi_image_new (GstVaapiDisplay * display, +GstVaapiImage * +gst_vaapi_image_new (GstVaapiDisplay * display, GstVideoFormat format, guint width, guint height) { GstVaapiImage *image; @@ -258,10 +275,12 @@ GST_VAAPI_OBJECT_DEFINE_CLASS_WITH_CODE (GstVaapiImage, GST_DEBUG ("format %s, size %ux%u", gst_vaapi_video_format_to_string (format), width, height); - image = gst_vaapi_object_new (gst_vaapi_image_class (), display); + image = g_slice_new (GstVaapiImage); if (!image) return NULL; + gst_vaapi_image_init (image, display); + if (!gst_vaapi_image_create (image, format, width, height)) goto error; return image; @@ -269,7 +288,7 @@ GST_VAAPI_OBJECT_DEFINE_CLASS_WITH_CODE (GstVaapiImage, /* ERRORS */ error: { - gst_vaapi_object_unref (image); + gst_vaapi_image_unref (image); return NULL; } } @@ -300,10 +319,12 @@ gst_vaapi_image_new_with_image (GstVaapiDisplay * display, VAImage * va_image) GST_FOURCC_ARGS (va_image->format.fourcc), va_image->width, va_image->height); - image = gst_vaapi_object_new (gst_vaapi_image_class (), display); + image = g_slice_new (GstVaapiImage); if (!image) return NULL; + gst_vaapi_image_init (image, display); + if (!_gst_vaapi_image_set_image (image, va_image)) goto error; return image; @@ -311,7 +332,7 @@ gst_vaapi_image_new_with_image (GstVaapiDisplay * display, VAImage * va_image) /* ERRORS */ error: { - gst_vaapi_object_unref (image); + gst_vaapi_image_unref (image); return NULL; } } @@ -329,7 +350,7 @@ gst_vaapi_image_get_id (GstVaapiImage * image) { g_return_val_if_fail (image != NULL, VA_INVALID_ID); - return GST_VAAPI_OBJECT_ID (image); + return GST_VAAPI_IMAGE_ID (image); } /** @@ -385,7 +406,7 @@ _gst_vaapi_image_set_image (GstVaapiImage * image, const VAImage * va_image) image->width = va_image->width; image->height = va_image->height; - GST_VAAPI_OBJECT_ID (image) = va_image->image_id; + GST_VAAPI_IMAGE_ID (image) = va_image->image_id; /* Try to linearize image */ if (!image->is_linear) { @@ -554,7 +575,7 @@ _gst_vaapi_image_map (GstVaapiImage * image, GstVaapiImageRaw * raw_image) if (_gst_vaapi_image_is_mapped (image)) goto map_success; - display = GST_VAAPI_OBJECT_DISPLAY (image); + display = GST_VAAPI_IMAGE_DISPLAY (image); if (!display) return FALSE; @@ -607,7 +628,7 @@ _gst_vaapi_image_unmap (GstVaapiImage * image) if (!_gst_vaapi_image_is_mapped (image)) return TRUE; - display = GST_VAAPI_OBJECT_DISPLAY (image); + display = GST_VAAPI_IMAGE_DISPLAY (image); if (!display) return FALSE; diff --git a/gst-libs/gst/vaapi/gstvaapiimage.h b/gst-libs/gst/vaapi/gstvaapiimage.h index 6e440ef706..5f8305d5cc 100644 --- a/gst-libs/gst/vaapi/gstvaapiimage.h +++ b/gst-libs/gst/vaapi/gstvaapiimage.h @@ -59,8 +59,32 @@ G_BEGIN_DECLS */ #define GST_VAAPI_IMAGE_HEIGHT(image) gst_vaapi_image_get_height(image) +/** + * GST_VAAPI_IMAGE_DISPLAY: + * @image: a #GstVaapiImage + * + * Macro that evaluates to the display of @image + */ +#define GST_VAAPI_IMAGE_DISPLAY(image) gst_vaapi_image_get_display(image) + +/** + * GST_VAAPI_IMAGE_ID: + * @image: a #GstVaapiImage + * + * Macro that evaluates to the ID of @image + */ +#define GST_VAAPI_IMAGE_ID(image) gst_vaapi_image_get_id(image) + +#define GST_TYPE_VAAPI_IMAGE (gst_vaapi_image_get_type ()) + typedef struct _GstVaapiImage GstVaapiImage; +GType +gst_vaapi_image_get_type (void) G_GNUC_CONST; + +GstVaapiDisplay * +gst_vaapi_image_get_display (GstVaapiImage * image); + GstVaapiImage * gst_vaapi_image_new( GstVaapiDisplay *display, @@ -72,6 +96,20 @@ gst_vaapi_image_new( GstVaapiImage * gst_vaapi_image_new_with_image(GstVaapiDisplay *display, VAImage *va_image); +/** + * gst_vaapi_image_unref: (skip) + * @image: (transfer full): a #GstVaapiImage. + * + * Decreases the refcount of the image. If the refcount reaches 0, the + * image will be freed. + */ +static inline void gst_vaapi_image_unref(GstVaapiImage* image); +static inline void +gst_vaapi_image_unref (GstVaapiImage * image) +{ + gst_mini_object_unref (GST_MINI_OBJECT_CAST (image)); +} + GstVaapiID gst_vaapi_image_get_id(GstVaapiImage *image); @@ -131,6 +169,8 @@ gst_vaapi_image_update_from_buffer( gboolean gst_vaapi_image_copy(GstVaapiImage *dst_image, GstVaapiImage *src_image); +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstVaapiImage, gst_vaapi_image_unref) + G_END_DECLS #endif /* GST_VAAPI_IMAGE_H */ diff --git a/gst-libs/gst/vaapi/gstvaapiimage_priv.h b/gst-libs/gst/vaapi/gstvaapiimage_priv.h index bed4a9472a..584de56d2a 100644 --- a/gst-libs/gst/vaapi/gstvaapiimage_priv.h +++ b/gst-libs/gst/vaapi/gstvaapiimage_priv.h @@ -26,11 +26,9 @@ #define GST_VAAPI_IMAGE_PRIV_H #include -#include "gstvaapiobject_priv.h" G_BEGIN_DECLS -typedef struct _GstVaapiImageClass GstVaapiImageClass; typedef struct _GstVaapiImageRaw GstVaapiImageRaw; /** @@ -40,7 +38,9 @@ typedef struct _GstVaapiImageRaw GstVaapiImageRaw; */ struct _GstVaapiImage { /*< private >*/ - GstVaapiObject parent_instance; + GstMiniObject mini_object; + GstVaapiDisplay *display; + GstVaapiID object_id; VAImage internal_image; VAImage image; @@ -52,16 +52,6 @@ struct _GstVaapiImage { guint is_linear : 1; }; -/** - * GstVaapiImageClass: - * - * A VA image wrapper class - */ -struct _GstVaapiImageClass { - /*< private >*/ - GstVaapiObjectClass parent_class; -}; - /** * GstVaapiImageRaw: * @@ -107,6 +97,27 @@ struct _GstVaapiImageRaw { #define GST_VAAPI_IMAGE_HEIGHT(image) \ (GST_VAAPI_IMAGE(image)->height) +/** + * GST_VAAPI_IMAGE_DISPLAY: + * @image: a #GstVaapiImage + * + * Macro that evaluates to the @image's display + */ +#undef GST_VAAPI_IMAGE_DISPLAY +#define GST_VAAPI_IMAGE_DISPLAY(image) \ + (GST_VAAPI_IMAGE(image)->display) + +/** + * GST_VAAPI_IMAGE_ID: + * @image: a #GstVaapiImage + * + * Macro that evaluates to the @image's object ID + */ +#undef GST_VAAPI_IMAGE_ID +#define GST_VAAPI_IMAGE_ID(image) \ + (GST_VAAPI_IMAGE(image)->object_id) + + G_GNUC_INTERNAL gboolean gst_vaapi_image_get_raw( diff --git a/gst-libs/gst/vaapi/gstvaapisubpicture.c b/gst-libs/gst/vaapi/gstvaapisubpicture.c index 7c3f54d41b..56db3784c7 100644 --- a/gst-libs/gst/vaapi/gstvaapisubpicture.c +++ b/gst-libs/gst/vaapi/gstvaapisubpicture.c @@ -88,7 +88,7 @@ gst_vaapi_subpicture_destroy (GstVaapiSubpicture * subpicture) } GST_VAAPI_OBJECT_ID (subpicture) = VA_INVALID_ID; } - gst_vaapi_object_replace (&subpicture->image, NULL); + gst_mini_object_replace ((GstMiniObject **) & subpicture->image, NULL); } static gboolean @@ -101,7 +101,7 @@ gst_vaapi_subpicture_create (GstVaapiSubpicture * subpicture, GST_VAAPI_DISPLAY_LOCK (display); status = vaCreateSubpicture (GST_VAAPI_DISPLAY_VADISPLAY (display), - GST_VAAPI_OBJECT_ID (image), &subpicture_id); + GST_VAAPI_IMAGE_ID (image), &subpicture_id); GST_VAAPI_DISPLAY_UNLOCK (display); if (!vaapi_check_status (status, "vaCreateSubpicture()")) return FALSE; @@ -109,7 +109,8 @@ gst_vaapi_subpicture_create (GstVaapiSubpicture * subpicture, GST_DEBUG ("subpicture %" GST_VAAPI_ID_FORMAT, GST_VAAPI_ID_ARGS (subpicture_id)); GST_VAAPI_OBJECT_ID (subpicture) = subpicture_id; - subpicture->image = gst_vaapi_object_ref (image); + subpicture->image = + (GstVaapiImage *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (image)); return TRUE; } @@ -137,9 +138,9 @@ GST_VAAPI_OBJECT_DEFINE_CLASS (GstVaapiSubpicture, gst_vaapi_subpicture) g_return_val_if_fail (image != NULL, NULL); GST_DEBUG ("create from image %" GST_VAAPI_ID_FORMAT, - GST_VAAPI_ID_ARGS (GST_VAAPI_OBJECT_ID (image))); + GST_VAAPI_ID_ARGS (GST_VAAPI_IMAGE_ID (image))); - display = GST_VAAPI_OBJECT_DISPLAY (image); + display = GST_VAAPI_IMAGE_DISPLAY (image); format = GST_VAAPI_IMAGE_FORMAT (image); if (!gst_vaapi_display_has_subpicture_format (display, format, &va_flags)) return NULL; diff --git a/gst-libs/gst/vaapi/gstvaapisurface.c b/gst-libs/gst/vaapi/gstvaapisurface.c index f092b549e5..39c2a6ede9 100644 --- a/gst-libs/gst/vaapi/gstvaapisurface.c +++ b/gst-libs/gst/vaapi/gstvaapisurface.c @@ -34,7 +34,6 @@ #include "gstvaapisurface_priv.h" #include "gstvaapicontext.h" #include "gstvaapiimage.h" -#include "gstvaapiimage_priv.h" #include "gstvaapibufferproxy_priv.h" #define DEBUG 1 @@ -558,7 +557,7 @@ gst_vaapi_surface_get_format (GstVaapiSurface * surface) GstVaapiImage *const image = gst_vaapi_surface_derive_image (surface); if (image) { surface->format = GST_VAAPI_IMAGE_FORMAT (image); - gst_vaapi_object_unref (image); + gst_vaapi_image_unref (image); } if (surface->format == GST_VIDEO_FORMAT_UNKNOWN) surface->format = GST_VIDEO_FORMAT_ENCODED; @@ -638,7 +637,7 @@ gst_vaapi_surface_get_size (GstVaapiSurface * surface, * unreferenced when it's no longer needed. The image and image buffer * data structures will be destroyed. However, the surface contents * will remain unchanged until destroyed through the last call to - * gst_vaapi_object_unref(). + * gst_vaapi_image_unref(). * * Return value: the newly allocated #GstVaapiImage object, or %NULL * on failure @@ -702,7 +701,7 @@ gst_vaapi_surface_get_image (GstVaapiSurface * surface, GstVaapiImage * image) if (width != surface->width || height != surface->height) return FALSE; - image_id = GST_VAAPI_OBJECT_ID (image); + image_id = GST_VAAPI_IMAGE_ID (image); if (image_id == VA_INVALID_ID) return FALSE; @@ -746,7 +745,7 @@ gst_vaapi_surface_put_image (GstVaapiSurface * surface, GstVaapiImage * image) if (width != surface->width || height != surface->height) return FALSE; - image_id = GST_VAAPI_OBJECT_ID (image); + image_id = GST_VAAPI_IMAGE_ID (image); if (image_id == VA_INVALID_ID) return FALSE; diff --git a/gst-libs/gst/vaapi/gstvaapisurface_drm.c b/gst-libs/gst/vaapi/gstvaapisurface_drm.c index cbd7d71773..a7e33e015f 100644 --- a/gst-libs/gst/vaapi/gstvaapisurface_drm.c +++ b/gst-libs/gst/vaapi/gstvaapisurface_drm.c @@ -39,7 +39,8 @@ gst_vaapi_surface_get_drm_buf_handle (GstVaapiSurface * surface, guint type) /* The proxy takes ownership if the image, even creation failure. */ proxy = gst_vaapi_buffer_proxy_new_from_object (GST_VAAPI_OBJECT (surface), - image->internal_image.buf, type, gst_vaapi_object_unref, image); + image->internal_image.buf, type, (GDestroyNotify) gst_vaapi_image_unref, + image); if (!proxy) goto error_alloc_export_buffer; return proxy; diff --git a/gst-libs/gst/vaapi/gstvaapivideopool.c b/gst-libs/gst/vaapi/gstvaapivideopool.c index e431b52d1c..daeed76770 100644 --- a/gst-libs/gst/vaapi/gstvaapivideopool.c +++ b/gst-libs/gst/vaapi/gstvaapivideopool.c @@ -67,8 +67,19 @@ gst_vaapi_video_pool_init (GstVaapiVideoPool * pool, GstVaapiDisplay * display, void gst_vaapi_video_pool_finalize (GstVaapiVideoPool * pool) { - g_list_free_full (pool->used_objects, gst_vaapi_object_unref); - g_queue_foreach (&pool->free_objects, (GFunc) gst_vaapi_object_unref, NULL); + if (pool->object_type == GST_VAAPI_VIDEO_POOL_OBJECT_TYPE_IMAGE) { + g_list_free_full (pool->used_objects, + (GDestroyNotify) gst_mini_object_unref); + } else { + g_list_free_full (pool->used_objects, gst_vaapi_object_unref); + } + + if (pool->object_type == GST_VAAPI_VIDEO_POOL_OBJECT_TYPE_IMAGE) { + g_queue_foreach (&pool->free_objects, (GFunc) gst_mini_object_unref, NULL); + } else { + g_queue_foreach (&pool->free_objects, (GFunc) gst_vaapi_object_unref, NULL); + } + g_queue_clear (&pool->free_objects); gst_vaapi_display_replace (&pool->display, NULL); g_mutex_clear (&pool->mutex); @@ -183,7 +194,12 @@ gst_vaapi_video_pool_get_object_unlocked (GstVaapiVideoPool * pool) ++pool->used_count; pool->used_objects = g_list_prepend (pool->used_objects, object); - return gst_vaapi_object_ref (object); + + if (pool->object_type == GST_VAAPI_VIDEO_POOL_OBJECT_TYPE_IMAGE) + object = gst_mini_object_ref (GST_MINI_OBJECT_CAST (object)); + else + object = gst_vaapi_object_ref (object); + return object; } gpointer @@ -219,7 +235,11 @@ gst_vaapi_video_pool_put_object_unlocked (GstVaapiVideoPool * pool, if (!elem) return; - gst_vaapi_object_unref (object); + if (pool->object_type == GST_VAAPI_VIDEO_POOL_OBJECT_TYPE_IMAGE) + gst_mini_object_unref (GST_MINI_OBJECT_CAST (object)); + else + gst_vaapi_object_unref (object); + --pool->used_count; pool->used_objects = g_list_delete_link (pool->used_objects, elem); g_queue_push_tail (&pool->free_objects, object); @@ -251,7 +271,12 @@ static inline gboolean gst_vaapi_video_pool_add_object_unlocked (GstVaapiVideoPool * pool, gpointer object) { - g_queue_push_tail (&pool->free_objects, gst_vaapi_object_ref (object)); + if (pool->object_type == GST_VAAPI_VIDEO_POOL_OBJECT_TYPE_IMAGE) { + g_queue_push_tail (&pool->free_objects, + gst_mini_object_ref (GST_MINI_OBJECT_CAST (object))); + } else { + g_queue_push_tail (&pool->free_objects, gst_vaapi_object_ref (object)); + } return TRUE; } diff --git a/gst-libs/gst/vaapi/gstvaapiwindow_x11.c b/gst-libs/gst/vaapi/gstvaapiwindow_x11.c index c5bfb8604d..fd3b045118 100644 --- a/gst-libs/gst/vaapi/gstvaapiwindow_x11.c +++ b/gst-libs/gst/vaapi/gstvaapiwindow_x11.c @@ -39,6 +39,7 @@ #include "gstvaapisurface_priv.h" #include "gstvaapiutils.h" #include "gstvaapiutils_x11.h" +#include "gstvaapisurface_priv.h" GST_DEBUG_CATEGORY_EXTERN (gst_debug_vaapi_window); #define GST_CAT_DEFAULT gst_debug_vaapi_window diff --git a/gst/vaapi/gstvaapipluginbase.c b/gst/vaapi/gstvaapipluginbase.c index 35714d0a37..db088be9e3 100644 --- a/gst/vaapi/gstvaapipluginbase.c +++ b/gst/vaapi/gstvaapipluginbase.c @@ -1401,7 +1401,7 @@ extract_allowed_surface_formats (GstVaapiDisplay * display, if (res) g_array_append_val (out_formats, img_format); - gst_vaapi_object_unref (image); + gst_vaapi_image_unref (image); /* Just reuse the surface if the format is specified */ if (specified_format == GST_VIDEO_FORMAT_UNKNOWN) gst_vaapi_object_replace (&surface, NULL); diff --git a/gst/vaapi/gstvaapivideomemory.c b/gst/vaapi/gstvaapivideomemory.c index 5da1b18e8c..c6af52c46b 100644 --- a/gst/vaapi/gstvaapivideomemory.c +++ b/gst/vaapi/gstvaapivideomemory.c @@ -128,7 +128,7 @@ ensure_image (GstVaapiVideoMemory * mem) reset_image_usage (&mem->usage_flag); } else if (gst_vaapi_surface_get_format (mem->surface) != GST_VIDEO_INFO_FORMAT (mem->image_info)) { - gst_vaapi_object_replace (&mem->image, NULL); + gst_mini_object_replace ((GstMiniObject **) & mem->image, NULL); reset_image_usage (&mem->usage_flag); } } @@ -393,7 +393,7 @@ gst_vaapi_video_memory_reset_image (GstVaapiVideoMemory * mem) GST_VAAPI_VIDEO_ALLOCATOR_CAST (GST_MEMORY_CAST (mem)->allocator); if (!use_native_formats (mem->usage_flag)) - gst_vaapi_object_replace (&mem->image, NULL); + gst_mini_object_replace ((GstMiniObject **) & mem->image, NULL); else if (mem->image) { gst_vaapi_video_pool_put_object (allocator->image_pool, mem->image); mem->image = NULL; @@ -703,7 +703,7 @@ gst_video_info_update_from_surface (GstVideoInfo * vip, gst_vaapi_image_unmap (image); bail: - gst_vaapi_object_unref (image); + gst_vaapi_image_unref (image); return ret; /* ERRORS */ @@ -912,7 +912,7 @@ allocator_configure_image_info (GstVaapiDisplay * display, bail: if (image) - gst_vaapi_object_unref (image); + gst_vaapi_image_unref (image); return ret; /* ERRORS */ diff --git a/gst/vaapi/gstvaapivideometa.c b/gst/vaapi/gstvaapivideometa.c index 08040a9de1..3a0d313387 100644 --- a/gst/vaapi/gstvaapivideometa.c +++ b/gst/vaapi/gstvaapivideometa.c @@ -78,8 +78,9 @@ set_display (GstVaapiVideoMeta * meta, GstVaapiDisplay * display) static inline void set_image (GstVaapiVideoMeta * meta, GstVaapiImage * image) { - meta->image = gst_vaapi_object_ref (image); - set_display (meta, gst_vaapi_object_get_display (GST_VAAPI_OBJECT (image))); + meta->image = + (GstVaapiImage *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (image)); + set_display (meta, gst_vaapi_image_get_display (image)); } static gboolean @@ -131,7 +132,7 @@ gst_vaapi_video_meta_destroy_image (GstVaapiVideoMeta * meta) if (meta->image) { if (meta->image_pool) gst_vaapi_video_pool_put_object (meta->image_pool, meta->image); - gst_vaapi_object_unref (meta->image); + gst_vaapi_image_unref (meta->image); meta->image = NULL; } gst_vaapi_video_pool_replace (&meta->image_pool, NULL); @@ -228,7 +229,8 @@ gst_vaapi_video_meta_copy (GstVaapiVideoMeta * meta) copy->ref_count = 1; copy->display = gst_object_ref (meta->display); copy->image_pool = NULL; - copy->image = meta->image ? gst_vaapi_object_ref (meta->image) : NULL; + copy->image = meta->image ? (GstVaapiImage *) + gst_mini_object_ref (GST_MINI_OBJECT_CAST (meta->image)) : NULL; copy->proxy = meta->proxy ? gst_vaapi_surface_proxy_copy (meta->proxy) : NULL; copy->converter = meta->converter; copy->render_flags = meta->render_flags; @@ -462,7 +464,7 @@ gst_vaapi_video_meta_get_display (GstVaapiVideoMeta * meta) * * Retrieves the #GstVaapiImage bound to the @meta. The @meta owns * the #GstVaapiImage so the caller is responsible for calling - * gst_vaapi_object_ref() when needed. + * gst_mini_object_ref() when needed. * * Return value: the #GstVaapiImage bound to the @meta, or %NULL if * there is none @@ -526,7 +528,7 @@ gst_vaapi_video_meta_set_image_from_pool (GstVaapiVideoMeta * meta, * * Retrieves the #GstVaapiSurface bound to the @meta. The @meta * owns the #GstVaapiSurface so the caller is responsible for calling - * gst_vaapi_object_ref() when needed. + * gst_mini_object_ref() when needed. * * Return value: the #GstVaapiSurface bound to the @meta, or %NULL if * there is none diff --git a/tests/internal/image.c b/tests/internal/image.c index 1304471000..aba0b14516 100644 --- a/tests/internal/image.c +++ b/tests/internal/image.c @@ -87,7 +87,7 @@ image_generate_full (GstVaapiDisplay * display, return image; error: - gst_vaapi_object_unref (image); + gst_vaapi_image_unref (image); return NULL; } @@ -321,7 +321,7 @@ image_draw_rectangle (GstVaapiImage * image, if (height > image_height - y) height = image_height - y; - display = gst_vaapi_object_get_display (GST_VAAPI_OBJECT (image)); + display = gst_vaapi_image_get_display (image); if (!display) return FALSE; @@ -374,7 +374,7 @@ image_upload (GstVaapiImage * image, GstVaapiSurface * surface) surface_image = gst_vaapi_surface_derive_image (surface); if (surface_image) { success = gst_vaapi_image_copy (surface_image, image); - gst_vaapi_object_unref (surface_image); + gst_vaapi_image_unref (surface_image); if (success) return TRUE; } diff --git a/tests/internal/simple-encoder.c b/tests/internal/simple-encoder.c index 97857731f2..90b778e35b 100644 --- a/tests/internal/simple-encoder.c +++ b/tests/internal/simple-encoder.c @@ -456,7 +456,7 @@ app_run (App * app) ret = EXIT_SUCCESS; gst_vaapi_video_pool_replace (&pool, NULL); - gst_vaapi_object_unref (image); + gst_vaapi_image_unref (image); return ret; } diff --git a/tests/internal/test-fei-enc-in.c b/tests/internal/test-fei-enc-in.c index 9f79c166d5..ad67909e2f 100644 --- a/tests/internal/test-fei-enc-in.c +++ b/tests/internal/test-fei-enc-in.c @@ -638,7 +638,7 @@ app_run (App * app) ret = EXIT_SUCCESS; gst_vaapi_video_pool_replace (&pool, NULL); - gst_vaapi_object_unref (image); + gst_vaapi_image_unref (image); return ret; } diff --git a/tests/internal/test-filter.c b/tests/internal/test-filter.c index ab57775a04..926fe7f566 100644 --- a/tests/internal/test-filter.c +++ b/tests/internal/test-filter.c @@ -117,7 +117,7 @@ create_test_surface (GstVaapiDisplay * display, guint width, guint height, if (!image_upload (image, surface)) goto error_upload_image; - gst_vaapi_object_unref (image); + gst_vaapi_image_unref (image); return surface; /* ERRORS */ @@ -139,7 +139,7 @@ error_upload_image: goto error_cleanup; error_cleanup: if (image) - gst_vaapi_object_unref (image); + gst_vaapi_image_unref (image); if (surface) gst_vaapi_object_unref (surface); if (error_ptr) diff --git a/tests/internal/test-windows.c b/tests/internal/test-windows.c index 595be3fe1d..5b185ecb5b 100644 --- a/tests/internal/test-windows.c +++ b/tests/internal/test-windows.c @@ -89,7 +89,7 @@ create_test_surface (GstVaapiDisplay * display, guint width, guint height) if (!gst_vaapi_surface_sync (surface)) g_error ("could not complete image upload"); - gst_vaapi_object_unref (image); + gst_vaapi_image_unref (image); return surface; }