va: Move common variable need_negotiation to GstBaseDec.
authorVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Tue, 26 Oct 2021 07:28:10 +0000 (09:28 +0200)
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Fri, 29 Oct 2021 16:06:52 +0000 (16:06 +0000)
This is a common variable to all decoders, so it's sound to move it to
the base helper.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1257>

subprojects/gst-plugins-bad/sys/va/gstvaav1dec.c
subprojects/gst-plugins-bad/sys/va/gstvabasedec.h
subprojects/gst-plugins-bad/sys/va/gstvah264dec.c
subprojects/gst-plugins-bad/sys/va/gstvah265dec.c
subprojects/gst-plugins-bad/sys/va/gstvampeg2dec.c
subprojects/gst-plugins-bad/sys/va/gstvavp8dec.c
subprojects/gst-plugins-bad/sys/va/gstvavp9dec.c

index 790c69c..a3dc527 100644 (file)
@@ -76,8 +76,6 @@ struct _GstVaAV1Dec
   GstAV1SequenceHeaderOBU seq;
   gint max_width;
   gint max_height;
-
-  gboolean need_negotiation;
 };
 
 static GstElementClass *parent_class = NULL;
@@ -101,10 +99,10 @@ gst_va_av1_dec_negotiate (GstVideoDecoder * decoder)
   GstCapsFeatures *capsfeatures = NULL;
 
   /* Ignore downstream renegotiation request. */
-  if (!self->need_negotiation)
+  if (!base->need_negotiation)
     return TRUE;
 
