[gst-devel] Stopping playback

Will Newton will.newton at gmail.com
Thu Feb 8 23:05:20 CET 2007


On 2/8/07, Christoffer Nyborg <christoffer.nyborg at gmail.com> wrote:
> Hi again, thanks for the reply.
>
> On 2/8/07, Stefan Kost <ensonic at hora-obscura.de> wrote:
> > hi,
> > Christoffer Nyborg wrote:
> > > Hi
> > >
> > > I'm writing an application where I might need to interrupt playback.
> > > From what I've read I'm supposed to change the state with
> > > gst_element_set_state (pipeline, GST_STATE_NULL);
> > > but I'm unable to because
> > > g_main_loop_run (loop);
> > > is blocking. How can I solve this? Can I throw the call
> > > g_main_loop_run (loop);
> > > into another thread or something?
> > >
> > Once the mainloop run, all signal handlers will be triggered. E.g. if you
> run a
> > UI, you can do the
> > gst_element_set_state (pipeline, GST_STATE_NULL);
> > call, when the user presses a button. If you do a commandline application,
> you
> > have to handle that on your own.
>
>
> Yes, because I'm developing a command line application that is my problem, I
> don't know how to handle it.
> If anyone have a suggestion I'd greatly appreciate it.

You could try adding a glib IO channel connected to stdin to the glib main loop:

http://developer.gnome.org/doc/API/2.0/glib/glib-IO-Channels.html

see g_io_add_watch().




More information about the gstreamer-devel mailing list