Commit graph

648 commits

Author SHA1 Message Date
Sebastian Dröge 8177173db0 element: Add gst_element_call_async()
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
2016-04-27 18:51:33 +03:00
Tim-Philipp Müller 6e3fb7af52 element: add API to get property change notifications via messages
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
2016-04-08 13:27:59 +01:00
Mark Combellack b8f2929dac GST_REFCOUNTING: Add logging of pointer address for dispose, finalize, etc messages
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
2016-04-02 18:18:10 +01:00
Tim-Philipp Müller c7734d2711 element: minor docs fix
Make gtk-doc happy.
2016-03-01 19:50:26 +00:00
Tim-Philipp Müller fa12d23a17 element: add gst_element_class_add_static_pad_template()
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
2016-02-28 13:10:03 +00:00
Sebastian Dröge a0b3a7f658 Revert "element: Don't hold state lock all the time while sending an event"
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
2016-02-17 16:41:02 +02:00
Stefan Sauer 2f41e7bc6a tracer: harmonize the query hooks
In post hooks always pass the return value as the last param. Pass the query
also to post hooks since it is still alive.
2016-01-07 23:03:48 +01:00
Sebastian Dröge 615af0b1b0 element: Unref event if GstElement::send_event() is not implemented
Otherwise we'll take ownership of the event only if it's implemented, and
leak the event in all other situations.
2015-12-14 10:10:04 +01:00
Aurélien Zanelli 51a70dd586 element: unref message in _post_message when there is no implementation
'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
2015-12-10 16:44:31 +02:00
Sebastian Dröge b427997119 element: Don't hold state lock all the time while sending an event
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
2015-12-10 11:35:05 +02:00
Sebastian Dröge c247117990 element: Check for an activated pad before adding, not a non-flushing one
The pad could be activated but flushing because of a FLUSH_START event. That's
not what we're looking for here, we want to check for activated pads.

https://bugzilla.gnome.org/show_bug.cgi?id=758928
2015-12-07 12:59:39 +02:00
Thiago Santos 82c1ec4931 tracer: add element-change-state-pre/post hook
Helps catching when a state change is starting and ending.

It is also possible to track the end of state changes by checking the
async-done or state-change messages.
This is particularly important for elements that do async state changes.
2015-11-12 15:39:26 -03:00
Thiago Santos 973cd86c99 element: emit tracer's element-new hook from 'constructed'
It allows to properly emitting it for all newly created elements

https://bugzilla.gnome.org/show_bug.cgi?id=757045
2015-10-29 07:27:35 -03:00
Marcin Kolny e8d0b019b3 tracer: add missing hooks
Add following hooks: element-new, element-add-pad, element-remove-pad,
bin-add-pre, bin-add-post, bin-remove-pre, bin-remove-post, pad-link-pre,
pad-link-post, pad-unlink-pre, pad-unlink-post.

https://bugzilla.gnome.org/show_bug.cgi?id=733187
2015-10-05 20:59:39 +02:00
Stefan Sauer 46ea9729df tracer: split into tracer and tracerutils
Keep tracer base class in tracer and move core support into the utils module.
Add a unstable-api guard to the tracer.h so that external modules would need to
acknowledge the status by setting GST_USE_UNSTABLE_API.
2015-10-05 20:59:39 +02:00
Stefan Sauer ce7ce2d866 tracer: add more hooks and handle it in the plugins 2015-10-05 20:59:39 +02:00
Matthew Waters d5ded15889 bin: implement context propagation when adding elements
When adding an element to a bin we need to propagate the GstContext's
to/from the element.

This moves the GstContext list from GstBin to GstElement and adds
convenience functions to get the currently set list of GstContext's.

This does not deal with the collection of GstContext's propagated
using GST_CONTEXT_QUERY.  Element subclasses are advised to call
gst_element_set_context if they need to propagate GstContext's
received from the context query.

https://bugzilla.gnome.org/show_bug.cgi?id=705579
2015-09-28 18:21:59 +10:00
Stian Selnes 0fbf1d3eb7 bin: element: Ignore activate result for removed pads on state change
This fixes a race where a state change may return failure if it has
request pads that are deactivated and removed (and thus have no
parent) at the same time as the element changes state and (de)activates
its pads.

https://bugzilla.gnome.org/show_bug.cgi?id=755342
2015-09-24 12:14:57 +02:00
Olivier Crête 518babf6cb element: Document when a clock is available from gst_element_get_clock()
https://bugzilla.gnome.org/show_bug.cgi?id=744442
2015-04-02 17:33:22 -04:00
Thibault Saunier 43a31d4835 element: Fix request_new_pad introspection
Marking gst_element_request_pad as the caller of the ->request_new_pad
virtual method.
2015-04-02 09:34:00 +02:00
Ramiro Polla 5253a4d879 element: properly escape percent sign in documentation 2015-03-14 14:19:47 +00:00
Olivier Crête f9baff11c8 Revert "element: set pads need-parent flag to false when removing"
This reverts commit 1911554cff.

This breaks the functionality of GST_PAD_FLAG_NEED_PARENT, the reason for this
flag is that if a pad is removed from a running element, you don't want
functions (such as chain or event) to be called on the pad without a parent set.
This can happen if you remove a request or sometimes pad from a running element.

I don't see the code that caused this in tsdemux, but if it needs to unset
the flag on remove, it should do it itself and then make sure that the parent
exists in any pad function.
2015-02-20 16:22:23 -05:00
Edward Hervey 53cbbcd8d9 element: Fix doc and default implementation of send_event
The documentation states that gst_element_send_event is to "send an event
to an element".

