diff options
author | Max Kellermann <max@duempel.org> | 2009-10-23 10:55:52 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-10-23 10:55:52 +0200 |
commit | e53ca368a5448291ca2783b8061727635084618f (patch) | |
tree | 596c18606cd386b580a23cc6d07cf121cca8db37 /src/output_command.c | |
parent | c426a0bc5cc641ecd044c389f7180dad50a355bf (diff) | |
download | mpd-e53ca368a5448291ca2783b8061727635084618f.tar.gz mpd-e53ca368a5448291ca2783b8061727635084618f.tar.xz mpd-e53ca368a5448291ca2783b8061727635084618f.zip |
output_plugin: added methods enable() and disable()
With these methods, an output plugin can allocate some global
resources only if it is actually enabled. The method enable() is
called after daemonization, which allows for more sophisticated
resource allocation during that method.
Diffstat (limited to 'src/output_command.c')
-rw-r--r-- | src/output_command.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/output_command.c b/src/output_command.c index 9d948c8cc..b47890043 100644 --- a/src/output_command.c +++ b/src/output_command.c @@ -29,6 +29,7 @@ #include "output_internal.h" #include "output_plugin.h" #include "mixer_control.h" +#include "player_control.h" #include "idle.h" extern unsigned audio_output_state_version; @@ -42,10 +43,14 @@ audio_output_enable_index(unsigned idx) return false; ao = audio_output_get(idx); + if (ao->enabled) + return true; ao->enabled = true; idle_add(IDLE_OUTPUT); + pc_update_audio(); + ++audio_output_state_version; return true; @@ -61,6 +66,8 @@ audio_output_disable_index(unsigned idx) return false; ao = audio_output_get(idx); + if (!ao->enabled) + return true; ao->enabled = false; idle_add(IDLE_OUTPUT); @@ -71,6 +78,8 @@ audio_output_disable_index(unsigned idx) idle_add(IDLE_MIXER); } + pc_update_audio(); + ++audio_output_state_version; return true; |