summaryrefslogtreecommitdiffstats
path: root/audio/out
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-05-05 21:45:55 +0200
committerwm4 <wm4@nowhere>2015-05-05 21:45:55 +0200
commit66f4e7cce497f24e5b693b95fa222382da649f86 (patch)
treeaee4988369bd86e6f7b6fd063d8fcf66be0dffda /audio/out
parentcf210c4ffc6d008dd2bdd7c5d4d031ecdcf05fb7 (diff)
downloadmpv-66f4e7cce497f24e5b693b95fa222382da649f86.tar.bz2
mpv-66f4e7cce497f24e5b693b95fa222382da649f86.tar.xz
ao_coreaudio: change physical format before channel negotiation
If for example the physical format is set to stereo, the reported multichannel layout will actually be stereo. It fixes itself only after the physical format is changed.
Diffstat (limited to 'audio/out')
-rw-r--r--audio/out/ao_coreaudio.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/audio/out/ao_coreaudio.c b/audio/out/ao_coreaudio.c
index 85057bee67..f0de12cbe1 100644
--- a/audio/out/ao_coreaudio.c
+++ b/audio/out/ao_coreaudio.c
@@ -125,6 +125,7 @@ static int control(struct ao *ao, enum aocontrol cmd, void *arg)
static bool init_chmap(struct ao *ao);
static bool init_audiounit(struct ao *ao, AudioStreamBasicDescription asbd);
+static void init_physical_format(struct ao *ao);
static bool reinit_device(struct ao *ao) {
struct priv *p = ao->priv;
@@ -145,6 +146,8 @@ coreaudio_error:
static int init(struct ao *ao)
{
+ struct priv *p = ao->priv;
+
if (AF_FORMAT_IS_IEC61937(ao->format)) {
MP_WARN(ao, "detected IEC61937, redirecting to coreaudio_exclusive\n");
ao->redirect = "coreaudio_exclusive";
@@ -154,6 +157,9 @@ static int init(struct ao *ao)
if (!reinit_device(ao))
goto coreaudio_error;
+ if (p->change_physical_format)
+ init_physical_format(ao);
+
if (!init_chmap(ao))
goto coreaudio_error;
@@ -262,11 +268,14 @@ coreaudio_error:
return false;
}
-static void init_physical_format(struct ao *ao, AudioStreamBasicDescription asbd)
+static void init_physical_format(struct ao *ao)
{
struct priv *p = ao->priv;
OSErr err;
+ AudioStreamBasicDescription asbd;
+ ca_fill_asbd(ao, &asbd);
+
AudioStreamID *streams;
size_t n_streams;
@@ -314,9 +323,6 @@ static bool init_audiounit(struct ao *ao, AudioStreamBasicDescription asbd)
uint32_t size;
struct priv *p = ao->priv;
- if (p->change_physical_format)
- init_physical_format(ao, asbd);
-
AudioComponentDescription desc = (AudioComponentDescription) {
.componentType = kAudioUnitType_Output,
.componentSubType = (ao->device) ?