Therefore we *send* upstream events to a source pad and downstream events
to a sink pad
2014-11-28 16:25:02 +01:00
Edward Hervey 78577fd8e4 element: Figure default send_event direction handling
If we get a downstream event we want to send it to a random SINK pad
(and vice-versa).
2014-11-28 11:16:00 +01:00
Stefan Sauer d5518edf12 fixme: bump leftover 0.11 fixme comments 2014-09-25 21:27:03 +02:00
Sebastian Dröge 82e01491a0 element: Clarify docs about gst_element_get_request_pad() and remove deprecation part
This function is not really pad or slow for the common case of requesting a
pad with the name of the template. It is only slower if you to name your pads
directly instead of letting the element handle it.

Also there's no reason to deprecate it in favor of a more complicated function
for the common case.
2014-08-13 12:37:08 +03:00
Evan Nemerson 4088363aea introspection: add some missing allow-none annotations to in params
https://bugzilla.gnome.org/show_bug.cgi?id=730957
2014-06-26 19:00:58 +02:00
Evan Nemerson 2759882379 introspection: add missing (nullable) annotations to return values
Support for (nullable) was added to G-I at the same time as nullable
return values.  Previous versions of G-I will not mark return values as
nullable, even when an (allow-none) annotation is present, so it is
not necessary to add (allow-none) annotations for compatibility with
older versions of G-I.

https://bugzilla.gnome.org/show_bug.cgi?id=730957
2014-06-26 18:56:38 +02:00
Evan Nemerson e10266e3f3 docs: convert NULL, TRUE, and FALSE to %NULL, %TRUE, and %FALSE
This should help improve documentation generated for
languages other than C.

https://bugzilla.gnome.org/show_bug.cgi?id=730961
2014-05-30 00:20:27 +01:00
Thiago Santos 1911554cff element: set pads need-parent flag to false when removing
When a pad is added the need-parent flag is set to true, so when
they are removed the flag should be set back to false

This was preventing GstPads to be reused in elements (removed and
later re-added). A unit tests was added to verify that this is
working now.

The use case is tsdemux that has a program-number property and
allows the user to switch programs. In order to do that tsdemux
will remove the pads of the current program and add from the new
ones. The removed pads are kept in the demuxer for later if the
user selects the old program again.
2014-05-29 17:01:20 -03:00
Wim Taymans 35a1822d7a pads: update docs for request pads
We would like to encourage the use of gst_element_request_pad()
2014-05-08 09:13:04 +02:00
Tim-Philipp Müller 6eb6d9ec38 docs: remove outdated and pointless 'Last reviewed' lines from docs
They are very confusing for people, and more often than not
also just not very accurate. Seeing 'last reviewed: 2005' in
your docs is not very confidence-inspiring. Let's just remove
those comments.
2014-04-26 21:21:51 +01:00
Sebastian Rasmussen 53ae1b2c9c docs: Fix typos in function/object descriptions
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=720029
2013-12-07 17:11:12 +00:00
Sebastian Dröge 014690326f element: Remove GstContext caching 2013-09-17 13:16:40 +02:00
Sebastian Dröge e47270ee24 element: Return an empty GstContext if none was set yet 2013-07-16 15:34:57 +02:00
Tim-Philipp Müller 0e1dd050a5 printf: don't build if debugging subsystem was disabled 2013-04-13 01:19:41 +01:00
Tim-Philipp Müller 7b19944280 info: use new internal printf for debug message printing
and remove all the printf extension/specifier stuff for
the system printf. Next we need to add back the custom
specifiers to our own printf implementation.

https://bugzilla.gnome.org/show_bug.cgi?id=613081
2013-04-12 23:05:57 +01:00
Stefan Sauer 28b0cb5721 element: make post_message and query more alike 2013-04-01 16:39:17 +02:00
Sebastian Dröge dd831b8114 element: Add API to get the last set context from an element
Elements should override GstElement::set_context() and also call
gst_element_set_context() to keep this context up-to-date with
the very latest context they internally use.
2013-03-31 11:26:32 +02:00
Sebastian Dröge b909061031 gst: Add new GstContext miniobject for sharing contexts in a pipeline 2013-03-29 16:40:21 +01:00
Stefan Sauer f9ce7e711b docs: link to the appropriate messages from gst_elements_set_state() docs
For an async state change return one would wait for ASYNC_DONE or STATE_CHANGED.
2013-02-17 13:21:36 +01:00
Wim Taymans 474610b191 element: remove old docs about iterators 2013-02-07 13:08:49 +01:00
Wim Taymans 63cc762626 element: improve debug 2012-12-14 11:08:57 +01:00
Tim-Philipp Müller 666c8c11c6 Fix FSF address
https://bugzilla.gnome.org/show_bug.cgi?id=687520
2012-11-03 20:44:48 +00:00
Sebastian Dröge 1c4fe1bf1a element: API: Add GstElement::post_message() vfunc
Conflicts:
	gst/gstelement.h
2012-10-16 12:35:56 +02:00
Sebastian Dröge 24cad1a91c elementfactory: Fail if no valid element factory metadata is set 2012-09-25 15:10:32 +02:00
Edward Hervey 7a89e5d046 element: Specify the order of pad iterators
The order of returned pads wasn't specified before, so let's specify
it and use an order which might prove the most useful : the order in
which pads were added to the element.

If someone changes the order, make sure users of those iterators from
now on don't rely on that order !
2012-08-06 11:36:29 +02:00
Wim Taymans f05b0e222f Update for new seeking variable name
When seeking, the start value and type are now called start and start_type.
2012-07-27 15:24:52 +02:00
Edward Hervey d3ffa82639 Remove 0.10-related documentation and "Since" markers 2012-07-10 12:03:27 +02:00
Tim-Philipp Müller 0841ac48f1 pads: make pad activation debug logs a bit more readable 2012-07-03 22:20:40 +01:00