From: Javier Jardón Date: Wed, 8 Aug 2012 03:50:41 +0000 (+0900) Subject: decoder: use g_object_notify_by_pspec(). X-Git-Tag: 1.19.3~503^2~2999 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5157a019427a73bc592cd1a155bb4adfbbecef8d;p=platform%2Fupstream%2Fgstreamer.git decoder: use g_object_notify_by_pspec(). Use g_object_notify_by_pspec() instead of g_object_notify() so that to avoid a property name lookup. i.e. this makes notifications faster to the `vaapidecode' element. Signed-off-by: Gwenole Beauchesne --- diff --git a/gst-libs/gst/vaapi/gstvaapidecoder.c b/gst-libs/gst/vaapi/gstvaapidecoder.c index d47bea6..a1af830 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder.c +++ b/gst-libs/gst/vaapi/gstvaapidecoder.c @@ -42,8 +42,12 @@ enum { PROP_DISPLAY, PROP_CAPS, + + N_PROPERTIES }; +static GParamSpec *g_properties[N_PROPERTIES] = { NULL, }; + static void destroy_buffer(GstBuffer *buffer) { @@ -311,22 +315,20 @@ gst_vaapi_decoder_class_init(GstVaapiDecoderClass *klass) * * The #GstVaapiDisplay this decoder is bound to. */ - g_object_class_install_property - (object_class, - PROP_DISPLAY, + g_properties[PROP_DISPLAY] = g_param_spec_object("display", "Display", "The GstVaapiDisplay this decoder is bound to", GST_VAAPI_TYPE_DISPLAY, - G_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY)); + G_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY); - g_object_class_install_property - (object_class, - PROP_CAPS, + g_properties[PROP_CAPS] = g_param_spec_pointer("caps", "Decoder caps", "The decoder caps", - G_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY)); + G_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY); + + g_object_class_install_properties(object_class, N_PROPERTIES, g_properties); } static void @@ -455,7 +457,7 @@ gst_vaapi_decoder_set_picture_size( } if (size_changed) - g_object_notify(G_OBJECT(decoder), "caps"); + g_object_notify_by_pspec(G_OBJECT(decoder), g_properties[PROP_CAPS]); } void @@ -479,7 +481,7 @@ gst_vaapi_decoder_set_framerate( "framerate", GST_TYPE_FRACTION, fps_n, fps_d, NULL ); - g_object_notify(G_OBJECT(decoder), "caps"); + g_object_notify_by_pspec(G_OBJECT(decoder), g_properties[PROP_CAPS]); } } @@ -504,7 +506,7 @@ gst_vaapi_decoder_set_pixel_aspect_ratio( "pixel-aspect-ratio", GST_TYPE_FRACTION, par_n, par_d, NULL ); - g_object_notify(G_OBJECT(decoder), "caps"); + g_object_notify_by_pspec(G_OBJECT(decoder), g_properties[PROP_CAPS]); } } @@ -521,7 +523,7 @@ gst_vaapi_decoder_set_interlaced(GstVaapiDecoder *decoder, gboolean interlaced) "interlaced", G_TYPE_BOOLEAN, interlaced, NULL ); - g_object_notify(G_OBJECT(decoder), "caps"); + g_object_notify_by_pspec(G_OBJECT(decoder), g_properties[PROP_CAPS]); } }