13#include <QReadWriteLock>
14#include <QWaitCondition>
21#include <QRecursiveMutex>
25#include "libmythbase/mythconfig.h"
167 bool event(QEvent*
Event)
override;
168 bool eventFilter(QObject* Object, QEvent*
Event)
override;
170 static bool IsTVRunning();
172 static bool IsPaused();
174 static void SetFuncPtr(
const char*
Name,
void* Pointer);
175 static int ConfiguredTunerCards();
176 static bool IsTunable(
uint ChanId);
185 void HandleOSDClosed(
int OSDType);
191 void timerEvent(QTimerEvent*
Event)
override;
194 void onApplicationStateChange(Qt::ApplicationState
State);
195 void customEvent(QEvent*
Event)
override;
196 void VolumeChange(
bool Up,
int NewVolume = -1);
199 void Embed(
bool Embed, QRect Rect = {},
const QStringList& Data = {});
202 static inline QStringList lastProgramStringList = {};
214 bool StartPlaying(std::chrono::milliseconds MaxWait = -1ms);
217 static TV* AcquireRelease(
int& RefCount,
bool Acquire,
bool Create =
false);
220 static QList<QKeyEvent*> ConvertScreenPressKeyMap(
const QString& KeyList);
228 bool ProcessKeypressOrGesture(QEvent*
Event);
229 bool TranslateKeyPressOrGesture(
const QString& Context, QEvent*
Event,
230 QStringList& Actions,
bool IsLiveTV,
231 bool AllowJumps =
true);
233 QStringList& Actions,
bool IsLiveTV);
234 void ProcessNetworkControlCommand(
const QString&
Command);
236 bool HandleTrackAction(
const QString&
Action);
237 bool ActiveHandleAction(
const QStringList& Actions,
bool IsDVD,
bool IsDVDStillFrame);
238 bool BrowseHandleAction(
const QStringList& Actions);
239 void OSDDialogEvent(
int Result,
const QString& Text, QString
Action);
240 bool ToggleHandleAction(
const QStringList& Actions,
bool IsDVD);
241 bool FFRewHandleAction(
const QStringList& Actions);
242 bool ActivePostQHandleAction(
const QStringList& Actions);
243 bool HandleJumpToProgramAction(
const QStringList& Actions);
244 bool SeekHandleAction(
const QStringList& Actions,
bool IsDVD);
245 bool TimeStretchHandleAction(
const QStringList& Actions);
246 bool DiscMenuHandleAction(
const QStringList& Actions)
const;
249 int StartTimer(std::chrono::milliseconds Interval,
int Line);
250 void KillTimer(
int Id);
252 void SetSpeedChangeTimer(std::chrono::milliseconds When,
int Line);
253 void HandleEndOfPlaybackTimerEvent();
254 void HandleEndOfRecordingExitPromptTimerEvent();
255 void HandleVideoExitDialogTimerEvent();
256 void HandlePseudoLiveTVTimerEvent();
257 void HandleSpeedChangeTimerEvent();
258 void ToggleSleepTimer();
259 void ToggleSleepTimer(
const QString& Time);
260 bool HandleLCDTimerEvent();
261 void HandleLCDVolumeTimerEvent();
262 void HandleSaveLastPlayPosEvent();
266 const QString& arg =
"");
267 bool IsTunablePriv(
uint ChanId);
271 const QString & EditArg =
"");
272 QString GetRecordingGroup()
const;
273 void UpdateChannelList(
int GroupID);
277 void ReturnOSDLock()
const;
278 void GetPlayerWriteLock()
const;
279 void GetPlayerReadLock()
const;
280 void ReturnPlayerLock()
const;
283 void ToggleAutoExpire();
292 void HandleStateChange();
294 void ForceNextStateNone();
295 void ScheduleStateChange();
296 void ScheduleInputChange();
306 void PrepareToExitPlayer(
int Line);
307 void SetExitPlayer(
bool SetIt,
bool WantsTo);
312 bool StartRecorder(std::chrono::milliseconds MaxWait = -1ms);
313 void StopStuff(
bool StopRingBuffer,
bool StopPlayer,
bool StopRecorder);
314 bool StartPlayer(
TVState desiredState);
326 bool IsDeleteAllowed();
329 static void ToggleChannelFavorite();
330 void ToggleChannelFavorite(
const QString &ChangroupName)
const;
332 void ChangeChannel(
uint Chanid,
const QString&
Channum);
334 void ShowPreviousChannel();
335 void PopPreviousChannel(
bool ImmediateChange);
338 void AddKeyToInputQueue(
char Key);
339 void ClearInputQueues(
bool Hideosd);
340 bool CommitQueuedInput();
341 bool ProcessSmartChannel(QString &InputStr);
348 QString GetQueuedInput()
const;
349 int GetQueuedInputAsInt(
bool *
OK =
nullptr,
int Base = 10)
const;
350 QString GetQueuedChanNum()
const;
354 void SwitchSource(
uint Direction);
355 void SwitchInputs(
uint ChanID = 0, QString ChanNum =
"",
uint InputID = 0);
359 void UnpauseLiveTV(
bool Quietly =
false);
361 float DoTogglePauseStart();
362 void DoTogglePauseFinish(
float Time,
bool ShowOSD);
363 void DoTogglePause(
bool ShowOSD);
364 bool DoSetPauseState(
bool Pause);
365 bool ContextIsPaused(
const char* File,
int Location);
372 void DoSeek(
float Time,
const QString &Msg,
bool TimeIsOffset,
bool HonorCutlist);
373 void DoSeek(std::chrono::seconds TimeInSec,
const QString &Msg,
bool TimeIsOffset,
bool HonorCutlist) {
374 DoSeek(TimeInSec.count(), Msg, TimeIsOffset, HonorCutlist); };
375 bool DoPlayerSeek(
float Time);
376 bool DoPlayerSeekToFrame(uint64_t FrameNum);
377 enum ArbSeekWhence : uint8_t { ARBSEEK_SET = 0, ARBSEEK_REWIND, ARBSEEK_FORWARD, ARBSEEK_END };
378 void DoSeekAbsolute(
long long Seconds,
bool HonorCutlist);
379 void DoArbSeek(ArbSeekWhence Whence,
bool HonorCutlist);
385 void ChangeSpeed(
int Direction);
386 void ToggleTimeStretch();
387 void ChangeTimeStretch(
int Dir,
bool AllowEdit =
true);
389 void DVDJumpForward();
391 void ChangeFFRew(
int Direction);
392 void SetFFRew(
int Index);
395 bool AudioSyncHandleAction(
const QStringList& Actions);
398 int GetNumChapters();
399 void GetChapterTimes(QList<std::chrono::seconds> &Times);
400 int GetCurrentChapter();
402 int GetCurrentTitle();
403 std::chrono::seconds GetTitleDuration(
int Title);
404 QString GetTitleName(
int Title);
405 void DoSwitchTitle(
int Title);
407 int GetCurrentAngle();
408 QString GetAngleName(
int Angle);
409 void DoSwitchAngle(
int Angle);
410 void DoJumpChapter(
int Chapter);
413 void DoSkipCommercials(
int Direction);
417 void DoQueueTranscode(
const QString& Profile);
420 bool IsBookmarkAllowed();
421 void SetBookmark(
bool Clear =
false);
425 void ToggleOSD(
bool IncludeStatusOSD);
426 void UpdateOSDProgInfo(
const char *WhichInfo);
427 void UpdateOSDStatus(
const QString& Title,
const QString& Desc,
428 const QString& Value,
int Type,
const QString& Units,
431 void UpdateOSDSeekMessage(
const QString &Msg,
enum OSDTimeout Timeout);
432 void UpdateOSDInput();
433 void UpdateOSDSignal(
const QStringList &List);
434 void UpdateOSDTimeoutMessage();
435 bool CalcPlayerSliderPosition(
osdInfo &
info,
bool paddedFields =
false)
const;
436 void HideOSDWindow(
const char *window);
439 bool SubtitleZoomHandleAction(
const QStringList& Actions);
440 bool SubtitleDelayHandleAction(
const QStringList &Actions);
444 bool PictureAttributeHandleAction(
const QStringList &Actions);
449 void ITVRestart(
bool IsLive);
452 void SetManualZoom(
bool ZoomON,
const QString& Desc);
453 bool ManualZoomHandleAction(
const QStringList &Actions);
456 void StartChannelEditMode();
457 bool HandleOSDChannelEdit(
const QString&
Action);
458 void ChannelEditAutoFill(
InfoMap &Info);
459 void ChannelEditXDSFill(
InfoMap &Info);
462 bool DialogIsVisible(
const QString &Dialog);
463 void HandleOSDInfo(
const QString&
Action);
467 void ShowOSDAskAllow();
468 void HandleOSDAskAllow(
const QString&
Action);
469 void AskAllowRecording(
const QStringList &Msg,
int Timeuntil,
bool HasRec,
bool HasLater);
472 void ShowOSDCutpoint(
const QString &Type);
473 bool HandleOSDCutpoint(
const QString&
Action);
474 void StartProgramEditMode();
477 void ShowOSDAlreadyEditing();
478 void HandleOSDAlreadyEditing(
const QString&
Action,
bool WasPaused);
482 void HandleOSDSleep(
const QString&
Action);
483 void SleepDialogTimeout();
487 void HandleOSDIdle(
const QString&
Action);
488 void IdleDialogTimeout();
491 void ShowOSDStopWatchingRecording();
492 void ShowOSDPromptDeleteRecording(
const QString& Title,
bool Force =
false);
493 bool HandleOSDVideoExit(
const QString&
Action);
496 void StartOsdNavigation();
499 void ShowOSDMenu(
bool isCompact =
false);
500 void FillOSDMenuJumpRec(
const QString &Category =
"",
int Level = 0,
const QString &Selected =
"");
502 const QVector<string_pair> & people);
503 void FillOSDMenuCast(
void);
504 void FillOSDMenuActorShows(
const QString & actor,
int person_id,
505 const QString & category =
"");
506 void PlaybackMenuShow(
const MythTVMenu &Menu,
const QDomNode &Node,
const QDomNode &Selected);
509 void PlaybackMenuInit(
const MythTVMenu& Menu);
510 void PlaybackMenuDeinit(
const MythTVMenu& Menu);
511 static void MenuStrings();
512 void MenuLazyInit(
void* Field);
517 void ShowLCDChannelInfo();
518 void ShowLCDDVDInfo();
521 static inline int m_activeChannelGroupId {-1};
532 QString m_dbChannelFormat {
"<num> <sign>"};
533 std::chrono::milliseconds m_dbIdleTimeout {0ms};
534 int m_dbPlaybackExitPrompt {0};
535 uint m_dbAutoexpireDefault {0};
536 bool m_dbAutoSetWatched {
false};
537 bool m_dbEndOfRecExitPrompt {
false};
538 bool m_dbJumpPreferOsd {
true};
539 bool m_dbUseGuiSizeForTv {
false};
540 bool m_dbUseVideoModes {
false};
541 bool m_dbRunJobsOnRemote {
false};
542 bool m_dbContinueEmbedded {
false};
543 bool m_dbBrowseAlways {
false};
546 bool m_dbRememberLastChannelGroup {
false};
549 bool m_smartForward {
false};
550 float m_ffRewRepos {1.0F};
551 bool m_ffRewReverse {
false};
559 mutable bool m_wantsToQuit {
true};
560 bool m_stretchAdjustment {
false};
561 bool m_audiosyncAdjustment {
false};
562 bool m_subtitleZoomAdjustment {
false};
563 bool m_subtitleDelayAdjustment {
false};
564 bool m_zoomMode {
false};
565 bool m_sigMonMode {
false};
566 bool m_endOfRecording {
false};
567 bool m_requestDelete {
false};
568 bool m_allowRerecord {
false};
569 bool m_doSmartForward {
false};
570 bool m_queuedTranscode {
false};
571 bool m_savePosOnExit {
false};
572 bool m_clearPosOnExit {
false};
595 std::chrono::milliseconds m_sleepTimerTimeout {0ms};
596 int m_sleepTimerId {0};
597 int m_sleepDialogTimerId {0};
599 int m_idleTimerId {0};
600 int m_idleDialogTimerId {0};
607 bool m_ccInputMode {
false};
611 bool m_asInputMode {
false};
628 static const int kScreenPressRegionCount = 12;
634 bool m_lockTimerOn {
false};
641 bool m_inPlaylist {
false};
642 bool m_underNetworkControl {
false};
645 bool m_jumpToProgram {
false};
655 bool m_noHardwareDecoders {
false};
673 bool m_weDisabledGUI {
false};
676 bool m_ignoreKeyPresses {
false};
677 bool m_savedPause {
false};
684 volatile int m_channelGroupId {-1};
691 volatile int m_lcdTimerId {0};
692 volatile int m_lcdVolumeTimerId {0};
693 volatile int m_networkControlTimerId {0};
694 volatile int m_ccInputTimerId {0};
695 volatile int m_asInputTimerId {0};
696 volatile int m_queueInputTimerId {0};
697 volatile int m_endOfPlaybackTimerId {0};
698 volatile int m_endOfRecPromptTimerId {0};
699 volatile int m_videoExitDialogTimerId {0};
700 volatile int m_pseudoChangeChanTimerId {0};
701 volatile int m_speedChangeTimerId {0};
702 volatile int m_errorRecoveryTimerId {0};
703 mutable volatile int m_exitPlayerTimerId {0};
704 volatile int m_saveLastPlayPosTimerId {0};
705 volatile int m_signalMonitorTimerId {0};
712 std::array<int,kTrackTypeCount> m_tvmCurtrack {};
715 bool m_tvmAvsync {
true};
718 bool m_tvmFillAutoDetect {
false};
721 int m_tvmSpeedX100 {100};
723 bool m_tvmIsRecording {
false};
724 bool m_tvmIsRecorded {
false};
725 bool m_tvmIsVideo {
false};
727 bool m_tvmIsPaused {
false};
728 int m_tvmFreeRecorderCount {-1};
729 bool m_tvmIsDvd {
false};
730 bool m_tvmIsBd {
false};
731 bool m_tvmJump {
false};
732 bool m_tvmIsLiveTv {
false};
733 bool m_tvmPreviousChan {
false};
736 int m_tvmNumChapters {0};
737 int m_tvmCurrentChapter {0};
739 int m_tvmNumAngles {0};
740 int m_tvmCurrentAngle {0};
741 int m_tvmNumTitles {0};
742 int m_tvmCurrentTitle {0};
744 bool m_tvmSubsForcedOn {
true};
745 bool m_tvmSubsHaveSubs {
false};
747 bool m_tvmIsOn {
false};
748 bool m_tvmTranscoding {
false};
759 static inline const int kInitFFRWSpeed = 0;
760 static inline const uint kInputKeysMax = 6;
761 static inline const uint kNextSource = 1;
762 static inline const uint kPreviousSource = 2;
764 static inline const std::chrono::milliseconds kInputModeTimeout = 5s;
765 static inline const std::chrono::milliseconds kLCDTimeout = 1s;
766 static inline const std::chrono::milliseconds kBrowseTimeout = 30s;
767 static inline const std::chrono::milliseconds kKeyRepeatTimeout = 300ms;
768 static inline const std::chrono::milliseconds kPrevChanTimeout = 750ms;
769 static inline const std::chrono::milliseconds kSleepTimerDialogTimeout = 45s;
770 static inline const std::chrono::milliseconds kIdleTimerDialogTimeout = 45s;
771 static inline const std::chrono::milliseconds kVideoExitDialogTimeout = 2min;
772 static inline const std::chrono::milliseconds kEndOfPlaybackCheckFrequency = 250ms;
773 static inline const std::chrono::milliseconds kEmbedCheckFrequency = 250ms;
774 static inline const std::chrono::milliseconds kSpeedChangeCheckFrequency = 250ms;
775 static inline const std::chrono::milliseconds kErrorRecoveryCheckFrequency = 250ms;
776 static inline const std::chrono::milliseconds kEndOfRecPromptCheckFrequency = 250ms;
777 static inline const std::chrono::milliseconds kSaveLastPlayPosTimeout = 5s;
779 static inline const std::chrono::milliseconds kEndOfPlaybackFirstCheckTimer = 1min;
781 static inline const std::chrono::milliseconds kEndOfPlaybackFirstCheckTimer = 5s;
std::vector< ChannelGroupItem > ChannelGroupList
std::vector< ChannelInfo > ChannelInfoList
An action (for this plugin) consists of a description, and a set of key sequences.
AskProgramInfo(QDateTime e, bool r, bool l, ProgramInfo *i)
bool m_isInSameInputGroup
A custom event that represents a mouse gesture.
A QElapsedTimer based timer to replace use of QTime as a timer.
Holds information on recordings and videos.
General purpose reference counter.
SavePositionThread(ProgramInfo *progInfoPtr, uint64_t framesPos)
bool m_dbUseChannelGroups
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.
QList< std::chrono::seconds > m_tvmChapterTimes
MythTVMenu m_playbackCompactMenu
InfoMap m_chanEditMap
Channel Editing initial map.
QList< QKeyEvent * > m_screenPressKeyMapLiveTV
bool GetJumpToProgram() const
This is set if the user asked MythTV to jump to the previous recording in the playlist.
QList< QKeyEvent * > m_screenPressKeyMapPlayback
uint GetQueuedChanID() const
QMap< QString, ProgramList > m_progLists
MythDeque< QString > m_networkControlCommands
MythTVMenu m_cutlistCompactMenu
bool HasQueuedChannel() const
bool GetAllowRerecord() const
Returns true if the user told Mythtv to allow re-recording of the show.
QVector< string_pair > m_guests
ChannelGroupList m_dbChannelGroups
void setUnderNetworkControl(bool setting)
bool GetEndOfRecording() const
This is set to true if the player reaches the end of the recording without the user explicitly exitin...
QVariant m_tvmJumprecBackHack
QMap< QString, AskProgramInfo > m_askAllowPrograms
QString m_queuedChanNum
Input key presses queued up so far to form a valid ChanNum.
static void SetActiveChannelGroupId(int channelgroupid)
static const std::vector< SleepTimerInfo > kSleepTimes
MythTimer m_keyRepeatTimer
Queue of unprocessed key presses.
static int GetActiveChannelGroupId()
QRect m_playerBounds
Prior GUI window bounds, for DoEditSchedule() and player exit().
QReadWriteLock m_playerLock
lock on player and playerActive changes
QRecursiveMutex m_askAllowLock
void PlaybackExiting(TV *Player)
QVector< string_pair > m_guestStars
std::array< QStringList, kTrackTypeCount > m_tvmTracks
QPair< QString, QString > string_pair
QMutex m_channelGroupLock
Lock necessary when modifying channel group variables.
std::vector< int > m_ffRewSpeeds
QDateTime m_lastLockSeenTime
QString m_queuedInput
Input key presses queued up so far...
MythTVMenu m_playbackMenu
bool IsSwitchingCards() const
Returns true if we are currently in the process of switching recorders.
void DoSeek(std::chrono::seconds TimeInSec, const QString &Msg, bool TimeIsOffset, bool HonorCutlist)
QElapsedTimer m_lockTimer
QRecursiveMutex m_chanEditMapLock
Lock for chanEditMap and ddMap.
bool HasQueuedInput() const
QVector< string_pair > m_actors
void SetInPlayList(bool InPlayList)
ChannelInfoList m_channelGroupChannelList
Simple screen shown while the video player is starting up.
static void ReloadKeys(void)
static void InitKeys(void)
QHash< QString, QString > InfoMap
const QString kPlayerInUseID
ChannelChangeDirection
ChannelChangeDirection is an enumeration of possible channel changing directions.
TVState
TVState is an enumeration of the states used by TV and TVRec.
@ kState_None
None State, this is the initial state in both TV and TVRec, it indicates that we are ready to change ...
void(*)(const ProgramInfo *, void *) EMBEDRETURNVOIDSCHEDIT
void(*)(void *, bool) EMBEDRETURNVOID
void(*)(uint, const QString &, const QDateTime, TV *, bool, bool, int) EMBEDRETURNVOIDEPG
void(*)(TV *, int, const QString &) EMBEDRETURNVOIDPROGLIST
@ kStartTVIgnoreLastPlayPos
@ kStartTVIgnoreProgStart
@ kStartTVByNetworkCommand
void(*)(TV *, bool, bool) EMBEDRETURNVOIDFINDER
NoRecorderMsg
Type of message displayed in ShowNoRecorderDialog()
@ kNoRecorders
No free recorders.
@ kNoCurrRec
No current recordings.
@ kNoTuners
No capture cards configured.