summaryrefslogtreecommitdiff
path: root/gst-libs
diff options
context:
space:
mode:
authorHe Junyan <junyan.he@intel.com>2020-08-27 21:39:35 +0800
committerHe Junyan <junyan.he@intel.com>2020-12-14 18:43:52 +0800
commit46c1f3875a6e998b3d85ab4f938fd846e616252a (patch)
treeabb72e3dbed015d98983a4a084bf0903b6b71453 /gst-libs
parenta16849b4ed03557b2f03cc1458cd297ef6aeda71 (diff)
libs: codecobject: Add number of elements when create codec object.
One slice data may need several slice parameter buffers at one time. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/191>
Diffstat (limited to 'gst-libs')
-rw-r--r--gst-libs/gst/vaapi/gstvaapicodec_objects.c17
-rw-r--r--gst-libs/gst/vaapi/gstvaapicodec_objects.h8
-rw-r--r--gst-libs/gst/vaapi/gstvaapidecoder_objects.c20
-rw-r--r--gst-libs/gst/vaapi/gstvaapidecoder_objects.h11
4 files changed, 50 insertions, 6 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapicodec_objects.c b/gst-libs/gst/vaapi/gstvaapicodec_objects.c
index e66d2fe7..1bdd93b2 100644
--- a/gst-libs/gst/vaapi/gstvaapicodec_objects.c
+++ b/gst-libs/gst/vaapi/gstvaapicodec_objects.c
@@ -68,9 +68,10 @@ gst_vaapi_codec_object_create (GstVaapiCodecObject * object,
}
GstVaapiCodecObject *
-gst_vaapi_codec_object_new (const GstVaapiCodecObjectClass * object_class,
- GstVaapiCodecBase * codec, gconstpointer param, guint param_size,
- gconstpointer data, guint data_size, guint flags)
+gst_vaapi_codec_object_new_with_param_num (const GstVaapiCodecObjectClass *
+ object_class, GstVaapiCodecBase * codec, gconstpointer param,
+ guint param_size, guint param_num, gconstpointer data,
+ guint data_size, guint flags)
{
GstVaapiCodecObject *obj;
GstVaapiCodecObjectConstructorArgs args;
@@ -85,6 +86,7 @@ gst_vaapi_codec_object_new (const GstVaapiCodecObjectClass * object_class,
args.param = param;
args.param_size = param_size;
+ args.param_num = param_num;
args.data = data;
args.data_size = data_size;
args.flags = flags;
@@ -96,6 +98,15 @@ gst_vaapi_codec_object_new (const GstVaapiCodecObjectClass * object_class,
return NULL;
}
+GstVaapiCodecObject *
+gst_vaapi_codec_object_new (const GstVaapiCodecObjectClass * object_class,
+ GstVaapiCodecBase * codec, gconstpointer param, guint param_size,
+ gconstpointer data, guint data_size, guint flags)
+{
+ return gst_vaapi_codec_object_new_with_param_num (object_class, codec, param,
+ param_size, 1, data, data_size, flags);
+}
+
#define GET_DECODER(obj) GST_VAAPI_DECODER_CAST((obj)->parent_instance.codec)
#define GET_VA_DISPLAY(obj) GET_DECODER(obj)->va_display
#define GET_VA_CONTEXT(obj) GET_DECODER(obj)->va_context
diff --git a/gst-libs/gst/vaapi/gstvaapicodec_objects.h b/gst-libs/gst/vaapi/gstvaapicodec_objects.h
index 2d081bde..ab30dab7 100644
--- a/gst-libs/gst/vaapi/gstvaapicodec_objects.h
+++ b/gst-libs/gst/vaapi/gstvaapicodec_objects.h
@@ -59,6 +59,7 @@ typedef struct
{
gconstpointer param;
guint param_size;
+ guint param_num;
gconstpointer data;
guint data_size;
guint flags;
@@ -105,6 +106,13 @@ gst_vaapi_codec_object_new (const GstVaapiCodecObjectClass * object_class,
GstVaapiCodecBase * codec, gconstpointer param, guint param_size,
gconstpointer data, guint data_size, guint flags);
+G_GNUC_INTERNAL
+GstVaapiCodecObject *
+gst_vaapi_codec_object_new_with_param_num (const GstVaapiCodecObjectClass *
+ object_class, GstVaapiCodecBase * codec, gconstpointer param,
+ guint param_size, guint param_num, gconstpointer data,
+ guint data_size, guint flags);
+
#define gst_vaapi_codec_object_ref(object) \
((gpointer) gst_vaapi_mini_object_ref (GST_VAAPI_MINI_OBJECT (object)))
diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_objects.c b/gst-libs/gst/vaapi/gstvaapidecoder_objects.c
index 48e9ead9..8139e140 100644
--- a/gst-libs/gst/vaapi/gstvaapidecoder_objects.c
+++ b/gst-libs/gst/vaapi/gstvaapidecoder_objects.c
@@ -457,9 +457,10 @@ gst_vaapi_slice_create (GstVaapiSlice * slice,
if (!success)
return FALSE;
- success = vaapi_create_buffer (GET_VA_DISPLAY (slice), GET_VA_CONTEXT (slice),
- VASliceParameterBufferType, args->param_size, args->param,
- &slice->param_id, &slice->param);
+ g_assert (args->param_num >= 1);
+ success = vaapi_create_n_elements_buffer (GET_VA_DISPLAY (slice),
+ GET_VA_CONTEXT (slice), VASliceParameterBufferType, args->param_size,
+ args->param, &slice->param_id, &slice->param, args->param_num);
if (!success)
return FALSE;
@@ -480,3 +481,16 @@ gst_vaapi_slice_new (GstVaapiDecoder * decoder,
GST_VAAPI_CODEC_BASE (decoder), param, param_size, data, data_size, 0);
return GST_VAAPI_SLICE_CAST (object);
}
+
+GstVaapiSlice *
+gst_vaapi_slice_new_n_params (GstVaapiDecoder * decoder,
+ gconstpointer param, guint param_size, guint param_num, const guchar * data,
+ guint data_size)
+{
+ GstVaapiCodecObject *object;
+
+ object = gst_vaapi_codec_object_new_with_param_num (&GstVaapiSliceClass,
+ GST_VAAPI_CODEC_BASE (decoder), param, param_size, param_num, data,
+ data_size, 0);
+ return GST_VAAPI_SLICE_CAST (object);
+}
diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_objects.h b/gst-libs/gst/vaapi/gstvaapidecoder_objects.h
index c4c4f858..16ef2550 100644
--- a/gst-libs/gst/vaapi/gstvaapidecoder_objects.h
+++ b/gst-libs/gst/vaapi/gstvaapidecoder_objects.h
@@ -260,6 +260,12 @@ GstVaapiSlice *
gst_vaapi_slice_new (GstVaapiDecoder * decoder, gconstpointer param,
guint param_size, const guchar * data, guint data_size);
+G_GNUC_INTERNAL
+GstVaapiSlice *
+gst_vaapi_slice_new_n_params (GstVaapiDecoder * decoder,
+ gconstpointer param, guint param_size, guint param_num, const guchar * data,
+ guint data_size);
+
/* ------------------------------------------------------------------------- */
/* --- Helpers to create codec-dependent objects --- */
/* ------------------------------------------------------------------------- */
@@ -273,6 +279,11 @@ gst_vaapi_slice_new (GstVaapiDecoder * decoder, gconstpointer param,
NULL, sizeof (G_PASTE (VASliceParameterBuffer, codec)), \
buf, buf_size)
+#define GST_VAAPI_SLICE_NEW_N_PARAMS(codec, decoder, buf, buf_size, n) \
+ gst_vaapi_slice_new_n_params (GST_VAAPI_DECODER_CAST (decoder), \
+ NULL, sizeof (G_PASTE (VASliceParameterBuffer, codec)), n, \
+ buf, buf_size)
+
G_END_DECLS
#endif /* GST_VAAPI_DECODER_OBJECTS_H */