add_watch
Description:
public uint add_watch (int priority, owned BusFunc func)
Adds a bus watch to the default main context with the given priority
(e.g.
DEFAULT).
It is also possible to use a non-default main context set up using push_thread_default (before one had to create a bus watch source and attach it to the desired main context 'manually').
This function is used to receive asynchronous messages in the main loop. There can only be a single bus watch per bus, you must remove it before you can set a new one.
The bus watch will only work if a MainLoop is being run.
When func
is called, the message belongs to the caller; if you want to keep a copy of it, call gst_message_ref
before
leaving func
.
The watch can be removed using remove_watch or by returning false
from func
. If the watch was added to the default main context it is also possible to remove the watch using
remove.
The bus watch will take its own reference to the this, so it is safe to unref this using unref after setting the bus watch.
Parameters:
this |
a Bus to create the watch for. |
priority |
The priority of the watch. |
func |
A function to call when a message is received. |
notify |
the function to call when the source is removed. |
user_data |
user data passed to |
Returns:
The event source id or 0 if this already got an event source. |