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();
266  void GetPlayerWriteLock();
267  void GetPlayerReadLock();
268  void GetPlayerReadLock() const;
269  void ReturnPlayerLock();
270  void ReturnPlayerLock() const;
271 
272  // Other toggles
273  void ToggleAutoExpire();
274  void QuickRecord();
275 
276  // General TV state
277  static bool StateIsRecording(TVState State);
278  static bool StateIsPlaying(TVState State);
279  static bool StateIsLiveTV(TVState State);
280 
281  TVState GetState() const;
282  void HandleStateChange();
283  void GetStatus();
284  void ForceNextStateNone();
285  void ScheduleStateChange();
286  void ScheduleInputChange();
287  void SetErrored();
288  void SetInPlayList(bool InPlayList) { m_inPlaylist = InPlayList; }
289  void setUnderNetworkControl(bool setting) { m_underNetworkControl = setting; }
290  void PrepToSwitchToRecordedProgram(const ProgramInfo& ProgInfo);
294  kBookmarkAuto // set iff db_playback_exit_prompt==2
295  };
296  void PrepareToExitPlayer(int Line, BookmarkAction Bookmark = kBookmarkAuto);
297  void SetExitPlayer(bool SetIt, bool WantsTo);
298 
299  bool RequestNextRecorder(bool ShowDialogs, const ChannelInfoList &Selection = ChannelInfoList());
300  void DeleteRecorder();
301 
302  bool StartRecorder(std::chrono::milliseconds MaxWait = -1ms);
303  void StopStuff(bool StopRingBuffer, bool StopPlayer, bool StopRecorder);
304  bool StartPlayer(TVState desiredState);
305 
307  bool IsSwitchingCards() const { return m_switchToRec; }
309  bool GetAllowRerecord() const { return m_allowRerecord; }
312  bool GetEndOfRecording() const { return m_endOfRecording; }
315  bool GetJumpToProgram() const { return m_jumpToProgram; }
316  bool IsDeleteAllowed();
317 
318  // Channels
319  static void ToggleChannelFavorite();
320  void ToggleChannelFavorite(const QString &ChangroupName) const;
321  void ChangeChannel(ChannelChangeDirection Direction);
322  void ChangeChannel(uint Chanid, const QString& Channum);
323 
324  void ShowPreviousChannel();
325  void PopPreviousChannel(bool ImmediateChange);
326 
327  // key queue commands
328  void AddKeyToInputQueue(char Key);
329  void ClearInputQueues(bool Hideosd);
330  bool CommitQueuedInput();
331  bool ProcessSmartChannel(QString &InputStr);
332 
333  // query key queues
334  bool HasQueuedInput() const { return !GetQueuedInput().isEmpty(); }
335  bool HasQueuedChannel() const { return m_queuedChanID || !GetQueuedChanNum().isEmpty(); }
336 
337  // get queued up input
338  QString GetQueuedInput() const;
339  int GetQueuedInputAsInt(bool *OK = nullptr, int Base = 10) const;
340  QString GetQueuedChanNum() const;
341  uint GetQueuedChanID() const { return m_queuedChanID; }
342 
343  // Source and input
344  void SwitchSource(uint Direction);
345  void SwitchInputs(uint ChanID = 0, QString ChanNum = "", uint InputID = 0);
346 
347  // Pause/play
348  void PauseLiveTV();
349  void UnpauseLiveTV(bool Quietly = false);
350  void DoPlay();
351  float DoTogglePauseStart();
352  void DoTogglePauseFinish(float Time, bool ShowOSD);
353  void DoTogglePause(bool ShowOSD);
354  bool DoSetPauseState(bool Pause);
355  bool ContextIsPaused(const char* File, int Location);
356 
357  // Program jumping stuff
358  void SetLastProgram(const ProgramInfo* ProgInfo);
359  ProgramInfo *GetLastProgram() const;
360 
361  // Seek, skip, jump, speed
362  void DoSeek(float Time, const QString &Msg, bool TimeIsOffset, bool HonorCutlist);
363  void DoSeek(std::chrono::seconds Time, const QString &Msg, bool TimeIsOffset, bool HonorCutlist) {
364  DoSeek(Time.count(), Msg, TimeIsOffset, HonorCutlist); };
365  bool DoPlayerSeek(float Time);
366  bool DoPlayerSeekToFrame(uint64_t FrameNum);
367  enum ArbSeekWhence { ARBSEEK_SET = 0, ARBSEEK_REWIND, ARBSEEK_FORWARD, ARBSEEK_END };
368  void DoSeekAbsolute(long long Seconds, bool HonorCutlist);
369  void DoArbSeek(ArbSeekWhence Whence, bool HonorCutlist);
370  void DoJumpFFWD();
371  void DoJumpRWND();
372  void DoSeekFFWD();
373  void DoSeekRWND();
374  void NormalSpeed();
375  void ChangeSpeed(int Direction);
376  void ToggleTimeStretch();
377  void ChangeTimeStretch(int Dir, bool AllowEdit = true);
378  void DVDJumpBack();
379  void DVDJumpForward();
380  float StopFFRew();
381  void ChangeFFRew(int Direction);
382  void SetFFRew(int Index);
383 
384  // Private audio methods
385  bool AudioSyncHandleAction(const QStringList& Actions);
386 
387  // Chapters, titles and angles
388  int GetNumChapters();
389  void GetChapterTimes(QList<std::chrono::seconds> &Times);
390  int GetCurrentChapter();
391  int GetNumTitles();
392  int GetCurrentTitle();
393  std::chrono::seconds GetTitleDuration(int Title);
394  QString GetTitleName(int Title);
395  void DoSwitchTitle(int Title);
396  int GetNumAngles();
397  int GetCurrentAngle();
398  QString GetAngleName(int Angle);
399  void DoSwitchAngle(int Angle);
400  void DoJumpChapter(int Chapter);
401 
402  // Commercial skipping
403  void DoSkipCommercials(int Direction);
404  void SetAutoCommercialSkip(CommSkipMode SkipMode = kCommSkipOff);
405 
406  // Transcode
407  void DoQueueTranscode(const QString& Profile);
408 
409  // Bookmarks
410  bool IsBookmarkAllowed();
411  void SetBookmark(bool Clear = false);
412 
413  // OSD
414  void ClearOSD();
415  void ToggleOSD( bool IncludeStatusOSD);
416  void UpdateOSDProgInfo(const char *WhichInfo);
417  void UpdateOSDStatus(const QString& Title, const QString& Desc,
418  const QString& Value, int Type, const QString& Units,
419  int Position = 0, enum OSDTimeout Timeout = kOSDTimeout_Med);
420  void UpdateOSDStatus(osdInfo &Info, int Type, enum OSDTimeout Timeout);
421  void UpdateOSDSeekMessage(const QString &Msg, enum OSDTimeout Timeout);
422  void UpdateOSDInput();
423  void UpdateOSDSignal(const QStringList &List);
424  void UpdateOSDTimeoutMessage();
425  bool CalcPlayerSliderPosition(osdInfo &info, bool paddedFields = false) const;
426 
427  // Captions/subtitles
428  bool SubtitleZoomHandleAction(const QStringList& Actions);
429  bool SubtitleDelayHandleAction(const QStringList &Actions);
430 
431  // Video controls
432  void DoTogglePictureAttribute(PictureAdjustType Type);
433  bool PictureAttributeHandleAction(const QStringList &Actions);
434  PictureAttribute NextPictureAdjustType(PictureAdjustType Type, PictureAttribute Attr);
435  void OverrideScan(FrameScanType Scan);
436 
437  // Sundry on screen
438  void ITVRestart(bool IsLive);
439 
440  // Manual zoom mode
441  void SetManualZoom(bool ZoomON, const QString& Desc);
442  bool ManualZoomHandleAction(const QStringList &Actions);
443 
444  // Channel editing support
445  void StartChannelEditMode();
446  bool HandleOSDChannelEdit(const QString& Action);
447  void ChannelEditAutoFill(InfoMap &Info);
448  void ChannelEditXDSFill(InfoMap &Info);
449 
450  // General dialog handling
451  bool DialogIsVisible(const QString &Dialog);
452  void HandleOSDInfo(const QString& Action);
453  void ShowNoRecorderDialog(NoRecorderMsg MsgType = kNoRecorders);
454 
455  // AskAllow dialog handling
456  void ShowOSDAskAllow();
457  void HandleOSDAskAllow(const QString& Action);
458  void AskAllowRecording(const QStringList &Msg, int Timeuntil, bool HasRec, bool HasLater);
459 
460  // Program editing support
461  void ShowOSDCutpoint(const QString &Type);
462  bool HandleOSDCutpoint(const QString& Action);
463  void StartProgramEditMode();
464 
465  // Already editing dialog
466  void ShowOSDAlreadyEditing();
467  void HandleOSDAlreadyEditing(const QString& Action, bool WasPaused);
468 
469  // Sleep dialog handling
470  void ShowOSDSleep();
471  void HandleOSDSleep(const QString& Action);
472  void SleepDialogTimeout();
473 
474  // Idle dialog handling
475  void ShowOSDIdle();
476  void HandleOSDIdle(const QString& Action);
477  void IdleDialogTimeout();
478 
479  // Exit/delete dialog handling
480  void ShowOSDStopWatchingRecording();
481  void ShowOSDPromptDeleteRecording(const QString& Title, bool Force = false);
482  bool HandleOSDVideoExit(const QString& Action);
483 
484  // Navigation Dialog
485  void StartOsdNavigation();
486 
487  // Menu dialog
488  void ShowOSDMenu(bool isCompact = false);
489  void FillOSDMenuJumpRec(const QString &Category = "", int Level = 0, const QString &Selected = "");
490  void PlaybackMenuShow(const MythTVMenu &Menu, const QDomNode &Node, const QDomNode &Selected);
491  bool MenuItemDisplay(const MythTVMenuItemContext& Context, MythOSDDialogData* Menu) override;
492  bool MenuItemDisplayPlayback(const MythTVMenuItemContext& Context, MythOSDDialogData* Menu);
493  bool MenuItemDisplayCutlist(const MythTVMenuItemContext& Context, MythOSDDialogData* Menu);
494  void PlaybackMenuInit(const MythTVMenu& Menu);
495  void PlaybackMenuDeinit(const MythTVMenu& Menu);
496  static void MenuStrings();
497  void MenuLazyInit(void* Field);
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_dbClearSavedPosition {false};
518  bool m_dbRunJobsOnRemote {false};
519  bool m_dbContinueEmbedded {false};
520  bool m_dbBrowseAlways {false};
521  bool m_dbBrowseAllTuners {false};
522  bool m_dbUseChannelGroups {false};
523  bool m_dbRememberLastChannelGroup {false};
525 
526  bool m_smartForward {false};
527  float m_ffRewRepos {1.0F};
528  bool m_ffRewReverse {false};
529  std::vector<int> m_ffRewSpeeds;
530 
531  uint m_vbimode {VBIMode::None};
532  uint m_switchToInputId {0};
533 
536  mutable bool m_wantsToQuit {true};
537  bool m_stretchAdjustment {false};
538  bool m_audiosyncAdjustment {false};
539  bool m_subtitleZoomAdjustment {false};
540  bool m_subtitleDelayAdjustment {false};
541  bool m_zoomMode {false};
542  bool m_sigMonMode {false};
543  bool m_endOfRecording {false};
544  bool m_requestDelete {false};
545  bool m_allowRerecord {false};
546  bool m_doSmartForward {false};
547  bool m_queuedTranscode {false};
551  PictureAttribute m_adjustingPictureAttribute {kPictureAttribute_None};
552 
553  // Ask Allow state
554  QMap<QString,AskProgramInfo> m_askAllowPrograms;
555 #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
556  QMutex m_askAllowLock {QMutex::Recursive};
557 #else
558  QRecursiveMutex m_askAllowLock;
559 #endif
560 
562  QMap<QString,ProgramList> m_progLists;
563 
564 #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
565  mutable QMutex m_chanEditMapLock {QMutex::Recursive};
566 #else
567  mutable QRecursiveMutex m_chanEditMapLock;
568 #endif
570 
572  static const std::vector<SleepTimerInfo> s_sleepTimes;
573  uint m_sleepIndex {0};
574  std::chrono::milliseconds m_sleepTimerTimeout {0ms};
575  int m_sleepTimerId {0};
576  int m_sleepDialogTimerId {0};
577  int m_idleTimerId {0};
579  int m_idleDialogTimerId {0};
580 
583 
584  // CC/Teletex input state variables
586  bool m_ccInputMode {false};
587 
588  // Arbitrary Seek input state variables
590  bool m_asInputMode {false};
591 
592  // Channel changing state variables
594  QString m_queuedInput;
596  mutable QString m_queuedChanNum;
598  uint m_queuedChanID {0};
600  uint m_initialChanID {0};
601 
607  static const int kScreenPressRegionCount = 12;
608  QList<QKeyEvent*> m_screenPressKeyMapPlayback;
609  QList<QKeyEvent*> m_screenPressKeyMapLiveTV;
610 
611  // Channel changing timeout notification variables
612  QElapsedTimer m_lockTimer;
613  bool m_lockTimerOn {false};
615 
616  // Program Info for currently playing video
617  // (or next video if InChangeState() is true)
618  mutable QMutex m_lastProgramLock;
619  ProgramInfo *m_lastProgram {nullptr};
620  bool m_inPlaylist {false};
621  bool m_underNetworkControl {false};
622 
623  // Program Jumping
624  bool m_jumpToProgram {false};
625 
626  // Video Player
627  PlayerContext m_playerContext { kPlayerInUseID };
628  // Ugly temporary workaround. We need a full MythPlayerInterface object but
629  // avoid endless casts
630  MythPlayerUI* m_player { nullptr };
632  mutable QReadWriteLock m_playerLock;
633 
634  bool m_noHardwareDecoders {false};
635 
636  // Remote Encoders
638  RemoteEncoder *m_switchToRec {nullptr};
639 
640  // LCD Info
641  QString m_lcdTitle;
642  QString m_lcdSubtitle;
643  QString m_lcdCallsign;
644 
645  // Window info (GUI is optional, transcoding, preview img, etc)
646  TvPlayWindow *m_myWindow {nullptr};
647  QRect m_playerBounds;
652  bool m_weDisabledGUI {false};
653 
654  // embedded and suspended status
655  bool m_ignoreKeyPresses {false};
656  bool m_savedPause {false};
657 
658  // Channel group stuff
662  mutable QMutex m_channelGroupLock;
663  volatile int m_channelGroupId {-1};
665 
666  // Network Control stuff
668 
669  // Timers
670  volatile int m_lcdTimerId {0};
671  volatile int m_lcdVolumeTimerId {0};
672  volatile int m_networkControlTimerId {0};
673  volatile int m_ccInputTimerId {0};
674  volatile int m_asInputTimerId {0};
675  volatile int m_queueInputTimerId {0};
676  volatile int m_endOfPlaybackTimerId {0};
677  volatile int m_endOfRecPromptTimerId {0};
678  volatile int m_videoExitDialogTimerId {0};
679  volatile int m_pseudoChangeChanTimerId {0};
680  volatile int m_speedChangeTimerId {0};
681  volatile int m_errorRecoveryTimerId {0};
682  mutable volatile int m_exitPlayerTimerId {0};
683  volatile int m_saveLastPlayPosTimerId {0};
684  volatile int m_signalMonitorTimerId {0};
685 
686  // Various tracks
687  // XXX This ignores kTrackTypeTextSubtitle which is greater than
688  // kTrackTypeCount, and it unnecessarily includes
689  // kTrackTypeUnknown.
690  QStringList m_tvmTracks[kTrackTypeCount];
691  int m_tvmCurtrack[kTrackTypeCount] {};
692 
693  // Audio
694  bool m_tvmAvsync {true};
695 
696  // Video
697  bool m_tvmFillAutoDetect {false};
698 
699  // Playback
700  int m_tvmSpeedX100 {100};
701  TVState m_tvmState {kState_None};
702  bool m_tvmIsRecording {false};
703  bool m_tvmIsRecorded {false};
704  bool m_tvmIsVideo {false};
705  CommSkipMode m_tvmCurSkip {kCommSkipOff};
706  bool m_tvmIsPaused {false};
707  int m_tvmFreeRecorderCount {-1};
708  bool m_tvmIsDvd {false};
709  bool m_tvmIsBd {false};
710  bool m_tvmJump {false};
711  bool m_tvmIsLiveTv {false};
712  bool m_tvmPreviousChan {false};
713 
714  // Navigate
715  int m_tvmNumChapters {0};
716  int m_tvmCurrentChapter {0};
717  QList<std::chrono::seconds> m_tvmChapterTimes;
718  int m_tvmNumAngles {0};
719  int m_tvmCurrentAngle {0};
720  int m_tvmNumTitles {0};
721  int m_tvmCurrentTitle {0};
722  // Subtitles
723  bool m_tvmSubsForcedOn {true};
724  bool m_tvmSubsHaveSubs {false};
725 
726  bool m_tvmIsOn {false};
727  bool m_tvmTranscoding {false};
728 
730  // End of playback menu state caching
731 
736 
737  public:
738  static inline const int kInitFFRWSpeed = 0; // 1x, default to normal speed
739  static inline const uint kInputKeysMax = 6; // When to start discarding early keys
740  static inline const uint kNextSource = 1;
741  static inline const uint kPreviousSource = 2;
742 
743  static inline const std::chrono::milliseconds kInputModeTimeout = 5s;
744  static inline const std::chrono::milliseconds kLCDTimeout = 1s;
745  static inline const std::chrono::milliseconds kBrowseTimeout = 30s;
746  static inline const std::chrono::milliseconds kKeyRepeatTimeout = 300ms;
747  static inline const std::chrono::milliseconds kPrevChanTimeout = 750ms;
748  static inline const std::chrono::milliseconds kSleepTimerDialogTimeout = 45s;
749  static inline const std::chrono::milliseconds kIdleTimerDialogTimeout = 45s;
750  static inline const std::chrono::milliseconds kVideoExitDialogTimeout = 2min;
751  static inline const std::chrono::milliseconds kEndOfPlaybackCheckFrequency = 250ms;
752  static inline const std::chrono::milliseconds kEmbedCheckFrequency = 250ms;
753  static inline const std::chrono::milliseconds kSpeedChangeCheckFrequency = 250ms;
754  static inline const std::chrono::milliseconds kErrorRecoveryCheckFrequency = 250ms;
755  static inline const std::chrono::milliseconds kEndOfRecPromptCheckFrequency = 250ms;
756  static inline const std::chrono::milliseconds kSaveLastPlayPosTimeout = 30s;
757 #ifdef USING_VALGRIND
758  static inline const std::chrono::milliseconds kEndOfPlaybackFirstCheckTimer = 1min;
759 #else
760  static inline const std::chrono::milliseconds kEndOfPlaybackFirstCheckTimer = 5s;
761 #endif
762 };
763 
764 #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:307
MythTVMenuItemDisplayer
Definition: mythtvmenu.h:63
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:618
tv.h
TV::DoSeek
void DoSeek(std::chrono::seconds Time, const QString &Msg, bool TimeIsOffset, bool HonorCutlist)
Definition: tv_play.h:363
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:632
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:529
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:734
TV::m_keyRepeatTimer
MythTimer m_keyRepeatTimer
Queue of unprocessed key presses.
Definition: tv_play.h:582
ReloadKeys
static void ReloadKeys(void)
Definition: mythtv/programs/mythfrontend/main.cpp:1629
TV::kBookmarkAlways
@ kBookmarkAlways
Definition: tv_play.h:292
MythTVMenuItemContext
Definition: mythtvmenu.h:36
TV::ArbSeekWhence
ArbSeekWhence
Definition: tv_play.h:367
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:312
kStartTVInPlayList
@ kStartTVInPlayList
Definition: tv_play.h:114
TV::m_screenPressKeyMapPlayback
QList< QKeyEvent * > m_screenPressKeyMapPlayback
Definition: tv_play.h:608
kStartTVNoFlags
@ kStartTVNoFlags
Definition: tv_play.h:113
TV::HasQueuedChannel
bool HasQueuedChannel() const
Definition: tv_play.h:335
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:571
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:594
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:562
TV::kBookmarkNever
@ kBookmarkNever
Definition: tv_play.h:293
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:612
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:717
TV::m_dbChannelGroups
ChannelGroupList m_dbChannelGroups
Definition: tv_play.h:524
TV::m_channelGroupChannelList
ChannelInfoList m_channelGroupChannelList
Definition: tv_play.h:664
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:291
TV::m_cutlistCompactMenu
MythTVMenu m_cutlistCompactMenu
Definition: tv_play.h:735
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:569
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:567
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:289
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:733
GuideGrid
Definition: guidegrid.h:102
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:596
TV::m_savedGuiBounds
QRect m_savedGuiBounds
Definition: tv_play.h:650
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
TVBrowseHelper
Definition: tvbrowsehelper.h:45
TV::m_askAllowLock
QRecursiveMutex m_askAllowLock
Definition: tv_play.h:558
referencecounter.h
PictureAttribute
PictureAttribute
Definition: videoouttypes.h:103
volumebase.h
InitKeys
static void InitKeys(void)
Definition: mythtv/programs/mythfrontend/main.cpp:1577
TV::HasQueuedInput
bool HasQueuedInput() const
Definition: tv_play.h:334
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:614
mythmiscutil.h
TV::m_progListsLock
QMutex m_progListsLock
Definition: tv_play.h:561
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:729
MythDeque< QString >
std
Definition: mythchrono.h:23
ProgInfo
Definition: programdata.h:221
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:643
MythTVMenu
Definition: mythtvmenu.h:70
decoderbase.h
TVBrowseHelper::TV
friend class TV
Definition: tvbrowsehelper.h:47
TV::m_lcdTitle
QString m_lcdTitle
Definition: tv_play.h:641
TV::m_channelGroupLock
QMutex m_channelGroupLock
Lock necessary when modifying channel group variables.
Definition: tv_play.h:662
PlayerContext
Definition: playercontext.h:52
inputinfo.h
TV::m_screenPressKeyMapLiveTV
QList< QKeyEvent * > m_screenPressKeyMapLiveTV
Definition: tv_play.h:609
TV::m_playbackMenu
MythTVMenu m_playbackMenu
Definition: tv_play.h:732
mythtimer.h
TV::SetInPlayList
void SetInPlayList(bool InPlayList)
Definition: tv_play.h:288
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:309
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:667
TV::m_lcdSubtitle
QString m_lcdSubtitle
Definition: tv_play.h:642
kOSDTimeout_Med
@ kOSDTimeout_Med
Definition: osd.h:61
TV::GetQueuedChanID
uint GetQueuedChanID() const
Definition: tv_play.h:341
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:315
TV::m_askAllowPrograms
QMap< QString, AskProgramInfo > m_askAllowPrograms
Definition: tv_play.h:554
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