mixer: added flag "open"

Remember if a mixer object is open or closed.  Don't call open() again
if it is already open.  This guarantees that the mixer plugin is
always called in a consistent state, and we will be able to remove
lots of checks from the implementations.

To support mixers which are automatically opened even if the audio
output is still closed (to set the volume before playback starts),
this patch also adds the "global" flag to the mixer_plugin struct.
Both ALSA and OSS set this flag, while PULSE does not.
This commit is contained in:
Max Kellermann
2009-03-26 19:43:18 +01:00
parent 7475ded935
commit 617a4fd2d2
8 changed files with 61 additions and 5 deletions

View File

@@ -46,6 +46,13 @@ mixer_open(struct mixer *mixer);
void
mixer_close(struct mixer *mixer);
/**
* Close the mixer unless the plugin's "global" flag is set. This is
* called when the #audio_output is closed.
*/
void
mixer_auto_close(struct mixer *mixer);
int
mixer_get_volume(struct mixer *mixer);