Permalink
Browse files

Subtitles: Try to reenable the previously selected caption type.

During DVD playback with AVSubs enabled, once in a while the decoder
disables and reenables subtitles.  If the DVD also contains cc608
captions, the caption priority order would favor cc608 and the user
would need to reselect AVSubs every time this happens.  To fix this,
we keep track of the previously selected caption type and default to
that if possible when captions are turned on.  This is in addition to
the existing code that tries to reselect the previous AVSubs track
when AVSubs are enabled.
  • Loading branch information...
1 parent 20a5628 commit d3b4762de093c25ff9c7ea73c7f8492318aa1190 @stichnot stichnot committed Mar 15, 2012
Showing with 29 additions and 12 deletions.
  1. +1 −1 mythtv/libs/libmythbase/mythversion.h
  2. +26 −11 mythtv/libs/libmythtv/mythplayer.cpp
  3. +2 −0 mythtv/libs/libmythtv/mythplayer.h
@@ -12,7 +12,7 @@
/// Update this whenever the plug-in API changes.
/// Including changes in the libmythbase, libmyth, libmythtv, libmythav* and
/// libmythui class methods used by plug-ins.
-#define MYTH_BINARY_VERSION "0.25.20120314-3"
+#define MYTH_BINARY_VERSION "0.25.20120315-1"
/** \brief Increment this whenever the MythTV network protocol changes.
*
@@ -165,6 +165,7 @@ MythPlayer::MythPlayer(PlayerFlags flags)
// General Caption/Teletext/Subtitle support
textDisplayMode(kDisplayNone),
prevTextDisplayMode(kDisplayNone),
+ prevNonzeroTextDisplayMode(kDisplayNone),
// Support for analog captions and teletext
vbimode(VBIMode::None),
ttPageNum(0x888),
@@ -1317,6 +1318,8 @@ void MythPlayer::ResetCaptions(void)
void MythPlayer::DisableCaptions(uint mode, bool osd_msg)
{
+ if (textDisplayMode)
+ prevNonzeroTextDisplayMode = textDisplayMode;
textDisplayMode &= ~mode;
ResetCaptions();
@@ -1394,6 +1397,8 @@ void MythPlayer::EnableCaptions(uint mode, bool osd_msg)
.arg(mode).arg(msg));
textDisplayMode = mode;
+ if (textDisplayMode)
+ prevNonzeroTextDisplayMode = textDisplayMode;
if (osd_msg)
SetOSDMessage(msg, kOSDTimeout_Med);
}
@@ -1432,7 +1437,8 @@ void MythPlayer::SetCaptionsEnabled(bool enable, bool osd_msg)
DisableCaptions(origMode, osd_msg);
return;
}
- int mode = NextCaptionTrack(kDisplayNone);
+ int mode = HasCaptionTrack(prevNonzeroTextDisplayMode) ?
+ prevNonzeroTextDisplayMode : NextCaptionTrack(kDisplayNone);
if (origMode != (uint)mode)
{
DisableCaptions(origMode, false);
@@ -1642,6 +1648,23 @@ void MythPlayer::ChangeCaptionTrack(int dir)
}
}
+bool MythPlayer::HasCaptionTrack(int mode)
+{
+ if (mode == kDisplayNone)
+ return false;
+ if (((mode == kDisplayTextSubtitle) && HasTextSubtitles()) ||
+ (mode == kDisplayNUVTeletextCaptions))
+ {
+ return true;
+ }
+ else if (!(mode == kDisplayTextSubtitle) &&
+ decoder->GetTrackCount(toTrackType(mode)))
+ {
+ return true;
+ }
+ return false;
+}
+
int MythPlayer::NextCaptionTrack(int mode)
{
// Text->TextStream->708/608->608/708->AVSubs->Teletext->NUV->None
@@ -1666,17 +1689,9 @@ int MythPlayer::NextCaptionTrack(int mode)
else if (kDisplayNone == mode)
nextmode = kDisplayTextSubtitle;
- if (((nextmode == kDisplayTextSubtitle) && HasTextSubtitles()) ||
- (nextmode == kDisplayNUVTeletextCaptions) ||
- (nextmode == kDisplayNone))
- {
- return nextmode;
- }
- else if (!(nextmode == kDisplayTextSubtitle) &&
- decoder->GetTrackCount(toTrackType(nextmode)))
- {
+ if (nextmode == kDisplayNone || HasCaptionTrack(nextmode))
return nextmode;
- }
+
return NextCaptionTrack(nextmode);
}
@@ -478,6 +478,7 @@ class MTV_PUBLIC MythPlayer
int GetTrack(uint type);
int ChangeTrack(uint type, int dir);
void ChangeCaptionTrack(int dir);
+ bool HasCaptionTrack(int mode);
int NextCaptionTrack(int mode);
void DoDisableForcedSubtitles(void);
void DoEnableForcedSubtitles(void);
@@ -674,6 +675,7 @@ class MTV_PUBLIC MythPlayer
// General Caption/Teletext/Subtitle support
uint textDisplayMode;
uint prevTextDisplayMode;
+ uint prevNonzeroTextDisplayMode;
// Support for analog captions and teletext
// (i.e. Vertical Blanking Interval (VBI) encoded data.)

0 comments on commit d3b4762

Please sign in to comment.