GNOME Bugzilla – Bug 539805
gst_bin_new() does something other than call g_object_new()
Last modified: 2008-07-26 09:47:43 UTC
gst_bin_new() calls private API which doesn't allow it to be reimplemented in c++ bindings. It should probably just use g_object_new() somehow. Here's the code: GstElement * gst_bin_new (const gchar * name) { return gst_element_factory_make ("bin", name); } Thanks.
Eh? gst_element_factory_make() isn't private API. Creating an element using its element factory has advantages when debugging, especially if you dump a pipeline to a dot file. However, it's possible to do the same thing using a few extra function calls.
Sorry, what I'm trying to say is that I think gst_bin_new() should use g_object_new() to create a GstBin because it makes it possible for the c++ bindings to create these bins by using standard glue code in c++ constructors using g_object_new(). I hope this is not a superfluous bug and that I'm not mistaken in this report, but the "Exporting a C API" chapter of the GObject manual ( http://library.gnome.org/devel/gobject/2.17/ch01s02.html) explains that the purpose of the GObject functionality is to allow automatic glue for bindings easier: "The greatest advantage of the solution implemented by GType is that the glue code sitting at the runtime domain boundaries is written once: the figure below states this more clearly." "Although that goal was arguably laudable, its pursuit has had a major influence on the whole GType/GObject library. C programmers are likely to be puzzled at the complexity of the features exposed in the following chapters if they forget that the GType/GObject library was not only designed to offer OO-like features to C programmers but also transparent cross-language interoperability." Is there something I'm misunderstanding? If it's possible to do the same thing using a few extra function calls this would be nice for the c++ bindings (I'm pretty sure). Thanks.
gst_bin_new() is just a convinience function that calls gst_element_factory_make(). Your bindings should use gst_element_factory_make() to get instances of GstElement subclasses and not g_object_new(). As such I'm closing this bug as NOTABUG now, just ignore gst_bin_new() in your bindings and write a custom constructor that calls gst_element_factory_make().