[gst-devel] how to make gstreamer run in separate thread
Alexey Chernov
4ernov at gmail.com
Fri Apr 16 21:32:32 CEST 2010
> GStreamer already run the data processing in separate threads.
Yes, I've read about it but in my case I would like to make callback functions
live in a separate thread.
>
> > I need
> >
> > it generally because I work with very slow v4l2 device driver and it
> > takes considerable time for to change state of pipeline (init driver
> > etc.).
>
> Are you synchronously waiting for the state change to happen? I wonder
> if you just use things a bit sub optimal.
No, my case is a little complicated. I run two pipelines, one just for v4l2src
and ximagesink (video pipeline) and another for alsasrc and pulsesink (audio
pipeline). The aim is to inform user if he entered wrong /dev/videoX device
(i.e. he entered /dev/video1 but the device is /dev/video0). I start both
pipelines and try to switch them to READY. v4l2src says that he has a wrong
device and throws error on the bus. In this case I try to switch both
pipelines to NULL and print a message to user. But the problem is that audio
pipeline hasn't completed its switch to READY (because of slow tuner driver).
But I try to change it to NULL and it blocks everything until it gets READY
state and then switch back to NULL.
Stefan, it seems that Qt event loop has g_main_loop_run() call somewhere
inside of it. For example, I don't call g_main_loop_run anywhere in my program
at all and even don't create GMainLoop object, I don't have while(true) pseudo
event loop but all the gstreamer stuff works just ok except this issue with
threads. Do you know if it's true? If so, maybe there's some way to bind
gstreamer's event loop to other QThread's Qt event loop..
Thanks for your help
More information about the gstreamer-devel
mailing list