diff --git a/data/locale/english.locale b/data/locale/english.locale index f4c233967..b08906d77 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -114,6 +114,8 @@ audiomenu.avsync_am Audio master audiomenu.clockrec audiomenu.dolbydigital Prefer Dolby Digital audiomenu.hdmi_dd Encoded DD on HDMI +audiomenu.hdmi_dd_auto auto +audiomenu.hdmi_dd_force force audiomenu.monoleft mono left audiomenu.monoright mono right audiomenu.pref_lang Prefered language diff --git a/lib/libcoolstream/audio_cs.h b/lib/libcoolstream/audio_cs.h index 34bd06340..049407260 100644 --- a/lib/libcoolstream/audio_cs.h +++ b/lib/libcoolstream/audio_cs.h @@ -5,6 +5,7 @@ /* */ /* (C) 2008 CoolStream International */ /* */ +/* $Id:: $ */ /*******************************************************************************/ #ifndef __AUDIO_CS_H_ #define __AUDIO_CS_H_ @@ -37,6 +38,36 @@ typedef enum { AUDIO_FMT_ADVANCED = AUDIO_FMT_MLP } AUDIO_FORMAT; +typedef enum { + HDMI_ENCODED_OFF, + HDMI_ENCODED_AUTO, + HDMI_ENCODED_FORCED +} HDMI_ENCODED_MODE; + +typedef enum +{ + HDMI_AUDIO_FMT_LPCM = 0x1, + HDMI_AUDIO_FMT_AC3 , + HDMI_AUDIO_FMT_MPEG1 , + HDMI_AUDIO_FMT_MP3 , + HDMI_AUDIO_FMT_MPEG2 , + HDMI_AUDIO_FMT_AAC , + HDMI_AUDIO_FMT_DTS , + HDMI_AUDIO_FMT_ATRAC +} HDMI_AUDIO_FORMAT; + +#define CS_MAX_AUDIO_FORMATS 10 + +typedef struct cs_audio_format { + HDMI_AUDIO_FORMAT format; + unsigned int max_channels; +} cs_audio_format_t; + +typedef struct cs_audio_caps { + unsigned char count; + cs_audio_format_t formats[CS_MAX_AUDIO_FORMATS]; +} cs_audio_caps_t; + class cAudio { private: CS_AUDIO_PDATA *privateData; @@ -57,7 +88,7 @@ private: int volume; bool clip_started; - bool hdmiDD; + HDMI_ENCODED_MODE hdmiDD; bool spdifDD; bool hasMuteScheduled; bool analogOut; @@ -110,10 +141,12 @@ public: void getAudioInfo(int &Type, int &Layer, int &Freq, int &Bitrate, int &Mode); void SetSRS(int iq_enable, int nmgr_enable, int iq_mode, int iq_level); bool IsHdmiDDSupported(void); - void SetHdmiDD(bool Enable); + void SetHdmiDD(HDMI_ENCODED_MODE type); void SetSpdifDD(bool Enable); void ScheduleMute(bool On); void EnableAnalogOut(bool Enable); + bool GetHdmiAudioCaps(cs_audio_caps_t &caps); + bool IsHdmiAudioFormatSupported(HDMI_AUDIO_FORMAT format); }; #endif //__AUDIO_CS_H_ diff --git a/src/gui/audio_setup.cpp b/src/gui/audio_setup.cpp index 27f290c40..b6483b232 100644 --- a/src/gui/audio_setup.cpp +++ b/src/gui/audio_setup.cpp @@ -103,6 +103,14 @@ const CMenuOptionChooser::keyval AUDIOMENU_AVSYNC_OPTIONS[AUDIOMENU_AVSYNC_OPTIO { 2, LOCALE_AUDIOMENU_AVSYNC_AM } }; +#define AUDIOMENU_HDMI_DD_OPTION_COUNT 3 +const CMenuOptionChooser::keyval AUDIOMENU_HDMI_DD_OPTIONS[AUDIOMENU_HDMI_DD_OPTION_COUNT] = +{ + { HDMI_ENCODED_OFF, LOCALE_OPTIONS_OFF }, + { HDMI_ENCODED_AUTO, LOCALE_AUDIOMENU_HDMI_DD_AUTO }, + { HDMI_ENCODED_FORCED, LOCALE_AUDIOMENU_HDMI_DD_FORCE } +}; + // #define AUDIOMENU_CLOCKREC_OPTION_COUNT 2 // const CMenuOptionChooser::keyval AUDIOMENU_CLOCKREC_OPTIONS[AUDIOMENU_CLOCKREC_OPTION_COUNT] = // { @@ -125,7 +133,7 @@ int CAudioSetup::showAudioSetup() CMenuOptionChooser * as_oj_ddsubchn = new CMenuOptionChooser(LOCALE_AUDIOMENU_DOLBYDIGITAL, &g_settings.audio_DolbyDigital, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, audioSetupNotifier); //dd via hdmi - CMenuOptionChooser * as_oj_dd_hdmi = new CMenuOptionChooser(LOCALE_AUDIOMENU_HDMI_DD, &g_settings.hdmi_dd, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, audioSetupNotifier); + CMenuOptionChooser * as_oj_dd_hdmi = new CMenuOptionChooser(LOCALE_AUDIOMENU_HDMI_DD, &g_settings.hdmi_dd, AUDIOMENU_HDMI_DD_OPTIONS, AUDIOMENU_HDMI_DD_OPTION_COUNT, true, audioSetupNotifier); //dd via spdif CMenuOptionChooser * as_oj_dd_spdif = new CMenuOptionChooser(LOCALE_AUDIOMENU_SPDIF_DD, &g_settings.spdif_dd, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, audioSetupNotifier); diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 98b05a173..91071a59c 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -1661,7 +1661,7 @@ int CNeutrinoApp::run(int argc, char **argv) audioDecoder->SetSRS(g_settings.srs_enable, g_settings.srs_nmgr_enable, g_settings.srs_algo, g_settings.srs_ref_volume); audioDecoder->setVolume(g_settings.current_volume, g_settings.current_volume); - audioDecoder->SetHdmiDD(g_settings.hdmi_dd ? true : false); + audioDecoder->SetHdmiDD((HDMI_ENCODED_MODE)g_settings.hdmi_dd); audioDecoder->SetSpdifDD(g_settings.spdif_dd ? true : false); audioDecoder->EnableAnalogOut(g_settings.analog_out ? true : false); @@ -3964,4 +3964,4 @@ void CNeutrinoApp::SDT_ReloadChannels() g_RCInput->postMsg(CRCInput::RC_ok, 0); } -} \ No newline at end of file +} diff --git a/src/system/locals.h b/src/system/locals.h index 924de1e0a..aac979f95 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -141,6 +141,8 @@ typedef enum LOCALE_AUDIOMENU_CLOCKREC, LOCALE_AUDIOMENU_DOLBYDIGITAL, LOCALE_AUDIOMENU_HDMI_DD, + LOCALE_AUDIOMENU_HDMI_DD_AUTO, + LOCALE_AUDIOMENU_HDMI_DD_FORCE, LOCALE_AUDIOMENU_MONOLEFT, LOCALE_AUDIOMENU_MONORIGHT, LOCALE_AUDIOMENU_PREF_LANG, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index 2d1390437..a642f9ea1 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -141,6 +141,8 @@ const char * locale_real_names[] = "audiomenu.clockrec", "audiomenu.dolbydigital", "audiomenu.hdmi_dd", + "audiomenu.hdmi_dd_auto", + "audiomenu.hdmi_dd_force", "audiomenu.monoleft", "audiomenu.monoright", "audiomenu.pref_lang", diff --git a/src/system/setting_helpers.cpp b/src/system/setting_helpers.cpp index cdac93341..e2392fa74 100644 --- a/src/system/setting_helpers.cpp +++ b/src/system/setting_helpers.cpp @@ -419,7 +419,7 @@ bool CAudioSetupNotifier::changeNotify(const neutrino_locale_t OptionName, void } else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_AUDIOMENU_ANALOG_OUT)) { audioDecoder->EnableAnalogOut(g_settings.analog_out ? true : false); } else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_AUDIOMENU_HDMI_DD)) { - audioDecoder->SetHdmiDD(g_settings.hdmi_dd ? true : false); + audioDecoder->SetHdmiDD((HDMI_ENCODED_MODE) g_settings.hdmi_dd); } else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_AUDIOMENU_SPDIF_DD)) { audioDecoder->SetSpdifDD(g_settings.spdif_dd ? true : false); } else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_AUDIOMENU_AVSYNC)) {