diff options
author | Javier Jardón <jjardon@gnome.org> | 2012-08-08 12:50:41 +0900 |
---|---|---|
committer | Gwenole Beauchesne <gwenole.beauchesne@intel.com> | 2012-08-27 09:56:47 +0200 |
commit | 5157a019427a73bc592cd1a155bb4adfbbecef8d (patch) | |
tree | c96684b36b403d24e41cfbb5161d0b76629258f7 | |
parent | a10ee527c7dd0988f81a7878dfd55520899fbd09 (diff) |
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 <gwenole.beauchesne@intel.com>
-rw-r--r-- | gst-libs/gst/vaapi/gstvaapidecoder.c | 26 |
1 files changed, 14 insertions, 12 deletions
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]); } } |