self->need_negotiation = FALSE;
/* Do not re-create the context if only the frame size changes */
- if (gst_va_decoder_format_changed (base->decoder, base->profile,
+ if (!gst_va_decoder_config_is_equal (base->decoder, base->profile,
base->rt_format, self->max_width, self->max_height)) {
if (gst_va_decoder_is_open (base->decoder)
&& !gst_va_decoder_close (base->decoder))
self->seq = *seq_hdr;
- if (gst_va_decoder_format_changed (base->decoder, profile,
+ if (!gst_va_decoder_config_is_equal (base->decoder, profile,
rt_format, seq_hdr->max_frame_width_minus_1 + 1,
seq_hdr->max_frame_height_minus_1 + 1)) {
base->profile = profile;
return gst_va_decoder_decode_with_aux_surface (self, pic, FALSE);
}
+gboolean
+gst_va_decoder_config_is_equal (GstVaDecoder * self, VAProfile new_profile,
+ guint new_rtformat, gint new_width, gint new_height)
+{
+ gboolean ret;
+
+ g_return_val_if_fail (GST_IS_VA_DECODER (self), FALSE);
+
+ /* @TODO: Check if current buffers are large enough, and reuse
+ * them */
+ GST_OBJECT_LOCK (self);
+ ret = (self->profile == new_profile && self->rt_format == new_rtformat
+ && self->coded_width == new_width && self->coded_height == new_height);
+ GST_OBJECT_UNLOCK (self);
+
+ return ret;
+}
+
static gboolean
_destroy_buffers (GstVaDecodePicture * pic)
{
}
gboolean
-gst_va_decoder_format_changed (GstVaDecoder * decoder, VAProfile new_profile,
- guint new_rtformat, gint new_width, gint new_height)
-{
- /* @TODO: Check if current buffers are large enough, and reuse
- * them */
- return !(decoder->profile == 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)
{
gboolean gst_va_decoder_decode_with_aux_surface (GstVaDecoder * self,
GstVaDecodePicture * pic,
gboolean use_aux);
+gboolean gst_va_decoder_config_is_equal (GstVaDecoder * decoder,
+ VAProfile new_profile,
+ guint new_rtformat,
+ gint new_width,
+ gint new_height);
GstVaDecodePicture * gst_va_decode_picture_new (GstVaDecoder * self,
GstBuffer * buffer);
void gst_va_decode_picture_free (GstVaDecodePicture * pic);
GstVaDecodePicture * gst_va_decode_picture_dup (GstVaDecodePicture * pic);
-gboolean gst_va_decoder_format_changed (GstVaDecoder * decoder,
- VAProfile new_profile,
- guint new_rtformat,
- gint new_width,
- gint new_height);
gboolean gst_va_decoder_get_config (GstVaDecoder * decoder,
VAProfile * profile,
guint * rt_format,
if (rt_format == 0)
return FALSE;
- if (gst_va_decoder_format_changed (base->decoder, profile,
+ if (!gst_va_decoder_config_is_equal (base->decoder, profile,
rt_format, sps->width, sps->height)) {
base->profile = profile;
base->rt_format = rt_format;
if (rt_format == 0)
return FALSE;
- if (gst_va_decoder_format_changed (base->decoder, profile,
+ if (!gst_va_decoder_config_is_equal (base->decoder, profile,
rt_format, sps->width, sps->height)) {
base->profile = profile;
base->rt_format = rt_format;
if (rt_format == 0)
return FALSE;
- if (gst_va_decoder_format_changed (base->decoder, profile,
+ if (!gst_va_decoder_config_is_equal (base->decoder, profile,
rt_format, width, height)) {
base->profile = profile;
base->rt_format = rt_format;
/* VP8 always use 8 bits 4:2:0 */
rt_format = VA_RT_FORMAT_YUV420;
- if (gst_va_decoder_format_changed (base->decoder, profile,
+ if (!gst_va_decoder_config_is_equal (base->decoder, profile,
rt_format, frame_hdr->width, frame_hdr->height)) {
base->profile = profile;
base->width = frame_hdr->width;
if (rt_format == 0)
return FALSE;
- if (gst_va_decoder_format_changed (base->decoder, profile,
+ if (!gst_va_decoder_config_is_equal (base->decoder, profile,
rt_format, frame_hdr->width, frame_hdr->height)) {
base->profile = profile;
base->width = frame_hdr->width;