-  self->need_negotiation = FALSE;
+  base->need_negotiation = FALSE;
 
   /* Do not re-create the context if only the frame size changes */
   if (!gst_va_decoder_config_is_equal (base->decoder, base->profile,
@@ -275,7 +273,7 @@ gst_va_av1_dec_new_sequence (GstAV1Decoder * decoder,
     base->rt_format = rt_format;
     self->max_width = seq_hdr->max_frame_width_minus_1 + 1;
     self->max_height = seq_hdr->max_frame_height_minus_1 + 1;
-    self->need_negotiation = TRUE;
+    base->need_negotiation = TRUE;
 
     base->min_buffers = 7 + 4;  /* dpb size + scratch surfaces */
 
@@ -313,10 +311,10 @@ gst_va_av1_dec_new_picture (GstAV1Decoder * decoder,
       /* *INDENT-ON* */
     }
 
-    self->need_negotiation = TRUE;
+    base->need_negotiation = TRUE;
   }
 
-  if (self->need_negotiation) {
+  if (base->need_negotiation) {
     if (!gst_video_decoder_negotiate (GST_VIDEO_DECODER (self))) {
       GST_ERROR_OBJECT (self, "Failed to negotiate with downstream");
       return GST_FLOW_NOT_NEGOTIATED;
index 4d855cb..8e84e5c 100644 (file)
@@ -76,6 +76,8 @@ struct _GstVaBaseDec
 
   gboolean apply_video_crop;
   GstVideoConverter *convert;
+
+  gboolean need_negotiation;
 };
 
 struct _GstVaBaseDecClass
index a41bdd3..617aabc 100644 (file)
@@ -84,7 +84,6 @@ struct _GstVaH264Dec
   /* Used to fill VAPictureParameterBufferH264.ReferenceFrames */
   GArray *ref_list;
 
-  gboolean need_negotiation;
   gboolean interlaced;
 };
 
@@ -748,7 +747,7 @@ gst_va_h264_dec_new_sequence (GstH264Decoder * decoder, const GstH264SPS * sps,
   base->min_buffers = self->dpb_size + 4;       /* dpb size + scratch surfaces */
 
   if (negotiation_needed) {
-    self->need_negotiation = TRUE;
+    base->need_negotiation = TRUE;
     if (!gst_video_decoder_negotiate (GST_VIDEO_DECODER (self))) {
       GST_ERROR_OBJECT (self, "Failed to negotiate with downstream");
       return GST_FLOW_NOT_NEGOTIATED;
@@ -824,10 +823,10 @@ gst_va_h264_dec_negotiate (GstVideoDecoder * decoder)
   GstH264Decoder *h264dec = GST_H264_DECODER (decoder);
 
   /* Ignore downstream renegotiation request. */
-  if (!self->need_negotiation)
+  if (!base->need_negotiation)
     return TRUE;
 
-  self->need_negotiation = FALSE;
+  base->need_negotiation = FALSE;
 
   if (gst_va_decoder_is_open (base->decoder)
       && !gst_va_decoder_close (base->decoder))
index cecc512..8f0c7ed 100644 (file)
@@ -99,8 +99,6 @@ struct _GstVaH265Dec
   gint32 WpOffsetHalfRangeC;
 
   struct slice prev_slice;
-
-  gboolean need_negotiation;
 };
 
 static GstElementClass *parent_class = NULL;
@@ -1121,7 +1119,7 @@ gst_va_h265_dec_new_sequence (GstH265Decoder * decoder, const GstH265SPS * sps,
   base->min_buffers = self->dpb_size + 4;       /* dpb size + scratch surfaces */
 
   if (negotiation_needed) {
-    self->need_negotiation = TRUE;
+    base->need_negotiation = TRUE;
     if (!gst_video_decoder_negotiate (GST_VIDEO_DECODER (self))) {
       GST_ERROR_OBJECT (self, "Failed to negotiate with downstream");
       return GST_FLOW_NOT_NEGOTIATED;
@@ -1208,10 +1206,10 @@ gst_va_h265_dec_negotiate (GstVideoDecoder * decoder)
   GstH265Decoder *h265dec = GST_H265_DECODER (decoder);
 
   /* Ignore downstream renegotiation request. */
-  if (!self->need_negotiation)
+  if (!base->need_negotiation)
     return TRUE;
 
-  self->need_negotiation = FALSE;
+  base->need_negotiation = FALSE;
 
   if (gst_va_decoder_is_open (base->decoder)
       && !gst_va_decoder_close (base->decoder))
index 16c5e56..78e6d90 100644 (file)
@@ -71,8 +71,6 @@ struct _GstVaMpeg2Dec
   GstVaBaseDec parent;
 
   gboolean progressive;
-  gboolean need_negotiation;
-
   GstMpegVideoSequenceHdr seq;
 };
 
@@ -97,10 +95,10 @@ gst_va_mpeg2_dec_negotiate (GstVideoDecoder * decoder)
   GstMpeg2Decoder *mpeg2dec = GST_MPEG2_DECODER (decoder);
 
   /* Ignore downstream renegotiation request. */
-  if (!self->need_negotiation)
+  if (!base->need_negotiation)
     return TRUE;
 
-  self->need_negotiation = FALSE;
+  base->need_negotiation = FALSE;
 
   if (gst_va_decoder_is_open (base->decoder)
       && !gst_va_decoder_close (base->decoder))
@@ -281,7 +279,7 @@ gst_va_mpeg2_dec_new_sequence (GstMpeg2Decoder * decoder,
   base->min_buffers = 2 + 4;    /* max num pic references + scratch surfaces */
 
   if (negotiation_needed) {
-    self->need_negotiation = TRUE;
+    base->need_negotiation = TRUE;
     if (!gst_video_decoder_negotiate (GST_VIDEO_DECODER (self))) {
       GST_ERROR_OBJECT (self, "Failed to negotiate with downstream");
       return GST_FLOW_NOT_NEGOTIATED;
index a23d101..2df289c 100644 (file)
@@ -71,8 +71,6 @@ struct _GstVaVp8Dec
   GstVaBaseDec parent;
 
   GstFlowReturn last_ret;
-
-  gboolean need_negotiation;
 };
 
 static GstElementClass *parent_class = NULL;
@@ -96,10 +94,10 @@ gst_va_vp8_dec_negotiate (GstVideoDecoder * decoder)
   GstVp8Decoder *vp8dec = GST_VP8_DECODER (decoder);
 
   /* Ignore downstream renegotiation request. */
-  if (!self->need_negotiation)
+  if (!base->need_negotiation)
     return TRUE;
 
-  self->need_negotiation = FALSE;
+  base->need_negotiation = FALSE;
 
   if (gst_va_decoder_is_open (base->decoder)
       && !gst_va_decoder_close (base->decoder))
@@ -180,7 +178,7 @@ gst_va_vp8_dec_new_sequence (GstVp8Decoder * decoder,
   base->min_buffers = 3 + 4;    /* max num pic references + scratch surfaces */
 
   if (negotiation_needed) {
-    self->need_negotiation = TRUE;
+    base->need_negotiation = TRUE;
     if (!gst_video_decoder_negotiate (GST_VIDEO_DECODER (self))) {
       GST_ERROR_OBJECT (self, "Failed to negotiate with downstream");
       return GST_FLOW_NOT_NEGOTIATED;
index be88f28..f713382 100644 (file)
@@ -70,8 +70,6 @@ struct _GstVaVp9Dec
 {
   GstVaBaseDec parent;
   GstVp9Segmentation segmentation[GST_VP9_MAX_SEGMENTS];
-
-  gboolean need_negotiation;
 };
 
 static GstElementClass *parent_class = NULL;
@@ -182,7 +180,7 @@ gst_va_vp9_new_sequence (GstVp9Decoder * decoder,
   base->min_buffers = GST_VP9_REF_FRAMES;
 
   if (negotiation_needed) {
-    self->need_negotiation = TRUE;
+    base->need_negotiation = TRUE;
     if (!gst_video_decoder_negotiate (GST_VIDEO_DECODER (self))) {
       GST_ERROR_OBJECT (self, "Failed to negotiate with downstream");
       return GST_FLOW_NOT_NEGOTIATED;
@@ -202,7 +200,7 @@ _check_resolution_change (GstVaVp9Dec * self, GstVp9Picture * picture)
     base->width = frame_hdr->width;
     base->height = frame_hdr->height;
 
-    self->need_negotiation = TRUE;
+    base->need_negotiation = TRUE;
     if (!gst_video_decoder_negotiate (GST_VIDEO_DECODER (self))) {
       GST_ERROR_OBJECT (self, "Resolution changed, but failed to"
           " negotiate with downstream");
@@ -555,10 +553,10 @@ gst_va_vp9_dec_negotiate (GstVideoDecoder * decoder)
   gboolean need_open;
 
   /* Ignore downstream renegotiation request. */
-  if (!self->need_negotiation)
+  if (!base->need_negotiation)
     return TRUE;
 
-  self->need_negotiation = FALSE;
+  base->need_negotiation = FALSE;
 
   need_open = TRUE;
   /* VP9 profile entry should have the ability to handle dynamical