GNOME Bugzilla – Bug 143283
[PATCH] Property accessors for the mixer interface
Last modified: 2004-12-22 21:47:04 UTC
The current mixer interface doesn't offer any property accessors for the GstMixerTrack class. Also, there is no way to get the available options list.
Created attachment 28083 [details] [review] Adds the property accessors The attached patch adds the property accessors to GstMixerTrack and a gst_mixer_options_get_values method to get the list of possible values for a GstMixerOptions track. It also includes a couple of syntax changes, in particular, typedef struct _Gst... { } Gst...; -> typedef struct _Gst... Gst...; struct _Gst... { }; because GAPI doesn't like this and I don't think it's consistent with the GNOME programming style.
Can you please attach a unified diff patch? Looks good otherwise, but just to be sure. :).
Created attachment 28100 [details] [review] Unified this time Oops! Sorry about that. I was trying to do it in a hurry before I left work.
It's actually not necessary to have this. But I understand that it will make things easier from a language binding point of view. In C, you can just do: GST_MIXER(element)->label ... And, don't create a new method call get_property(). It's already used by GObject and shouldn't be used by any classes/interfaces derived. (same with connect, that used to be used by GstElement) I'd rather see accessors for all different field names, like .set_label/.get_label.
It was the desire to use the mixer interface in the .NET bindings that drove me to add these accessors. What did you mean regarding calling a method get_property()? Surely, it's effectively just a private method existing in the gst_mixer namespace and, hence, doesn't interfere? Or am I missing something (disclaimer: the last time I did any real glib programming in C was pre-2.0). Regarding using named accessor methods such as set_label and get_label, I feel that this style of accessor is somewhat evil in that it undermines glib's already limited introspection capabilities. One of the few useful things you can easily do with with glib in the way of introspection is ask an object what properties it has. This breaks that.
Well, remember that an interface is not a class. I'm actually quite sure that interfaces provides properties already. The FileChooser for gtk+ 2.4 uses this. For python bindings (and other OO) bindings, the method get_property() is important to preserve, since it should map to the method of GObject instead of GstMixer. Otherwise mixer.get_property('name') will fail, since 'name' is a property of GstElement, but not found in the mixer (since it's an interface) and only provedes label etc.
No, GstMixerTrack & co are all GObjects. GstMixer is an interface. Owen's patch is correct and doesn't interfere.
(Note that Gtk provides both function accessors and properties, so I think following that model is the right way to go.)
Sorry, ignore me. I can't see the difference between GstMixer and GstMixerTrack
I've applied the patch.