add option to regulate audio systems volume via CEC

Origin commit data
------------------
Commit: 8e9c4a7568
Author: TangoCash <eric@loxat.de>
Date: 2018-10-14 (Sun, 14 Oct 2018)
This commit is contained in:
TangoCash
2018-10-14 22:29:22 +02:00
committed by vanhofen
parent 3d2b7f379a
commit 53131133cc
8 changed files with 61 additions and 1 deletions

View File

@@ -96,12 +96,19 @@ int CCECSetup::showMenu()
cec1->setHint("", LOCALE_MENU_HINT_CEC_VIEW_ON);
cec2 = new CMenuOptionChooser(LOCALE_VIDEOMENU_HDMI_CEC_STANDBY, &g_settings.hdmi_cec_standby, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, g_settings.hdmi_cec_mode != VIDEO_HDMI_CEC_MODE_OFF, this);
cec2->setHint("", LOCALE_MENU_HINT_CEC_STANDBY);
#if HAVE_ARM_HARDWARE
cec3 = new CMenuOptionChooser(LOCALE_VIDEOMENU_HDMI_CEC_VOLUME, &g_settings.hdmi_cec_volume, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, g_settings.hdmi_cec_mode != VIDEO_HDMI_CEC_MODE_OFF, this);
cec3->setHint("", LOCALE_MENU_HINT_CEC_VOLUME);
#endif
cec->addItem(cec_ch);
cec->addItem(GenericMenuSeparatorLine);
//-------------------------------------------------------
cec->addItem(cec1);
cec->addItem(cec2);
#if HAVE_ARM_HARDWARE
cec->addItem(cec3);
#endif
int res = cec->exec(NULL, "");
delete cec;

View File

@@ -36,7 +36,7 @@
class CCECSetup : public CMenuTarget, CChangeObserver
{
private:
CMenuOptionChooser *cec1, *cec2;
CMenuOptionChooser *cec1, *cec2, *cec3;
int width;

View File

@@ -414,6 +414,7 @@ int CNeutrinoApp::loadSetup(const char * fname)
g_settings.hdmi_cec_mode = configfile.getInt32("hdmi_cec_mode", 0); // default off
g_settings.hdmi_cec_view_on = configfile.getInt32("hdmi_cec_view_on", 0); // default off
g_settings.hdmi_cec_standby = configfile.getInt32("hdmi_cec_standby", 0); // default off
g_settings.hdmi_cec_volume = configfile.getInt32("hdmi_cec_volume", 0);
g_settings.video_Format = configfile.getInt32("video_Format", DISPLAY_AR_16_9);
g_settings.video_43mode = configfile.getInt32("video_43mode", DISPLAY_AR_MODE_LETTERBOX);
@@ -1343,6 +1344,7 @@ void CNeutrinoApp::saveSetup(const char * fname)
configfile.setInt32( "hdmi_cec_mode", g_settings.hdmi_cec_mode );
configfile.setInt32( "hdmi_cec_view_on", g_settings.hdmi_cec_view_on );
configfile.setInt32( "hdmi_cec_standby", g_settings.hdmi_cec_standby );
configfile.setInt32( "hdmi_cec_volume", g_settings.hdmi_cec_volume );
configfile.setInt32( "current_volume", g_settings.current_volume );
configfile.setInt32( "current_volume_step", g_settings.current_volume_step );
@@ -3032,6 +3034,13 @@ void CNeutrinoApp::RealRun()
showInfo();
break;
case SNeutrinoSettings::VOLUME:
#if HAVE_ARM_HARDWARE
if (g_settings.hdmi_cec_volume)
{
(msg == (neutrino_msg_t) g_settings.key_volumeup || msg == CRCInput::RC_right) ? hdmi_cec::getInstance()->vol_up() : hdmi_cec::getInstance()->vol_down();
}
else
#endif
g_volume->setVolume(msg);
break;
default: /* SNeutrinoSettings::ZAP */
@@ -3147,6 +3156,13 @@ void CNeutrinoApp::RealRun()
showInfo();
break;
case SNeutrinoSettings::VOLUME:
#if HAVE_ARM_HARDWARE
if (g_settings.hdmi_cec_volume)
{
(msg == (neutrino_msg_t) g_settings.key_volumeup || msg == CRCInput::RC_right) ? hdmi_cec::getInstance()->vol_up() : hdmi_cec::getInstance()->vol_down();
}
else
#endif
g_volume->setVolume(msg);
break;
default: /* SNeutrinoSettings::ZAP */
@@ -3658,6 +3674,13 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data)
}
else if ((msg == CRCInput::RC_plus) || (msg == CRCInput::RC_minus))
{
#if HAVE_ARM_HARDWARE
if (g_settings.hdmi_cec_volume)
{
(msg == (neutrino_msg_t) g_settings.key_volumeup || msg == CRCInput::RC_right) ? hdmi_cec::getInstance()->vol_up() : hdmi_cec::getInstance()->vol_down();
}
else
#endif
g_volume->setVolume(msg);
return messages_return::handled;
}
@@ -3668,15 +3691,36 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data)
}
else {
//mute
#if HAVE_ARM_HARDWARE
if (g_settings.hdmi_cec_volume)
{
hdmi_cec::getInstance()->toggle_mute();
}
else
#endif
g_audioMute->AudioMute(!current_muted, true);
}
return messages_return::handled;
}
else if( msg == CRCInput::RC_mute_on ) {
#if HAVE_ARM_HARDWARE
if (g_settings.hdmi_cec_volume)
{
hdmi_cec::getInstance()->toggle_mute();
}
else
#endif
g_audioMute->AudioMute(true, true);
return messages_return::handled;
}
else if( msg == CRCInput::RC_mute_off ) {
#if HAVE_ARM_HARDWARE
if (g_settings.hdmi_cec_volume)
{
hdmi_cec::getInstance()->toggle_mute();
}
else
#endif
g_audioMute->AudioMute(false, true);
return messages_return::handled;
}

