mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 06:58:56 +00:00
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>
This commit is contained in:
parent
a16849b4ed
commit
46c1f3875a
4 changed files with 50 additions and 6 deletions
|
@ -68,9 +68,10 @@ gst_vaapi_codec_object_create (GstVaapiCodecObject * object,
|
||||||
}
|
}
|
||||||
|
|
||||||
GstVaapiCodecObject *
|
GstVaapiCodecObject *
|
||||||
gst_vaapi_codec_object_new (const GstVaapiCodecObjectClass * object_class,
|
gst_vaapi_codec_object_new_with_param_num (const GstVaapiCodecObjectClass *
|
||||||
GstVaapiCodecBase * codec, gconstpointer param, guint param_size,
|
object_class, GstVaapiCodecBase * codec, gconstpointer param,
|
||||||
gconstpointer data, guint data_size, guint flags)
|
guint param_size, guint param_num, gconstpointer data,
|
||||||
|
guint data_size, guint flags)
|
||||||
{
|
{
|
||||||
GstVaapiCodecObject *obj;
|
GstVaapiCodecObject *obj;
|
||||||
GstVaapiCodecObjectConstructorArgs args;
|
GstVaapiCodecObjectConstructorArgs args;
|
||||||
|
@ -85,6 +86,7 @@ gst_vaapi_codec_object_new (const GstVaapiCodecObjectClass * object_class,
|
||||||
|
|
||||||
args.param = param;
|
args.param = param;
|
||||||
args.param_size = param_size;
|
args.param_size = param_size;
|
||||||
|
args.param_num = param_num;
|
||||||
args.data = data;
|
args.data = data;
|
||||||
args.data_size = data_size;
|
args.data_size = data_size;
|
||||||
args.flags = flags;
|
args.flags = flags;
|
||||||
|
@ -96,6 +98,15 @@ gst_vaapi_codec_object_new (const GstVaapiCodecObjectClass * object_class,
|
||||||
return NULL;
|
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_DECODER(obj) GST_VAAPI_DECODER_CAST((obj)->parent_instance.codec)
|
||||||
#define GET_VA_DISPLAY(obj) GET_DECODER(obj)->va_display
|
#define GET_VA_DISPLAY(obj) GET_DECODER(obj)->va_display
|
||||||
#define GET_VA_CONTEXT(obj) GET_DECODER(obj)->va_context
|
#define GET_VA_CONTEXT(obj) GET_DECODER(obj)->va_context
|
||||||
|
|
|
@ -59,6 +59,7 @@ typedef struct
|
||||||
{
|
{
|
||||||
gconstpointer param;
|
gconstpointer param;
|
||||||
guint param_size;
|
guint param_size;
|
||||||
|
guint param_num;
|
||||||
gconstpointer data;
|
gconstpointer data;
|
||||||
guint data_size;
|
guint data_size;
|
||||||
guint flags;
|
guint flags;
|
||||||
|
@ -105,6 +106,13 @@ gst_vaapi_codec_object_new (const GstVaapiCodecObjectClass * object_class,
|
||||||
GstVaapiCodecBase * codec, gconstpointer param, guint param_size,
|
GstVaapiCodecBase * codec, gconstpointer param, guint param_size,
|
||||||
gconstpointer data, guint data_size, guint flags);
|
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) \
|
#define gst_vaapi_codec_object_ref(object) \
|
||||||
((gpointer) gst_vaapi_mini_object_ref (GST_VAAPI_MINI_OBJECT (object)))
|
((gpointer) gst_vaapi_mini_object_ref (GST_VAAPI_MINI_OBJECT (object)))
|
||||||
|
|
||||||
|
|
|
@ -457,9 +457,10 @@ gst_vaapi_slice_create (GstVaapiSlice * slice,
|
||||||
if (!success)
|
if (!success)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
success = vaapi_create_buffer (GET_VA_DISPLAY (slice), GET_VA_CONTEXT (slice),
|
g_assert (args->param_num >= 1);
|
||||||
VASliceParameterBufferType, args->param_size, args->param,
|
success = vaapi_create_n_elements_buffer (GET_VA_DISPLAY (slice),
|
||||||
&slice->param_id, &slice->param);
|
GET_VA_CONTEXT (slice), VASliceParameterBufferType, args->param_size,
|
||||||
|
args->param, &slice->param_id, &slice->param, args->param_num);
|
||||||
if (!success)
|
if (!success)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -480,3 +481,16 @@ gst_vaapi_slice_new (GstVaapiDecoder * decoder,
|
||||||
GST_VAAPI_CODEC_BASE (decoder), param, param_size, data, data_size, 0);
|
GST_VAAPI_CODEC_BASE (decoder), param, param_size, data, data_size, 0);
|
||||||
return GST_VAAPI_SLICE_CAST (object);
|
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);
|
||||||
|
}
|
||||||
|
|
|
@ -260,6 +260,12 @@ GstVaapiSlice *
|
||||||
gst_vaapi_slice_new (GstVaapiDecoder * decoder, gconstpointer param,
|
gst_vaapi_slice_new (GstVaapiDecoder * decoder, gconstpointer param,
|
||||||
guint param_size, const guchar * data, guint data_size);
|
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 --- */
|
/* --- Helpers to create codec-dependent objects --- */
|
||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
|
@ -273,6 +279,11 @@ gst_vaapi_slice_new (GstVaapiDecoder * decoder, gconstpointer param,
|
||||||
NULL, sizeof (G_PASTE (VASliceParameterBuffer, codec)), \
|
NULL, sizeof (G_PASTE (VASliceParameterBuffer, codec)), \
|
||||||
buf, buf_size)
|
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
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* GST_VAAPI_DECODER_OBJECTS_H */
|
#endif /* GST_VAAPI_DECODER_OBJECTS_H */
|
||||||
|
|
Loading…
Reference in a new issue