summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-03-10 10:08:08 +0100
committerwm4 <wm4@nowhere>2015-03-10 10:08:15 +0100
commitee14da2988a543fe2d520ff63729edf9d3484907 (patch)
tree01b0ece7e5e9f87e7b781ea1c049bbebcf425c76
parent30b0a5b98a0c68324e3d676d64e2e150e2091e03 (diff)
downloadmpv-ee14da2988a543fe2d520ff63729edf9d3484907.tar.bz2
mpv-ee14da2988a543fe2d520ff63729edf9d3484907.tar.xz
ao_coreaudio_exclusive: rip out pseudo volume control
This could mute a digital passthrough stream by writing zeros. All other volume values did nothing. The comment about MPlayer dying hasn't been true in mpv for quite a while. It's even possible that it's fixed in upstream MPlayer. mpv will print a scary error message when trying to change volume with spdif, and continue normally. If we really want to mute by writing zeros, we should do it in a separate filter. But I'm not overly fascinated by this approach; is it even guaranteed receivers will not be confused by a stream of zeros? The main reason to remove this is that it's in the way of further cleanups.
-rw-r--r--audio/out/ao_coreaudio_exclusive.c41
1 files changed, 1 insertions, 40 deletions
diff --git a/audio/out/ao_coreaudio_exclusive.c b/audio/out/ao_coreaudio_exclusive.c
index af77409534..cccd4c5808 100644
--- a/audio/out/ao_coreaudio_exclusive.c
+++ b/audio/out/ao_coreaudio_exclusive.c
@@ -332,7 +332,6 @@ struct priv {
bool changed_mixing;
int stream_asbd_changed;
- bool muted;
};
static int get_ring_size(struct ao *ao)
@@ -351,47 +350,11 @@ static OSStatus render_cb_digital(
AudioBuffer buf = out_data->mBuffers[p->stream_idx];
int requested = buf.mDataByteSize;
- if (p->muted)
- mp_ring_drain(p->buffer, requested);
- else
- mp_ring_read(p->buffer, buf.mData, requested);
+ mp_ring_read(p->buffer, buf.mData, requested);
return noErr;
}
-static int control(struct ao *ao, enum aocontrol cmd, void *arg)
-{
- struct priv *p = ao->priv;
- ao_control_vol_t *control_vol;
- switch (cmd) {
- case AOCONTROL_GET_VOLUME:
- control_vol = (ao_control_vol_t *)arg;
- // Digital output has no volume adjust.
- int digitalvol = p->muted ? 0 : 100;
- *control_vol = (ao_control_vol_t) {
- .left = digitalvol, .right = digitalvol,
- };
- return CONTROL_TRUE;
-
- case AOCONTROL_SET_VOLUME:
- control_vol = (ao_control_vol_t *)arg;
- // Digital output can not set volume. Here we have to return true
- // to make mixer forget it. Else mixer will add a soft filter,
- // that's not we expected and the filter not support ac3 stream
- // will cause mplayer die.
-
- // Although not support set volume, but at least we support mute.
- // MPlayer set mute by set volume to zero, we handle it.
- if (control_vol->left == 0 && control_vol->right == 0)
- p->muted = true;
- else
- p->muted = false;
- return CONTROL_TRUE;
-
- } // end switch
- return CONTROL_UNKNOWN;
-}
-
static int init_digital(struct ao *ao, AudioStreamBasicDescription asbd);
static int init(struct ao *ao)
@@ -648,7 +611,6 @@ const struct ao_driver audio_out_coreaudio_exclusive = {
.uninit = uninit,
.init = init,
.play = play,
- .control = control,
.get_space = get_space,
.get_delay = get_delay,
.reset = reset,
@@ -657,7 +619,6 @@ const struct ao_driver audio_out_coreaudio_exclusive = {
.list_devs = ca_get_device_list,
.priv_size = sizeof(struct priv),
.priv_defaults = &(const struct priv){
- .muted = false,
.stream_asbd_changed = 0,
.hog_pid = -1,
.stream = 0,