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

Emeric Poupon itmfr at yahoo.fr
Sat Mar 14 18:59:49 UTC 2020


Thanks for your answers!

>> - 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.

Yes, actually I use ffmpeg under the hood to decode the files to a user defined format (defaulting to s16le / 44.1khz / stereo)
Ok, I will try to open/close the stream when the user start/stop the player.


>> - 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.


Ok! Keeping the same stream makes the usage of pa_stream_get_time more complicated (but it's already complicated since the user can scroll within the songs).
Could you please elaborate more on meta data? I don't find any reference of this in the doc.


More information about the pulseaudio-discuss mailing list