Skip to content

Commit

Permalink
[IMX6] when FB is going blank/off, we will loose video + audio
Browse files Browse the repository at this point in the history
this leads Kodi to timeout, resync, error, hard error -> collapse
(specially on 1cpu systems) - this changes should avoid such case.

- don't poweroff screen if player is active (audio/video)
- in CEC settings add option to "action on TV power off" which
  will just apply same action as setting "action on switching source"
- changed default configuration on "action on TV power off"
  from suspend to this new value
- changed default configuration on "action on switching source"
  from pause to stop (mostly due to PVR/timeshift)
- reordered this two settings
  • Loading branch information
mk01 committed Dec 28, 2015
1 parent d7b0c81 commit 99bb819
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 13 deletions.
7 changes: 6 additions & 1 deletion addons/resource.language.en_gb/resources/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -5445,7 +5445,12 @@ msgctxt "#13005"
msgid "Shutdown"
msgstr ""

#empty strings from id 13006 to 13007
#empty strings from id 13006

#: system/peripherals.xml
msgctxt "#13007"
msgid "Same as \"switching source\""
msgstr ""

#: system/settings/settings.xml
msgctxt "#13008"
Expand Down
8 changes: 4 additions & 4 deletions system/peripherals.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
<setting key="send_inactive_source" type="bool" value="1" label="36025" order="5" />
<setting key="cec_standby_screensaver" type="bool" value="0" label="36009" order="6" />
<setting key="cec_wake_screensaver" type="bool" value="1" label="36010" order="7" />
<setting key="standby_pc_on_tv_standby" type="enum" value="13011" label="36029" order="8" lvalues="36028|13005|13011" />
<setting key="standby_tv_on_pc_standby" type="bool" value="1" label="36026" order="9" />
<setting key="use_tv_menu_language" type="bool" value="1" label="36018" order="10" />
<setting key="standby_tv_on_pc_standby" type="bool" value="1" label="36026" order="8" />
<setting key="standby_pc_on_tv_standby" type="enum" value="13007" label="36029" order="9" lvalues="36028|13005|13011|13007" />
<setting key="pause_or_stop_playback_on_deactivate" type="enum" value="36044" label="36033" order="10" lvalues="231|36044|36045" />
<setting key="use_tv_menu_language" type="bool" value="1" label="36018" order="11" />
<setting key="pause_playback_on_deactivate" type="bool" value="1" label="36033" configurable="0" />
<setting key="pause_or_stop_playback_on_deactivate" type="enum" value="231" label="36033" order="11" lvalues="231|36044|36045" />
<setting key="connected_device" type="enum" label="36019" value="36037" lvalues="36037|36038" order="12" />
<setting key="cec_hdmi_port" type="int" value="1" min="1" max="15" label="36015" order="13" />
<setting key="physical_address" type="string" label="36021" value="0" order="14" />
Expand Down
30 changes: 22 additions & 8 deletions xbmc/peripherals/devices/PeripheralCecAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,11 @@ int CPeripheralCecAdapter::CecCommand(void *cbParam, const cec_command command)
g_application.ExecuteXBMCAction("Shutdown");
}
if (command.initiator == CECDEVICE_TV)
{
if (adapter->GetSettingInt("standby_pc_on_tv_standby") == 13007)
CecEventPostAction(cbParam, 0, true);
g_screen.SetOff();
}
break;
case CEC_OPCODE_SET_MENU_LANGUAGE:
if (adapter->m_configuration.bUseTVMenuLanguage == 1 && command.initiator == CECDEVICE_TV && command.parameters.size == 3)
Expand Down Expand Up @@ -1156,16 +1160,13 @@ void CPeripheralCecAdapter::OnSettingChanged(const std::string &strChangedSettin
}
}

void CPeripheralCecAdapter::CecSourceActivated(void *cbParam, const CEC::cec_logical_address address, const uint8_t activated)

void CPeripheralCecAdapter::CecEventPostAction(void *cbParam, const uint8_t activated, bool wait)
{
CPeripheralCecAdapter *adapter = (CPeripheralCecAdapter *)cbParam;
if (!adapter)
return;

// wake up the screensaver, so the user doesn't switch to a black screen
if (activated == 1)
g_application.WakeUpScreenSaverAndDPMS();

if (adapter->GetSettingInt("pause_or_stop_playback_on_deactivate") != LOCALISED_ID_NONE)
{
bool bShowingSlideshow = (g_windowManager.GetActiveWindow() == WINDOW_SLIDESHOW);
Expand All @@ -1187,16 +1188,29 @@ void CPeripheralCecAdapter::CecSourceActivated(void *cbParam, const CEC::cec_log
pSlideShow->OnAction(CAction(ACTION_PAUSE));
else
// pause/resume player
CApplicationMessenger::GetInstance().SendMsg(TMSG_MEDIA_PAUSE);
CApplicationMessenger::GetInstance().SendMsg(TMSG_MEDIA_PAUSE, wait);
}
else if (adapter->GetSettingInt("pause_or_stop_playback_on_deactivate") == LOCALISED_ID_STOP)
{
if (pSlideShow)
pSlideShow->OnAction(CAction(ACTION_STOP));
else
CApplicationMessenger::GetInstance().SendMsg(TMSG_MEDIA_STOP);
CApplicationMessenger::GetInstance().SendMsg(TMSG_MEDIA_STOP, wait);
}
}
}

void CPeripheralCecAdapter::CecSourceActivated(void *cbParam, const CEC::cec_logical_address address, const uint8_t activated)
{
CPeripheralCecAdapter *adapter = (CPeripheralCecAdapter *)cbParam;
if (!adapter)
return;

// wake up the screensaver, so the user doesn't switch to a black screen
if (activated == 1)
g_application.WakeUpScreenSaverAndDPMS();

CecEventPostAction(cbParam, activated, true);

if (activated != 1)
g_screen.SetOff();
Expand Down Expand Up @@ -1303,7 +1317,7 @@ void CPeripheralCecAdapter::SetConfigurationFromLibCEC(const CEC::libcec_configu

bChanged |= SetSetting("standby_pc_on_tv_standby",
m_configuration.bPowerOffOnStandby == 1 ? 13011 :
m_configuration.bShutdownOnStandby == 1 ? 13005 : 36028);
m_configuration.bShutdownOnStandby == 1 ? 13005 : GetSettingInt("standby_pc_on_tv_standby"));

if (bChanged)
CLog::Log(LOGDEBUG, "SetConfigurationFromLibCEC - settings updated by libCEC");
Expand Down
2 changes: 2 additions & 0 deletions xbmc/peripherals/devices/PeripheralCecAdapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ namespace PERIPHERALS
bool GetAudioSystemConnected();
void SetMenuLanguage(const char *strLanguage);

static void CecEventPostAction(void *cbParam, const uint8_t activated, bool wait);

// callbacks from libCEC
static int CecLogMessage(void *cbParam, const CEC::cec_log_message message);
static int CecCommand(void *cbParam, const CEC::cec_command command);
Expand Down
2 changes: 2 additions & 0 deletions xbmc/utils/Screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ void CScreen::SetState(bool state, bool doBlank)
switch (state)
{
case true:
if (g_application.m_pPlayer->IsPlaying() && !g_application.m_pPlayer->IsPausedPlayback())
break;

g_VideoReferenceClock.Stop();
if (!g_application.IsInScreenSaver())
Expand Down

0 comments on commit 99bb819

Please sign in to comment.