MythTV  master
tv_play.h
Go to the documentation of this file.
1 // -*- Mode: c++ -*-
2 
3 #ifndef TVPLAY_H
4 #define TVPLAY_H
5 
6 // C++
7 #include <cstdint>
8 #include <utility>
9 #include <vector>
10 
11 // Qt
12 #include <QReadWriteLock>
13 #include <QWaitCondition>
14 #include <QStringList>
15 #include <QDateTime>
16 #include <QObject>
17 #include <QString>
18 #include <QMutex>
19 #include <QMap>
20 #if QT_VERSION >= QT_VERSION_CHECK(5,14,0)
21 #include <QRecursiveMutex>
22 #endif
23 #include <QVector>
24 
25 // MythTV
27 #include "libmythbase/mythdeque.h"
28 #include "libmythbase/mythtimer.h"
30 
31 #include "channelgroup.h"
32 #include "channelinfo.h"
33 #include "decoders/decoderbase.h"
34 #include "inputinfo.h"
35 #include "mythtvmenu.h"
36 #include "osd.h"
37 #include "playercontext.h"
38 #include "tv.h"
39 #include "tvbrowsehelper.h"
40 #include "tvplaybackstate.h"
41 #include "videoouttypes.h"
42 
43 class QEvent;
44 class QKeyEvent;
45 class QTimerEvent;
46 class QDateTime;
47 class QDomDocument;
48 class QDomNode;
49 class OSD;
50 class RemoteEncoder;
51 class MythPlayer;
52 class MythPlayerUI;
53 class MythMediaBuffer;
54 class ProgramInfo;
55 class TvPlayWindow;
56 class TV;
57 class MythMainWindow;
58 struct osdInfo;
59 
60 using EMBEDRETURNVOID = void (*) (void *, bool);
61 using EMBEDRETURNVOIDEPG = void (*) (uint, const QString &, const QDateTime, TV *, bool, bool, int);
62 using EMBEDRETURNVOIDFINDER = void (*) (TV *, bool, bool);
63 using EMBEDRETURNVOIDSCHEDIT = void (*) (const ProgramInfo *, void *);
64 
65 // Locking order
66 //
67 // playerLock -> askAllowLock -> osdLock
68 // -> progListLock -> osdLock
69 // -> chanEditMapLock -> osdLock
70 // -> lastProgramLock
71 // -> recorderPlaybackInfoLock
72 // -> timerIdLock
73 // -> mainLoopCondLock
74 // -> channelGroupLock
75 //
76 // When holding one of these locks, you may lock any lock of the locks to
77 // the right of the current lock, but may not lock any lock to the left of
78 // this lock (which will cause a deadlock). Nor should you lock any other
79 // lock in the TV class without first adding it to the locking order list
80 // above.
81 //
82 // Note: Taking a middle lock such as askAllowLock, without taking a
83 // playerLock first does not violate these rules, but once you are
84 // holding it, you cannot later lock playerLock.
85 //
86 // It goes without saying that any locks outside of this class should only
87 // be taken one at a time, and should be taken last and released first of
88 // all the locks required for any algorithm. (Unless you use tryLock and
89 // release all locks if it can't gather them all at once, see the
90 // "multi_lock()" function as an example; but this is not efficient nor
91 // desirable and should be avoided when possible.)
92 //
93 
100 };
101 
106 {
109  kNoTuners = 2,
110 };
111 
112 enum {
119 };
120 
122 {
123  public:
124  AskProgramInfo() = default;
125  AskProgramInfo(QDateTime e, bool r, bool l, ProgramInfo *i) :
126  m_expiry(std::move(e)), m_hasRec(r), m_hasLater(l), m_info(i) {}
127 
128  QDateTime m_expiry;
129  bool m_hasRec {false};
130  bool m_hasLater {false};
131  bool m_isInSameInputGroup {false};
132  bool m_isConflicting {false};
133  ProgramInfo *m_info {nullptr};
134 };
135 
155 {
156  friend class PlaybackBox;
157  friend class GuideGrid;
158  friend class TVBrowseHelper;
159 
160  Q_OBJECT
161 
162  public:
163  static bool IsTVRunning();
164  static bool StartTV(ProgramInfo* TVRec, uint Flags, const ChannelInfoList& Selection = ChannelInfoList());
165  static bool IsPaused();
166  static void InitKeys();
167  static void SetFuncPtr(const char* Name, void* Pointer);
168  static int ConfiguredTunerCards();
169  static bool IsTunable(uint ChanId);
170  void ReloadKeys();
171 
172  bool IsSameProgram(const ProgramInfo* ProgInfo) const;
173 
174  public slots:
175  bool event(QEvent* Event) override;
176  bool eventFilter(QObject* Object, QEvent* Event) override;
177  void timerEvent(QTimerEvent* Event) override;
178  void StopPlayback();
179  void HandleOSDClosed(int OSDType);
180 
181  signals:
182  void PlaybackExiting(TV* Player);
183 
184  protected slots:
185  void onApplicationStateChange(Qt::ApplicationState State);
186  void customEvent(QEvent* Event) override;
187  void VolumeChange(bool Up, int NewVolume = -1);
188 
189  private slots:
190  void Embed(bool Embed, QRect Rect = {}, const QStringList& Data = {});
191 
192  private:
193  static inline QStringList lastProgramStringList = {};
194  static inline EMBEDRETURNVOID RunPlaybackBoxPtr = nullptr;
195  static inline EMBEDRETURNVOID RunViewScheduledPtr = nullptr;
196  static inline EMBEDRETURNVOIDEPG RunProgramGuidePtr = nullptr;
197  static inline EMBEDRETURNVOIDFINDER RunProgramFinderPtr = nullptr;
198  static inline EMBEDRETURNVOIDSCHEDIT RunScheduleEditorPtr = nullptr;
199 
200  explicit TV(MythMainWindow* MainWindow);
201  ~TV() override;
202  PlayerContext* GetPlayerContext();
203  bool CreatePlayer(TVState State, bool Muted = false);
204  bool StartPlaying(std::chrono::milliseconds MaxWait = -1ms);
205 
206  // Private initialisation
207  static TV* AcquireRelease(int& RefCount, bool Acquire, bool Create = false);
208  bool Init();
209  void InitFromDB();
210  static QList<QKeyEvent*> ConvertScreenPressKeyMap(const QString& KeyList);
211 
212  // Top level playback methods
213  bool LiveTV(bool ShowDialogs, const ChannelInfoList &Selection);
214  int Playback(const ProgramInfo &ProgInfo);
215  void PlaybackLoop();
216 
217  // Private event handling
218  bool ProcessKeypressOrGesture(QEvent* Event);
219  bool TranslateKeyPressOrGesture(const QString& Context, QEvent* Event,
220  QStringList& Actions, bool IsLiveTV,
221  bool AllowJumps = true);
222  bool TranslateGesture(const QString &Context, MythGestureEvent *Event,
223  QStringList& Actions, bool IsLiveTV);
224  void ProcessNetworkControlCommand(const QString& Command);
225 
226  bool HandleTrackAction(const QString& Action);
227  bool ActiveHandleAction(const QStringList& Actions, bool IsDVD, bool IsDVDStillFrame);
228  bool BrowseHandleAction(const QStringList& Actions);
229  void OSDDialogEvent(int Result, const QString& Text, QString Action);
230  bool ToggleHandleAction(const QStringList& Actions, bool IsDVD);
231  bool FFRewHandleAction(const QStringList& Actions);
232  bool ActivePostQHandleAction(const QStringList& Actions);
233  bool HandleJumpToProgramAction(const QStringList& Actions);
234  bool SeekHandleAction(const QStringList& Actions, bool IsDVD);
235  bool TimeStretchHandleAction(const QStringList& Actions);
236  bool DiscMenuHandleAction(const QStringList& Actions) const;
237 
238  // Timers and timer events
239  int StartTimer(std::chrono::milliseconds Interval, int Line);
240  void KillTimer(int Id);
241 
242  void SetSpeedChangeTimer(std::chrono::milliseconds When, int Line);
243  void HandleEndOfPlaybackTimerEvent();
244  void HandleEndOfRecordingExitPromptTimerEvent();
245  void HandleVideoExitDialogTimerEvent();
246  void HandlePseudoLiveTVTimerEvent();
247  void HandleSpeedChangeTimerEvent();
248  void ToggleSleepTimer();
249  void ToggleSleepTimer(const QString& Time);
250  bool HandleLCDTimerEvent();
251  void HandleLCDVolumeTimerEvent();
252  void HandleSaveLastPlayPosEvent();
253 
254  // Commands used by frontend UI screens (PlaybackBox, GuideGrid etc)
255  void EditSchedule(int EditType = kScheduleProgramGuide);
256  bool IsTunablePriv(uint ChanId);
257  static QVector<uint> IsTunableOn(PlayerContext* Context, uint ChanId);
258  void ChangeChannel(const ChannelInfoList& Options);
259  void DoEditSchedule(int EditType = kScheduleProgramGuide);
260  QString GetRecordingGroup() const;
261  void UpdateChannelList(int GroupID);
262 
263  // Lock handling
264  OSD* GetOSDL();
265  void ReturnOSDLock() const;
266  void GetPlayerWriteLock() const;
267  void GetPlayerReadLock() const;
268  void ReturnPlayerLock() const;
269 
270  // Other toggles
271  void ToggleAutoExpire();
272  void QuickRecord();
273 
274  // General TV state
275  static bool StateIsRecording(TVState State);
276  static bool StateIsPlaying(TVState State);
277  static bool StateIsLiveTV(TVState State);
278 
279  TVState GetState() const;
280  void HandleStateChange();
281  void GetStatus();
282  void ForceNextStateNone();
283  void ScheduleStateChange();
284  void ScheduleInputChange();
285  void SetErrored();
286  void SetInPlayList(bool InPlayList) { m_inPlaylist = InPlayList; }
287  void setUnderNetworkControl(bool setting) { m_underNetworkControl = setting; }
288  void PrepToSwitchToRecordedProgram(const ProgramInfo& ProgInfo);
292  kBookmarkAuto // set iff db_playback_exit_prompt==2
293  };
294  void PrepareToExitPlayer(int Line);
295  void SetExitPlayer(bool SetIt, bool WantsTo);
296 
297  bool RequestNextRecorder(bool ShowDialogs, const ChannelInfoList &Selection = ChannelInfoList());
298  void DeleteRecorder();
299 
300  bool StartRecorder(std::chrono::milliseconds MaxWait = -1ms);
301  void StopStuff(bool StopRingBuffer, bool StopPlayer, bool StopRecorder);
302  bool StartPlayer(TVState desiredState);
303 
305  bool IsSwitchingCards() const { return m_switchToRec; }
307  bool GetAllowRerecord() const { return m_allowRerecord; }
310  bool GetEndOfRecording() const { return m_endOfRecording; }
313  bool GetJumpToProgram() const { return m_jumpToProgram; }
314  bool IsDeleteAllowed();
315 
316  // Channels
317  static void ToggleChannelFavorite();
318  void ToggleChannelFavorite(const QString &ChangroupName) const;
319  void ChangeChannel(ChannelChangeDirection Direction);
320  void ChangeChannel(uint Chanid, const QString& Channum);
321 
322  void ShowPreviousChannel();
323  void PopPreviousChannel(bool ImmediateChange);
324 
325  // key queue commands
326  void AddKeyToInputQueue(char Key);
327  void ClearInputQueues(bool Hideosd);
328  bool CommitQueuedInput();
329  bool ProcessSmartChannel(QString &InputStr);
330 
331  // query key queues
332  bool HasQueuedInput() const { return !GetQueuedInput().isEmpty(); }
333  bool HasQueuedChannel() const { return m_queuedChanID || !GetQueuedChanNum().isEmpty(); }
334 
335  // get queued up input
336  QString GetQueuedInput() const;
337  int GetQueuedInputAsInt(bool *OK = nullptr, int Base = 10) const;
338  QString GetQueuedChanNum() const;
339  uint GetQueuedChanID() const { return m_queuedChanID; }
340 
341  // Source and input
342  void SwitchSource(uint Direction);
343  void SwitchInputs(uint ChanID = 0, QString ChanNum = "", uint InputID = 0);
344 
345  // Pause/play
346  void PauseLiveTV();
347  void UnpauseLiveTV(bool Quietly = false);
348  void DoPlay();
349  float DoTogglePauseStart();
350  void DoTogglePauseFinish(float Time, bool ShowOSD);
351  void DoTogglePause(bool ShowOSD);
352  bool DoSetPauseState(bool Pause);
353  bool ContextIsPaused(const char* File, int Location);
354 
355  // Program jumping stuff
356  void SetLastProgram(const ProgramInfo* ProgInfo);
357  ProgramInfo *GetLastProgram() const;
358 
359  // Seek, skip, jump, speed
360  void DoSeek(float Time, const QString &Msg, bool TimeIsOffset, bool HonorCutlist);
361  void DoSeek(std::chrono::seconds Time, const QString &Msg, bool TimeIsOffset, bool HonorCutlist) {
362  DoSeek(Time.count(), Msg, TimeIsOffset, HonorCutlist); };
363  bool DoPlayerSeek(float Time);
364  bool DoPlayerSeekToFrame(uint64_t FrameNum);
365  enum ArbSeekWhence { ARBSEEK_SET = 0, ARBSEEK_REWIND, ARBSEEK_FORWARD, ARBSEEK_END };
366  void DoSeekAbsolute(long long Seconds, bool HonorCutlist);
367  void DoArbSeek(ArbSeekWhence Whence, bool HonorCutlist);
368  void DoJumpFFWD();
369  void DoJumpRWND();
370  void DoSeekFFWD();
371  void DoSeekRWND();
372  void NormalSpeed();
373  void ChangeSpeed(int Direction);
374  void ToggleTimeStretch();
375  void ChangeTimeStretch(int Dir, bool AllowEdit = true);
376  void DVDJumpBack();
377  void DVDJumpForward();
378  float StopFFRew();
379  void ChangeFFRew(int Direction);
380  void SetFFRew(int Index);
381 
382  // Private audio methods
383  bool AudioSyncHandleAction(const QStringList& Actions);
384 
385  // Chapters, titles and angles
386  int GetNumChapters();
387  void GetChapterTimes(QList<std::chrono::seconds> &Times);
388  int GetCurrentChapter();
389  int GetNumTitles();
390  int GetCurrentTitle();
391  std::chrono::seconds GetTitleDuration(int Title);
392  QString GetTitleName(int Title);
393  void DoSwitchTitle(int Title);
394  int GetNumAngles();
395  int GetCurrentAngle();
396  QString GetAngleName(int Angle);
397  void DoSwitchAngle(int Angle);
398  void DoJumpChapter(int Chapter);
399 
400  // Commercial skipping
401  void DoSkipCommercials(int Direction);
402  void SetAutoCommercialSkip(CommSkipMode SkipMode = kCommSkipOff);
403 
404  // Transcode
405  void DoQueueTranscode(const QString& Profile);
406 
407  // Bookmarks
408  bool IsBookmarkAllowed();
409  void SetBookmark(bool Clear = false);
410 
411  // OSD
412  void ClearOSD();
413  void ToggleOSD( bool IncludeStatusOSD);
414  void UpdateOSDProgInfo(const char *WhichInfo);
415  void UpdateOSDStatus(const QString& Title, const QString& Desc,
416  const QString& Value, int Type, const QString& Units,
417  int Position = 0, enum OSDTimeout Timeout = kOSDTimeout_Med);
418  void UpdateOSDStatus(osdInfo &Info, int Type, enum OSDTimeout Timeout);
419  void UpdateOSDSeekMessage(const QString &Msg, enum OSDTimeout Timeout);
420  void UpdateOSDInput();
421  void UpdateOSDSignal(const QStringList &List);
422  void UpdateOSDTimeoutMessage();
423  bool CalcPlayerSliderPosition(osdInfo &info, bool paddedFields = false) const;
424  void HideOSDWindow(const char *window);
425 
426  // Captions/subtitles
427  bool SubtitleZoomHandleAction(const QStringList& Actions);
428  bool SubtitleDelayHandleAction(const QStringList &Actions);
429 
430  // Video controls
431  void DoTogglePictureAttribute(PictureAdjustType Type);
432  bool PictureAttributeHandleAction(const QStringList &Actions);
433  PictureAttribute NextPictureAdjustType(PictureAdjustType Type, PictureAttribute Attr);
434  void OverrideScan(FrameScanType Scan);
435 
436  // Sundry on screen
437  void ITVRestart(bool IsLive);
438 
439  // Manual zoom mode
440  void SetManualZoom(bool ZoomON, const QString& Desc);
441  bool ManualZoomHandleAction(const QStringList &Actions);
442 
443  // Channel editing support
444  void StartChannelEditMode();
445  bool HandleOSDChannelEdit(const QString& Action);
446  void ChannelEditAutoFill(InfoMap &Info);
447  void ChannelEditXDSFill(InfoMap &Info);
448 
449  // General dialog handling
450  bool DialogIsVisible(const QString &Dialog);
451  void HandleOSDInfo(const QString& Action);
452  void ShowNoRecorderDialog(NoRecorderMsg MsgType = kNoRecorders);
453 
454  // AskAllow dialog handling
455  void ShowOSDAskAllow();
456  void HandleOSDAskAllow(const QString& Action);
457  void AskAllowRecording(const QStringList &Msg, int Timeuntil, bool HasRec, bool HasLater);
458 
459  // Program editing support
460  void ShowOSDCutpoint(const QString &Type);
461  bool HandleOSDCutpoint(const QString& Action);
462  void StartProgramEditMode();
463 
464  // Already editing dialog
465  void ShowOSDAlreadyEditing();
466  void HandleOSDAlreadyEditing(const QString& Action, bool WasPaused);
467 
468  // Sleep dialog handling
469  void ShowOSDSleep();
470  void HandleOSDSleep(const QString& Action);
471  void SleepDialogTimeout();
472 
473  // Idle dialog handling
474  void ShowOSDIdle();
475  void HandleOSDIdle(const QString& Action);
476  void IdleDialogTimeout();
477 
478  // Exit/delete dialog handling
479  void ShowOSDStopWatchingRecording();
480  void ShowOSDPromptDeleteRecording(const QString& Title, bool Force = false);
481  bool HandleOSDVideoExit(const QString& Action);
482 
483  // Navigation Dialog
484  void StartOsdNavigation();
485 
486  // Menu dialog
487  void ShowOSDMenu(bool isCompact = false);
488  void FillOSDMenuJumpRec(const QString &Category = "", int Level = 0, const QString &Selected = "");
489  void PlaybackMenuShow(const MythTVMenu &Menu, const QDomNode &Node, const QDomNode &Selected);
490  bool MenuItemDisplay(const MythTVMenuItemContext& Context, MythOSDDialogData* Menu) override;
491  bool MenuItemDisplayPlayback(const MythTVMenuItemContext& Context, MythOSDDialogData* Menu);
492  bool MenuItemDisplayCutlist(const MythTVMenuItemContext& Context, MythOSDDialogData* Menu);
493  void PlaybackMenuInit(const MythTVMenu& Menu);
494  void PlaybackMenuDeinit(const MythTVMenu& Menu);
495  static void MenuStrings();
496  void MenuLazyInit(void* Field);
497  const MythTVMenu& getMenuFromId(MenuTypeId id);
498 
499  // LCD
500  void UpdateLCD();
501  void ShowLCDChannelInfo();
502  void ShowLCDDVDInfo();
503 
504  private:
505  MythMainWindow* m_mainWindow { nullptr };
506 
507  // Configuration variables from database
508  QString m_dbChannelFormat {"<num> <sign>"};
509  std::chrono::milliseconds m_dbIdleTimeout {0ms};
510  int m_dbPlaybackExitPrompt {0};
511  uint m_dbAutoexpireDefault {0};
512  bool m_dbAutoSetWatched {false};
513  bool m_dbEndOfRecExitPrompt {false};
514  bool m_dbJumpPreferOsd {true};
515  bool m_dbUseGuiSizeForTv {false};
516  bool m_dbUseVideoModes {false};
517  bool m_dbRunJobsOnRemote {false};
518  bool m_dbContinueEmbedded {false};
519  bool m_dbBrowseAlways {false};
520  bool m_dbBrowseAllTuners {false};
521  bool m_dbUseChannelGroups {false};
522  bool m_dbRememberLastChannelGroup {false};
524 
525  bool m_smartForward {false};
526  float m_ffRewRepos {1.0F};
527  bool m_ffRewReverse {false};
528  std::vector<int> m_ffRewSpeeds;
529 
530  uint m_vbimode {VBIMode::None};
531  uint m_switchToInputId {0};
532 
535  mutable bool m_wantsToQuit {true};
536  bool m_stretchAdjustment {false};
537  bool m_audiosyncAdjustment {false};
538  bool m_subtitleZoomAdjustment {false};
539  bool m_subtitleDelayAdjustment {false};
540  bool m_zoomMode {false};
541  bool m_sigMonMode {false};
542  bool m_endOfRecording {false};
543  bool m_requestDelete {false};
544  bool m_allowRerecord {false};
545  bool m_doSmartForward {false};
546  bool m_queuedTranscode {false};
547  bool m_savePosOnExit {false};
548  bool m_clearPosOnExit {false};
549  PictureAdjustType m_adjustingPicture {kAdjustingPicture_None};
552  PictureAttribute m_adjustingPictureAttribute {kPictureAttribute_None};
553 
554  // Ask Allow state
555  QMap<QString,AskProgramInfo> m_askAllowPrograms;
556 #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
557  QMutex m_askAllowLock {QMutex::Recursive};
558 #else
559  QRecursiveMutex m_askAllowLock;
560 #endif
561 
563  QMap<QString,ProgramList> m_progLists;
564 
565 #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
566  mutable QMutex m_chanEditMapLock {QMutex::Recursive};
567 #else
568  mutable QRecursiveMutex m_chanEditMapLock;
569 #endif
571 
573  static const std::vector<SleepTimerInfo> s_sleepTimes;
574  uint m_sleepIndex {0};
575  std::chrono::milliseconds m_sleepTimerTimeout {0ms};
576  int m_sleepTimerId {0};
577  int m_sleepDialogTimerId {0};
578  int m_idleTimerId {0};
580  int m_idleDialogTimerId {0};
581 
584 
585  // CC/Teletex input state variables
587  bool m_ccInputMode {false};
588 
589  // Arbitrary Seek input state variables
591  bool m_asInputMode {false};
592 
593  // Channel changing state variables
595  QString m_queuedInput;
597  mutable QString m_queuedChanNum;
599  uint m_queuedChanID {0};
601  uint m_initialChanID {0};
602 
608  static const int kScreenPressRegionCount = 12;
609  QList<QKeyEvent*> m_screenPressKeyMapPlayback;
610  QList<QKeyEvent*> m_screenPressKeyMapLiveTV;
611 
612  // Channel changing timeout notification variables
613  QElapsedTimer m_lockTimer;
614  bool m_lockTimerOn {false};
616 
617  // Program Info for currently playing video
618  // (or next video if InChangeState() is true)
619  mutable QMutex m_lastProgramLock;
620  ProgramInfo *m_lastProgram {nullptr};
621  bool m_inPlaylist {false};
622  bool m_underNetworkControl {false};
623 
624  // Program Jumping
625  bool m_jumpToProgram {false};
626 
627  // Video Player
628  PlayerContext m_playerContext { kPlayerInUseID };
629  // Ugly temporary workaround. We need a full MythPlayerInterface object but
630  // avoid endless casts
631  MythPlayerUI* m_player { nullptr };
633  mutable QReadWriteLock m_playerLock;
634 
635  bool m_noHardwareDecoders {false};
636 
637  // Remote Encoders
639  RemoteEncoder *m_switchToRec {nullptr};
640 
641  // LCD Info
642  QString m_lcdTitle;
643  QString m_lcdSubtitle;
644  QString m_lcdCallsign;
645 
646  // Window info (GUI is optional, transcoding, preview img, etc)
647  TvPlayWindow *m_myWindow {nullptr};
648  QRect m_playerBounds;
653  bool m_weDisabledGUI {false};
654 
655  // embedded and suspended status
656  bool m_ignoreKeyPresses {false};
657  bool m_savedPause {false};
658 
659  // Channel group stuff
663  mutable QMutex m_channelGroupLock;
664  volatile int m_channelGroupId {-1};
666 
667  // Network Control stuff
669 
670  // Timers
671  volatile int m_lcdTimerId {0};
672  volatile int m_lcdVolumeTimerId {0};
673  volatile int m_networkControlTimerId {0};
674  volatile int m_ccInputTimerId {0};
675  volatile int m_asInputTimerId {0};
676  volatile int m_queueInputTimerId {0};
677  volatile int m_endOfPlaybackTimerId {0};
678  volatile int m_endOfRecPromptTimerId {0};
679  volatile int m_videoExitDialogTimerId {0};
680  volatile int m_pseudoChangeChanTimerId {0};
681  volatile int m_speedChangeTimerId {0};
682  volatile int m_errorRecoveryTimerId {0};
683  mutable volatile int m_exitPlayerTimerId {0};
684  volatile int m_saveLastPlayPosTimerId {0};
685  volatile int m_signalMonitorTimerId {0};
686 
687  // Various tracks
688  // XXX This ignores kTrackTypeTextSubtitle which is greater than
689  // kTrackTypeCount, and it unnecessarily includes
690  // kTrackTypeUnknown.
691  QStringList m_tvmTracks[kTrackTypeCount];
692  int m_tvmCurtrack[kTrackTypeCount] {};
693 
694  // Audio
695  bool m_tvmAvsync {true};
696 
697  // Video
698  bool m_tvmFillAutoDetect {false};
699 
700  // Playback
701  int m_tvmSpeedX100 {100};
702  TVState m_tvmState {kState_None};
703  bool m_tvmIsRecording {false};
704  bool m_tvmIsRecorded {false};
705  bool m_tvmIsVideo {false};
706  CommSkipMode m_tvmCurSkip {kCommSkipOff};
707  bool m_tvmIsPaused {false};
708  int m_tvmFreeRecorderCount {-1};
709  bool m_tvmIsDvd {false};
710  bool m_tvmIsBd {false};
711  bool m_tvmJump {false};
712  bool m_tvmIsLiveTv {false};
713  bool m_tvmPreviousChan {false};
714 
715  // Navigate
716  int m_tvmNumChapters {0};
717  int m_tvmCurrentChapter {0};
718  QList<std::chrono::seconds> m_tvmChapterTimes;
719  int m_tvmNumAngles {0};
720  int m_tvmCurrentAngle {0};
721  int m_tvmNumTitles {0};
722  int m_tvmCurrentTitle {0};
723  // Subtitles
724  bool m_tvmSubsForcedOn {true};
725  bool m_tvmSubsHaveSubs {false};
726 
727  bool m_tvmIsOn {false};
728  bool m_tvmTranscoding {false};
729 
731  // End of playback menu state caching
732 
737 
738  public:
739  static inline const int kInitFFRWSpeed = 0; // 1x, default to normal speed
740  static inline const uint kInputKeysMax = 6; // When to start discarding early keys
741  static inline const uint kNextSource = 1;
742  static inline const uint kPreviousSource = 2;
743 
744  static inline const std::chrono::milliseconds kInputModeTimeout = 5s;
745  static inline const std::chrono::milliseconds kLCDTimeout = 1s;
746  static inline const std::chrono::milliseconds kBrowseTimeout = 30s;
747  static inline const std::chrono::milliseconds kKeyRepeatTimeout = 300ms;
748  static inline const std::chrono::milliseconds kPrevChanTimeout = 750ms;
749  static inline const std::chrono::milliseconds kSleepTimerDialogTimeout = 45s;
750  static inline const std::chrono::milliseconds kIdleTimerDialogTimeout = 45s;
751  static inline const std::chrono::milliseconds kVideoExitDialogTimeout = 2min;
752  static inline const std::chrono::milliseconds kEndOfPlaybackCheckFrequency = 250ms;
753  static inline const std::chrono::milliseconds kEmbedCheckFrequency = 250ms;
754  static inline const std::chrono::milliseconds kSpeedChangeCheckFrequency = 250ms;
755  static inline const std::chrono::milliseconds kErrorRecoveryCheckFrequency = 250ms;
756  static inline const std::chrono::milliseconds kEndOfRecPromptCheckFrequency = 250ms;
757  static inline const std::chrono::milliseconds kSaveLastPlayPosTimeout = 5s;
758 #ifdef USING_VALGRIND
759  static inline const std::chrono::milliseconds kEndOfPlaybackFirstCheckTimer = 1min;
760 #else
761  static inline const std::chrono::milliseconds kEndOfPlaybackFirstCheckTimer = 5s;
762 #endif
763 };
764 
765 #endif
kPictureAttribute_None
@ kPictureAttribute_None
Definition: videoouttypes.h:105
TV::IsSwitchingCards
bool IsSwitchingCards() const
Returns true if we are currently in the process of switching recorders.
Definition: tv_play.h:305
MythTVMenuItemDisplayer
Definition: mythtvmenu.h:76
CommSkipMode
CommSkipMode
Definition: tv.h:130
kViewSchedule
@ kViewSchedule
Definition: tv_play.h:98
TVPlaybackState
Tracks current playback state, as signalled by the player, and requests changes to the current state.
Definition: tvplaybackstate.h:12
bool
bool
Definition: pxsup2dast.c:30
TV::m_lastProgramLock
QMutex m_lastProgramLock
Definition: tv_play.h:619
tv.h
TV::DoSeek
void DoSeek(std::chrono::seconds Time, const QString &Msg, bool TimeIsOffset, bool HonorCutlist)
Definition: tv_play.h:361
kStartTVIgnoreProgStart
@ kStartTVIgnoreProgStart
Definition: tv_play.h:117
osdInfo
Definition: playercontext.h:38
TV::m_playerLock
QReadWriteLock m_playerLock
lock on player and playerActive changes
Definition: tv_play.h:633
ChannelChangeDirection
ChannelChangeDirection
ChannelChangeDirection is an enumeration of possible channel changing directions.
Definition: tv.h:28
TV::m_ffRewSpeeds
std::vector< int > m_ffRewSpeeds
Definition: tv_play.h:528
kScheduleProgramFinder
@ kScheduleProgramFinder
Definition: tv_play.h:96
kTrackTypeCount
@ kTrackTypeCount
Definition: decoderbase.h:38
MythTimer
A QElapsedTimer based timer to replace use of QTime as a timer.
Definition: mythtimer.h:13
PictureAdjustType
PictureAdjustType
Definition: tv.h:120
TV::m_cutlistMenu
MythTVMenu m_cutlistMenu
Definition: tv_play.h:735
TV::m_keyRepeatTimer
MythTimer m_keyRepeatTimer
Queue of unprocessed key presses.
Definition: tv_play.h:583
ReloadKeys
static void ReloadKeys(void)
Definition: mythfrontend.cpp:1656
TV::kBookmarkAlways
@ kBookmarkAlways
Definition: tv_play.h:290
MythTVMenuItemContext
Definition: mythtvmenu.h:49
TV::ArbSeekWhence
ArbSeekWhence
Definition: tv_play.h:365
TV::GetEndOfRecording
bool GetEndOfRecording() const
This is set to true if the player reaches the end of the recording without the user explicitly exitin...
Definition: tv_play.h:310
kStartTVInPlayList
@ kStartTVInPlayList
Definition: tv_play.h:114
TV::m_screenPressKeyMapPlayback
QList< QKeyEvent * > m_screenPressKeyMapPlayback
Definition: tv_play.h:609
kStartTVNoFlags
@ kStartTVNoFlags
Definition: tv_play.h:113
TV::HasQueuedChannel
bool HasQueuedChannel() const
Definition: tv_play.h:333
FrameScanType
FrameScanType
Definition: videoouttypes.h:94
EMBEDRETURNVOID
void(*)(void *, bool) EMBEDRETURNVOID
Definition: tv_play.h:60
osd.h
MythMediaBuffer
Definition: mythmediabuffer.h:50
VBIMode::None
@ None
Definition: tv.h:11
MythPlayer
Definition: mythplayer.h:84
TV::m_queuedInput
QString m_queuedInput
Input key presses queued up so far...
Definition: tv_play.h:595
AskProgramInfo::m_info
ProgramInfo * m_info
Definition: tv_play.h:133
mythdeque.h
TV::m_progLists
QMap< QString, ProgramList > m_progLists
Definition: tv_play.h:563
TV::kBookmarkNever
@ kBookmarkNever
Definition: tv_play.h:291
RemoteEncoder
Definition: remoteencoder.h:24
Action
An action (for this plugin) consists of a description, and a set of key sequences.
Definition: action.h:40
NoRecorderMsg
NoRecorderMsg
Type of message displayed in ShowNoRecorderDialog()
Definition: tv_play.h:105
InfoMap
QHash< QString, QString > InfoMap
Definition: mythtypes.h:15
TV::m_lockTimer
QElapsedTimer m_lockTimer
Definition: tv_play.h:613
kState_None
@ kState_None
None State, this is the initial state in both TV and TVRec, it indicates that we are ready to change ...
Definition: tv.h:58
tvbrowsehelper.h
EMBEDRETURNVOIDFINDER
void(*)(TV *, bool, bool) EMBEDRETURNVOIDFINDER
Definition: tv_play.h:62
MythPlayerUI
Definition: mythplayerui.h:10
TV::m_tvmChapterTimes
QList< std::chrono::seconds > m_tvmChapterTimes
Definition: tv_play.h:718
TV::m_dbChannelGroups
ChannelGroupList m_dbChannelGroups
Definition: tv_play.h:523
TV::m_channelGroupChannelList
ChannelInfoList m_channelGroupChannelList
Definition: tv_play.h:665
AskProgramInfo::AskProgramInfo
AskProgramInfo(QDateTime e, bool r, bool l, ProgramInfo *i)
Definition: tv_play.h:125
Command
Definition: gamesettings.cpp:233
TV::BookmarkAction
BookmarkAction
Definition: tv_play.h:289
TV::m_cutlistCompactMenu
MythTVMenu m_cutlistCompactMenu
Definition: tv_play.h:736
OSDTimeout
OSDTimeout
Definition: osd.h:55
kScheduleProgramGuide
@ kScheduleProgramGuide
Definition: tv_play.h:95
MythOSDDialogData
Definition: osd.h:64
TV::m_chanEditMap
InfoMap m_chanEditMap
Channel Editing initial map.
Definition: tv_play.h:570
AskProgramInfo::m_isConflicting
bool m_isConflicting
Definition: tv_play.h:132
videoouttypes.h
tvplaybackstate.h
EMBEDRETURNVOIDSCHEDIT
void(*)(const ProgramInfo *, void *) EMBEDRETURNVOIDSCHEDIT
Definition: tv_play.h:63
TV::m_chanEditMapLock
QRecursiveMutex m_chanEditMapLock
Lock for chanEditMap and ddMap.
Definition: tv_play.h:568
Event
Event details.
Definition: zmdefines.h:26
kPlaybackBox
@ kPlaybackBox
Definition: tv_play.h:99
kStartTVIgnoreBookmark
@ kStartTVIgnoreBookmark
Definition: tv_play.h:116
TV::setUnderNetworkControl
void setUnderNetworkControl(bool setting)
Definition: tv_play.h:287
TV::SleepTimerInfo
Definition: tv_play.cpp:938
AskProgramInfo::m_expiry
QDateTime m_expiry
Definition: tv_play.h:128
TVBrowseHelper::m_dbUseChannelGroups
bool m_dbUseChannelGroups
Definition: tvbrowsehelper.h:78
kScheduledRecording
@ kScheduledRecording
Definition: tv_play.h:97
State
State
Definition: zmserver.h:68
TVBrowseHelper::m_dbBrowseAllTuners
bool m_dbBrowseAllTuners
Definition: tvbrowsehelper.h:77
kNoRecorders
@ kNoRecorders
No free recorders.
Definition: tv_play.h:107
TV::m_playbackCompactMenu
MythTVMenu m_playbackCompactMenu
Definition: tv_play.h:734
GuideGrid
Definition: guidegrid.h:101
TV::m_queuedChanNum
QString m_queuedChanNum
Input key presses queued up so far to form a valid ChanNum.
Definition: tv_play.h:597
TV::m_savedGuiBounds
QRect m_savedGuiBounds
Definition: tv_play.h:651
GetState
#define GetState(a, b)
Definition: audiooutputopensles.cpp:47
ChannelGroupList
std::vector< ChannelGroupItem > ChannelGroupList
Definition: channelgroup.h:31
scheduleEditTypes
scheduleEditTypes
Definition: tv_play.h:94
uint
unsigned int uint
Definition: compat.h:79
EMBEDRETURNVOIDEPG
void(*)(uint, const QString &, const QDateTime, TV *, bool, bool, int) EMBEDRETURNVOIDEPG
Definition: tv_play.h:61
MenuTypeId
MenuTypeId
Definition: mythtvmenu.h:36
TVBrowseHelper
Definition: tvbrowsehelper.h:45
TV::m_askAllowLock
QRecursiveMutex m_askAllowLock
Definition: tv_play.h:559
referencecounter.h
PictureAttribute
PictureAttribute
Definition: videoouttypes.h:103
volumebase.h
TV::HasQueuedInput
bool HasQueuedInput() const
Definition: tv_play.h:332
MTV_PUBLIC
#define MTV_PUBLIC
Definition: mythtvexp.h:15
AskProgramInfo::m_hasLater
bool m_hasLater
Definition: tv_play.h:130
channelinfo.h
PlaybackBox
Definition: playbackbox.h:63
Channum
Definition: channelsettings.cpp:57
ProgramInfo
Holds information on recordings and videos.
Definition: programinfo.h:67
channelgroup.h
TV::s_sleepTimes
static const std::vector< SleepTimerInfo > s_sleepTimes
Definition: tv_play.h:572
AskProgramInfo::AskProgramInfo
AskProgramInfo()=default
TV::m_lastLockSeenTime
QDateTime m_lastLockSeenTime
Definition: tv_play.h:615
TV::m_progListsLock
QMutex m_progListsLock
Definition: tv_play.h:562
TVState
TVState
TVState is an enumeration of the states used by TV and TVRec.
Definition: tv.h:50
MythTVMenuItemDisplayer::MenuItemDisplay
virtual bool MenuItemDisplay(const MythTVMenuItemContext &Context, MythOSDDialogData *Menu)=0
Clear
#define Clear(a)
Definition: audiooutputopensles.cpp:46
playercontext.h
kPlayerInUseID
const QString kPlayerInUseID
Definition: programtypes.cpp:16
AskProgramInfo::m_hasRec
bool m_hasRec
Definition: tv_play.h:129
mythtvmenu.h
Name
Definition: channelsettings.cpp:47
TV::m_tvmJumprecBackHack
QVariant m_tvmJumprecBackHack
Definition: tv_play.h:730
MythDeque< QString >
std
Definition: mythchrono.h:23
ProgInfo
Definition: programdata.h:226
TVRec
This is the coordinating class of the Recorder Subsystem.
Definition: tv_rec.h:144
AskProgramInfo::m_isInSameInputGroup
bool m_isInSameInputGroup
Definition: tv_play.h:131
TV::m_lcdCallsign
QString m_lcdCallsign
Definition: tv_play.h:644
kStartTVIgnoreLastPlayPos
@ kStartTVIgnoreLastPlayPos
Definition: tv_play.h:118
MythTVMenu
Definition: mythtvmenu.h:83
decoderbase.h
TVBrowseHelper::TV
friend class TV
Definition: tvbrowsehelper.h:47
TV::m_lcdTitle
QString m_lcdTitle
Definition: tv_play.h:642
OK
static constexpr int OK
Definition: dvbci.cpp:69
TV::m_channelGroupLock
QMutex m_channelGroupLock
Lock necessary when modifying channel group variables.
Definition: tv_play.h:663
PlayerContext
Definition: playercontext.h:53
inputinfo.h
TV::m_screenPressKeyMapLiveTV
QList< QKeyEvent * > m_screenPressKeyMapLiveTV
Definition: tv_play.h:610
TV::m_playbackMenu
MythTVMenu m_playbackMenu
Definition: tv_play.h:733
mythtimer.h
TV::SetInPlayList
void SetInPlayList(bool InPlayList)
Definition: tv_play.h:286
MythGestureEvent
A custom event that represents a mouse gesture.
Definition: mythgesture.h:39
kCommSkipOff
@ kCommSkipOff
Definition: tv.h:132
Player
Definition: zmliveplayer.h:34
TV::GetAllowRerecord
bool GetAllowRerecord() const
Returns true if the user told Mythtv to allow re-recording of the show.
Definition: tv_play.h:307
TvPlayWindow
Simple screen shown while the video player is starting up.
Definition: tv_play_win.h:12
kStartTVByNetworkCommand
@ kStartTVByNetworkCommand
Definition: tv_play.h:115
kAdjustingPicture_None
@ kAdjustingPicture_None
Definition: tv.h:122
TV::m_networkControlCommands
MythDeque< QString > m_networkControlCommands
Definition: tv_play.h:668
TV::m_lcdSubtitle
QString m_lcdSubtitle
Definition: tv_play.h:643
kOSDTimeout_Med
@ kOSDTimeout_Med
Definition: osd.h:60
TV::GetQueuedChanID
uint GetQueuedChanID() const
Definition: tv_play.h:339
OSD
Definition: osd.h:93
MythMainWindow
Definition: mythmainwindow.h:28
ReferenceCounter
General purpose reference counter.
Definition: referencecounter.h:26
kNoCurrRec
@ kNoCurrRec
No current recordings.
Definition: tv_play.h:108
TV::GetJumpToProgram
bool GetJumpToProgram() const
This is set if the user asked MythTV to jump to the previous recording in the playlist.
Definition: tv_play.h:313
TV::m_askAllowPrograms
QMap< QString, AskProgramInfo > m_askAllowPrograms
Definition: tv_play.h:555
InitKeys
static void InitKeys(void)
Definition: mythfrontend.cpp:1604
TV
Control TV playback.
Definition: tv_play.h:154
ChannelInfoList
std::vector< ChannelInfo > ChannelInfoList
Definition: channelinfo.h:131
AskProgramInfo
Definition: tv_play.h:121
kNoTuners
@ kNoTuners
No capture cards configured.
Definition: tv_play.h:109