After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 539805 - gst_bin_new() does something other than call g_object_new()
gst_bin_new() does something other than call g_object_new()
Status: RESOLVED NOTABUG
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2008-06-23 18:56 UTC by José Alburquerque
Modified: 2008-07-26 09:47 UTC
See Also:
GNOME target: ---
GNOME version: 2.21/2.22



Description José Alburquerque 2008-06-23 18:56:21 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.
Comment 1 David Schleef 2008-06-24 00:43:15 UTC
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.
Comment 2 José Alburquerque 2008-06-24 01:13:56 UTC
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.
Comment 3 Sebastian Dröge (slomo) 2008-06-24 05:55:07 UTC
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().