[pulseaudio-discuss] Need to information to implement a media player

Remi Denis-Courmont remi at remlab.net
Sat Mar 14 18:37:35 UTC 2020


Le 2020-03-14 18:52, Emeric Poupon a écrit :
> Hi!
> 
> I am implementing a headless media player. I have played a bit with
> the pulseaudio client asynchronous API and I am able to play my files
> with no problem, which is great.
> However, I have some questions about pulse audio usage:
> 
> - is it OK to open a stream as soon as the application starts, even if
> no sound will be eventually played? Or should I open a stream only
> when a song is requested to be played and close it once it has
> finished?

Can you enforce the same audio format throughout the application 
lifetime? It seems saner to keep the PA mainloop and the PA context for 
the whole application, but create a new stream only when you start 
playback. You can do either way though.

> - is it OK to use a single stream for several songs or is it better to
> use separate streams, one for each song?

You can of course do that. If you implement cross-fading, it's even hard 
to avoid. Remember to update the stream meta-data though.

> I thought it may be easier to
> use a single stream to implement gapless playback, but I may be wrong.

Yes.

-- 
Rémi Denis-Courmont


More information about the pulseaudio-discuss mailing list