11#define LOC QString("PlayerCaptions: ")
15 m_captionsOverlay(MainWindow, Tv, nullptr, m_painter)
18 qRegisterMetaType<MythCaptionsState>();
65 LOG(VB_GENERAL, LOG_INFO,
LOC +
"Initialising captions");
93 auto newval =
std::clamp(subs->GetZoom() + Delta, 50, 200);
98 subs->SetZoom(newval);
111 auto newval =
std::clamp(subs->GetDelay() + (Delta * 10), -5000ms, 5000ms);
117 subs->SetDelay(newval);
164 if (UpdateOSD || newTextDesired)
189 msg += tr(
"Text subtitles");
193 if (!msg.isEmpty() && UpdateOSD)
195 msg +=
" " + tr(
"Off");
205 if (UpdateOSD || newTextDesired)
223 msg += tr(
"Text subtitles");
240 msg +=
" " + tr(
"On");
241 LOG(VB_PLAYBACK, LOG_INFO, QString(
"EnableCaptions(%1) msg: %2").arg(
Mode).arg(msg));
292 if (UpdateOSD || Enable)
309 LOG(VB_PLAYBACK, LOG_INFO,
"No captions available yet to enable.");
554 [[maybe_unused]]
bool& Handled)
570 [[maybe_unused]]
uint Cardid,
571 [[maybe_unused]]
bool IsLiveTV)
578 m_interactiveTV->Restart(
static_cast<int>(Chanid),
static_cast<int>(Cardid), IsLiveTV);
616 return fps > 0 ? fps : 25.0;
622 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"SetStream '%1'").arg(Stream));
647 auto maxpos = duration_cast<std::chrono::milliseconds>(maxsecs);
649 return maxpos > pos ? maxpos : pos;
654 auto frameNum =
static_cast<uint64_t
>((Position.count() *
SafeFPS()) / 1000);
655 LOG(VB_PLAYBACK, LOG_INFO,
LOC + QString(
"SetStreamPos %1 mS = frame %2, now=%3")
An action (for this plugin) consists of a description, and a set of key sequences.
void SetTTPageNum(int page)
void SetCurrentService(int service)
virtual uint GetTrackCount(uint Type)
int ChangeTrack(uint Type, int Dir)
virtual QString GetTrackDesc(uint Type, uint TrackNo)
virtual int SetTrack(uint Type, int TrackNo)
virtual bool SetAudioByComponentTag(int)
virtual bool SetVideoByComponentTag(int)
virtual QStringList GetTracks(uint Type)
StreamInfo GetTrackInfo(uint Type, uint TrackNo)
virtual int GetTrackLanguageIndex(uint Type, uint TrackNo)
virtual double GetFPS(void) const
This is the interface between an MHEG engine and a MythTV TV object.
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 EnableSubtitles(int Type, bool ForcedOnly=false)
void EnableTeletext(bool Enable, int Page)
bool TeletextAction(const QString &Action, bool &Exit)
SubtitleScreen * InitSubtitles()
void DisableForcedSubtitles()
bool GetBoolSetting(const QString &key, bool defaultval=false)
Acts as the interface between the UI and the underlying AudioPlayer object.
void InitialiseState() override
Initialise audio and signal initial state.
std::chrono::milliseconds GetStreamMaxPos()
virtual void SetTrack(uint Type, uint TrackNo)
void ExternalSubtitlesUpdated()
void StreamPlay(bool Playing=true)
void SetInteractiveStreamPos(std::chrono::milliseconds Position)
InteractiveTV * GetInteractiveTV() override
void DoEnableForcedSubtitles()
void LoadExternalSubtitles()
void CaptionsStateChanged(MythCaptionsState &CaptionsState)
void SetCaptionsEnabled(bool Enable, bool UpdateOSD=true)
void ToggleCaptionsByType(uint Type)
void AdjustSubtitleDelay(std::chrono::milliseconds Delta)
void InitialiseState() override
void ITVRestart(uint Chanid, uint Cardid, bool IsLiveTV)
Restart the MHEG/MHP engine.
void EnableTeletext(int Page=0x100)
void PlayInteractiveStream(bool Play)
void ChangeTrack(uint Type, int Direction)
void SetStream(const QString &Stream)
void SetStreamPos(std::chrono::milliseconds Position)
QStringList GetTracks(uint Type)
uint GetTrackCount(uint Type)
void ChangeCaptionTrack(int Direction)
MythCaptionsOverlay m_captionsOverlay
uint m_lastValidTextDisplayMode
void SetTeletextPage(uint Page)
Set Teletext NUV Caption page.
MythCaptionsState m_captionsState
std::chrono::milliseconds GetStreamPos()
void tracksChanged(uint TrackType) override
This tries to re-enable captions/subtitles if the user wants them and one of the captions/subtitles t...
void AdjustSubtitleZoom(int Delta)
void EnableSubtitles(bool Enable)
bool SetVideoByComponentTag(int Tag)
Selects the video stream using the DVB component tag.
MythPlayerCaptionsUI(MythMainWindow *MainWindow, TV *Tv, PlayerContext *Context, PlayerFlags Flags)
void SetInteractiveStream(const QString &Stream)
void ITVHandleAction(const QString &Action, bool &Handled)
Submit Action to the interactiveTV object.
InteractiveTV * m_interactiveTV
void DoDisableForcedSubtitles()
virtual void DisableCaptions(uint Mode, bool UpdateOSD=true)
virtual void EnableCaptions(uint Mode, bool UpdateOSD=true)
void HandleTeletextAction(const QString &Action, bool &Handled)
~MythPlayerCaptionsUI() override
uint NextCaptionTrack(uint Mode)
void SetAllowForcedSubtitles(bool Allow)
uint m_lastTextDisplayMode
bool SetAudioByComponentTag(int Tag)
Selects the audio stream using the DVB component tag.
bool HasCaptionTrack(uint Mode)
void ChangeOSDPositionUpdates(bool Enable)
void UpdateOSDMessage(const QString &Message)
void UpdateOSDStatus(osdInfo &Info, int Type, OSDTimeout Timeout)
QRecursiveMutex m_osdLock
void SetEof(EofState eof)
bool FlagIsSet(PlayerFlags arg)
bool m_disableForcedSubtitles
virtual bool JumpToFrame(uint64_t frame)
QRecursiveMutex m_decoderChangeLock
bool m_allowForcedSubtitles
std::chrono::seconds m_totalDuration
uint64_t GetFramesPlayed(void) const
void RequestResetCaptions()
bool m_enableForcedSubtitles
int m_ttPageNum
VBI page to display when in PAL vbimode.
SubtitleReader m_subReader
bool Play(float speed=1.0, bool normal=true, bool unpauseaudio=true)
uint m_vbiMode
VBI decoder to use.
PlayerContext * m_playerCtx
std::chrono::seconds m_totalLength
TVState GetState(void) const
MythMediaBuffer * m_buffer
void TextSubtitlesUpdated()
AVSubtitles * GetAVSubtitles(void)
void LoadExternalSubtitles(const QString &subtitleFileName, bool isInProgress)
bool HasTextSubtitles(void)
void SetCaptionsEnabled(bool Enable, bool UpdateOSD=true)
void EnableCaptions(uint Mode, bool UpdateOSD=true)
void ChangeCaptionTrack(int Direction)
void DisableCaptions(uint Mode, bool UpdateOSD=true)
void CaptionsStateChanged(MythCaptionsState CaptionsState)
void AdjustSubtitleDelay(std::chrono::milliseconds Delta)
void AdjustSubtitleZoom(int Delta)
void ChangeTrack(uint Type, int Direction)
void SetTeletextPage(uint Page)
void HandleTeletextAction(const QString &Action, bool &Handled)
void RestartITV(uint Chanid, uint Cardid, bool IsLiveTV)
void HandleITVAction(const QString &Action, bool &Handled)
void EnableTeletext(int Page=0x100)
void ToggleCaptionsByType(uint Type)
void ChangeAllowForcedSubtitles(bool Allow)
void SetTrack(uint Type, uint TrackNo)
@ kTrackTypeTeletextCaptions
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.
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
static uint toCaptionType(uint Type)
static uint toTrackType(uint Type)
@ kOSDFunctionalType_SubtitleZoomAdjust
@ kOSDFunctionalType_SubtitleDelayAdjust
static eu8 clamp(eu8 value, eu8 low, eu8 high)
@ kState_WatchingLiveTV
Watching LiveTV is the state for when we are watching a recording and the user has control over the c...
@ kState_WatchingRecording
Watching Recording is the state for when we are watching an in progress recording,...
@ kDisplayRawTextSubtitle
@ kDisplayAllTextCaptions
@ kDisplayNUVTeletextCaptions
@ kDisplayTeletextCaptions
bool OptionalCaptionEnabled(uint Captions)
Return whether any optional captions are enabled.