diff --git a/gst-libs/gst/vaapi/gstvaapiencoder.c b/gst-libs/gst/vaapi/gstvaapiencoder.c index bd56b8af21..e3108e4984 100644 --- a/gst-libs/gst/vaapi/gstvaapiencoder.c +++ b/gst-libs/gst/vaapi/gstvaapiencoder.c @@ -1547,8 +1547,8 @@ error_operation_failed: } /* Initialize default values for configurable properties */ -static void -gst_vaapi_encoder_constructed (GObject * object) +__attribute__ ((unused)) + static void gst_vaapi_encoder_constructed (GObject * object) { GstVaapiEncoder *encoder = GST_VAAPI_ENCODER (object); GstVaapiEncoderClass *const klass = GST_VAAPI_ENCODER_GET_CLASS (encoder); @@ -1601,9 +1601,8 @@ enum static GParamSpec *properties[ENCODER_N_PROPERTIES]; -__attribute__ ((unused)) - static void - _gst_vaapi_encoder_set_property (GObject * object, guint prop_id, +static void +_gst_vaapi_encoder_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) { GstVaapiEncoder *encoder = GST_VAAPI_ENCODER (object); @@ -1653,9 +1652,8 @@ __attribute__ ((unused)) g_param_spec_get_name (pspec), status); } -__attribute__ ((unused)) - static void - _gst_vaapi_encoder_get_property (GObject * object, guint prop_id, +static void +_gst_vaapi_encoder_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec) { GstVaapiEncoder *encoder = GST_VAAPI_ENCODER (object); @@ -1730,8 +1728,9 @@ gst_vaapi_encoder_finalize (GObject * object) G_OBJECT_CLASS (gst_vaapi_encoder_parent_class)->finalize (object); } -static void -encoder_set_property (GObject * object, guint prop_id, +__attribute__ ((unused)) + static void + encoder_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) { GstVaapiEncoder *encoder = GST_VAAPI_ENCODER (object); @@ -1749,8 +1748,9 @@ encoder_set_property (GObject * object, guint prop_id, } } -static void -encoder_get_property (GObject * object, guint prop_id, +__attribute__ ((unused)) + static void + encoder_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec) { GstVaapiEncoder *encoder = GST_VAAPI_ENCODER (object); @@ -1770,10 +1770,9 @@ gst_vaapi_encoder_class_init (GstVaapiEncoderClass * klass) { GObjectClass *const object_class = G_OBJECT_CLASS (klass); - object_class->set_property = encoder_set_property; - object_class->get_property = encoder_get_property; + object_class->set_property = _gst_vaapi_encoder_set_property; + object_class->get_property = _gst_vaapi_encoder_get_property; object_class->finalize = gst_vaapi_encoder_finalize; - object_class->constructed = gst_vaapi_encoder_constructed; /** * GstVaapiDecoder:display: diff --git a/gst/vaapi/gstvaapiencode.c b/gst/vaapi/gstvaapiencode.c index 975fe49f30..5f09f828a5 100644 --- a/gst/vaapi/gstvaapiencode.c +++ b/gst/vaapi/gstvaapiencode.c @@ -578,8 +578,6 @@ static gboolean ensure_encoder (GstVaapiEncode * encode) { GstVaapiEncodeClass *klass = GST_VAAPIENCODE_GET_CLASS (encode); - GstVaapiEncoderStatus status; - GPtrArray *const prop_values = encode->prop_values; guint i; g_return_val_if_fail (klass->alloc_encoder, FALSE); @@ -592,15 +590,17 @@ ensure_encoder (GstVaapiEncode * encode) if (!encode->encoder) return FALSE; - if (prop_values) { - for (i = 0; i < prop_values->len; i++) { - PropValue *const prop_value = g_ptr_array_index (prop_values, i); - status = gst_vaapi_encoder_set_property (encode->encoder, prop_value->id, - &prop_value->value); - if (status != GST_VAAPI_ENCODER_STATUS_SUCCESS) - return FALSE; + if (encode->prop_values && encode->prop_values->len) { + for (i = 0; i < encode->prop_values->len; i++) { + PropValue *const prop_value = g_ptr_array_index (encode->prop_values, i); + g_object_set_property ((GObject *) encode->encoder, + g_param_spec_get_name (prop_value->pspec), &prop_value->value); } + /* clear alll the cache */ + g_ptr_array_unref (encode->prop_values); + encode->prop_values = NULL; } + return TRUE; } diff --git a/gst/vaapi/gstvaapiencode_h264.c b/gst/vaapi/gstvaapiencode_h264.c index e861255c8c..4d452a092c 100644 --- a/gst/vaapi/gstvaapiencode_h264.c +++ b/gst/vaapi/gstvaapiencode_h264.c @@ -116,7 +116,7 @@ G_DEFINE_TYPE (GstVaapiEncodeH264, gst_vaapiencode_h264, GST_TYPE_VAAPIENCODE); static void gst_vaapiencode_h264_init (GstVaapiEncodeH264 * encode) { - gst_vaapiencode_init_properties (GST_VAAPIENCODE_CAST (encode)); + /* nothing to do here */ } static void @@ -128,36 +128,6 @@ gst_vaapiencode_h264_finalize (GObject * object) G_OBJECT_CLASS (gst_vaapiencode_h264_parent_class)->finalize (object); } -static void -gst_vaapiencode_h264_set_property (GObject * object, - guint prop_id, const GValue * value, GParamSpec * pspec) -{ - GstVaapiEncodeClass *const encode_class = GST_VAAPIENCODE_GET_CLASS (object); - GstVaapiEncode *const base_encode = GST_VAAPIENCODE_CAST (object); - - switch (prop_id) { - default: - if (!encode_class->set_property (base_encode, prop_id, value)) - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gst_vaapiencode_h264_get_property (GObject * object, - guint prop_id, GValue * value, GParamSpec * pspec) -{ - GstVaapiEncodeClass *const encode_class = GST_VAAPIENCODE_GET_CLASS (object); - GstVaapiEncode *const base_encode = GST_VAAPIENCODE_CAST (object); - - switch (prop_id) { - default: - if (!encode_class->get_property (base_encode, prop_id, value)) - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - static GstVaapiProfile gst_vaapiencode_h264_get_profile (GstCaps * caps) { @@ -577,15 +547,15 @@ gst_vaapiencode_h264_class_init (GstVaapiEncodeH264Class * klass) GObjectClass *const object_class = G_OBJECT_CLASS (klass); GstElementClass *const element_class = GST_ELEMENT_CLASS (klass); GstVaapiEncodeClass *const encode_class = GST_VAAPIENCODE_CLASS (klass); + gpointer encoder_class; GST_DEBUG_CATEGORY_INIT (gst_vaapi_h264_encode_debug, GST_PLUGIN_NAME, 0, GST_PLUGIN_DESC); object_class->finalize = gst_vaapiencode_h264_finalize; - object_class->set_property = gst_vaapiencode_h264_set_property; - object_class->get_property = gst_vaapiencode_h264_get_property; + object_class->set_property = gst_vaapiencode_set_property_subclass; + object_class->get_property = gst_vaapiencode_get_property_subclass; - encode_class->get_properties = gst_vaapi_encoder_h264_get_default_properties; encode_class->get_profile = gst_vaapiencode_h264_get_profile; encode_class->set_config = gst_vaapiencode_h264_set_config; encode_class->get_caps = gst_vaapiencode_h264_get_caps; @@ -605,5 +575,8 @@ gst_vaapiencode_h264_class_init (GstVaapiEncodeH264Class * klass) gst_element_class_add_static_pad_template (element_class, &gst_vaapiencode_h264_src_factory); - gst_vaapiencode_class_init_properties (encode_class); + encoder_class = g_type_class_ref (GST_TYPE_VAAPI_ENCODER_H264); + g_assert (encoder_class); + gst_vaapiencode_class_install_properties (encode_class, encoder_class); + g_type_class_unref (encoder_class); } diff --git a/gst/vaapi/gstvaapiencode_h264_fei.c b/gst/vaapi/gstvaapiencode_h264_fei.c index 6e4d51a88a..0b1b74a6f6 100644 --- a/gst/vaapi/gstvaapiencode_h264_fei.c +++ b/gst/vaapi/gstvaapiencode_h264_fei.c @@ -97,7 +97,7 @@ G_DEFINE_TYPE (GstVaapiEncodeH264Fei, gst_vaapiencode_h264_fei, static void gst_vaapiencode_h264_fei_init (GstVaapiEncodeH264Fei * encode) { - gst_vaapiencode_init_properties (GST_VAAPIENCODE_CAST (encode)); + /* nothing to do here */ } static void @@ -106,36 +106,6 @@ gst_vaapiencode_h264_fei_finalize (GObject * object) G_OBJECT_CLASS (gst_vaapiencode_h264_fei_parent_class)->finalize (object); } -static void -gst_vaapiencode_h264_fei_set_property (GObject * object, - guint prop_id, const GValue * value, GParamSpec * pspec) -{ - GstVaapiEncodeClass *const encode_class = GST_VAAPIENCODE_GET_CLASS (object); - GstVaapiEncode *const base_encode = GST_VAAPIENCODE_CAST (object); - - switch (prop_id) { - default: - if (!encode_class->set_property (base_encode, prop_id, value)) - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gst_vaapiencode_h264_fei_get_property (GObject * object, - guint prop_id, GValue * value, GParamSpec * pspec) -{ - GstVaapiEncodeClass *const encode_class = GST_VAAPIENCODE_GET_CLASS (object); - GstVaapiEncode *const base_encode = GST_VAAPIENCODE_CAST (object); - - switch (prop_id) { - default: - if (!encode_class->get_property (base_encode, prop_id, value)) - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - typedef struct { GstVaapiProfile best_profile; @@ -504,16 +474,15 @@ gst_vaapiencode_h264_fei_class_init (GstVaapiEncodeH264FeiClass * klass) GObjectClass *const object_class = G_OBJECT_CLASS (klass); GstElementClass *const element_class = GST_ELEMENT_CLASS (klass); GstVaapiEncodeClass *const encode_class = GST_VAAPIENCODE_CLASS (klass); + gpointer encoder_class; GST_DEBUG_CATEGORY_INIT (gst_vaapi_h264_fei_encode_debug, GST_PLUGIN_NAME, 0, GST_PLUGIN_DESC); object_class->finalize = gst_vaapiencode_h264_fei_finalize; - object_class->set_property = gst_vaapiencode_h264_fei_set_property; - object_class->get_property = gst_vaapiencode_h264_fei_get_property; + object_class->set_property = gst_vaapiencode_set_property_subclass; + object_class->get_property = gst_vaapiencode_get_property_subclass; - encode_class->get_properties = - gst_vaapi_encoder_h264_fei_get_default_properties; encode_class->set_config = gst_vaapiencode_h264_fei_set_config; encode_class->get_caps = gst_vaapiencode_h264_fei_get_caps; encode_class->alloc_encoder = gst_vaapiencode_h264_fei_alloc_encoder; @@ -537,5 +506,8 @@ gst_vaapiencode_h264_fei_class_init (GstVaapiEncodeH264FeiClass * klass) gst_element_class_add_static_pad_template (element_class, &gst_vaapiencode_h264_fei_src_factory); - gst_vaapiencode_class_init_properties (encode_class); + encoder_class = g_type_class_ref (GST_TYPE_VAAPI_ENCODER_H264_FEI); + g_assert (encoder_class); + gst_vaapiencode_class_install_properties (encode_class, encoder_class); + g_type_class_unref (encoder_class); } diff --git a/gst/vaapi/gstvaapiencode_h265.c b/gst/vaapi/gstvaapiencode_h265.c index fa03fdcefc..ed00a93872 100644 --- a/gst/vaapi/gstvaapiencode_h265.c +++ b/gst/vaapi/gstvaapiencode_h265.c @@ -90,7 +90,7 @@ G_DEFINE_TYPE (GstVaapiEncodeH265, gst_vaapiencode_h265, GST_TYPE_VAAPIENCODE); static void gst_vaapiencode_h265_init (GstVaapiEncodeH265 * encode) { - gst_vaapiencode_init_properties (GST_VAAPIENCODE_CAST (encode)); + /* nothing to do here */ } static void @@ -99,36 +99,6 @@ gst_vaapiencode_h265_finalize (GObject * object) G_OBJECT_CLASS (gst_vaapiencode_h265_parent_class)->finalize (object); } -static void -gst_vaapiencode_h265_set_property (GObject * object, - guint prop_id, const GValue * value, GParamSpec * pspec) -{ - GstVaapiEncodeClass *const encode_class = GST_VAAPIENCODE_GET_CLASS (object); - GstVaapiEncode *const base_encode = GST_VAAPIENCODE_CAST (object); - - switch (prop_id) { - default: - if (!encode_class->set_property (base_encode, prop_id, value)) - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gst_vaapiencode_h265_get_property (GObject * object, - guint prop_id, GValue * value, GParamSpec * pspec) -{ - GstVaapiEncodeClass *const encode_class = GST_VAAPIENCODE_GET_CLASS (object); - GstVaapiEncode *const base_encode = GST_VAAPIENCODE_CAST (object); - - switch (prop_id) { - default: - if (!encode_class->get_property (base_encode, prop_id, value)) - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - static GstVaapiProfile gst_vaapiencode_h265_get_profile (GstCaps * caps) { @@ -407,15 +377,15 @@ gst_vaapiencode_h265_class_init (GstVaapiEncodeH265Class * klass) GObjectClass *const object_class = G_OBJECT_CLASS (klass); GstElementClass *const element_class = GST_ELEMENT_CLASS (klass); GstVaapiEncodeClass *const encode_class = GST_VAAPIENCODE_CLASS (klass); + gpointer encoder_class; GST_DEBUG_CATEGORY_INIT (gst_vaapi_h265_encode_debug, GST_PLUGIN_NAME, 0, GST_PLUGIN_DESC); object_class->finalize = gst_vaapiencode_h265_finalize; - object_class->set_property = gst_vaapiencode_h265_set_property; - object_class->get_property = gst_vaapiencode_h265_get_property; + object_class->set_property = gst_vaapiencode_set_property_subclass; + object_class->get_property = gst_vaapiencode_get_property_subclass; - encode_class->get_properties = gst_vaapi_encoder_h265_get_default_properties; encode_class->get_profile = gst_vaapiencode_h265_get_profile; encode_class->set_config = gst_vaapiencode_h265_set_config; encode_class->get_caps = gst_vaapiencode_h265_get_caps; @@ -436,5 +406,8 @@ gst_vaapiencode_h265_class_init (GstVaapiEncodeH265Class * klass) gst_element_class_add_static_pad_template (element_class, &gst_vaapiencode_h265_src_factory); - gst_vaapiencode_class_init_properties (encode_class); + encoder_class = g_type_class_ref (GST_TYPE_VAAPI_ENCODER_H265); + g_assert (encoder_class); + gst_vaapiencode_class_install_properties (encode_class, encoder_class); + g_type_class_unref (encoder_class); } diff --git a/gst/vaapi/gstvaapiencode_jpeg.c b/gst/vaapi/gstvaapiencode_jpeg.c index 4d644fa9d2..0de5cb381b 100644 --- a/gst/vaapi/gstvaapiencode_jpeg.c +++ b/gst/vaapi/gstvaapiencode_jpeg.c @@ -86,7 +86,7 @@ G_DEFINE_TYPE (GstVaapiEncodeJpeg, gst_vaapiencode_jpeg, GST_TYPE_VAAPIENCODE); static void gst_vaapiencode_jpeg_init (GstVaapiEncodeJpeg * encode) { - gst_vaapiencode_init_properties (GST_VAAPIENCODE_CAST (encode)); + /* nothing to do here */ } static void @@ -95,36 +95,6 @@ gst_vaapiencode_jpeg_finalize (GObject * object) G_OBJECT_CLASS (gst_vaapiencode_jpeg_parent_class)->finalize (object); } -static void -gst_vaapiencode_jpeg_set_property (GObject * object, - guint prop_id, const GValue * value, GParamSpec * pspec) -{ - GstVaapiEncodeClass *const encode_class = GST_VAAPIENCODE_GET_CLASS (object); - GstVaapiEncode *const base_encode = GST_VAAPIENCODE_CAST (object); - - switch (prop_id) { - default: - if (!encode_class->set_property (base_encode, prop_id, value)) - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gst_vaapiencode_jpeg_get_property (GObject * object, - guint prop_id, GValue * value, GParamSpec * pspec) -{ - GstVaapiEncodeClass *const encode_class = GST_VAAPIENCODE_GET_CLASS (object); - GstVaapiEncode *const base_encode = GST_VAAPIENCODE_CAST (object); - - switch (prop_id) { - default: - if (!encode_class->get_property (base_encode, prop_id, value)) - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - static GstCaps * gst_vaapiencode_jpeg_get_caps (GstVaapiEncode * base_encode) { @@ -148,15 +118,15 @@ gst_vaapiencode_jpeg_class_init (GstVaapiEncodeJpegClass * klass) GObjectClass *const object_class = G_OBJECT_CLASS (klass); GstElementClass *const element_class = GST_ELEMENT_CLASS (klass); GstVaapiEncodeClass *const encode_class = GST_VAAPIENCODE_CLASS (klass); + gpointer encoder_class; GST_DEBUG_CATEGORY_INIT (gst_vaapi_jpeg_encode_debug, GST_PLUGIN_NAME, 0, GST_PLUGIN_DESC); object_class->finalize = gst_vaapiencode_jpeg_finalize; - object_class->set_property = gst_vaapiencode_jpeg_set_property; - object_class->get_property = gst_vaapiencode_jpeg_get_property; + object_class->set_property = gst_vaapiencode_set_property_subclass; + object_class->get_property = gst_vaapiencode_get_property_subclass; - encode_class->get_properties = gst_vaapi_encoder_jpeg_get_default_properties; encode_class->get_caps = gst_vaapiencode_jpeg_get_caps; encode_class->alloc_encoder = gst_vaapiencode_jpeg_alloc_encoder; @@ -174,5 +144,8 @@ gst_vaapiencode_jpeg_class_init (GstVaapiEncodeJpegClass * klass) gst_element_class_add_static_pad_template (element_class, &gst_vaapiencode_jpeg_src_factory); - gst_vaapiencode_class_init_properties (encode_class); + encoder_class = g_type_class_ref (GST_TYPE_VAAPI_ENCODER_JPEG); + g_assert (encoder_class); + gst_vaapiencode_class_install_properties (encode_class, encoder_class); + g_type_class_unref (encoder_class); } diff --git a/gst/vaapi/gstvaapiencode_mpeg2.c b/gst/vaapi/gstvaapiencode_mpeg2.c index f43ac3f9fe..810de09f1f 100644 --- a/gst/vaapi/gstvaapiencode_mpeg2.c +++ b/gst/vaapi/gstvaapiencode_mpeg2.c @@ -89,7 +89,7 @@ G_DEFINE_TYPE (GstVaapiEncodeMpeg2, gst_vaapiencode_mpeg2, static void gst_vaapiencode_mpeg2_init (GstVaapiEncodeMpeg2 * encode) { - gst_vaapiencode_init_properties (GST_VAAPIENCODE_CAST (encode)); + /* nothing to do here */ } static void @@ -98,36 +98,6 @@ gst_vaapiencode_mpeg2_finalize (GObject * object) G_OBJECT_CLASS (gst_vaapiencode_mpeg2_parent_class)->finalize (object); } -static void -gst_vaapiencode_mpeg2_set_property (GObject * object, - guint prop_id, const GValue * value, GParamSpec * pspec) -{ - GstVaapiEncodeClass *const encode_class = GST_VAAPIENCODE_GET_CLASS (object); - GstVaapiEncode *const base_encode = GST_VAAPIENCODE_CAST (object); - - switch (prop_id) { - default: - if (!encode_class->set_property (base_encode, prop_id, value)) - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gst_vaapiencode_mpeg2_get_property (GObject * object, - guint prop_id, GValue * value, GParamSpec * pspec) -{ - GstVaapiEncodeClass *const encode_class = GST_VAAPIENCODE_GET_CLASS (object); - GstVaapiEncode *const base_encode = GST_VAAPIENCODE_CAST (object); - - switch (prop_id) { - default: - if (!encode_class->get_property (base_encode, prop_id, value)) - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - static GstCaps * gst_vaapiencode_mpeg2_get_caps (GstVaapiEncode * base_encode) { @@ -152,15 +122,15 @@ gst_vaapiencode_mpeg2_class_init (GstVaapiEncodeMpeg2Class * klass) GObjectClass *const object_class = G_OBJECT_CLASS (klass); GstElementClass *const element_class = GST_ELEMENT_CLASS (klass); GstVaapiEncodeClass *const encode_class = GST_VAAPIENCODE_CLASS (klass); + gpointer encoder_class; GST_DEBUG_CATEGORY_INIT (gst_vaapi_mpeg2_encode_debug, GST_PLUGIN_NAME, 0, GST_PLUGIN_DESC); object_class->finalize = gst_vaapiencode_mpeg2_finalize; - object_class->set_property = gst_vaapiencode_mpeg2_set_property; - object_class->get_property = gst_vaapiencode_mpeg2_get_property; + object_class->set_property = gst_vaapiencode_set_property_subclass; + object_class->get_property = gst_vaapiencode_get_property_subclass; - encode_class->get_properties = gst_vaapi_encoder_mpeg2_get_default_properties; encode_class->get_caps = gst_vaapiencode_mpeg2_get_caps; encode_class->alloc_encoder = gst_vaapiencode_mpeg2_alloc_encoder; @@ -177,5 +147,8 @@ gst_vaapiencode_mpeg2_class_init (GstVaapiEncodeMpeg2Class * klass) gst_element_class_add_static_pad_template (element_class, &gst_vaapiencode_mpeg2_src_factory); - gst_vaapiencode_class_init_properties (encode_class); + encoder_class = g_type_class_ref (GST_TYPE_VAAPI_ENCODER_MPEG2); + g_assert (encoder_class); + gst_vaapiencode_class_install_properties (encode_class, encoder_class); + g_type_class_unref (encoder_class); } diff --git a/gst/vaapi/gstvaapiencode_vp8.c b/gst/vaapi/gstvaapiencode_vp8.c index 5fee607b0a..64a3879f37 100644 --- a/gst/vaapi/gstvaapiencode_vp8.c +++ b/gst/vaapi/gstvaapiencode_vp8.c @@ -86,7 +86,7 @@ G_DEFINE_TYPE (GstVaapiEncodeVP8, gst_vaapiencode_vp8, GST_TYPE_VAAPIENCODE); static void gst_vaapiencode_vp8_init (GstVaapiEncodeVP8 * encode) { - gst_vaapiencode_init_properties (GST_VAAPIENCODE_CAST (encode)); + /* nothing to do here */ } static void @@ -95,36 +95,6 @@ gst_vaapiencode_vp8_finalize (GObject * object) G_OBJECT_CLASS (gst_vaapiencode_vp8_parent_class)->finalize (object); } -static void -gst_vaapiencode_vp8_set_property (GObject * object, - guint prop_id, const GValue * value, GParamSpec * pspec) -{ - GstVaapiEncodeClass *const encode_class = GST_VAAPIENCODE_GET_CLASS (object); - GstVaapiEncode *const base_encode = GST_VAAPIENCODE_CAST (object); - - switch (prop_id) { - default: - if (!encode_class->set_property (base_encode, prop_id, value)) - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gst_vaapiencode_vp8_get_property (GObject * object, - guint prop_id, GValue * value, GParamSpec * pspec) -{ - GstVaapiEncodeClass *const encode_class = GST_VAAPIENCODE_GET_CLASS (object); - GstVaapiEncode *const base_encode = GST_VAAPIENCODE_CAST (object); - - switch (prop_id) { - default: - if (!encode_class->get_property (base_encode, prop_id, value)) - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - static GstCaps * gst_vaapiencode_vp8_get_caps (GstVaapiEncode * base_encode) { @@ -148,15 +118,15 @@ gst_vaapiencode_vp8_class_init (GstVaapiEncodeVP8Class * klass) GObjectClass *const object_class = G_OBJECT_CLASS (klass); GstElementClass *const element_class = GST_ELEMENT_CLASS (klass); GstVaapiEncodeClass *const encode_class = GST_VAAPIENCODE_CLASS (klass); + gpointer encoder_class; GST_DEBUG_CATEGORY_INIT (gst_vaapi_vp8_encode_debug, GST_PLUGIN_NAME, 0, GST_PLUGIN_DESC); object_class->finalize = gst_vaapiencode_vp8_finalize; - object_class->set_property = gst_vaapiencode_vp8_set_property; - object_class->get_property = gst_vaapiencode_vp8_get_property; + object_class->set_property = gst_vaapiencode_set_property_subclass; + object_class->get_property = gst_vaapiencode_get_property_subclass; - encode_class->get_properties = gst_vaapi_encoder_vp8_get_default_properties; encode_class->get_caps = gst_vaapiencode_vp8_get_caps; encode_class->alloc_encoder = gst_vaapiencode_vp8_alloc_encoder; @@ -174,5 +144,8 @@ gst_vaapiencode_vp8_class_init (GstVaapiEncodeVP8Class * klass) gst_element_class_add_static_pad_template (element_class, &gst_vaapiencode_vp8_src_factory); - gst_vaapiencode_class_init_properties (encode_class); + encoder_class = g_type_class_ref (GST_TYPE_VAAPI_ENCODER_VP8); + g_assert (encoder_class); + gst_vaapiencode_class_install_properties (encode_class, encoder_class); + g_type_class_unref (encoder_class); } diff --git a/gst/vaapi/gstvaapiencode_vp9.c b/gst/vaapi/gstvaapiencode_vp9.c index 22c40a6443..97d2e13606 100644 --- a/gst/vaapi/gstvaapiencode_vp9.c +++ b/gst/vaapi/gstvaapiencode_vp9.c @@ -86,7 +86,7 @@ G_DEFINE_TYPE (GstVaapiEncodeVP9, gst_vaapiencode_vp9, GST_TYPE_VAAPIENCODE); static void gst_vaapiencode_vp9_init (GstVaapiEncodeVP9 * encode) { - gst_vaapiencode_init_properties (GST_VAAPIENCODE_CAST (encode)); + /* nothing to do here */ } static void @@ -95,36 +95,6 @@ gst_vaapiencode_vp9_finalize (GObject * object) G_OBJECT_CLASS (gst_vaapiencode_vp9_parent_class)->finalize (object); } -static void -gst_vaapiencode_vp9_set_property (GObject * object, - guint prop_id, const GValue * value, GParamSpec * pspec) -{ - GstVaapiEncodeClass *const encode_class = GST_VAAPIENCODE_GET_CLASS (object); - GstVaapiEncode *const base_encode = GST_VAAPIENCODE_CAST (object); - - switch (prop_id) { - default: - if (!encode_class->set_property (base_encode, prop_id, value)) - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -gst_vaapiencode_vp9_get_property (GObject * object, - guint prop_id, GValue * value, GParamSpec * pspec) -{ - GstVaapiEncodeClass *const encode_class = GST_VAAPIENCODE_GET_CLASS (object); - GstVaapiEncode *const base_encode = GST_VAAPIENCODE_CAST (object); - - switch (prop_id) { - default: - if (!encode_class->get_property (base_encode, prop_id, value)) - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - static GstCaps * gst_vaapiencode_vp9_get_caps (GstVaapiEncode * base_encode) { @@ -148,15 +118,15 @@ gst_vaapiencode_vp9_class_init (GstVaapiEncodeVP9Class * klass) GObjectClass *const object_class = G_OBJECT_CLASS (klass); GstElementClass *const element_class = GST_ELEMENT_CLASS (klass); GstVaapiEncodeClass *const encode_class = GST_VAAPIENCODE_CLASS (klass); + gpointer encoder_class; GST_DEBUG_CATEGORY_INIT (gst_vaapi_vp9_encode_debug, GST_PLUGIN_NAME, 0, GST_PLUGIN_DESC); object_class->finalize = gst_vaapiencode_vp9_finalize; - object_class->set_property = gst_vaapiencode_vp9_set_property; - object_class->get_property = gst_vaapiencode_vp9_get_property; + object_class->set_property = gst_vaapiencode_set_property_subclass; + object_class->get_property = gst_vaapiencode_get_property_subclass; - encode_class->get_properties = gst_vaapi_encoder_vp9_get_default_properties; encode_class->get_caps = gst_vaapiencode_vp9_get_caps; encode_class->alloc_encoder = gst_vaapiencode_vp9_alloc_encoder; @@ -174,5 +144,8 @@ gst_vaapiencode_vp9_class_init (GstVaapiEncodeVP9Class * klass) gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&gst_vaapiencode_vp9_src_factory)); - gst_vaapiencode_class_init_properties (encode_class); + encoder_class = g_type_class_ref (GST_TYPE_VAAPI_ENCODER_VP9); + g_assert (encoder_class); + gst_vaapiencode_class_install_properties (encode_class, encoder_class); + g_type_class_unref (encoder_class); }