The name `gst_element_get_request_pad()` is confusing to people
learning GStreamer. `gst_element_request_pad_simple()` aims at
providing the exact same functionality, while making it more
explicit it is a simplified `gst_element_request_pad()`.
`gst_element_request_pad_simple()` is consistent with other
functions such as `gst_element_seek_simple`.
This commit deprecates `gst_element_get_request_pad()` so that a
compilation warning is emitted when used and incite developers
to use the more explicit `gst_element_request_pad_simple()`.
See also https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/743#note_886586
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/802>
Otherwise the proxy pad of the ghost pad still stays linked to some
element inside the bin, which is not allowed anymore according to the
topology.
In 2.0 this should be fixed more generically from inside GstGhostPad but
currently there is no way to get notified that the ghost pad is
unparented.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/553>
Since glib 2.64, gthreadpool will start waiting on a GCond immediately upon
creation. This can cause issues if we fork *before* actually using the
threadpool since we will then be signalling that GCond ... from another process
and that will never work.
Instead, delay creationg of thread pools until the very first time we need
them. This introduces a minor (un-noticeable) delay when needing a new thread
but fixes the issues for all users of GSTreamer that will call gst_init, then
fork and actually start pipelines.
See https://gitlab.gnome.org/GNOME/glib/-/issues/2131 for more context.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/531>
By passing NULL to `g_signal_new` instead of a marshaller, GLib will
actually internally optimize the signal (if the marshaller is available
in GLib itself) by also setting the valist marshaller. This makes the
signal emission a bit more performant than the regular marshalling,
which still needs to box into `GValue` and call libffi in case of a
generic marshaller.
Note that for custom marshallers, one would use
`g_signal_set_va_marshaller()` with the valist marshaller instead.
This is racy if the state lock of the parent bin is not taken. The
parent bin might've just checked the flag in another thread and as the
next step proceed to change the child element's state.
The documentation incorrectly used to state that the pads were
not automatically activated when added, whereas we actually do
that when appropriate.
Callers of gst_element_add_pad must not hold the object lock,
which implies that they cannot perform the same checks as
add_pad in a non-racy manner.
This updates the documentation, and removes the g_warning
that was output before performing automatic activation.
https://bugzilla.gnome.org/show_bug.cgi?id=797181
While the refcount of the pad is decreased, it's the refcount that is
owned by the parent (i.e. the element) and not the one passed in by the
caller.
Fixes a memory leak in bindings.
Add convenience API that iterates over all pads, sink pads or
source pads and makes sure that the foreach function is called
exactly once for each pad.
This is a KISS implementation. It doesn't use GstIterator and
doesn't try to do clever things like resync if pads are added
or removed while the function is executing. We can still do that
in future if we think it's needed, but in practice it will
likely make absolutely no difference whatsoever, since these
things will have to be handled properly elsewhere by the element
anyway if they're important.
After all, it's always possible that a pad is added or removed
just after the iterator finishes iterating, but before the
function returns.
This is also a replacement for gst_aggregator_iterate_sink_pads().
https://bugzilla.gnome.org/show_bug.cgi?id=785679
If a function takes a floating reference parameter, it should also be
sinked in error cases. Otherwise the function behaves differently
between error and normal cases, which is impossible for bindings to
handle.
https://bugzilla.gnome.org/show_bug.cgi?id=747990
If a function takes a floating reference and sinks it, it should also do
that in error cases. I.e. call ref_sink() followed by unref().
Otherwise the reference counting behaviour of the function will be
different between the good and the error case, and simply inconsistent.
https://bugzilla.gnome.org/show_bug.cgi?id=747990
It's a programming error to pass other pads here, and it easily causes
crashes or other problematic behaviour down the road as subclasses
usually assume to only get their pads.
Fixes g-i warning "Gst: Constructor return type mismatch
symbol='gst_element_message_new_details' constructed='Gst.Element'
return='Gst.Structure'".
This is a newly-added function in git that has not been in a stable
release yet, so it's fine to rename it. It's also only used indirectly
via macros.
We don't free this from gst_deinit() but from gst_task_cleanup_all(),
so more GStreamer API may be called. In particular makes unit tests
work again with CK_FORK=no.
https://bugzilla.gnome.org/show_bug.cgi?id=768577
This ensures that all async operations (started from gst_element_call_async())
have been completed and so there is no extra thread running.
Fix races when checking for leaks on unit tests as some of those
operations were still running when the leaks tracer was checking for
leaked objects.
https://bugzilla.gnome.org/show_bug.cgi?id=768577
This calls a function from another thread, asynchronously. This is to be
used for cases when a state change has to be performed from a streaming
thread, directly via gst_element_set_state() or indirectly e.g. via SEEK
events.
Calling those functions directly from the streaming thread will cause
deadlocks in many situations, as they might involve waiting for the
streaming thread to shut down from this very streaming thread.
This is mostly a convenience function around a GThreadPool and is for example
used by GstBin to continue asynchronous state changes.
https://bugzilla.gnome.org/show_bug.cgi?id=760532
Be notified in the application thread via bus messages about
notify::* and deep-notify::* property changes, instead of
having to deal with it in a non-application thread.
API: gst_element_add_property_notify_watch()
API: gst_element_add_property_deep_notify_watch()
API: gst_element_remove_property_notify_watch()
API: gst_message_new_property_notify()
API: gst_message_parse_property_notify()
API: GST_MESSAGE_PROPERTY_NOTIFY
https://bugzilla.gnome.org/show_bug.cgi?id=763142
Updated the GST_REFCOUNTING logging so that it includes the pointer
address of the object that is being disposed or finalized.
With this change is is then possible to match up GST_REFCOUNTING log messages
for object allocation/disposal/finalization. This can help with diagnosing
"memory leaks" in applications that have not correctly disposed of all the
GStreamer objects it creates.
https://bugzilla.gnome.org/show_bug.cgi?id=749427
Pretty much every single element does
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&some_templ));
which is both confusing and unnecessary. We might just
as well add a function to do that in one step.
https://bugzilla.gnome.org/show_bug.cgi?id=762778
This reverts commit b427997119.
It breaks things that used to work before, even if the change by itself is
correct and the previous code is just working around deeper bugs in the async
state change code. Let's go back to what previously worked and then fix async
state changes in general.
https://bugzilla.gnome.org/show_bug.cgi?id=760532
'gst_element_post_message' takes the ownership of the message, so it
shall unref it when there is no post_message implementation. Otherwise
message is leaked.
https://bugzilla.gnome.org/show_bug.cgi?id=759300
This lock seems to exist only to prevent elements from changing states while
events are being processed. However events are going to be processed
nonetheless in those elements if sent directly via pads, so protection must
already be implemented inside the elements for event handling if it is needed.
As such having the lock here is not very useful and is actually causing
various deadlocks in different situations as described in
https://bugzilla.gnome.org/show_bug.cgi?id=744040