Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add alsa+hdmi audio output mode #499

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions OMXAudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ bool COMXAudio::PortSettingsChanged()
if(!m_omx_mixer.Initialize("OMX.broadcom.audio_mixer", OMX_IndexParamAudioInit))
return false;
}
if(m_config.device == "omx:both")
if(m_config.device == "omx:both" || m_config.device == "omx:alsa+hdmi")
{
if(!m_omx_splitter.Initialize("OMX.broadcom.audio_splitter", OMX_IndexParamAudioInit))
return false;
Expand All @@ -107,12 +107,12 @@ bool COMXAudio::PortSettingsChanged()
if(!m_omx_render_analog.Initialize("OMX.broadcom.audio_render", OMX_IndexParamAudioInit))
return false;
}
if (m_config.device == "omx:both" || m_config.device == "omx:hdmi")
if (m_config.device == "omx:both" || m_config.device == "omx:hdmi" || m_config.device == "omx:alsa+hdmi")
{
if(!m_omx_render_hdmi.Initialize("OMX.broadcom.audio_render", OMX_IndexParamAudioInit))
return false;
}
if (m_config.device == "omx:alsa")
if (m_config.device == "omx:alsa" || m_config.device == "omx:alsa+hdmi")
{
if(!m_omx_render_analog.Initialize("OMX.alsa.audio_render", OMX_IndexParamAudioInit))
return false;
Expand Down Expand Up @@ -232,15 +232,15 @@ bool COMXAudio::PortSettingsChanged()
// when in dual audio mode, make analogue the slave
OMX_CONFIG_BOOLEANTYPE configBool;
OMX_INIT_STRUCTURE(configBool);
configBool.bEnabled = m_config.is_live || m_config.device == "omx:both" ? OMX_FALSE:OMX_TRUE;
configBool.bEnabled = m_config.is_live || (m_config.device == "omx:both" || m_config.device == "omx:alsa+hdmi") ? OMX_FALSE:OMX_TRUE;

omx_err = m_omx_render_analog.SetConfig(OMX_IndexConfigBrcmClockReferenceSource, &configBool);
if (omx_err != OMX_ErrorNone)
return false;

OMX_CONFIG_BRCMAUDIODESTINATIONTYPE audioDest;
OMX_INIT_STRUCTURE(audioDest);
strncpy((char *)audioDest.sName, m_config.device == "omx:alsa" ? m_config.subdevice.c_str() : "local", sizeof(audioDest.sName));
strncpy((char *)audioDest.sName, (m_config.device == "omx:alsa" || m_config.device == "omx:alsa+hdmi") ? m_config.subdevice.c_str() : "local", sizeof(audioDest.sName));
omx_err = m_omx_render_analog.SetConfig(OMX_IndexConfigBrcmAudioDestination, &audioDest);
if (omx_err != OMX_ErrorNone)
{
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Usage: omxplayer [OPTIONS] [FILE]
-v --version Print version info
-k --keys Print key bindings
-n --aidx index Audio stream index : e.g. 1
-o --adev device Audio out device : e.g. hdmi/local/both/alsa[:device]
-o --adev device Audio out device : e.g. hdmi/local/both/alsa[:device]/alsa+hdmi[:device]
-i --info Dump stream format and exit
-I --with-info dump stream format before playback
-s --stats Pts and buffer stats
Expand Down
7 changes: 4 additions & 3 deletions omxplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -721,9 +721,9 @@ int main(int argc, char *argv[])
}
}
if(m_config_audio.device != "local" && m_config_audio.device != "hdmi" && m_config_audio.device != "both" &&
m_config_audio.device != "alsa")
m_config_audio.device != "alsa" && m_config_audio.device != "alsa+hdmi")
{
printf("Bad argument for -%c: Output device must be `local', `hdmi', `both' or `alsa'\n", c);
printf("Bad argument for -%c: Output device must be `local', `hdmi', `both', `alsa' or `alsa+hdmi'\n", c);
return EXIT_FAILURE;
}
m_config_audio.device = "omx:" + m_config_audio.device;
Expand Down Expand Up @@ -1148,7 +1148,8 @@ int main(int argc, char *argv[])
m_config_audio.device = "omx:local";
}

if(m_config_audio.device == "omx:alsa" && m_config_audio.subdevice.empty())
if ((m_config_audio.device == "omx:alsa" ||
m_config_audio.device == "omx:alsa+hdmi") && m_config_audio.subdevice.empty())
m_config_audio.subdevice = "default";

if ((m_config_audio.hints.codec == AV_CODEC_ID_AC3 || m_config_audio.hints.codec == AV_CODEC_ID_EAC3) &&
Expand Down