@@ -167,7 +167,8 @@ MythPlayer::MythPlayer(bool muted)
167167 ttPageNum(0x888 ),
168168 // Support for captions, teletext, etc. decoded by libav
169169 textDesired(false ), enableCaptions(false ), disableCaptions(false ),
170- enableForcedSubtitles(false ), allowForcedSubtitles(true ),
170+ enableForcedSubtitles(false ), disableForcedSubtitles(false ),
171+ allowForcedSubtitles(true ),
171172 // CC608/708
172173 db_prefer708(true ), cc608(this ), cc708(this ),
173174 // MHEG/MHI Interactive TV visible in OSD
@@ -227,6 +228,7 @@ MythPlayer::MythPlayer(bool muted)
227228 endExitPrompt = gCoreContext ->GetNumSetting (" EndOfRecordingExitPrompt" );
228229 pip_default_loc = (PIPLocation)gCoreContext ->GetNumSetting (" PIPLocation" , kPIPTopLeft );
229230 tc_wrap[TC_AUDIO] = gCoreContext ->GetNumSetting (" AudioSyncOffset" , 0 );
231+ allowForcedSubtitles = gCoreContext ->GetNumSetting (" AllowForcedSubtitles" , 1 );
230232
231233 // Get VBI page number
232234 QString mypage = gCoreContext ->GetSetting (" VBIpageNr" , " 888" );
@@ -1537,6 +1539,38 @@ void MythPlayer::EnableSubtitles(bool enable)
15371539 disableCaptions = true ;
15381540}
15391541
1542+ void MythPlayer::EnableForcedSubtitles (bool enable)
1543+ {
1544+ if (enable)
1545+ enableForcedSubtitles = true ;
1546+ else
1547+ disableForcedSubtitles = true ;
1548+ }
1549+
1550+ void MythPlayer::SetAllowForcedSubtitles (bool allow)
1551+ {
1552+ bool old = allowForcedSubtitles;
1553+ allowForcedSubtitles = allow;
1554+ SetOSDMessage (allowForcedSubtitles ?
1555+ QObject::tr (" Forced Subtitles On" ) :
1556+ QObject::tr (" Forced Subtitles Off" ),
1557+ kOSDTimeout_Med );
1558+ if (old != allowForcedSubtitles)
1559+ {
1560+ gCoreContext ->SaveSetting (" AllowForcedSubtitles" ,
1561+ allowForcedSubtitles);
1562+ }
1563+ }
1564+
1565+ void MythPlayer::DoDisableForcedSubtitles (void )
1566+ {
1567+ disableForcedSubtitles = false ;
1568+ osdLock.lock ();
1569+ if (osd)
1570+ osd->DisableForcedSubtitles ();
1571+ osdLock.unlock ();
1572+ }
1573+
15401574void MythPlayer::DoEnableForcedSubtitles (void )
15411575{
15421576 enableForcedSubtitles = false ;
@@ -1545,7 +1579,7 @@ void MythPlayer::DoEnableForcedSubtitles(void)
15451579
15461580 osdLock.lock ();
15471581 if (osd)
1548- osd->InitSubtitles ( );
1582+ osd->EnableSubtitles ( kDisplayAVSubtitle , true /* forced only */ );
15491583 osdLock.unlock ();
15501584}
15511585
@@ -2616,9 +2650,11 @@ void MythPlayer::EventLoop(void)
26162650 if (disableCaptions)
26172651 SetCaptionsEnabled (false , false );
26182652
2619- // enable forced subtitles if signalled by the decoder
2653+ // enable/disable forced subtitles if signalled by the decoder
26202654 if (enableForcedSubtitles)
26212655 DoEnableForcedSubtitles ();
2656+ if (disableForcedSubtitles)
2657+ DoDisableForcedSubtitles ();
26222658
26232659 // reset the scan (and hence deinterlacers) if triggered by the decoder
26242660 if (resetScan != kScan_Ignore )
0 commit comments