va: Refactor _set_format() to _set_frame_size().

Renamed gst_va_decoder_set_format() to
gst_va_decoder_set_frame_size_with_surfaces() which resembles better
the passed parameters. Internally it creates the vaContext.

Added gst_va_decoder_set_frame_size() which is an alias of
gst_va_decoder_set_frame_size_with_surfaces() without surfaces. This
is the function which replaces gst_va_decoder_set_format() where
used.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2417>
This commit is contained in:
Víctor Manuel Jáquez Leal 2021-07-17 20:29:45 +02:00
parent 4299596d16
commit 1bf2805560
8 changed files with 26 additions and 16 deletions

View file

@ -112,8 +112,8 @@ gst_va_av1_dec_negotiate (GstVideoDecoder * decoder)
if (!gst_va_decoder_open (base->decoder, base->profile, base->rt_format))
return FALSE;
if (!gst_va_decoder_set_format (base->decoder, self->max_width,
self->max_height, NULL))
if (!gst_va_decoder_set_frame_size (base->decoder, self->max_width,
self->max_height))
return FALSE;
}

View file

@ -296,8 +296,8 @@ gst_va_decoder_close (GstVaDecoder * self)
}
gboolean
gst_va_decoder_set_format (GstVaDecoder * self, gint coded_width,
gint coded_height, GArray * surfaces)
gst_va_decoder_set_frame_size_with_surfaces (GstVaDecoder * self,
gint coded_width, gint coded_height, GArray * surfaces)
{
VAContextID context;
VADisplay dpy;
@ -310,7 +310,7 @@ gst_va_decoder_set_format (GstVaDecoder * self, gint coded_width,
GST_OBJECT_LOCK (self);
if (self->context != VA_INVALID_ID) {
GST_OBJECT_UNLOCK (self);
GST_INFO_OBJECT (self, "decoder already has a format");
GST_INFO_OBJECT (self, "decoder already has a context");
return TRUE;
}
GST_OBJECT_UNLOCK (self);
@ -346,6 +346,14 @@ gst_va_decoder_set_format (GstVaDecoder * self, gint coded_width,
return TRUE;
}
gboolean
gst_va_decoder_set_frame_size (GstVaDecoder * self, gint coded_width,
gint coded_height)
{
return gst_va_decoder_set_frame_size_with_surfaces (self, coded_width,
coded_height, NULL);
}
gboolean
gst_va_decoder_change_resolution (GstVaDecoder * self, gint coded_width,
gint coded_height)

View file

@ -44,10 +44,14 @@ gboolean gst_va_decoder_open (GstVaDecoder * self,
guint rt_format);
gboolean gst_va_decoder_close (GstVaDecoder * self);
gboolean gst_va_decoder_is_open (GstVaDecoder * self);
gboolean gst_va_decoder_set_format (GstVaDecoder * self,
gboolean gst_va_decoder_set_frame_size_with_surfaces
(GstVaDecoder * self,
gint coded_width,
gint coded_height,
GArray * surfaces);
gboolean gst_va_decoder_set_frame_size (GstVaDecoder * self,
gint coded_width,
gint coded_height);
gboolean gst_va_decoder_change_resolution (GstVaDecoder * self,
gint coded_width,
gint coded_height);

View file

@ -815,8 +815,8 @@ gst_va_h264_dec_negotiate (GstVideoDecoder * decoder)
if (!gst_va_decoder_open (base->decoder, base->profile, base->rt_format))
return FALSE;
if (!gst_va_decoder_set_format (base->decoder, self->coded_width,
self->coded_height, NULL))
if (!gst_va_decoder_set_frame_size (base->decoder, self->coded_width,
self->coded_height))
return FALSE;
if (base->output_state)

View file

@ -1198,8 +1198,8 @@ gst_va_h265_dec_negotiate (GstVideoDecoder * decoder)
if (!gst_va_decoder_open (base->decoder, base->profile, base->rt_format))
return FALSE;
if (!gst_va_decoder_set_format (base->decoder, self->coded_width,
self->coded_height, NULL))
if (!gst_va_decoder_set_frame_size (base->decoder, self->coded_width,
self->coded_height))
return FALSE;
if (base->output_state)

View file

@ -105,8 +105,7 @@ gst_va_mpeg2_dec_negotiate (GstVideoDecoder * decoder)
if (!gst_va_decoder_open (base->decoder, base->profile, base->rt_format))
return FALSE;
if (!gst_va_decoder_set_format (base->decoder, base->width,
base->height, NULL))
if (!gst_va_decoder_set_frame_size (base->decoder, base->width, base->height))
return FALSE;
if (base->output_state)

View file

@ -104,8 +104,7 @@ gst_va_vp8_dec_negotiate (GstVideoDecoder * decoder)
if (!gst_va_decoder_open (base->decoder, base->profile, base->rt_format))
return FALSE;
if (!gst_va_decoder_set_format (base->decoder, base->width, base->height,
NULL))
if (!gst_va_decoder_set_frame_size (base->decoder, base->width, base->height))
return FALSE;
if (base->output_state)

View file

@ -575,8 +575,8 @@ gst_va_vp9_dec_negotiate (GstVideoDecoder * decoder)
if (!gst_va_decoder_open (base->decoder, base->profile, base->rt_format))
return FALSE;
if (!gst_va_decoder_set_format (base->decoder, base->width, base->height,
NULL))
if (!gst_va_decoder_set_frame_size (base->decoder, base->width,
base->height))
return FALSE;
}