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