diff options
author | wm4 <wm4@nowhere> | 2013-10-12 18:28:02 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-10-12 18:57:02 +0200 |
commit | 20988ee6076bac53015b6eaab753203ca7dd6a8c (patch) | |
tree | e8a7d8b08dca4fac7a860a072d1ffa18769f4186 /audio | |
parent | 38874b2f2e3a5e0473bada789ef04af632e27ecb (diff) | |
download | mpv-20988ee6076bac53015b6eaab753203ca7dd6a8c.tar.bz2 mpv-20988ee6076bac53015b6eaab753203ca7dd6a8c.tar.xz |
command: don't allow changing volume if no audio initialized
Changing volume when audio is disabled was a feature request (github
issue #215), and was introduced with commit 327a779.
But trying to fix github issue #280 (volume is not correct in no-audio
mode, and if audio is re-enabled, the volume set in no-audio mode isn't
set), I concluded that it's not worth the trouble and the current
implementation is questionable all around. (For example, you can't
change the real volume in no-audio mode, even if the AO is open - this
could happen with gapless audio.) It's hard to get right, and the
current mixer code is already hilariously overcomplicated. (Virtually
all of mixer.c is an amalgamation of various obscure corner cases.)
So just remove this feature again.
Note that "options/volume" and "options/mute" still can be used in
idle mode to adjust the volume used next time, though these properties
can't be used during playback and thus not in audio-only mode.
Querying the volume still "works" in audio-only mode, though it can
return bogus values.
Diffstat (limited to 'audio')
-rw-r--r-- | audio/mixer.c | 5 | ||||
-rw-r--r-- | audio/mixer.h | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/audio/mixer.c b/audio/mixer.c index 07ce229f73..f3e9d959aa 100644 --- a/audio/mixer.c +++ b/audio/mixer.c @@ -59,6 +59,11 @@ struct mixer *mixer_init(void *talloc_ctx, struct MPOpts *opts) return mixer; } +bool mixer_audio_initialized(struct mixer *mixer) +{ + return !!mixer->ao; +} + static void checkvolume(struct mixer *mixer) { if (!mixer->ao) diff --git a/audio/mixer.h b/audio/mixer.h index 9fbb4bcdca..e2e574c22e 100644 --- a/audio/mixer.h +++ b/audio/mixer.h @@ -36,6 +36,7 @@ struct mixer; struct mixer *mixer_init(void *talloc_ctx, struct MPOpts *opts); void mixer_reinit_audio(struct mixer *mixer, struct ao *ao, struct af_stream *af); void mixer_uninit_audio(struct mixer *mixer); +bool mixer_audio_initialized(struct mixer *mixer); void mixer_getvolume(struct mixer *mixer, float *l, float *r); void mixer_setvolume(struct mixer *mixer, float l, float r); void mixer_incvolume(struct mixer *mixer); |