Commit 0d5f8eb8 authored by Felix Paul Kühne's avatar Felix Paul Kühne

AudioUnit iOS: add headphone detection

parent 47524d79
......@@ -95,7 +95,8 @@ enum port_type
{
PORT_TYPE_DEFAULT,
PORT_TYPE_USB,
PORT_TYPE_HDMI
PORT_TYPE_HDMI,
PORT_TYPE_HEADPHONES
};
#pragma mark -
......@@ -189,6 +190,8 @@ avas_GetOptimalChannelLayout(audio_output_t *p_aout, enum port_type *pport_type,
port_type = PORT_TYPE_USB;
else if ([out.portType isEqualToString: AVAudioSessionPortHDMI])
port_type = PORT_TYPE_HDMI;
else if ([out.portType isEqualToString: AVAudioSessionPortHeadphones])
port_type = PORT_TYPE_HEADPHONES;
else
port_type = PORT_TYPE_DEFAULT;
......@@ -245,7 +248,8 @@ avas_GetOptimalChannelLayout(audio_output_t *p_aout, enum port_type *pport_type,
msg_Dbg(p_aout, "Output on %s, channel count: %u",
*pport_type == PORT_TYPE_HDMI ? "HDMI" :
*pport_type == PORT_TYPE_USB ? "USB" : "Default",
*pport_type == PORT_TYPE_USB ? "USB" :
*pport_type == PORT_TYPE_HEADPHONES ? "Headphones" : "Default",
layout ? (unsigned) layout->mNumberChannelDescriptions : 2);
*playout = layout;
......@@ -404,6 +408,8 @@ Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt)
goto error;
}
p_aout->current_sink_info.headphones = port_type == PORT_TYPE_HEADPHONES;
p_sys->au_unit = au_NewOutputInstance(p_aout, kAudioUnitSubType_RemoteIO);
if (p_sys->au_unit == NULL)
goto error;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment