Go to the documentation of this file.
8 #define LOC QString("PlayerCaptions: ")
12 m_captionsOverlay(MainWindow, Tv, nullptr, m_painter)
15 qRegisterMetaType<MythCaptionsState>();
62 LOG(VB_GENERAL, LOG_INFO,
LOC +
"Initialising captions");
90 auto newval =
std::clamp(subs->GetZoom() + Delta, 50, 200);
95 subs->SetZoom(newval);
108 auto newval =
std::clamp(subs->GetDelay() + (Delta * 10), -5000ms, 5000ms);
114 subs->SetDelay(newval);
161 if (UpdateOSD || newTextDesired)
186 msg += tr(
"Text subtitles");
190 if (!msg.isEmpty() && UpdateOSD)
192 msg +=
" " + tr(
"Off");
202 if (UpdateOSD || newTextDesired)
220 msg += tr(
"Text subtitles");
237 msg +=
" " + tr(
"On");
238 LOG(VB_PLAYBACK, LOG_INFO, QString(
"EnableCaptions(%1) msg: %2").arg(
Mode).arg(msg));
289 if (UpdateOSD || Enable)
306 LOG(VB_PLAYBACK, LOG_INFO,
"No captions available yet to enable.");
552 [[maybe_unused]]
bool& Handled)
568 [[maybe_unused]]
uint Cardid,
569 [[maybe_unused]]
bool IsLiveTV)
614 return fps > 0 ? fps : 25.0;
620 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"SetStream '%1'").arg(Stream));
645 auto maxpos = duration_cast<std::chrono::milliseconds>(maxsecs);
647 return maxpos > pos ? maxpos : pos;
652 auto frameNum =
static_cast<uint64_t
>((Position.count() *
SafeFPS()) / 1000);
653 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
@ kDisplayNUVTeletextCaptions
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)
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)
@ kDisplayRawTextSubtitle
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)
void tracksChanged(uint TrackType) override
This tries to re-enable captions/subtitles if the user wants them and one of the captions/subtitles t...
bool SetAudioByComponentTag(int Tag)
Selects the audio stream using the DVB component tag.
uint m_lastValidTextDisplayMode
MythCaptionsOverlay m_captionsOverlay
MythMediaBuffer * m_buffer
bool TeletextAction(const QString &Action, bool &Exit)
void SetTeletextPage(uint Page)
void ITVRestart(uint Chanid, uint Cardid, bool IsLiveTV)
Restart the MHEG/MHP engine.
void HandleITVAction(const QString &Action, bool &Handled)
@ kOSDFunctionalType_SubtitleZoomAdjust
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
@ kState_WatchingLiveTV
Watching LiveTV is the state for when we are watching a recording and the user has control over the c...
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)
bool m_disableForcedSubtitles
void RequestResetCaptions()
void EnableTeletext(int Page=0x100)
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
static eu8 clamp(eu8 value, eu8 low, eu8 high)
@ kOSDFunctionalType_SubtitleDelayAdjust
uint m_vbiMode
VBI decoder to use.
virtual void DisableCaptions(uint Mode, bool UpdateOSD=true)
void AdjustSubtitleDelay(std::chrono::milliseconds Delta)
@ kState_WatchingRecording
Watching Recording is the state for when we are watching an in progress recording,...
void SetTrack(uint Type, uint TrackNo)
AVSubtitles * GetAVSubtitles(void)
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)
@ kDisplayAllTextCaptions
void StreamPlay(bool Playing=true)
InteractiveTV * m_interactiveTV
void DoDisableForcedSubtitles()
@ kTrackTypeTeletextCaptions
bool HasTextSubtitles(void)
std::chrono::seconds m_totalLength
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
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)
@ kDisplayTeletextCaptions
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)