Skip to content
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
3 changes: 2 additions & 1 deletion mythtv/libs/libmythtv/mythplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ MythPlayer::MythPlayer(PlayerContext* Context, PlayerFlags Flags)
m_deleteMap.SetPlayerContext(m_playerCtx);

m_vbiMode = VBIMode::Parse(gCoreContext->GetSetting("VbiFormat"));
m_captionsEnabledbyDefault = gCoreContext->GetBoolSetting("DefaultCCMode");
m_captionsEnabledbyDefault = gCoreContext->GetNumSetting("DefaultCCMode");
m_lastCaptionsEnabled = gCoreContext->GetBoolSetting("LastCaptions", false);
m_endExitPrompt = gCoreContext->GetNumSetting("EndOfRecordingExitPrompt");

// Get VBI page number
Expand Down
3 changes: 2 additions & 1 deletion mythtv/libs/libmythtv/mythplayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,8 @@ class MTV_PUBLIC MythPlayer : public QObject
TeletextReader m_ttxReader;
/// This allows us to enable captions/subtitles later if the streams
/// are not immediately available when the video starts playing.
bool m_captionsEnabledbyDefault {false};
uint m_captionsEnabledbyDefault {0}; // 0=off, 1=on, 2=last
bool m_lastCaptionsEnabled {false};
bool m_enableForcedSubtitles {false};
bool m_disableForcedSubtitles {false};
bool m_allowForcedSubtitles {true};
Expand Down
4 changes: 3 additions & 1 deletion mythtv/libs/libmythtv/mythplayercaptionsui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,9 @@ void MythPlayerCaptionsUI::SetAllowForcedSubtitles(bool Allow)

void MythPlayerCaptionsUI::ToggleCaptions()
{
SetCaptionsEnabled(!(static_cast<bool>(m_captionsState.m_textDisplayMode)));
bool togval = !(static_cast<bool>(m_captionsState.m_textDisplayMode));
SetCaptionsEnabled(togval);
gCoreContext->SaveSetting("LastCaptions", togval);
}

void MythPlayerCaptionsUI::ToggleCaptionsByType(uint Type)
Expand Down
15 changes: 14 additions & 1 deletion mythtv/libs/libmythtv/mythplayerui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,20 @@ void MythPlayerUI::VideoStart()
if (hasForcedTextTrack)
SetTrack(kTrackTypeRawText, forcedTrackNumber);
else
SetCaptionsEnabled(m_captionsEnabledbyDefault, false);
{
switch (m_captionsEnabledbyDefault)
{
case 0: // Captions off
SetCaptionsEnabled(false, false);
break;
case 1: // Captions on
SetCaptionsEnabled(true, false);
break;
default: // Last captions state
SetCaptionsEnabled(m_lastCaptionsEnabled, false);
break;
}
}

m_osdLock.unlock();

Expand Down
10 changes: 6 additions & 4 deletions mythtv/programs/mythfrontend/globalsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1673,14 +1673,16 @@ static HostSpinBoxSetting *YScanDisplacement()
return gs;
};

static HostCheckBoxSetting *DefaultCCMode()
static HostComboBoxSetting *DefaultCCMode()
{
auto *gc = new HostCheckBoxSetting("DefaultCCMode");
auto *gc = new HostComboBoxSetting("DefaultCCMode");

gc->setLabel(OSDSettings::tr("Always display closed captioning or "
gc->setLabel(OSDSettings::tr("Default to display closed captioning or "
"subtitles"));

gc->setValue(false);
gc->addSelection(OSDSettings::tr("Captions off"), "0");
gc->addSelection(OSDSettings::tr("Captions on"), "1");
gc->addSelection(OSDSettings::tr("Last captions state"), "2");

gc->setHelpText(OSDSettings::tr("If enabled, captions will be displayed "
"when playing back recordings or watching "
Expand Down
Loading