mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
va: decoder: Add helper functions to get and change the resolution.
Some codecs such as VP9, its config and context have the ability to dynamically. When we only change the width and height, no need to re-create the config and context. The helper function can just change the resolution without re-creating config and context. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2407>
This commit is contained in:
parent
30e105561d
commit
6887e77201
2 changed files with 57 additions and 0 deletions
|
@ -346,6 +346,34 @@ gst_va_decoder_set_format (GstVaDecoder * self, gint coded_width,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_va_decoder_change_resolution (GstVaDecoder * self, gint coded_width,
|
||||
gint coded_height)
|
||||
{
|
||||
g_return_val_if_fail (GST_IS_VA_DECODER (self), FALSE);
|
||||
|
||||
if (!gst_va_decoder_is_open (self)) {
|
||||
GST_ERROR_OBJECT (self, "decoder has not been opened yet");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
GST_OBJECT_LOCK (self);
|
||||
if (self->context == VA_INVALID_ID) {
|
||||
GST_OBJECT_UNLOCK (self);
|
||||
GST_INFO_OBJECT (self, "decoder does not have a format");
|
||||
return FALSE;
|
||||
}
|
||||
GST_OBJECT_UNLOCK (self);
|
||||
|
||||
|
||||
GST_OBJECT_LOCK (self);
|
||||
self->coded_width = coded_width;
|
||||
self->coded_height = coded_height;
|
||||
GST_OBJECT_UNLOCK (self);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_get_codec_caps (GstVaDecoder * self)
|
||||
{
|
||||
|
@ -779,3 +807,24 @@ gst_va_decoder_format_changed (GstVaDecoder * decoder, VAProfile new_profile,
|
|||
decoder->rt_format == new_rtformat &&
|
||||
decoder->coded_width == new_width && decoder->coded_height == new_height);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_va_decoder_get_config (GstVaDecoder * decoder, VAProfile * profile,
|
||||
guint * rt_format, gint * width, gint * height)
|
||||
{
|
||||
g_return_val_if_fail (decoder, FALSE);
|
||||
|
||||
if (!gst_va_decoder_is_open (decoder))
|
||||
return FALSE;
|
||||
|
||||
if (profile)
|
||||
*profile = decoder->profile;
|
||||
if (rt_format)
|
||||
*rt_format = decoder->rt_format;
|
||||
if (width)
|
||||
*width = decoder->coded_width;
|
||||
if (height)
|
||||
*height = decoder->coded_height;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -48,6 +48,9 @@ gboolean gst_va_decoder_set_format (GstVaDecoder * self,
|
|||
gint coded_width,
|
||||
gint coded_height,
|
||||
GArray * surfaces);
|
||||
gboolean gst_va_decoder_change_resolution (GstVaDecoder * self,
|
||||
gint coded_width,
|
||||
gint coded_height);
|
||||
GstCaps * gst_va_decoder_get_srcpad_caps (GstVaDecoder * self);
|
||||
GstCaps * gst_va_decoder_get_sinkpad_caps (GstVaDecoder * self);
|
||||
gboolean gst_va_decoder_has_profile (GstVaDecoder * self,
|
||||
|
@ -92,5 +95,10 @@ gboolean gst_va_decoder_format_changed (GstVaDecoder * decode
|
|||
guint new_rtformat,
|
||||
gint new_width,
|
||||
gint new_height);
|
||||
gboolean gst_va_decoder_get_config (GstVaDecoder * decoder,
|
||||
VAProfile * profile,
|
||||
guint * rt_format,
|
||||
gint * width,
|
||||
gint * height);
|
||||
|
||||
G_END_DECLS
|
||||
|
|
Loading…
Reference in a new issue