summaryrefslogtreecommitdiff
path: root/gst-libs
diff options
context:
space:
mode:
authorHe Junyan <junyan.he@intel.com>2020-07-11 23:09:59 +0800
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>2020-11-30 16:45:54 +0000
commit973b879f95588581d860ade43a348d7cd73a9346 (patch)
treea3ae7d3106398b343a72b18068bdfa3a0de71c30 /gst-libs
parentba58557c140f5bb2155e1b73252ea779de23130b (diff)
libs: encoder: vp9: Add allowed_profiles.
We need the allowed_profiles to store the allowed profiles in down stream's caps. Command line like: vaapivp9enc ! capsfilter caps=video/x-vp9,profile="{ (string)1, \ (string)3 }" We need to store GST_VAAPI_PROFILE_VP9_1 and GST_VAAPI_PROFILE_VP9_3 in this list. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/380>
Diffstat (limited to 'gst-libs')
-rw-r--r--gst-libs/gst/vaapi/gstvaapiencoder_vp9.c34
-rw-r--r--gst-libs/gst/vaapi/gstvaapiencoder_vp9.h4
2 files changed, 38 insertions, 0 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapiencoder_vp9.c b/gst-libs/gst/vaapi/gstvaapiencoder_vp9.c
index e9b711b9..fcad2e69 100644
--- a/gst-libs/gst/vaapi/gstvaapiencoder_vp9.c
+++ b/gst-libs/gst/vaapi/gstvaapiencoder_vp9.c
@@ -104,6 +104,7 @@ struct _GstVaapiEncoderVP9
GstVaapiSurfaceProxy *ref_list[GST_VP9_REF_FRAMES]; /* reference list */
guint ref_list_idx; /* next free slot in ref_list */
GstVaapiEntrypoint entrypoint;
+ GArray *allowed_profiles;
/* Bitrate contral parameters, CPB = Coded Picture Buffer */
guint bitrate_bits; /* bitrate (bits) */
@@ -560,6 +561,19 @@ gst_vaapi_encoder_vp9_init (GstVaapiEncoderVP9 * encoder)
memset (encoder->ref_list, 0,
G_N_ELEMENTS (encoder->ref_list) * sizeof (encoder->ref_list[0]));
encoder->ref_list_idx = 0;
+
+ encoder->allowed_profiles = NULL;
+}
+
+static void
+gst_vaapi_encoder_vp9_finalize (GObject * object)
+{
+ GstVaapiEncoderVP9 *const encoder = GST_VAAPI_ENCODER_VP9 (object);
+
+ if (encoder->allowed_profiles)
+ g_array_unref (encoder->allowed_profiles);
+
+ G_OBJECT_CLASS (gst_vaapi_encoder_vp9_parent_class)->finalize (object);
}
/**
@@ -678,6 +692,7 @@ gst_vaapi_encoder_vp9_class_init (GstVaapiEncoderVP9Class * klass)
object_class->set_property = gst_vaapi_encoder_vp9_set_property;
object_class->get_property = gst_vaapi_encoder_vp9_get_property;
+ object_class->finalize = gst_vaapi_encoder_vp9_finalize;
properties[ENCODER_VP9_PROP_RATECONTROL] =
g_param_spec_enum ("rate-control",
@@ -763,3 +778,22 @@ gst_vaapi_encoder_vp9_new (GstVaapiDisplay * display)
{
return g_object_new (GST_TYPE_VAAPI_ENCODER_VP9, "display", display, NULL);
}
+
+/**
+ * gst_vaapi_encoder_vp9_set_allowed_profiles:
+ * @encoder: a #GstVaapiEncoderVP9
+ * @profiles: a #GArray of all allowed #GstVaapiProfile.
+ *
+ * Set the all allowed profiles for the encoder.
+ *
+ * Return value: %TRUE on success
+ */
+gboolean
+gst_vaapi_encoder_vp9_set_allowed_profiles (GstVaapiEncoderVP9 * encoder,
+ GArray * profiles)
+{
+ g_return_val_if_fail (profiles != 0, FALSE);
+
+ encoder->allowed_profiles = g_array_ref (profiles);
+ return TRUE;
+}
diff --git a/gst-libs/gst/vaapi/gstvaapiencoder_vp9.h b/gst-libs/gst/vaapi/gstvaapiencoder_vp9.h
index b66290b7..6459c01b 100644
--- a/gst-libs/gst/vaapi/gstvaapiencoder_vp9.h
+++ b/gst-libs/gst/vaapi/gstvaapiencoder_vp9.h
@@ -43,6 +43,10 @@ gst_vaapi_encoder_vp9_get_type (void) G_GNUC_CONST;
GstVaapiEncoder *
gst_vaapi_encoder_vp9_new (GstVaapiDisplay * display);
+gboolean
+gst_vaapi_encoder_vp9_set_allowed_profiles (GstVaapiEncoderVP9 * encoder,
+ GArray * profiles);
+
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstVaapiEncoderVP9, gst_object_unref)
G_END_DECLS