From 2ab5e0ef46b8f76c68eeda9ea20e88c959016592 Mon Sep 17 00:00:00 2001 From: He Junyan Date: Thu, 29 Aug 2019 15:43:45 +0800 Subject: [PATCH] plugin: encode: delete set/get_property func in encode class Use standard gobject's property functions to replace the old way. --- gst/vaapi/gstvaapiencode.c | 47 -------------------------------------- gst/vaapi/gstvaapiencode.h | 5 ---- 2 files changed, 52 deletions(-) diff --git a/gst/vaapi/gstvaapiencode.c b/gst/vaapi/gstvaapiencode.c index efe85d8451..417323541c 100644 --- a/gst/vaapi/gstvaapiencode.c +++ b/gst/vaapi/gstvaapiencode.c @@ -125,17 +125,6 @@ prop_value_free (PropValue * prop_value) g_slice_free (PropValue, prop_value); } -static inline PropValue * -prop_value_lookup (GstVaapiEncode * encode, guint prop_id) -{ - GPtrArray *const prop_values = encode->prop_values; - - if (prop_values && - (prop_id >= PROP_BASE && prop_id < PROP_BASE + prop_values->len)) - return g_ptr_array_index (prop_values, prop_id - PROP_BASE); - return NULL; -} - static PropValue * prop_value_new_entry (guint id, GParamSpec * pspec, const GValue * value) { @@ -176,40 +165,6 @@ prop_value_lookup_entry (GPtrArray * prop_values, guint prop_id) return NULL; } - -static gboolean -gst_vaapiencode_default_get_property (GstVaapiEncode * encode, guint prop_id, - GValue * value) -{ - PropValue *const prop_value = prop_value_lookup (encode, prop_id); - - if (prop_value) { - g_value_copy (&prop_value->value, value); - return TRUE; - } - return FALSE; -} - -static gboolean -gst_vaapiencode_default_set_property (GstVaapiEncode * encode, guint prop_id, - const GValue * value) -{ - PropValue *const prop_value = prop_value_lookup (encode, prop_id); - GstVaapiEncoder *encoder = encode->encoder; - - if (prop_value) { - g_value_copy (value, &prop_value->value); - - if (encoder) - return (gst_vaapi_encoder_set_property (encoder, prop_value->id, - value) == GST_VAAPI_ENCODER_STATUS_SUCCESS); - - return TRUE; - } - - return FALSE; -} - static GstFlowReturn gst_vaapiencode_default_alloc_buffer (GstVaapiEncode * encode, GstVaapiCodedBuffer * coded_buf, GstBuffer ** outbuf_ptr) @@ -967,8 +922,6 @@ gst_vaapiencode_class_init (GstVaapiEncodeClass * klass) venc_class->flush = GST_DEBUG_FUNCPTR (gst_vaapiencode_flush); venc_class->sink_event = GST_DEBUG_FUNCPTR (gst_vaapiencode_sink_event); - klass->get_property = gst_vaapiencode_default_get_property; - klass->set_property = gst_vaapiencode_default_set_property; klass->alloc_buffer = gst_vaapiencode_default_alloc_buffer; venc_class->src_query = GST_DEBUG_FUNCPTR (gst_vaapiencode_src_query); diff --git a/gst/vaapi/gstvaapiencode.h b/gst/vaapi/gstvaapiencode.h index a552ac123b..64efecb224 100644 --- a/gst/vaapi/gstvaapiencode.h +++ b/gst/vaapi/gstvaapiencode.h @@ -75,11 +75,6 @@ struct _GstVaapiEncodeClass guint prop_num; GPtrArray * (*get_properties) (void); - gboolean (*get_property) (GstVaapiEncode * encode, - guint prop_id, GValue * value); - gboolean (*set_property) (GstVaapiEncode * encode, - guint prop_id, const GValue * value); - gboolean (*set_config) (GstVaapiEncode * encode); GstCaps * (*get_caps) (GstVaapiEncode * encode); GstVaapiEncoder * (*alloc_encoder) (GstVaapiEncode * encode,