[gst-devel] The best way to control a plugin from application?
t.i.m at zen.co.uk
Fri Jun 26 00:07:22 CEST 2009
On Thu, 2009-06-25 at 14:19 -0700, joh wrote:
> I have another fundamental question. When should I use g_signal_x or
> gst_message_x in my plug-in to emit a signal? I guess only difference
> at the application is handling the signal at specific callback
> function or bus message handler.
> The gstreamer app. developers' guide said, bus message passing is
> asynchronous to pipeline. Which means time critical operation should
> not be controlled through bus messages. Then, what about the
> g_signal_ ? Does it guarantee the synchronization between pipeline and
> application? (execute a callback function within the pipeline thread?)
Yes, signal callbacks are always called synchronously in the same thread
context as the g_signal_emit(). Messages posted on the bus are usually
processed asynchronously by the application, but may be intercepted
synchronously as well if needed. One advantage of signals is that the
emitting code can collect a return value, this is not possible with
messages, they're always one-way. When to use what is mostly a matter of
taste. If in doubt, you should probably use a message; even if they're
processed asynchronously, that's usually still fast enough. Depends on
your exact use case of course.
More information about the gstreamer-devel