Go to the documentation of this file.
8 #define LOC QString("PlayerCaptions: ")
12 m_captionsOverlay(MainWindow, Tv, nullptr, m_painter)
15 qRegisterMetaType<MythCaptionsState>();
63 LOG(VB_GENERAL, LOG_INFO,
LOC +
"Initialising captions");
91 auto newval = std::clamp(subs->GetZoom() + Delta, 50, 200);
96 subs->SetZoom(newval);
109 auto newval = std::clamp(subs->GetDelay() + (Delta * 10), -5000ms, 5000ms);
115 subs->SetDelay(newval);
162 if (UpdateOSD || newTextDesired)
187 msg += tr(
"Text subtitles");
191 if (!msg.isEmpty() && UpdateOSD)
193 msg +=
" " + tr(
"Off");
203 if (UpdateOSD || newTextDesired)
219 msg += tr(
"Text subtitles");
236 msg +=
" " + tr(
"On");
237 LOG(VB_PLAYBACK, LOG_INFO, QString(
"EnableCaptions(%1) msg: %2").arg(
Mode).arg(msg));
288 if (UpdateOSD || Enable)
305 LOG(VB_PLAYBACK, LOG_INFO,
"No captions available yet to enable.");
551 [[maybe_unused]]
bool& Handled)
567 [[maybe_unused]]
uint Cardid,
568 [[maybe_unused]]
bool IsLiveTV)
613 return fps > 0 ? fps : 25.0;
619 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"SetStream '%1'").arg(Stream));
644 auto maxpos = duration_cast<std::chrono::milliseconds>(maxsecs);
646 return maxpos > pos ? maxpos : pos;
651 auto frameNum =
static_cast<uint64_t
>((Position.count() *
SafeFPS()) / 1000);
652 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"SetStreamPos %1 mS = frame %2, now=%3")
uint NextCaptionTrack(uint Mode)
InteractiveTV * GetInteractiveTV() override
void PlayInteractiveStream(bool Play)
virtual void SetTrack(uint Type, uint TrackNo)
virtual bool SetVideoByComponentTag(int)
TVState GetState(void) const
bool m_enableForcedSubtitles
virtual int SetTrack(uint Type, int TrackNo)
QRecursiveMutex m_decoderChangeLock
void JumpToNext(bool up, std::chrono::seconds pos)
jump to the next (up == true) or previous (up == false) liveTV program If pos > 0: indicate the absol...
void SetEof(EofState eof)
void TextSubtitlesUpdated()
void EnableSubtitles(int Type, bool ForcedOnly=false)
void SetAllowForcedSubtitles(bool Allow)
SubtitleReader m_subReader
void HandleTeletextAction(const QString &Action, bool &Handled)
bool m_allowForcedSubtitles
void SetInteractiveStream(const QString &Stream)
std::chrono::seconds m_totalDuration
uint m_lastTextDisplayMode
SubtitleScreen * InitSubtitles()
static uint toTrackType(uint Type)
void AdjustSubtitleDelay(std::chrono::milliseconds Delta)
std::chrono::milliseconds GetStreamPos()
void SetTTPageNum(int page)
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
int ChangeTrack(uint Type, int Dir)
virtual bool SetAudioByComponentTag(int)
void EnableCaptions(uint Mode, bool UpdateOSD=true)
void ITVHandleAction(const QString &Action, bool &Handled)
Submit Action to the interactiveTV object.
void ChangeTrack(uint Type, int Direction)
void InitialiseState() override
void ToggleCaptionsByType(uint Type)
void AdjustSubtitleZoom(int Delta)
Acts as the interface between the UI and the underlying AudioPlayer object.
An action (for this plugin) consists of a description, and a set of key sequences.
bool OfferKey(const QString &key)
static uint toCaptionType(uint Type)
@ kState_WatchingRecording
Watching Recording is the state for when we are watching an in progress recording,...
void EnableTeletext(bool Enable, int Page)
void UpdateOSDMessage(const QString &Message)
virtual QString GetTrackDesc(uint Type, uint TrackNo)
virtual uint GetTrackCount(uint Type)
uint64_t GetFramesPlayed(void) const
void EnableSubtitles(bool Enable)
@ kDisplayNUVTeletextCaptions
StreamInfo GetTrackInfo(uint Type, uint TrackNo)
void InitialiseState() override
Initialise audio and signal initial state.
void LoadExternalSubtitles(const QString &subtitleFileName, bool isInProgress)
void AdjustSubtitleZoom(int Delta)
void ChangeAllowForcedSubtitles(bool Allow)
void ChangeOSDPositionUpdates(bool Enable)
bool SetAudioByComponentTag(int Tag)
Selects the audio stream using the DVB component tag.
uint m_lastValidTextDisplayMode
MythCaptionsOverlay m_captionsOverlay
MythMediaBuffer * m_buffer
@ kOSDFunctionalType_SubtitleDelayAdjust
bool TeletextAction(const QString &Action, bool &Exit)
void SetTeletextPage(uint Page)
void ITVRestart(uint Chanid, uint Cardid, bool IsLiveTV)
Restart the MHEG/MHP engine.
@ kTrackTypeTeletextCaptions
void HandleITVAction(const QString &Action, bool &Handled)
void RestartITV(uint Chanid, uint Cardid, bool IsLiveTV)
QStringList GetTracks(uint Type)
int m_ttPageNum
VBI page to display when in PAL vbimode.
void SetCaptionsEnabled(bool Enable, bool UpdateOSD=true)
PlayerContext * m_playerCtx
virtual double GetFPS(void) const
void SetTeletextPage(uint Page)
Set Teletext NUV Caption page.
void SetStreamPos(std::chrono::milliseconds Position)
void SetCaptionsEnabled(bool Enable, bool UpdateOSD=true)
@ kDisplayRawTextSubtitle
bool m_disableForcedSubtitles
void RequestResetCaptions()
void EnableTeletext(int Page=0x100)
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
@ kDisplayAllTextCaptions
uint m_vbiMode
VBI decoder to use.
@ kOSDFunctionalType_SubtitleZoomAdjust
virtual void DisableCaptions(uint Mode, bool UpdateOSD=true)
void AdjustSubtitleDelay(std::chrono::milliseconds Delta)
void SetTrack(uint Type, uint TrackNo)
bool GetBoolSetting(const QString &key, bool defaultval=false)
void DoEnableForcedSubtitles()
std::chrono::milliseconds GetStreamMaxPos()
virtual void EnableCaptions(uint Mode, bool UpdateOSD=true)
~MythPlayerCaptionsUI() override
void SetCurrentService(int service)
void ToggleCaptionsByType(uint Type)
void ExternalSubtitlesUpdated()
void EnableTeletext(int Page=0x100)
void LoadExternalSubtitles()
QRecursiveMutex m_osdLock
void SetStream(const QString &Stream)
bool OptionalCaptionEnabled(uint Captions)
Return whether any optional captions are enabled.
void SetInteractiveStreamPos(std::chrono::milliseconds Position)
void StreamPlay(bool Playing=true)
InteractiveTV * m_interactiveTV
void DoDisableForcedSubtitles()
bool HasTextSubtitles(void)
std::chrono::seconds m_totalLength
@ kState_WatchingLiveTV
Watching LiveTV is the state for when we are watching a recording and the user has control over the c...
void DisableCaptions(uint Mode, bool UpdateOSD=true)
void UpdateOSDStatus(osdInfo &Info, int Type, enum OSDTimeout Timeout)
void ChangeCaptionTrack(int Direction)
void CaptionsStateChanged(MythCaptionsState &CaptionsState)
bool FlagIsSet(PlayerFlags arg)
bool SetVideoByComponentTag(int Tag)
Selects the video stream using the DVB component tag.
void CaptionsStateChanged(MythCaptionsState CaptionsState)
virtual bool JumpToFrame(uint64_t frame)
MythPlayerCaptionsUI(MythMainWindow *MainWindow, TV *Tv, PlayerContext *Context, PlayerFlags Flags)
MythCaptionsState m_captionsState
void SignalTracksChanged(uint Type)
void TracksChanged(uint TrackType)
This tries to re-enable captions/subtitles if the user wants them and one of the captions/subtitles t...
uint GetTrackCount(uint Type)
This is the interface between an MHEG engine and a MythTV TV object.
virtual QStringList GetTracks(uint Type)
bool HasCaptionTrack(uint Mode)
void Restart(int chanid, int sourceid, bool isLive)
bool Play(float speed=1.0, bool normal=true, bool unpauseaudio=true)
virtual int GetTrackLanguageIndex(uint Type, uint TrackNo)
void ChangeTrack(uint Type, int Direction)
std::enable_if_t< std::is_floating_point_v< T >, std::chrono::milliseconds > millisecondsFromFloat(T value)
Helper function for convert a floating point number to a duration.
void ChangeCaptionTrack(int Direction)
void DisableForcedSubtitles()
void HandleTeletextAction(const QString &Action, bool &Handled)
@ kDisplayTeletextCaptions