can I use g_mail_loop_run() inside a while loop?
Sebastian Dröge
sebastian at centricular.com
Thu Sep 8 06:28:14 UTC 2016
On Wed, 2016-09-07 at 11:01 -0700, ge_keep wrote:
>
> *Is g_main_loop_run (loop) a blocking function and will not return until the
> file playback is done?*
> My objective is to be able to play File1 (if that was the first event) and
> then allow the while loop to still listen to events and when an event for
> File2 arrive (assuming that File1 event will not come anymore), I want to
> play File 2 on the 2nd channel of the SAME sound card. My problem is that
> g_main_loop_run (loop) blocks the first playback and prevent the while loop
> to receive events and does not allow my application to play the 2 files in
> parallel (simultaneously)!!!
>
> Is anyone can give me some hints how to implement this use case as regards
> to how/where to use g_main_loop_run() ?
GMainLoop is a normal event loop and g_main_loop_run() continues until
you called g_main_loop_quit(). In the meantime it will consume all
events that are happening.
So you either want to integrate your events with GMainLoop (for which
there are lots of different possibilities, depending on what kind of
events you get and from where), or you don't want to use a GMainLoop
and do your own event loop instead (in which case you can use other
parts of the GstBus API for getting GstMessages, depending on how you
want to integrate with your own event loop).
--
Sebastian Dröge, Centricular Ltd · http://www.centricular.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 931 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20160908/0bc4f813/attachment.sig>
More information about the gstreamer-devel
mailing list