vaencoder: Add gst_va_encoder_get_reconstruct_pool_config()
authorVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Tue, 20 Sep 2022 17:11:35 +0000 (19:11 +0200)
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Wed, 9 Nov 2022 05:13:25 +0000 (06:13 +0100)
This method will return the caps configured in the reconstruct buffer
pool, and its maxium number of buffers to allocate.

The caps are needed later to know if the internal encoder has to be
reopened if the stream properties change.

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

subprojects/gst-plugins-bad/sys/va/gstvaencoder.c
subprojects/gst-plugins-bad/sys/va/gstvaencoder.h

index db836e2..3e0c2b3 100644 (file)
@@ -535,6 +535,28 @@ gst_va_encoder_new (GstVaDisplay * display, guint32 codec,
 }
 
 gboolean
+gst_va_encoder_get_reconstruct_pool_config (GstVaEncoder * self,
+    GstCaps ** caps, guint * max_surfaces)
+{
+  GstStructure *config;
+  gboolean ret;
+
+  g_return_val_if_fail (GST_IS_VA_ENCODER (self), FALSE);
+
+  if (!gst_va_encoder_is_open (self))
+    return FALSE;
+
+  if (!self->recon_pool)
+    return FALSE;
+
+  config = gst_buffer_pool_get_config (self->recon_pool);
+  ret = gst_buffer_pool_config_get_params (config, caps, NULL, NULL,
+      max_surfaces);
+  gst_structure_free (config);
+  return ret;
+}
+
+gboolean
 gst_va_encoder_has_profile (GstVaEncoder * self, VAProfile profile)
 {
   VAProfile p;
index 2152f0b..9def532 100644 (file)
@@ -56,6 +56,9 @@ gboolean              gst_va_encoder_open                 (GstVaEncoder * self,
                                                            guint rc_ctrl,
                                                            guint32 packed_headers);
 gboolean              gst_va_encoder_close                (GstVaEncoder * self);
+gboolean              gst_va_encoder_get_reconstruct_pool_config (GstVaEncoder * self,
+                                                                  GstCaps ** caps,
+                                                                  guint * max_surfaces);
 gboolean              gst_va_encoder_has_profile          (GstVaEncoder * self,
                                                            VAProfile profile);
 gint                  gst_va_encoder_get_max_slice_num    (GstVaEncoder * self,