View File

@@ -1213,6 +1213,7 @@ typedef enum
LOCALE_MENU_HINT_CEC_MODE,
LOCALE_MENU_HINT_CEC_STANDBY,
LOCALE_MENU_HINT_CEC_VIEW_ON,
LOCALE_MENU_HINT_CEC_VOLUME,
LOCALE_MENU_HINT_CHANNELLIST_ADDITIONAL,
LOCALE_MENU_HINT_CHANNELLIST_ENABLESDT,
LOCALE_MENU_HINT_CHANNELLIST_EPG_ALIGN,
@@ -2816,6 +2817,7 @@ typedef enum
LOCALE_VIDEOMENU_HDMI_CEC_MODE_TUNER,
LOCALE_VIDEOMENU_HDMI_CEC_STANDBY,
LOCALE_VIDEOMENU_HDMI_CEC_VIEW_ON,
LOCALE_VIDEOMENU_HDMI_CEC_VOLUME,
LOCALE_VIDEOMENU_HUE,
LOCALE_VIDEOMENU_LETTERBOX,
LOCALE_VIDEOMENU_PANSCAN,

View File

@@ -1213,6 +1213,7 @@ const char * locale_real_names[] =
"menu.hint_cec_mode",
"menu.hint_cec_standby",
"menu.hint_cec_view_on",
"menu.hint_cec_volume",
"menu.hint_channellist_additional",
"menu.hint_channellist_enablesdt",
"menu.hint_channellist_epg_align",
@@ -2816,6 +2817,7 @@ const char * locale_real_names[] =
"videomenu.hdmi_cec_mode_tuner",
"videomenu.hdmi_cec_standby",
"videomenu.hdmi_cec_view_on",
"videomenu.hdmi_cec_volume",
"videomenu.hue",
"videomenu.letterbox",
"videomenu.panscan",

View File

@@ -262,6 +262,7 @@ struct SNeutrinoSettings
int hdmi_cec_mode;
int hdmi_cec_view_on;
int hdmi_cec_standby;
int hdmi_cec_volume;
int enabled_video_modes[VIDEOMENU_VIDEOMODE_OPTION_COUNT];
int enabled_auto_modes[VIDEOMENU_VIDEOMODE_OPTION_COUNT];
int cpufreq;