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