1 # QtGStreamer vs C GStreamer
3 QtGStreamer is designed to mirror the C GStreamer API as closely as
4 possible. There are, of course, minor differences. They are documented
22 <td><code>gst_element_factory_make()</code></td>
23 <td><code>QGst::ElementFactory::make(const QString &factoryName, const char *elementName=NULL)</code></td>
26 <td><code>gst_parse_bin_from_description()</code></td>
27 <td><code>QGst::Bin::fromDescription(const QString &description, BinFromDescriptionOption ghostUnlinkedPads=Ghost)</code></td>
30 <td><code>gst_caps_from_string()</code></td>
31 <td><p><code>QGst::Caps::fromString(const QString &string)</code></p></td>
34 <td><code>g_signal_connect()</code></td>
35 <td><code>QGlib::connect(GObject* instance, const char *detailedSignal, T *receiver, R(T::*)(Args...) slot, ConnectFlags flags)</code></td>
42 QtGStreamer follows a strict naming policy to help make cross
47 The "G" namespace (`GObject`, `GValue`, etc...) is referred to as
50 The "Gst" namespace (`GstObject`, `GstElement`, etc...) is referred to
55 Class names should be the same as their G\* equivalents, with the
56 namespace prefix removed. For example, "`GstObject`" becomes
57 "`QGst::Object`", "`GParamSpec`" becomes "`QGlib::ParamSpec`", etc...
61 In general the method names should be the same as the GStreamer ones,
62 with the g\[st\]\_\<class\> prefix removed and converted to camel case.
67 gboolean gst_caps_is_emtpy(const GstCaps *caps);
80 There are cases where this may not be followed:
82 1. **Properties**. Most property getters have a "get" prefix, for
83 example, `gst_object_get_name()`. In QtGStreamer the "get" prefix is
84 omitted, so this becomes just `name()`.
85 2. **Overloaded members**. In C there is no possibility to have two
86 methods with the same name, so overloaded members usually have some
87 extra suffix, like "\_full". For example, `g_object_set_data()` and
88 `g_object_set_data_full()`. In C++ we just add a method with the
89 same name, or put optional parameters in the existing method.
90 3. **Other cases where the glib/gstreamer method name doesn't make much
91 sense**. For example, `gst_element_is_locked_state()`. That doesn't
92 make sense in english, as "sate" is the subject and should go before
93 the verb "is". So, it becomes `stateIsLocked()`.
97 Reference counting is handled the same way as Qt does. There is no need
98 to call `g_object_ref()`` and g_object_unref()`.
100 ## Access to GStreamer Elements
102 QtGStreamer provides access to the underlying C objects, in case you
103 need them. This is accessible with a simple cast:
106 ElementPtr qgstElement = QGst::ElementFactory::make("playbin");
107 GstElement* gstElement = GST_ELEMENT(qgstElement);