14#include <QReadWriteLock>
15#include <QWaitCondition>
22#include <QRecursiveMutex>
26#include "libmythbase/mythconfig.h"
168 bool event(QEvent*
Event)
override;
169 bool eventFilter(QObject* Object, QEvent*
Event)
override;
171 static bool IsTVRunning();
173 static bool IsPaused();
175 static void SetFuncPtr(
const char*
Name,
void* Pointer);
176 static int ConfiguredTunerCards();
177 static bool IsTunable(
uint ChanId);
186 void HandleOSDClosed(
int OSDType);
192 void timerEvent(QTimerEvent*
Event)
override;
195 void onApplicationStateChange(Qt::ApplicationState
State);
196 void customEvent(QEvent*
Event)
override;
197 void VolumeChange(
bool Up,
int NewVolume = -1);
200 void Embed(
bool Embed, QRect Rect = {},
const QStringList& Data = {});
203 static inline QStringList lastProgramStringList = {};
215 bool StartPlaying(std::chrono::milliseconds MaxWait = -1ms);
218 static TV* AcquireRelease(
int& RefCount,
bool Acquire,
bool Create =
false);
221 static QList<QKeyEvent*> ConvertScreenPressKeyMap(
const QString& KeyList);
229 bool ProcessKeypressOrGesture(QEvent*
Event);
230 bool TranslateKeyPressOrGesture(
const QString& Context, QEvent*
Event,
231 QStringList& Actions,
bool IsLiveTV,
232 bool AllowJumps =
true);
234 QStringList& Actions,
bool IsLiveTV);
235 void ProcessNetworkControlCommand(
const QString&
Command);
237 bool HandleTrackAction(
const QString&
Action);
238 bool ActiveHandleAction(
const QStringList& Actions,
bool IsDVD,
bool IsDVDStillFrame);
239 bool BrowseHandleAction(
const QStringList& Actions);
240 void OSDDialogEvent(
int Result,
const QString& Text, QString
Action);
241 bool ToggleHandleAction(
const QStringList& Actions,
bool IsDVD);
242 bool FFRewHandleAction(
const QStringList& Actions);
243 bool ActivePostQHandleAction(
const QStringList& Actions);
244 bool HandleJumpToProgramAction(
const QStringList& Actions);
245 bool SeekHandleAction(
const QStringList& Actions,
bool IsDVD);
246 bool TimeStretchHandleAction(
const QStringList& Actions);
247 bool DiscMenuHandleAction(
const QStringList& Actions)
const;
250 int StartTimer(std::chrono::milliseconds Interval,
int Line);
251 void KillTimer(
int Id);
253 void SetSpeedChangeTimer(std::chrono::milliseconds When,
int Line);
254 void HandleEndOfPlaybackTimerEvent();
255 void HandleEndOfRecordingExitPromptTimerEvent();
256 void HandleVideoExitDialogTimerEvent();
257 void HandlePseudoLiveTVTimerEvent();
258 void HandleSpeedChangeTimerEvent();
259 void ToggleSleepTimer();
260 void ToggleSleepTimer(
const QString& Time);
261 bool HandleLCDTimerEvent();
262 void HandleLCDVolumeTimerEvent();
263 void HandleSaveLastPlayPosEvent();
267 const QString& arg =
"");
268 bool IsTunablePriv(
uint ChanId);
272 const QString & EditArg =
"");
273 QString GetRecordingGroup()
const;
274 void UpdateChannelList(
int GroupID);
278 void ReturnOSDLock()
const;
279 void GetPlayerWriteLock()
const;
280 void GetPlayerReadLock()
const;
281 void ReturnPlayerLock()
const;
284 void ToggleAutoExpire();
293 void HandleStateChange();
295 void ForceNextStateNone();
296 void ScheduleStateChange();
297 void ScheduleInputChange();
307 void PrepareToExitPlayer(
int Line);
308 void SetExitPlayer(
bool SetIt,
bool WantsTo);
313 bool StartRecorder(std::chrono::milliseconds MaxWait = -1ms);
314 void StopStuff(
bool StopRingBuffer,
bool StopPlayer,
bool StopRecorder);
315 bool StartPlayer(
TVState desiredState);
327 bool IsDeleteAllowed();
330 static void ToggleChannelFavorite();
331 void ToggleChannelFavorite(
const QString &ChangroupName)
const;
333 void ChangeChannel(
uint Chanid,
const QString&
Channum);
335 void ShowPreviousChannel();
336 void PopPreviousChannel(
bool ImmediateChange);
339 void AddKeyToInputQueue(
char Key);
340 void ClearInputQueues(
bool Hideosd);
341 bool CommitQueuedInput();
342 bool ProcessSmartChannel(QString &InputStr);
349 QString GetQueuedInput()
const;
350 int GetQueuedInputAsInt(
bool *
OK =
nullptr,
int Base = 10)
const;
351 QString GetQueuedChanNum()
const;
355 void SwitchSource(
uint Direction);
356 void SwitchInputs(
uint ChanID = 0, QString ChanNum =
"",
uint InputID = 0);
360 void UnpauseLiveTV(
bool Quietly =
false);
362 float DoTogglePauseStart();
363 void DoTogglePauseFinish(
float Time,
bool ShowOSD);
364 void DoTogglePause(
bool ShowOSD);
365 bool DoSetPauseState(
bool Pause);
366 bool ContextIsPaused(
const char* File,
int Location);
373 void DoSeek(
float Time,
const QString &Msg,
bool TimeIsOffset,
bool HonorCutlist);
374 void DoSeek(std::chrono::seconds TimeInSec,
const QString &Msg,
bool TimeIsOffset,
bool HonorCutlist) {
375 DoSeek(TimeInSec.count(), Msg, TimeIsOffset, HonorCutlist); };
376 bool DoPlayerSeek(
float Time);
377 bool DoPlayerSeekToFrame(uint64_t FrameNum);
378 enum ArbSeekWhence : uint8_t { ARBSEEK_SET = 0, ARBSEEK_REWIND, ARBSEEK_FORWARD, ARBSEEK_END };
379 void DoSeekAbsolute(
long long Seconds,
bool HonorCutlist);
380 void DoArbSeek(ArbSeekWhence Whence,
bool HonorCutlist);
386 void ChangeSpeed(
int Direction);
387 void ToggleTimeStretch();
388 void ChangeTimeStretch(
int Dir,
bool AllowEdit =
true);
390 void DVDJumpForward();
392 void ChangeFFRew(
int Direction);
393 void SetFFRew(
int Index);
396 bool AudioSyncHandleAction(
const QStringList& Actions);
399 int GetNumChapters();
400 void GetChapterTimes(QList<std::chrono::seconds> &Times);
401 int GetCurrentChapter();
403 int GetCurrentTitle();
404 std::chrono::seconds GetTitleDuration(
int Title);
405 QString GetTitleName(
int Title);
406 void DoSwitchTitle(
int Title);
408 int GetCurrentAngle();
409 QString GetAngleName(
int Angle);
410 void DoSwitchAngle(
int Angle);
411 void DoJumpChapter(
int Chapter);
414 void DoSkipCommercials(
int Direction);
418 void DoQueueTranscode(
const QString& Profile);
421 bool IsBookmarkAllowed();
422 void SetBookmark(
bool Clear =
false);
426 void ToggleOSD(
bool IncludeStatusOSD);
427 void UpdateOSDProgInfo(
const char *WhichInfo);
428 void UpdateOSDStatus(
const QString& Title,
const QString& Desc,
429 const QString& Value,
int Type,
const QString& Units,
432 void UpdateOSDSeekMessage(
const QString &Msg,
enum OSDTimeout Timeout);
433 void UpdateOSDInput();
434 void UpdateOSDSignal(
const QStringList &List);
435 void UpdateOSDTimeoutMessage();
436 bool CalcPlayerSliderPosition(
osdInfo &
info,
bool paddedFields =
false)
const;
437 void HideOSDWindow(
const char *window);
440 bool SubtitleZoomHandleAction(
const QStringList& Actions);
441 bool SubtitleDelayHandleAction(
const QStringList &Actions);
445 bool PictureAttributeHandleAction(
const QStringList &Actions);
450 void ITVRestart(
bool IsLive);
453 void SetManualZoom(
bool ZoomON,
const QString& Desc);
454 bool ManualZoomHandleAction(
const QStringList &Actions);
457 void StartChannelEditMode();
458 bool HandleOSDChannelEdit(
const QString&
Action);
459 void ChannelEditAutoFill(
InfoMap &Info);
460 void ChannelEditXDSFill(
InfoMap &Info);
463 bool DialogIsVisible(
const QString &Dialog);
464 void HandleOSDInfo(
const QString&
Action);
468 void ShowOSDAskAllow();
469 void HandleOSDAskAllow(
const QString&
Action);
470 void AskAllowRecording(
const QStringList &Msg,
int Timeuntil,
bool HasRec,
bool HasLater);
473 void ShowOSDCutpoint(
const QString &Type);
474 bool HandleOSDCutpoint(
const QString&
Action);
475 void StartProgramEditMode();
478 void ShowOSDAlreadyEditing();
479 void HandleOSDAlreadyEditing(
const QString&
Action,
bool WasPaused);
483 void HandleOSDSleep(
const QString&
Action);
484 void SleepDialogTimeout();
488 void HandleOSDIdle(
const QString&
Action);
489 void IdleDialogTimeout();
492 void ShowOSDStopWatchingRecording();
493 void ShowOSDPromptDeleteRecording(
const QString& Title,
bool Force =
false);
494 bool HandleOSDVideoExit(
const QString&
Action);
497 void StartOsdNavigation();
500 void ShowOSDMenu(
bool isCompact =
false);
501 void FillOSDMenuJumpRec(
const QString &Category =
"",
int Level = 0,
const QString &Selected =
"");
503 const QVector<string_pair> & people);
504 void FillOSDMenuCast(
void);
505 void FillOSDMenuActorShows(
const QString & actor,
int person_id,
506 const QString & category =
"");
507 void PlaybackMenuShow(
const MythTVMenu &Menu,
const QDomNode &Node,
const QDomNode &Selected);
510 void PlaybackMenuInit(
const MythTVMenu& Menu);
511 void PlaybackMenuDeinit(
const MythTVMenu& Menu);
512 static void MenuStrings();
513 void MenuLazyInit(
void* Field);
518 void ShowLCDChannelInfo();
519 void ShowLCDDVDInfo();
522 static inline int m_activeChannelGroupId {-1};
533 QString m_dbChannelFormat {
"<num> <sign>"};
534 std::chrono::milliseconds m_dbIdleTimeout {0ms};
535 int m_dbPlaybackExitPrompt {0};
536 uint m_dbAutoexpireDefault {0};
537 bool m_dbAutoSetWatched {
false};
538 bool m_dbEndOfRecExitPrompt {
false};
539 bool m_dbJumpPreferOsd {
true};
540 bool m_dbUseGuiSizeForTv {
false};
541 bool m_dbUseVideoModes {
false};
542 bool m_dbRunJobsOnRemote {
false};
543 bool m_dbContinueEmbedded {
false};
544 bool m_dbBrowseAlways {
false};
547 bool m_dbRememberLastChannelGroup {
false};
550 bool m_smartForward {
false};
551 float m_ffRewRepos {1.0F};
552 bool m_ffRewReverse {
false};
560 mutable bool m_wantsToQuit {
true};
561 bool m_stretchAdjustment {
false};
562 bool m_audiosyncAdjustment {
false};
563 bool m_subtitleZoomAdjustment {
false};
564 bool m_subtitleDelayAdjustment {
false};
565 bool m_zoomMode {
false};
566 bool m_sigMonMode {
false};
567 bool m_endOfRecording {
false};
568 bool m_requestDelete {
false};
569 bool m_allowRerecord {
false};
570 bool m_doSmartForward {
false};
571 bool m_queuedTranscode {
false};
572 bool m_savePosOnExit {
false};
573 bool m_clearPosOnExit {
false};
596 std::chrono::milliseconds m_sleepTimerTimeout {0ms};
597 int m_sleepTimerId {0};
598 int m_sleepDialogTimerId {0};
600 int m_idleTimerId {0};
601 int m_idleDialogTimerId {0};
608 bool m_ccInputMode {
false};
612 bool m_asInputMode {
false};
629 static const int kScreenPressRegionCount = 12;
635 bool m_lockTimerOn {
false};
642 bool m_inPlaylist {
false};
643 bool m_underNetworkControl {
false};
646 bool m_jumpToProgram {
false};
656 bool m_noHardwareDecoders {
false};
674 bool m_weDisabledGUI {
false};
677 bool m_ignoreKeyPresses {
false};
678 bool m_savedPause {
false};
685 volatile int m_channelGroupId {-1};
692 volatile int m_lcdTimerId {0};
693 volatile int m_lcdVolumeTimerId {0};
694 volatile int m_networkControlTimerId {0};
695 volatile int m_ccInputTimerId {0};
696 volatile int m_asInputTimerId {0};
697 volatile int m_queueInputTimerId {0};
698 volatile int m_endOfPlaybackTimerId {0};
699 volatile int m_endOfRecPromptTimerId {0};
700 volatile int m_videoExitDialogTimerId {0};
701 volatile int m_pseudoChangeChanTimerId {0};
702 volatile int m_speedChangeTimerId {0};
703 volatile int m_errorRecoveryTimerId {0};
704 mutable volatile int m_exitPlayerTimerId {0};
705 volatile int m_saveLastPlayPosTimerId {0};
706 volatile int m_signalMonitorTimerId {0};
713 std::array<int,kTrackTypeCount> m_tvmCurtrack {};
716 bool m_tvmAvsync {
true};
719 bool m_tvmFillAutoDetect {
false};
722 int m_tvmSpeedX100 {100};
724 bool m_tvmIsRecording {
false};
725 bool m_tvmIsRecorded {
false};
726 bool m_tvmIsVideo {
false};
728 bool m_tvmIsPaused {
false};
729 int m_tvmFreeRecorderCount {-1};
730 bool m_tvmIsDvd {
false};
731 bool m_tvmIsBd {
false};
732 bool m_tvmJump {
false};
733 bool m_tvmIsLiveTv {
false};
734 bool m_tvmPreviousChan {
false};
737 int m_tvmNumChapters {0};
738 int m_tvmCurrentChapter {0};
740 int m_tvmNumAngles {0};
741 int m_tvmCurrentAngle {0};
742 int m_tvmNumTitles {0};
743 int m_tvmCurrentTitle {0};
745 bool m_tvmSubsForcedOn {
true};
746 bool m_tvmSubsHaveSubs {
false};
748 bool m_tvmIsOn {
false};
749 bool m_tvmTranscoding {
false};
760 static inline const int kInitFFRWSpeed = 0;
761 static inline const uint kInputKeysMax = 6;
762 static inline const uint kNextSource = 1;
763 static inline const uint kPreviousSource = 2;
765 static inline const std::chrono::milliseconds kInputModeTimeout = 5s;
766 static inline const std::chrono::milliseconds kLCDTimeout = 1s;
767 static inline const std::chrono::milliseconds kBrowseTimeout = 30s;
768 static inline const std::chrono::milliseconds kKeyRepeatTimeout = 300ms;
769 static inline const std::chrono::milliseconds kPrevChanTimeout = 750ms;
770 static inline const std::chrono::milliseconds kSleepTimerDialogTimeout = 45s;
771 static inline const std::chrono::milliseconds kIdleTimerDialogTimeout = 45s;
772 static inline const std::chrono::milliseconds kVideoExitDialogTimeout = 2min;
773 static inline const std::chrono::milliseconds kEndOfPlaybackCheckFrequency = 250ms;
774 static inline const std::chrono::milliseconds kEmbedCheckFrequency = 250ms;
775 static inline const std::chrono::milliseconds kSpeedChangeCheckFrequency = 250ms;
776 static inline const std::chrono::milliseconds kErrorRecoveryCheckFrequency = 250ms;
777 static inline const std::chrono::milliseconds kEndOfRecPromptCheckFrequency = 250ms;
778 static inline const std::chrono::milliseconds kSaveLastPlayPosTimeout = 5s;
780 static inline const std::chrono::milliseconds kEndOfPlaybackFirstCheckTimer = 1min;
782 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.