summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHe Junyan <junyan.he@hotmail.com>2019-12-18 18:00:49 +0100
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>2019-12-20 05:01:07 +0000
commit6bf33ada4fd5f1a61fc8875b6c1e9ee2bd1957a8 (patch)
treed165197152ad61a77f01a17347d1e23a8fc1f767
parentd56824c05cc3245143dab4fb716902158ec6b7c6 (diff)
libs: codedbuffer: port to GstMiniObject
GstVaapiMiniObject and GstVaapiObject are deprecated. This is the first step to remove them by porting GstVaapiCodedBuffer as a GstMiniBuffer descendant. Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
-rw-r--r--gst-libs/gst/vaapi/gstvaapicodedbuffer.c54
-rw-r--r--gst-libs/gst/vaapi/gstvaapicodedbuffer.h21
-rw-r--r--gst-libs/gst/vaapi/gstvaapicodedbuffer_priv.h29
-rw-r--r--gst-libs/gst/vaapi/gstvaapicodedbufferproxy.c4
-rw-r--r--gst-libs/gst/vaapi/gstvaapiencoder_h264.c2
-rw-r--r--gst-libs/gst/vaapi/gstvaapiencoder_h264_fei.c2
-rw-r--r--gst-libs/gst/vaapi/gstvaapiencoder_h265.c2
-rw-r--r--gst-libs/gst/vaapi/gstvaapiencoder_jpeg.c2
-rw-r--r--gst-libs/gst/vaapi/gstvaapiencoder_mpeg2.c2
-rw-r--r--gst-libs/gst/vaapi/gstvaapiencoder_vp8.c2
-rw-r--r--gst-libs/gst/vaapi/gstvaapiencoder_vp9.c2
-rw-r--r--gst-libs/gst/vaapi/gstvaapifeienc_h264.c2
-rw-r--r--gst-libs/gst/vaapi/gstvaapifeipak_h264.c2
-rw-r--r--gst-libs/gst/vaapi/gstvaapivideopool.c21
14 files changed, 98 insertions, 49 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapicodedbuffer.c b/gst-libs/gst/vaapi/gstvaapicodedbuffer.c
index 39e5ec8a..5d5f3a2e 100644
--- a/gst-libs/gst/vaapi/gstvaapicodedbuffer.c
+++ b/gst-libs/gst/vaapi/gstvaapicodedbuffer.c
@@ -34,7 +34,7 @@ static gboolean
coded_buffer_create (GstVaapiCodedBuffer * buf, guint buf_size,
GstVaapiContext * context)
{
- GstVaapiDisplay *const display = GST_VAAPI_OBJECT_DISPLAY (buf);
+ GstVaapiDisplay *const display = GST_VAAPI_CODED_BUFFER_DISPLAY (buf);
VABufferID buf_id;
gboolean success;
@@ -47,56 +47,62 @@ coded_buffer_create (GstVaapiCodedBuffer * buf, guint buf_size,
return FALSE;
GST_DEBUG ("coded buffer %" GST_VAAPI_ID_FORMAT, GST_VAAPI_ID_ARGS (buf_id));
- GST_VAAPI_OBJECT_ID (buf) = buf_id;
+ GST_VAAPI_CODED_BUFFER_ID (buf) = buf_id;
return TRUE;
}
static void
-coded_buffer_destroy (GstVaapiCodedBuffer * buf)
+coded_buffer_free (GstVaapiCodedBuffer * buf)
{
- GstVaapiDisplay *const display = GST_VAAPI_OBJECT_DISPLAY (buf);
+ GstVaapiDisplay *const display = GST_VAAPI_CODED_BUFFER_DISPLAY (buf);
VABufferID buf_id;
- buf_id = GST_VAAPI_OBJECT_ID (buf);
+ buf_id = GST_VAAPI_CODED_BUFFER_ID (buf);
GST_DEBUG ("coded buffer %" GST_VAAPI_ID_FORMAT, GST_VAAPI_ID_ARGS (buf_id));
if (buf_id != VA_INVALID_ID) {
GST_VAAPI_DISPLAY_LOCK (display);
vaapi_destroy_buffer (GST_VAAPI_DISPLAY_VADISPLAY (display), &buf_id);
GST_VAAPI_DISPLAY_UNLOCK (display);
- GST_VAAPI_OBJECT_ID (buf) = VA_INVALID_ID;
+ GST_VAAPI_CODED_BUFFER_ID (buf) = VA_INVALID_ID;
}
+
+ gst_vaapi_display_replace (&GST_VAAPI_CODED_BUFFER_DISPLAY (buf), NULL);
+
+ g_slice_free1 (sizeof (GstVaapiCodedBuffer), buf);
}
static gboolean
coded_buffer_map (GstVaapiCodedBuffer * buf)
{
+ GstVaapiDisplay *const display = GST_VAAPI_CODED_BUFFER_DISPLAY (buf);
+
if (buf->segment_list)
return TRUE;
- GST_VAAPI_OBJECT_LOCK_DISPLAY (buf);
- buf->segment_list = vaapi_map_buffer (GST_VAAPI_OBJECT_VADISPLAY (buf),
- GST_VAAPI_OBJECT_ID (buf));
- GST_VAAPI_OBJECT_UNLOCK_DISPLAY (buf);
+ GST_VAAPI_DISPLAY_LOCK (display);
+ buf->segment_list =
+ vaapi_map_buffer (GST_VAAPI_DISPLAY_VADISPLAY (display),
+ GST_VAAPI_CODED_BUFFER_ID (buf));
+ GST_VAAPI_DISPLAY_UNLOCK (display);
return buf->segment_list != NULL;
}
static void
coded_buffer_unmap (GstVaapiCodedBuffer * buf)
{
+ GstVaapiDisplay *const display = GST_VAAPI_CODED_BUFFER_DISPLAY (buf);
+
if (!buf->segment_list)
return;
- GST_VAAPI_OBJECT_LOCK_DISPLAY (buf);
- vaapi_unmap_buffer (GST_VAAPI_OBJECT_VADISPLAY (buf),
- GST_VAAPI_OBJECT_ID (buf), (void **) &buf->segment_list);
- GST_VAAPI_OBJECT_UNLOCK_DISPLAY (buf);
+ GST_VAAPI_DISPLAY_LOCK (display);
+ vaapi_unmap_buffer (GST_VAAPI_DISPLAY_VADISPLAY (display),
+ GST_VAAPI_CODED_BUFFER_ID (buf), (void **) &buf->segment_list);
+ GST_VAAPI_DISPLAY_UNLOCK (display);
}
-/* *INDENT-OFF* */
-#define gst_vaapi_coded_buffer_finalize coded_buffer_destroy
-GST_VAAPI_OBJECT_DEFINE_CLASS (GstVaapiCodedBuffer, gst_vaapi_coded_buffer)
-/* *INDENT-ON* */
+GST_DEFINE_MINI_OBJECT_TYPE (GstVaapiCodedBuffer, gst_vaapi_coded_buffer);
/*
* gst_vaapi_coded_buffer_new:
@@ -120,10 +126,18 @@ gst_vaapi_coded_buffer_new (GstVaapiContext * context, guint buf_size)
display = GST_VAAPI_CONTEXT_DISPLAY (context);
g_return_val_if_fail (display != NULL, NULL);
- buf = gst_vaapi_object_new (gst_vaapi_coded_buffer_class (), display);
+ buf = g_slice_new (GstVaapiCodedBuffer);
if (!buf)
return NULL;
+ gst_mini_object_init (GST_MINI_OBJECT_CAST (buf), 0,
+ GST_TYPE_VAAPI_CODED_BUFFER, NULL, NULL,
+ (GstMiniObjectFreeFunction) coded_buffer_free);
+
+ GST_VAAPI_CODED_BUFFER_DISPLAY (buf) = gst_object_ref (display);
+ GST_VAAPI_CODED_BUFFER_ID (buf) = VA_INVALID_ID;
+ buf->segment_list = NULL;
+
if (!coded_buffer_create (buf, buf_size, context))
goto error;
return buf;
@@ -131,7 +145,7 @@ gst_vaapi_coded_buffer_new (GstVaapiContext * context, guint buf_size)
/* ERRORS */
error:
{
- gst_vaapi_object_unref (buf);
+ gst_vaapi_coded_buffer_unref (buf);
return NULL;
}
}
diff --git a/gst-libs/gst/vaapi/gstvaapicodedbuffer.h b/gst-libs/gst/vaapi/gstvaapicodedbuffer.h
index 4980e9c3..e84f57b8 100644
--- a/gst-libs/gst/vaapi/gstvaapicodedbuffer.h
+++ b/gst-libs/gst/vaapi/gstvaapicodedbuffer.h
@@ -42,12 +42,33 @@ typedef struct _GstVaapiCodedBuffer GstVaapiCodedBuffer;
typedef struct _GstVaapiCodedBufferProxy GstVaapiCodedBufferProxy;
typedef struct _GstVaapiCodedBufferPool GstVaapiCodedBufferPool;
+#define GST_TYPE_VAAPI_CODED_BUFFER (gst_vaapi_coded_buffer_get_type ())
+
+GType
+gst_vaapi_coded_buffer_get_type (void) G_GNUC_CONST;
+
+/**
+ * gst_vaapi_coded_buffer_unref: (skip)
+ * @buf: (transfer full): a #GstVaapiCodedBuffer.
+ *
+ * Decreases the refcount of @buf. If the refcount reaches 0, the
+ * @buf will be freed.
+ */
+static inline void gst_vaapi_coded_buffer_unref(GstVaapiCodedBuffer* buf);
+static inline void
+gst_vaapi_coded_buffer_unref (GstVaapiCodedBuffer * buf)
+{
+ gst_mini_object_unref (GST_MINI_OBJECT_CAST (buf));
+}
+
gssize
gst_vaapi_coded_buffer_get_size (GstVaapiCodedBuffer * buf);
gboolean
gst_vaapi_coded_buffer_copy_into (GstBuffer * dest, GstVaapiCodedBuffer * src);
+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstVaapiCodedBuffer, gst_vaapi_coded_buffer_unref)
+
G_END_DECLS
#endif /* GST_VAAPI_CODED_BUFFER_H */
diff --git a/gst-libs/gst/vaapi/gstvaapicodedbuffer_priv.h b/gst-libs/gst/vaapi/gstvaapicodedbuffer_priv.h
index 8d0de4d1..85a6193c 100644
--- a/gst-libs/gst/vaapi/gstvaapicodedbuffer_priv.h
+++ b/gst-libs/gst/vaapi/gstvaapicodedbuffer_priv.h
@@ -26,15 +26,12 @@
#include <gst/vaapi/gstvaapicontext.h>
#include "gstvaapicodedbuffer.h"
-#include "gstvaapiobject_priv.h"
G_BEGIN_DECLS
#define GST_VAAPI_CODED_BUFFER_CAST(obj) \
((GstVaapiCodedBuffer *)(obj))
-typedef struct _GstVaapiCodedBufferClass GstVaapiCodedBufferClass;
-
/**
* GstVaapiCodedBuffer:
*
@@ -43,22 +40,32 @@ typedef struct _GstVaapiCodedBufferClass GstVaapiCodedBufferClass;
struct _GstVaapiCodedBuffer
{
/*< private >*/
- GstVaapiObject parent_instance;
+ GstMiniObject mini_object;
+ GstVaapiDisplay *display;
+ GstVaapiID object_id;
+ /*< public >*/
GstVaapiContext *context;
VACodedBufferSegment *segment_list;
};
/**
- * GstVaapiCodedBufferClass:
+ * GST_VAAPI_CODED_BUFFER_DISPLAY:
+ * @buf: a #GstVaapiCodedBuffer
*
- * A VA coded buffer object wrapper class.
+ * Macro that evaluates to the #GstVaapiDisplay of @buf
*/
-struct _GstVaapiCodedBufferClass
-{
- /*< private >*/
- GstVaapiObjectClass parent_class;
-};
+#undef GST_VAAPI_CODED_BUFFER_DISPLAY
+#define GST_VAAPI_CODED_BUFFER_DISPLAY(buf) (GST_VAAPI_CODED_BUFFER (buf)->display)
+
+/**
+ * GST_VAAPI_CODED_BUFFER_ID:
+ * @buf: a #GstVaapiCodedBuffer
+ *
+ * Macro that evaluates to the object ID of @buf
+ */
+#undef GST_VAAPI_CODED_BUFFER_ID
+#define GST_VAAPI_CODED_BUFFER_ID(buf) (GST_VAAPI_CODED_BUFFER (buf)->object_id)
G_GNUC_INTERNAL
GstVaapiCodedBuffer *
diff --git a/gst-libs/gst/vaapi/gstvaapicodedbufferproxy.c b/gst-libs/gst/vaapi/gstvaapicodedbufferproxy.c
index d28e7b64..c0adfcbf 100644
--- a/gst-libs/gst/vaapi/gstvaapicodedbufferproxy.c
+++ b/gst-libs/gst/vaapi/gstvaapicodedbufferproxy.c
@@ -45,7 +45,7 @@ coded_buffer_proxy_finalize (GstVaapiCodedBufferProxy * proxy)
if (proxy->buffer) {
if (proxy->pool)
gst_vaapi_video_pool_put_object (proxy->pool, proxy->buffer);
- gst_vaapi_object_unref (proxy->buffer);
+ gst_vaapi_coded_buffer_unref (proxy->buffer);
proxy->buffer = NULL;
}
gst_vaapi_video_pool_replace (&proxy->pool, NULL);
@@ -115,7 +115,7 @@ gst_vaapi_coded_buffer_proxy_new_from_pool (GstVaapiCodedBufferPool * pool)
#endif
if (!proxy->buffer)
goto error;
- gst_vaapi_object_ref (proxy->buffer);
+ gst_mini_object_ref (GST_MINI_OBJECT_CAST (proxy->buffer));
return proxy;
/* ERRORS */
diff --git a/gst-libs/gst/vaapi/gstvaapiencoder_h264.c b/gst-libs/gst/vaapi/gstvaapiencoder_h264.c
index 56f90dc1..f3dcc3df 100644
--- a/gst-libs/gst/vaapi/gstvaapiencoder_h264.c
+++ b/gst-libs/gst/vaapi/gstvaapiencoder_h264.c
@@ -2236,7 +2236,7 @@ fill_picture (GstVaapiEncoderH264 * encoder, GstVaapiEncPicture * picture,
for (; i < 16; ++i) {
pic_param->ReferenceFrames[i].picture_id = VA_INVALID_ID;
}
- pic_param->coded_buf = GST_VAAPI_OBJECT_ID (codedbuf);
+ pic_param->coded_buf = GST_VAAPI_CODED_BUFFER_ID (codedbuf);
pic_param->pic_parameter_set_id = encoder->view_idx;
pic_param->seq_parameter_set_id = encoder->view_idx ? 1 : 0;
diff --git a/gst-libs/gst/vaapi/gstvaapiencoder_h264_fei.c b/gst-libs/gst/vaapi/gstvaapiencoder_h264_fei.c
index 92111e0b..04927450 100644
--- a/gst-libs/gst/vaapi/gstvaapiencoder_h264_fei.c
+++ b/gst-libs/gst/vaapi/gstvaapiencoder_h264_fei.c
@@ -2015,7 +2015,7 @@ fill_picture (GstVaapiEncoderH264Fei * encoder, GstVaapiEncPicture * picture,
for (; i < 16; ++i) {
pic_param->ReferenceFrames[i].picture_id = VA_INVALID_ID;
}
- pic_param->coded_buf = GST_VAAPI_OBJECT_ID (codedbuf);
+ pic_param->coded_buf = GST_VAAPI_CODED_BUFFER_ID (codedbuf);
pic_param->pic_parameter_set_id = encoder->view_idx;
pic_param->seq_parameter_set_id = encoder->view_idx ? 1 : 0;
diff --git a/gst-libs/gst/vaapi/gstvaapiencoder_h265.c b/gst-libs/gst/vaapi/gstvaapiencoder_h265.c
index 663c7681..795075e3 100644
--- a/gst-libs/gst/vaapi/gstvaapiencoder_h265.c
+++ b/gst-libs/gst/vaapi/gstvaapiencoder_h265.c
@@ -1613,7 +1613,7 @@ fill_picture (GstVaapiEncoderH265 * encoder, GstVaapiEncPicture * picture,
pic_param->reference_frames[i].picture_id = VA_INVALID_SURFACE;
pic_param->reference_frames[i].flags = 0;
}
- pic_param->coded_buf = GST_VAAPI_OBJECT_ID (codedbuf);
+ pic_param->coded_buf = GST_VAAPI_CODED_BUFFER_ID (codedbuf);
/* slice_temporal_mvp_enable_flag == FALSE */
pic_param->collocated_ref_pic_index = 0xFF;
diff --git a/gst-libs/gst/vaapi/gstvaapiencoder_jpeg.c b/gst-libs/gst/vaapi/gstvaapiencoder_jpeg.c
index 82839081..56910877 100644
--- a/gst-libs/gst/vaapi/gstvaapiencoder_jpeg.c
+++ b/gst-libs/gst/vaapi/gstvaapiencoder_jpeg.c
@@ -214,7 +214,7 @@ fill_picture (GstVaapiEncoderJpeg * encoder,
GST_VAAPI_SURFACE_PROXY_SURFACE_ID (surface);
pic_param->picture_width = GST_VAAPI_ENCODER_WIDTH (encoder);
pic_param->picture_height = GST_VAAPI_ENCODER_HEIGHT (encoder);
- pic_param->coded_buf = GST_VAAPI_OBJECT_ID (codedbuf);
+ pic_param->coded_buf = GST_VAAPI_CODED_BUFFER_ID (codedbuf);
pic_param->pic_flags.bits.profile = 0; /* Profile = Baseline */
pic_param->pic_flags.bits.progressive = 0; /* Sequential encoding */
diff --git a/gst-libs/gst/vaapi/gstvaapiencoder_mpeg2.c b/gst-libs/gst/vaapi/gstvaapiencoder_mpeg2.c
index 9574be02..0aca23ba 100644
--- a/gst-libs/gst/vaapi/gstvaapiencoder_mpeg2.c
+++ b/gst-libs/gst/vaapi/gstvaapiencoder_mpeg2.c
@@ -269,7 +269,7 @@ fill_picture (GstVaapiEncoderMpeg2 * encoder,
pic_param->reconstructed_picture =
GST_VAAPI_SURFACE_PROXY_SURFACE_ID (surface);
- pic_param->coded_buf = GST_VAAPI_OBJECT_ID (codedbuf);
+ pic_param->coded_buf = GST_VAAPI_CODED_BUFFER_ID (codedbuf);
pic_param->picture_type = get_va_enc_picture_type (picture->type);
pic_param->temporal_reference = picture->frame_num & (1024 - 1);
pic_param->vbv_delay = 0xFFFF;
diff --git a/gst-libs/gst/vaapi/gstvaapiencoder_vp8.c b/gst-libs/gst/vaapi/gstvaapiencoder_vp8.c
index 102b45a4..b91fa435 100644
--- a/gst-libs/gst/vaapi/gstvaapiencoder_vp8.c
+++ b/gst-libs/gst/vaapi/gstvaapiencoder_vp8.c
@@ -304,7 +304,7 @@ fill_picture (GstVaapiEncoderVP8 * encoder,
memset (pic_param, 0, sizeof (VAEncPictureParameterBufferVP8));
pic_param->reconstructed_frame = GST_VAAPI_SURFACE_PROXY_SURFACE_ID (surface);
- pic_param->coded_buf = GST_VAAPI_OBJECT_ID (codedbuf);
+ pic_param->coded_buf = GST_VAAPI_CODED_BUFFER_ID (codedbuf);
if (picture->type == GST_VAAPI_PICTURE_TYPE_P) {
pic_param->pic_flags.bits.frame_type = 1;
diff --git a/gst-libs/gst/vaapi/gstvaapiencoder_vp9.c b/gst-libs/gst/vaapi/gstvaapiencoder_vp9.c
index 6c8878b4..07c8154b 100644
--- a/gst-libs/gst/vaapi/gstvaapiencoder_vp9.c
+++ b/gst-libs/gst/vaapi/gstvaapiencoder_vp9.c
@@ -344,7 +344,7 @@ fill_picture (GstVaapiEncoderVP9 * encoder,
memset (pic_param, 0, sizeof (VAEncPictureParameterBufferVP9));
pic_param->reconstructed_frame = GST_VAAPI_SURFACE_PROXY_SURFACE_ID (surface);
- pic_param->coded_buf = GST_VAAPI_OBJECT_ID (codedbuf);
+ pic_param->coded_buf = GST_VAAPI_CODED_BUFFER_ID (codedbuf);
/* Update Reference Frame list */
if (picture->type == GST_VAAPI_PICTURE_TYPE_I)
diff --git a/gst-libs/gst/vaapi/gstvaapifeienc_h264.c b/gst-libs/gst/vaapi/gstvaapifeienc_h264.c
index 333744bc..60f08c41 100644
--- a/gst-libs/gst/vaapi/gstvaapifeienc_h264.c
+++ b/gst-libs/gst/vaapi/gstvaapifeienc_h264.c
@@ -766,7 +766,7 @@ fill_picture (GstVaapiFeiEncH264 * feienc, GstVaapiEncPicture * picture,
pic_param->ReferenceFrames[i].flags = VA_PICTURE_H264_INVALID;
}
- pic_param->coded_buf = GST_VAAPI_OBJECT_ID (codedbuf);
+ pic_param->coded_buf = GST_VAAPI_CODED_BUFFER_ID (codedbuf);
pic_param->pic_parameter_set_id = feienc->view_idx;
pic_param->seq_parameter_set_id = feienc->view_idx ? 1 : 0;
diff --git a/gst-libs/gst/vaapi/gstvaapifeipak_h264.c b/gst-libs/gst/vaapi/gstvaapifeipak_h264.c
index ceb821b2..575c4f93 100644
--- a/gst-libs/gst/vaapi/gstvaapifeipak_h264.c
+++ b/gst-libs/gst/vaapi/gstvaapifeipak_h264.c
@@ -1342,7 +1342,7 @@ fill_picture (GstVaapiFEIPakH264 * feipak, GstVaapiEncPicture * picture,
pic_param->ReferenceFrames[i].picture_id = VA_INVALID_ID;
pic_param->ReferenceFrames[i].frame_idx = VA_PICTURE_H264_INVALID;
}
- pic_param->coded_buf = GST_VAAPI_OBJECT_ID (codedbuf);
+ pic_param->coded_buf = GST_VAAPI_CODED_BUFFER_ID (codedbuf);
return TRUE;
}
diff --git a/gst-libs/gst/vaapi/gstvaapivideopool.c b/gst-libs/gst/vaapi/gstvaapivideopool.c
index daeed767..9e79b951 100644
--- a/gst-libs/gst/vaapi/gstvaapivideopool.c
+++ b/gst-libs/gst/vaapi/gstvaapivideopool.c
@@ -67,14 +67,16 @@ gst_vaapi_video_pool_init (GstVaapiVideoPool * pool, GstVaapiDisplay * display,
void
gst_vaapi_video_pool_finalize (GstVaapiVideoPool * pool)
{
- if (pool->object_type == GST_VAAPI_VIDEO_POOL_OBJECT_TYPE_IMAGE) {
+ if (pool->object_type == GST_VAAPI_VIDEO_POOL_OBJECT_TYPE_IMAGE
+ || pool->object_type == GST_VAAPI_VIDEO_POOL_OBJECT_TYPE_CODED_BUFFER) {
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) {
+ if (pool->object_type == GST_VAAPI_VIDEO_POOL_OBJECT_TYPE_IMAGE
+ || pool->object_type == GST_VAAPI_VIDEO_POOL_OBJECT_TYPE_CODED_BUFFER) {
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);
@@ -195,10 +197,12 @@ gst_vaapi_video_pool_get_object_unlocked (GstVaapiVideoPool * pool)
++pool->used_count;
pool->used_objects = g_list_prepend (pool->used_objects, object);
- if (pool->object_type == GST_VAAPI_VIDEO_POOL_OBJECT_TYPE_IMAGE)
+ if (pool->object_type == GST_VAAPI_VIDEO_POOL_OBJECT_TYPE_IMAGE
+ || pool->object_type == GST_VAAPI_VIDEO_POOL_OBJECT_TYPE_CODED_BUFFER) {
object = gst_mini_object_ref (GST_MINI_OBJECT_CAST (object));
- else
+ } else {
object = gst_vaapi_object_ref (object);
+ }
return object;
}
@@ -235,10 +239,12 @@ gst_vaapi_video_pool_put_object_unlocked (GstVaapiVideoPool * pool,
if (!elem)
return;
- if (pool->object_type == GST_VAAPI_VIDEO_POOL_OBJECT_TYPE_IMAGE)
+ if (pool->object_type == GST_VAAPI_VIDEO_POOL_OBJECT_TYPE_IMAGE
+ || pool->object_type == GST_VAAPI_VIDEO_POOL_OBJECT_TYPE_CODED_BUFFER) {
gst_mini_object_unref (GST_MINI_OBJECT_CAST (object));
- else
+ } else {
gst_vaapi_object_unref (object);
+ }
--pool->used_count;
pool->used_objects = g_list_delete_link (pool->used_objects, elem);
@@ -271,7 +277,8 @@ static inline gboolean
gst_vaapi_video_pool_add_object_unlocked (GstVaapiVideoPool * pool,
gpointer object)
{
- if (pool->object_type == GST_VAAPI_VIDEO_POOL_OBJECT_TYPE_IMAGE) {
+ if (pool->object_type == GST_VAAPI_VIDEO_POOL_OBJECT_TYPE_IMAGE
+ || pool->object_type == GST_VAAPI_VIDEO_POOL_OBJECT_TYPE_CODED_BUFFER) {
g_queue_push_tail (&pool->free_objects,
gst_mini_object_ref (GST_MINI_OBJECT_CAST (object)));
} else {