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

@@ -230,4 +230,5 @@ const struct mixer_plugin alsa_mixer = {
.close = alsa_mixer_close,
.get_volume = alsa_mixer_get_volume,
.set_volume = alsa_mixer_set_volume,
.global = true,
};

View File

@@ -198,4 +198,5 @@ const struct mixer_plugin oss_mixer = {
.close = oss_mixer_close,
.get_volume = oss_mixer_get_volume,
.set_volume = oss_mixer_set_volume,
.global = true,
};