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 <QSet>
24 
25 // MythTV
26 #include "mythdeque.h"
27 #include "tv.h"
28 #include "channelinfo.h"
29 #include "videoouttypes.h"
30 #include "volumebase.h"
31 #include "inputinfo.h"
32 #include "channelgroup.h"
33 #include "mythtimer.h"
34 #include "osd.h"
35 #include "playercontext.h"
36 #include "decoders/decoderbase.h"
37 #include "mythmiscutil.h"
38 #include "tvbrowsehelper.h"
39 #include "mythtvmenu.h"
40 #include "tvplaybackstate.h"
41 #include "referencecounter.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 QSet<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, BookmarkAction Bookmark = kBookmarkAuto);
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 
425  // Captions/subtitles
426  bool SubtitleZoomHandleAction(const QStringList& Actions);
427  bool SubtitleDelayHandleAction(const QStringList &Actions);
428 
429  // Video controls
430  void DoTogglePictureAttribute(PictureAdjustType Type);
431  bool PictureAttributeHandleAction(const QStringList &Actions);
432  PictureAttribute NextPictureAdjustType(PictureAdjustType Type, PictureAttribute Attr);
433  void OverrideScan(FrameScanType Scan);
434 
435  // Sundry on screen
436  void ITVRestart(bool IsLive);
437 
438  // Manual zoom mode
439  void SetManualZoom(bool ZoomON, const QString& Desc);
440  bool ManualZoomHandleAction(const QStringList &Actions);
441 
442  // Channel editing support
443  void StartChannelEditMode();
444  bool HandleOSDChannelEdit(const QString& Action);
445  void ChannelEditAutoFill(InfoMap &Info);
446  void ChannelEditXDSFill(InfoMap &Info);
447 
448  // General dialog handling
449  bool DialogIsVisible(const QString &Dialog);
450  void HandleOSDInfo(const QString& Action);
451  void ShowNoRecorderDialog(NoRecorderMsg MsgType = kNoRecorders);
452 
453  // AskAllow dialog handling
454  void ShowOSDAskAllow();
455  void HandleOSDAskAllow(const QString& Action);
456  void AskAllowRecording(const QStringList &Msg, int Timeuntil, bool HasRec, bool HasLater);
457 
458  // Program editing support
459  void ShowOSDCutpoint(const QString &Type);
460  bool HandleOSDCutpoint(const QString& Action);
461  void StartProgramEditMode();
462 
463  // Already editing dialog
464  void ShowOSDAlreadyEditing();
465  void HandleOSDAlreadyEditing(const QString& Action, bool WasPaused);
466 
467  // Sleep dialog handling
468  void ShowOSDSleep();
469  void HandleOSDSleep(const QString& Action);
470  void SleepDialogTimeout();
471 
472  // Idle dialog handling
473  void ShowOSDIdle();
474  void HandleOSDIdle(const QString& Action);
475  void IdleDialogTimeout();
476 
477  // Exit/delete dialog handling
478  void ShowOSDStopWatchingRecording();
479  void ShowOSDPromptDeleteRecording(const QString& Title, bool Force = false);
480  bool HandleOSDVideoExit(const QString& Action);
481 
482  // Navigation Dialog
483  void StartOsdNavigation();
484 
485  // Menu dialog
486  void ShowOSDMenu(bool isCompact = false);
487  void FillOSDMenuJumpRec(const QString &Category = "", int Level = 0, const QString &Selected = "");
488  void PlaybackMenuShow(const MythTVMenu &Menu, const QDomNode &Node, const QDomNode &Selected);
489  bool MenuItemDisplay(const MythTVMenuItemContext& Context, MythOSDDialogData* Menu) override;
490  bool MenuItemDisplayPlayback(const MythTVMenuItemContext& Context, MythOSDDialogData* Menu);
491  bool MenuItemDisplayCutlist(const MythTVMenuItemContext& Context, MythOSDDialogData* Menu);
492  void PlaybackMenuInit(const MythTVMenu& Menu);
493  void PlaybackMenuDeinit(const MythTVMenu& Menu);
494  static void MenuStrings();
495  void MenuLazyInit(void* Field);
496  const MythTVMenu& getMenuFromId(MenuTypeId id);
497 
498  // LCD
499  void UpdateLCD();
500  void ShowLCDChannelInfo();
501  void ShowLCDDVDInfo();
502 
503  private:
504  MythMainWindow* m_mainWindow { nullptr };
505 
506  // Configuration variables from database
507  QString m_dbChannelFormat {"<num> <sign>"};
508  std::chrono::milliseconds m_dbIdleTimeout {0ms};
509  int m_dbPlaybackExitPrompt {0};
510  uint m_dbAutoexpireDefault {0};
511  bool m_dbAutoSetWatched {false};
512  bool m_dbEndOfRecExitPrompt {false};
513  bool m_dbJumpPreferOsd {true};
514  bool m_dbUseGuiSizeForTv {false};
515  bool m_dbUseVideoModes {false};
516  bool m_dbClearSavedPosition {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};
550  PictureAttribute m_adjustingPictureAttribute {kPictureAttribute_None};
551 
552  // Ask Allow state
553  QMap<QString,AskProgramInfo> m_askAllowPrograms;
554 #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
555  QMutex m_askAllowLock {QMutex::Recursive};
556 #else
557  QRecursiveMutex m_askAllowLock;
558 #endif
559 
561  QMap<QString,ProgramList> m_progLists;
562 
563 #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
564  mutable QMutex m_chanEditMapLock {QMutex::Recursive};
565 #else
566  mutable QRecursiveMutex m_chanEditMapLock;
567 #endif
569 
571  static const std::vector<SleepTimerInfo> s_sleepTimes;
572  uint m_sleepIndex {0};
573  std::chrono::milliseconds m_sleepTimerTimeout {0ms};
574  int m_sleepTimerId {0};
575  int m_sleepDialogTimerId {0};
576  int m_idleTimerId {0};
578  int m_idleDialogTimerId {0};
579 
582 
583  // CC/Teletex input state variables
585  bool m_ccInputMode {false};
586 
587  // Arbitrary Seek input state variables
589  bool m_asInputMode {false};
590 
591  // Channel changing state variables
593  QString m_queuedInput;
595  mutable QString m_queuedChanNum;
597  uint m_queuedChanID {0};
599  uint m_initialChanID {0};
600 
606  static const int kScreenPressRegionCount = 12;
607  QList<QKeyEvent*> m_screenPressKeyMapPlayback;
608  QList<QKeyEvent*> m_screenPressKeyMapLiveTV;
609 
610  // Channel changing timeout notification variables
611  QElapsedTimer m_lockTimer;
612  bool m_lockTimerOn {false};
614 
615  // Program Info for currently playing video
616  // (or next video if InChangeState() is true)
617  mutable QMutex m_lastProgramLock;
618  ProgramInfo *m_lastProgram {nullptr};
619  bool m_inPlaylist {false};
620  bool m_underNetworkControl {false};
621 
622  // Program Jumping
623  bool m_jumpToProgram {false};
624 
625  // Video Player
626  PlayerContext m_playerContext { kPlayerInUseID };
627  // Ugly temporary workaround. We need a full MythPlayerInterface object but
628  // avoid endless casts
629  MythPlayerUI* m_player { nullptr };
631  mutable QReadWriteLock m_playerLock;
632 
633  bool m_noHardwareDecoders {false};
634 
635  // Remote Encoders
637  RemoteEncoder *m_switchToRec {nullptr};
638 
639  // LCD Info
640  QString m_lcdTitle;
641  QString m_lcdSubtitle;
642  QString m_lcdCallsign;
643 
644  // Window info (GUI is optional, transcoding, preview img, etc)
645  TvPlayWindow *m_myWindow {nullptr};
646  QRect m_playerBounds;
651  bool m_weDisabledGUI {false};
652 
653  // embedded and suspended status
654  bool m_ignoreKeyPresses {false};
655  bool m_savedPause {false};
656 
657  // Channel group stuff
661  mutable QMutex m_channelGroupLock;
662  volatile int m_channelGroupId {-1};
664 
665  // Network Control stuff
667 
668  // Timers
669  volatile int m_lcdTimerId {0};
670  volatile int m_lcdVolumeTimerId {0};
671  volatile int m_networkControlTimerId {0};
672  volatile int m_ccInputTimerId {0};
673  volatile int m_asInputTimerId {0};
674  volatile int m_queueInputTimerId {0};
675  volatile int m_endOfPlaybackTimerId {0};
676  volatile int m_endOfRecPromptTimerId {0};
677  volatile int m_videoExitDialogTimerId {0};
678  volatile int m_pseudoChangeChanTimerId {0};
679  volatile int m_speedChangeTimerId {0};
680  volatile int m_errorRecoveryTimerId {0};
681  mutable volatile int m_exitPlayerTimerId {0};
682  volatile int m_saveLastPlayPosTimerId {0};
683  volatile int m_signalMonitorTimerId {0};
684 
685  // Various tracks
686  // XXX This ignores kTrackTypeTextSubtitle which is greater than
687  // kTrackTypeCount, and it unnecessarily includes
688  // kTrackTypeUnknown.
689  QStringList m_tvmTracks[kTrackTypeCount];
690  int m_tvmCurtrack[kTrackTypeCount] {};
691 
692  // Audio
693  bool m_tvmAvsync {true};
694 
695  // Video
696  bool m_tvmFillAutoDetect {false};
697 
698  // Playback
699  int m_tvmSpeedX100 {100};
700  TVState m_tvmState {kState_None};
701  bool m_tvmIsRecording {false};
702  bool m_tvmIsRecorded {false};
703  bool m_tvmIsVideo {false};
704  CommSkipMode m_tvmCurSkip {kCommSkipOff};
705  bool m_tvmIsPaused {false};
706  int m_tvmFreeRecorderCount {-1};
707  bool m_tvmIsDvd {false};
708  bool m_tvmIsBd {false};
709  bool m_tvmJump {false};
710  bool m_tvmIsLiveTv {false};
711  bool m_tvmPreviousChan {false};
712 
713  // Navigate
714  int m_tvmNumChapters {0};
715  int m_tvmCurrentChapter {0};
716  QList<std::chrono::seconds> m_tvmChapterTimes;
717  int m_tvmNumAngles {0};
718  int m_tvmCurrentAngle {0};
719  int m_tvmNumTitles {0};
720  int m_tvmCurrentTitle {0};
721  // Subtitles
722  bool m_tvmSubsForcedOn {true};
723  bool m_tvmSubsHaveSubs {false};
724 
725  bool m_tvmIsOn {false};
726  bool m_tvmTranscoding {false};
727 
729  // End of playback menu state caching
730 
735 
736  public:
737  static inline const int kInitFFRWSpeed = 0; // 1x, default to normal speed
738  static inline const uint kInputKeysMax = 6; // When to start discarding early keys
739  static inline const uint kNextSource = 1;
740  static inline const uint kPreviousSource = 2;
741 
742  static inline const std::chrono::milliseconds kInputModeTimeout = 5s;
743  static inline const std::chrono::milliseconds kLCDTimeout = 1s;
744  static inline const std::chrono::milliseconds kBrowseTimeout = 30s;
745  static inline const std::chrono::milliseconds kKeyRepeatTimeout = 300ms;
746  static inline const std::chrono::milliseconds kPrevChanTimeout = 750ms;
747  static inline const std::chrono::milliseconds kSleepTimerDialogTimeout = 45s;
748  static inline const std::chrono::milliseconds kIdleTimerDialogTimeout = 45s;
749  static inline const std::chrono::milliseconds kVideoExitDialogTimeout = 2min;
750  static inline const std::chrono::milliseconds kEndOfPlaybackCheckFrequency = 250ms;
751  static inline const std::chrono::milliseconds kEmbedCheckFrequency = 250ms;
752  static inline const std::chrono::milliseconds kSpeedChangeCheckFrequency = 250ms;
753  static inline const std::chrono::milliseconds kErrorRecoveryCheckFrequency = 250ms;
754  static inline const std::chrono::milliseconds kEndOfRecPromptCheckFrequency = 250ms;
755  static inline const std::chrono::milliseconds kSaveLastPlayPosTimeout = 30s;
756 #ifdef USING_VALGRIND
757  static inline const std::chrono::milliseconds kEndOfPlaybackFirstCheckTimer = 1min;
758 #else
759  static inline const std::chrono::milliseconds kEndOfPlaybackFirstCheckTimer = 5s;
760 #endif
761 };
762 
763 #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:617
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:37
TV::m_playerLock
QReadWriteLock m_playerLock
lock on player and playerActive changes
Definition: tv_play.h:631
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:733
TV::m_keyRepeatTimer
MythTimer m_keyRepeatTimer
Queue of unprocessed key presses.
Definition: tv_play.h:581
ReloadKeys
static void ReloadKeys(void)
Definition: mythtv/programs/mythfrontend/main.cpp:1628
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:607
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
TV::s_sleepTimes
static const std::vector< SleepTimerInfo > s_sleepTimes
Definition: tv_play.h:570
VBIMode::None
@ None
Definition: tv.h:11
MythPlayer
Definition: mythplayer.h:86
TV::m_queuedInput
QString m_queuedInput
Input key presses queued up so far...
Definition: tv_play.h:593
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:561
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:611
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:716
TV::m_dbChannelGroups
ChannelGroupList m_dbChannelGroups
Definition: tv_play.h:523
TV::m_channelGroupChannelList
ChannelInfoList m_channelGroupChannelList
Definition: tv_play.h:663
AskProgramInfo::AskProgramInfo
AskProgramInfo(QDateTime e, bool r, bool l, ProgramInfo *i)
Definition: tv_play.h:125
Command
Definition: gamesettings.cpp:227
TV::BookmarkAction
BookmarkAction
Definition: tv_play.h:289
TV::m_cutlistCompactMenu
MythTVMenu m_cutlistCompactMenu
Definition: tv_play.h:734
OSDTimeout
OSDTimeout
Definition: osd.h:56
kScheduleProgramGuide
@ kScheduleProgramGuide
Definition: tv_play.h:95
MythOSDDialogData
Definition: osd.h:65
TV::m_chanEditMap
InfoMap m_chanEditMap
Channel Editing initial map.
Definition: tv_play.h:568
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:566
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:949
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:732
GuideGrid
Definition: guidegrid.h:101
kStartTVAllowLastPlayPos
@ kStartTVAllowLastPlayPos
Definition: tv_play.h:118
TV::m_queuedChanNum
QString m_queuedChanNum
Input key presses queued up so far to form a valid ChanNum.
Definition: tv_play.h:595
TV::m_savedGuiBounds
QRect m_savedGuiBounds
Definition: tv_play.h:649
GetState
#define GetState(a, b)
Definition: audiooutputopensles.cpp:48
Bookmark
Definition: bookmarkmanager.h:13
ChannelGroupList
std::vector< ChannelGroupItem > ChannelGroupList
Definition: channelgroup.h:31
scheduleEditTypes
scheduleEditTypes
Definition: tv_play.h:94
uint
unsigned int uint
Definition: compat.h:140
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:557
referencecounter.h
PictureAttribute
PictureAttribute
Definition: videoouttypes.h:103
volumebase.h
InitKeys
static void InitKeys(void)
Definition: mythtv/programs/mythfrontend/main.cpp:1576
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:62
Channum
Definition: channelsettings.cpp:56
ProgramInfo
Holds information on recordings and videos.
Definition: programinfo.h:67
channelgroup.h
AskProgramInfo::AskProgramInfo
AskProgramInfo()=default
TV::m_lastLockSeenTime
QDateTime m_lastLockSeenTime
Definition: tv_play.h:613
mythmiscutil.h
TV::m_progListsLock
QMutex m_progListsLock
Definition: tv_play.h:560
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:47
playercontext.h
kPlayerInUseID
const QString kPlayerInUseID
Definition: programtypes.cpp:13
AskProgramInfo::m_hasRec
bool m_hasRec
Definition: tv_play.h:129
mythtvmenu.h
Name
Definition: channelsettings.cpp:46
TV::m_tvmJumprecBackHack
QVariant m_tvmJumprecBackHack
Definition: tv_play.h:728
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:145
AskProgramInfo::m_isInSameInputGroup
bool m_isInSameInputGroup
Definition: tv_play.h:131
TV::m_lcdCallsign
QString m_lcdCallsign
Definition: tv_play.h:642
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:640
TV::m_channelGroupLock
QMutex m_channelGroupLock
Lock necessary when modifying channel group variables.
Definition: tv_play.h:661
PlayerContext
Definition: playercontext.h:52
inputinfo.h
TV::m_screenPressKeyMapLiveTV
QList< QKeyEvent * > m_screenPressKeyMapLiveTV
Definition: tv_play.h:608
TV::m_playbackMenu
MythTVMenu m_playbackMenu
Definition: tv_play.h:731
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:666
TV::m_lcdSubtitle
QString m_lcdSubtitle
Definition: tv_play.h:641
kOSDTimeout_Med
@ kOSDTimeout_Med
Definition: osd.h:61
TV::GetQueuedChanID
uint GetQueuedChanID() const
Definition: tv_play.h:339
OK
#define OK
Definition: dvbci.cpp:69
OSD
Definition: osd.h:94
MythMainWindow
Definition: mythmainwindow.h:35
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:553
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