[pulseaudio-discuss] Getting the pollfds from the PA mainloop

Thomas Martitz kugel at rockbox.org
Sun Mar 30 10:08:19 PDT 2014

Am 30.03.2014 17:04, schrieb Stephan Soller:
> Hi,
> is there a way to get the pollfds out of the poll() based Pulse Audio 
> mainloop? Basically I want to do the poll() myself so I can poll for 
> other stuff as well (some v4l2 devices and UNIX domain sockets).
> In ALSA there is the snd_pcm_poll_descriptors*() family of functions 
> to get the required pollfds. But I haven't found an equivalent Pulse 
> Audio function for that kind of stuff.
> I looked at the PA mainloop source code and found no matching 
> functions 
> (http://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/pulse/mainloop.c). 
> I found the pollfds and n_pollfds members in the pa_mainloop struct 
> but no way to access them from the outside. Does that mean I'm stuck 
> with ALSA?
> A little background: I'm currently building an audio/video live mixing 
> program. It combines several video and audio streams (webcams, frame 
> grabber, mics, ...) into one live stream and sends it to an encoder 
> process (ffmpeg).
> One big poll() loop fechtes video and audio data and manages some UNIX 
> domain sockets to send the result onwards. OpenGL is used to combine 
> the different video streams. The program only shuffles data around and 
> if possible I want to keep everything in one single threaded poll() loop.
> Any ideas are welcome.

Alternatively you can add your FDs to the pa mainloop using 
mainloop_io_new(). The end result (all FDs are covered with a single 
poll() call) is the same.

Best regards

More information about the pulseaudio-discuss mailing list