0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 12:02:23 +02:00

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.
This commit is contained in:
wm4 2015-05-05 21:45:55 +02:00
parent cf210c4ffc
commit 66f4e7cce4

View File

@ -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) ?