va: Refactor _set_format() to _set_frame_size().
authorVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Sat, 17 Jul 2021 18:29:45 +0000 (20:29 +0200)
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Sat, 17 Jul 2021 18:51:27 +0000 (20:51 +0200)
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>

sys/va/gstvaav1dec.c
sys/va/gstvadecoder.c
sys/va/gstvadecoder.h
sys/va/gstvah264dec.c
sys/va/gstvah265dec.c
sys/va/gstvampeg2dec.c
sys/va/gstvavp8dec.c
sys/va/gstvavp9dec.c

index 6616a0c..8afd91c 100644 (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;
   }
 
index 14ef2ba..3993a32 100644 (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);
@@ -347,6 +347,14 @@ gst_va_decoder_set_format (GstVaDecoder * self, gint coded_width,
 }
 
 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)
 {
index 7fadd26..3b91f33 100644 (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);
index 69535a1..bb4b2c7 100644 (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)
index bff3a97..63f50be 100644 (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)
index 426eb0e..6fe0169 100644 (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)
index b8cf57b..d9b266b 100644 (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)
index 606938f..d12fbc9 100644 (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;
   }