GNOME Bugzilla – Bug 547525
alsasrc and alsamixer incorrectly report that GstPropertyProbe is not supported
Last modified: 2008-08-13 23:00:13 UTC
Please describe the problem: Using the implements interface method to check if alsasrc implements an interface other than Mixer results in an Error and program termination. This is despite the fact that alsasrc *does* support the PropertyProbe interface. Using the same method to check if alsamixer supports an interface except Mixer results in a critical assertion and a return value of false, even though alsamixer also supports the PropertyProbe interface. Steps to reproduce: In a python shell: >>> import gst >>> aa = gst.element_factory_make("alsasrc") >>> aa.implements_interface(gst.interfaces.PropertyProbe) ** ** ERROR:(gstalsasrc.c:162):gst_alsasrc_interface_supported: assertion failed: (interface_type == GST_TYPE_MIXER) Aborted In a python shell: >>> import gst >>> am = gst.element_factory_make("alsamixer") >>> am.implements_interface(gst.interfaces.PropertyProbe) ** (.:26954): CRITICAL **: file gstalsamixerelement.c: line 69 (gst_alsa_mixer_element_interface_supported): should not be reached False >>> Actual results: Expected results: I expect both queries for gst.interfaces.PropertyProbe to return True. Does this happen every time? Other information:
Created attachment 116473 [details] [review] Remove error, critical assersion and return TRUE for GstPropertyProbe.
GstPropertyProbe isn't wrapped by GstImplementsInterface, only GstMixer is, so the result is sort of correct, even though the whole GstImplemeentsInterface thing is admittedly quite confusing and probably one of the worst APIs we have. It certainly shouldn't abort. I'm not really convinced whether your patch is right though, since it sort of implies that the property probe *is* wrapped by the implements interface. On the other hand, what are the chances anyone will ever notice ...
How is one supposed to check if GstPropertyProbe is available? I came across the abort problem because I wanted to be able to give my users the ability to switch between "alsasrc" and "pulsesrc" or any other source for that matter. I would create the element, and then check if it supports GstPropertyProbe before querying for the available device names. I guess if I am using Python I can do hasattr(src, "probe_property_name"), but this isn't the right way to do it, and there has got to be a way to check for this in C code as well.
Okay, I get it now. You are supposed to use g_type_is_a() or gobject.typs_is_a() in Python to check for static interfaces. And the GstImplementsInterface is for static interfaces which have are only conditionally supported. Such as the Mixer interface which may not work depending on which device is currently being used, even though the static GstMixer interface is always there. If this is correct, you are right it is damn confusing, but feel free to close this bug.
Yep, it's horribly confusing, and the best reason why 'ImplementsInterface' has to die. Personally I'd prefer to see all 'conditionally available interfaces' provide an foo_is_available() method.