VA: Add a helper function of decoder_add_slice_buffer_with_n_params.

Some codecs such as AV1 needs several parameters associated with one
slice. It may have multi tiles within one slice and each tile needs
its description parameter.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1636>
This commit is contained in:
He Junyan 2021-01-19 15:07:38 +08:00
parent 315b101394
commit e40e78a793
2 changed files with 21 additions and 4 deletions

View file

@ -527,9 +527,9 @@ gst_va_decoder_add_param_buffer (GstVaDecoder * self, GstVaDecodePicture * pic,
}
gboolean
gst_va_decoder_add_slice_buffer (GstVaDecoder * self, GstVaDecodePicture * pic,
gpointer params_data, gsize params_size, gpointer slice_data,
gsize slice_size)
gst_va_decoder_add_slice_buffer_with_n_params (GstVaDecoder * self,
GstVaDecodePicture * pic, gpointer params_data, gsize params_size,
guint params_num, gpointer slice_data, gsize slice_size)
{
VABufferID params_buffer, slice_buffer;
VADisplay dpy;
@ -543,7 +543,7 @@ gst_va_decoder_add_slice_buffer (GstVaDecoder * self, GstVaDecodePicture * pic,
dpy = gst_va_display_get_va_dpy (self->display);
gst_va_display_lock (self->display);
status = vaCreateBuffer (dpy, self->context, VASliceParameterBufferType,
params_size, 1, params_data, &params_buffer);
params_size, params_num, params_data, &params_buffer);
gst_va_display_unlock (self->display);
if (status != VA_STATUS_SUCCESS) {
GST_ERROR_OBJECT (self, "vaCreateBuffer: %s", vaErrorStr (status));
@ -565,6 +565,15 @@ gst_va_decoder_add_slice_buffer (GstVaDecoder * self, GstVaDecodePicture * pic,
return TRUE;
}
gboolean
gst_va_decoder_add_slice_buffer (GstVaDecoder * self, GstVaDecodePicture * pic,
gpointer params_data, gsize params_size, gpointer slice_data,
gsize slice_size)
{
return gst_va_decoder_add_slice_buffer_with_n_params (self, pic, params_data,
params_size, 1, slice_data, slice_size);
}
gboolean
gst_va_decoder_decode (GstVaDecoder * self, GstVaDecodePicture * pic)
{

View file

@ -65,6 +65,14 @@ gboolean gst_va_decoder_add_slice_buffer (GstVaDecoder * self,
gsize params_size,
gpointer slice_data,
gsize slice_size);
gboolean gst_va_decoder_add_slice_buffer_with_n_params
(GstVaDecoder * self,
GstVaDecodePicture * pic,
gpointer params_data,
gsize params_size,
guint params_num,
gpointer slice_data,
gsize slice_size);
gboolean gst_va_decoder_decode (GstVaDecoder * self,
GstVaDecodePicture * pic);