12 #include <QReadWriteLock>
13 #include <QWaitCondition>
14 #include <QStringList>
20 #if QT_VERSION >= QT_VERSION_CHECK(5,14,0)
21 #include <QRecursiveMutex>
163 static bool IsTVRunning();
165 static bool IsPaused();
167 static void SetFuncPtr(
const char*
Name,
void* Pointer);
168 static int ConfiguredTunerCards();
169 static bool IsTunable(
uint ChanId);
175 bool event(QEvent*
Event)
override;
176 bool eventFilter(QObject* Object, QEvent*
Event)
override;
177 void timerEvent(QTimerEvent*
Event)
override;
179 void HandleOSDClosed(
int OSDType);
185 void onApplicationStateChange(Qt::ApplicationState
State);
186 void customEvent(QEvent*
Event)
override;
187 void VolumeChange(
bool Up,
int NewVolume = -1);
190 void Embed(
bool Embed, QRect Rect = {},
const QStringList& Data = {});
193 static inline QStringList lastProgramStringList = {};
204 bool StartPlaying(std::chrono::milliseconds MaxWait = -1ms);
207 static TV* AcquireRelease(
int& RefCount,
bool Acquire,
bool Create =
false);
210 static QList<QKeyEvent*> ConvertScreenPressKeyMap(
const QString& KeyList);
218 bool ProcessKeypressOrGesture(QEvent*
Event);
219 bool TranslateKeyPressOrGesture(
const QString& Context, QEvent*
Event,
220 QStringList& Actions,
bool IsLiveTV,
221 bool AllowJumps =
true);
223 QStringList& Actions,
bool IsLiveTV);
224 void ProcessNetworkControlCommand(
const QString&
Command);
226 bool HandleTrackAction(
const QString&
Action);
227 bool ActiveHandleAction(
const QStringList& Actions,
bool IsDVD,
bool IsDVDStillFrame);
228 bool BrowseHandleAction(
const QStringList& Actions);
229 void OSDDialogEvent(
int Result,
const QString& Text, QString
Action);
230 bool ToggleHandleAction(
const QStringList& Actions,
bool IsDVD);
231 bool FFRewHandleAction(
const QStringList& Actions);
232 bool ActivePostQHandleAction(
const QStringList& Actions);
233 bool HandleJumpToProgramAction(
const QStringList& Actions);
234 bool SeekHandleAction(
const QStringList& Actions,
bool IsDVD);
235 bool TimeStretchHandleAction(
const QStringList& Actions);
236 bool DiscMenuHandleAction(
const QStringList& Actions)
const;
239 int StartTimer(std::chrono::milliseconds Interval,
int Line);
240 void KillTimer(
int Id);
242 void SetSpeedChangeTimer(std::chrono::milliseconds When,
int Line);
243 void HandleEndOfPlaybackTimerEvent();
244 void HandleEndOfRecordingExitPromptTimerEvent();
245 void HandleVideoExitDialogTimerEvent();
246 void HandlePseudoLiveTVTimerEvent();
247 void HandleSpeedChangeTimerEvent();
248 void ToggleSleepTimer();
249 void ToggleSleepTimer(
const QString& Time);
250 bool HandleLCDTimerEvent();
251 void HandleLCDVolumeTimerEvent();
252 void HandleSaveLastPlayPosEvent();
256 bool IsTunablePriv(
uint ChanId);
260 QString GetRecordingGroup()
const;
261 void UpdateChannelList(
int GroupID);
265 void ReturnOSDLock()
const;
266 void GetPlayerWriteLock()
const;
267 void GetPlayerReadLock()
const;
268 void ReturnPlayerLock()
const;
271 void ToggleAutoExpire();
280 void HandleStateChange();
282 void ForceNextStateNone();
283 void ScheduleStateChange();
284 void ScheduleInputChange();
294 void PrepareToExitPlayer(
int Line);
295 void SetExitPlayer(
bool SetIt,
bool WantsTo);
298 void DeleteRecorder();
300 bool StartRecorder(std::chrono::milliseconds MaxWait = -1ms);
301 void StopStuff(
bool StopRingBuffer,
bool StopPlayer,
bool StopRecorder);
302 bool StartPlayer(
TVState desiredState);
314 bool IsDeleteAllowed();
317 static void ToggleChannelFavorite();
318 void ToggleChannelFavorite(
const QString &ChangroupName)
const;
320 void ChangeChannel(
uint Chanid,
const QString&
Channum);
322 void ShowPreviousChannel();
323 void PopPreviousChannel(
bool ImmediateChange);
326 void AddKeyToInputQueue(
char Key);
327 void ClearInputQueues(
bool Hideosd);
328 bool CommitQueuedInput();
329 bool ProcessSmartChannel(QString &InputStr);
336 QString GetQueuedInput()
const;
337 int GetQueuedInputAsInt(
bool *
OK =
nullptr,
int Base = 10)
const;
338 QString GetQueuedChanNum()
const;
342 void SwitchSource(
uint Direction);
343 void SwitchInputs(
uint ChanID = 0, QString ChanNum =
"",
uint InputID = 0);
347 void UnpauseLiveTV(
bool Quietly =
false);
349 float DoTogglePauseStart();
350 void DoTogglePauseFinish(
float Time,
bool ShowOSD);
351 void DoTogglePause(
bool ShowOSD);
352 bool DoSetPauseState(
bool Pause);
353 bool ContextIsPaused(
const char* File,
int Location);
360 void DoSeek(
float Time,
const QString &Msg,
bool TimeIsOffset,
bool HonorCutlist);
361 void DoSeek(std::chrono::seconds TimeInSec,
const QString &Msg,
bool TimeIsOffset,
bool HonorCutlist) {
362 DoSeek(TimeInSec.count(), Msg, TimeIsOffset, HonorCutlist); };
363 bool DoPlayerSeek(
float Time);
364 bool DoPlayerSeekToFrame(uint64_t FrameNum);
365 enum ArbSeekWhence { ARBSEEK_SET = 0, ARBSEEK_REWIND, ARBSEEK_FORWARD, ARBSEEK_END };
366 void DoSeekAbsolute(
long long Seconds,
bool HonorCutlist);
367 void DoArbSeek(ArbSeekWhence Whence,
bool HonorCutlist);
373 void ChangeSpeed(
int Direction);
374 void ToggleTimeStretch();
375 void ChangeTimeStretch(
int Dir,
bool AllowEdit =
true);
377 void DVDJumpForward();
379 void ChangeFFRew(
int Direction);
380 void SetFFRew(
int Index);
383 bool AudioSyncHandleAction(
const QStringList& Actions);
386 int GetNumChapters();
387 void GetChapterTimes(QList<std::chrono::seconds> &Times);
388 int GetCurrentChapter();
390 int GetCurrentTitle();
391 std::chrono::seconds GetTitleDuration(
int Title);
392 QString GetTitleName(
int Title);
393 void DoSwitchTitle(
int Title);
395 int GetCurrentAngle();
396 QString GetAngleName(
int Angle);
397 void DoSwitchAngle(
int Angle);
398 void DoJumpChapter(
int Chapter);
401 void DoSkipCommercials(
int Direction);
405 void DoQueueTranscode(
const QString& Profile);
408 bool IsBookmarkAllowed();
409 void SetBookmark(
bool Clear =
false);
413 void ToggleOSD(
bool IncludeStatusOSD);
414 void UpdateOSDProgInfo(
const char *WhichInfo);
415 void UpdateOSDStatus(
const QString& Title,
const QString& Desc,
416 const QString& Value,
int Type,
const QString& Units,
419 void UpdateOSDSeekMessage(
const QString &Msg,
enum OSDTimeout Timeout);
420 void UpdateOSDInput();
421 void UpdateOSDSignal(
const QStringList &List);
422 void UpdateOSDTimeoutMessage();
423 bool CalcPlayerSliderPosition(
osdInfo &info,
bool paddedFields =
false)
const;
424 void HideOSDWindow(
const char *window);
427 bool SubtitleZoomHandleAction(
const QStringList& Actions);
428 bool SubtitleDelayHandleAction(
const QStringList &Actions);
432 bool PictureAttributeHandleAction(
const QStringList &Actions);
437 void ITVRestart(
bool IsLive);
440 void SetManualZoom(
bool ZoomON,
const QString& Desc);
441 bool ManualZoomHandleAction(
const QStringList &Actions);
444 void StartChannelEditMode();
445 bool HandleOSDChannelEdit(
const QString&
Action);
446 void ChannelEditAutoFill(
InfoMap &Info);
447 void ChannelEditXDSFill(
InfoMap &Info);
450 bool DialogIsVisible(
const QString &Dialog);
451 void HandleOSDInfo(
const QString&
Action);
455 void ShowOSDAskAllow();
456 void HandleOSDAskAllow(
const QString&
Action);
457 void AskAllowRecording(
const QStringList &Msg,
int Timeuntil,
bool HasRec,
bool HasLater);
460 void ShowOSDCutpoint(
const QString &Type);
461 bool HandleOSDCutpoint(
const QString&
Action);
462 void StartProgramEditMode();
465 void ShowOSDAlreadyEditing();
466 void HandleOSDAlreadyEditing(
const QString&
Action,
bool WasPaused);
470 void HandleOSDSleep(
const QString&
Action);
471 void SleepDialogTimeout();
475 void HandleOSDIdle(
const QString&
Action);
476 void IdleDialogTimeout();
479 void ShowOSDStopWatchingRecording();
480 void ShowOSDPromptDeleteRecording(
const QString& Title,
bool Force =
false);
481 bool HandleOSDVideoExit(
const QString&
Action);
484 void StartOsdNavigation();
487 void ShowOSDMenu(
bool isCompact =
false);
488 void FillOSDMenuJumpRec(
const QString &Category =
"",
int Level = 0,
const QString &Selected =
"");
489 void PlaybackMenuShow(
const MythTVMenu &Menu,
const QDomNode &Node,
const QDomNode &Selected);
493 void PlaybackMenuInit(
const MythTVMenu& Menu);
494 void PlaybackMenuDeinit(
const MythTVMenu& Menu);
495 static void MenuStrings();
496 void MenuLazyInit(
void* Field);
501 void ShowLCDChannelInfo();
502 void ShowLCDDVDInfo();
508 QString m_dbChannelFormat {
"<num> <sign>"};
509 std::chrono::milliseconds m_dbIdleTimeout {0ms};
510 int m_dbPlaybackExitPrompt {0};
511 uint m_dbAutoexpireDefault {0};
512 bool m_dbAutoSetWatched {
false};
513 bool m_dbEndOfRecExitPrompt {
false};
514 bool m_dbJumpPreferOsd {
true};
515 bool m_dbUseGuiSizeForTv {
false};
516 bool m_dbUseVideoModes {
false};
517 bool m_dbRunJobsOnRemote {
false};
518 bool m_dbContinueEmbedded {
false};
519 bool m_dbBrowseAlways {
false};
522 bool m_dbRememberLastChannelGroup {
false};
525 bool m_smartForward {
false};
526 float m_ffRewRepos {1.0F};
527 bool m_ffRewReverse {
false};
535 mutable bool m_wantsToQuit {
true};
536 bool m_stretchAdjustment {
false};
537 bool m_audiosyncAdjustment {
false};
538 bool m_subtitleZoomAdjustment {
false};
539 bool m_subtitleDelayAdjustment {
false};
540 bool m_zoomMode {
false};
541 bool m_sigMonMode {
false};
542 bool m_endOfRecording {
false};
543 bool m_requestDelete {
false};
544 bool m_allowRerecord {
false};
545 bool m_doSmartForward {
false};
546 bool m_queuedTranscode {
false};
547 bool m_savePosOnExit {
false};
548 bool m_clearPosOnExit {
false};
556 #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
557 QMutex m_askAllowLock {QMutex::Recursive};
565 #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
566 mutable QMutex m_chanEditMapLock {QMutex::Recursive};
575 std::chrono::milliseconds m_sleepTimerTimeout {0ms};
576 int m_sleepTimerId {0};
577 int m_sleepDialogTimerId {0};
578 int m_idleTimerId {0};
580 int m_idleDialogTimerId {0};
587 bool m_ccInputMode {
false};
591 bool m_asInputMode {
false};
608 static const int kScreenPressRegionCount = 12;
614 bool m_lockTimerOn {
false};
621 bool m_inPlaylist {
false};
622 bool m_underNetworkControl {
false};
625 bool m_jumpToProgram {
false};
635 bool m_noHardwareDecoders {
false};
648 QRect m_playerBounds;
653 bool m_weDisabledGUI {
false};
656 bool m_ignoreKeyPresses {
false};
657 bool m_savedPause {
false};
664 volatile int m_channelGroupId {-1};
671 volatile int m_lcdTimerId {0};
672 volatile int m_lcdVolumeTimerId {0};
673 volatile int m_networkControlTimerId {0};
674 volatile int m_ccInputTimerId {0};
675 volatile int m_asInputTimerId {0};
676 volatile int m_queueInputTimerId {0};
677 volatile int m_endOfPlaybackTimerId {0};
678 volatile int m_endOfRecPromptTimerId {0};
679 volatile int m_videoExitDialogTimerId {0};
680 volatile int m_pseudoChangeChanTimerId {0};
681 volatile int m_speedChangeTimerId {0};
682 volatile int m_errorRecoveryTimerId {0};
683 mutable volatile int m_exitPlayerTimerId {0};
684 volatile int m_saveLastPlayPosTimerId {0};
685 volatile int m_signalMonitorTimerId {0};
695 bool m_tvmAvsync {
true};
698 bool m_tvmFillAutoDetect {
false};
701 int m_tvmSpeedX100 {100};
703 bool m_tvmIsRecording {
false};
704 bool m_tvmIsRecorded {
false};
705 bool m_tvmIsVideo {
false};
707 bool m_tvmIsPaused {
false};
708 int m_tvmFreeRecorderCount {-1};
709 bool m_tvmIsDvd {
false};
710 bool m_tvmIsBd {
false};
711 bool m_tvmJump {
false};
712 bool m_tvmIsLiveTv {
false};
713 bool m_tvmPreviousChan {
false};
716 int m_tvmNumChapters {0};
717 int m_tvmCurrentChapter {0};
719 int m_tvmNumAngles {0};
720 int m_tvmCurrentAngle {0};
721 int m_tvmNumTitles {0};
722 int m_tvmCurrentTitle {0};
724 bool m_tvmSubsForcedOn {
true};
725 bool m_tvmSubsHaveSubs {
false};
727 bool m_tvmIsOn {
false};
728 bool m_tvmTranscoding {
false};
739 static inline const int kInitFFRWSpeed = 0;
740 static inline const uint kInputKeysMax = 6;
741 static inline const uint kNextSource = 1;
742 static inline const uint kPreviousSource = 2;
744 static inline const std::chrono::milliseconds kInputModeTimeout = 5s;
745 static inline const std::chrono::milliseconds kLCDTimeout = 1s;
746 static inline const std::chrono::milliseconds kBrowseTimeout = 30s;
747 static inline const std::chrono::milliseconds kKeyRepeatTimeout = 300ms;
748 static inline const std::chrono::milliseconds kPrevChanTimeout = 750ms;
749 static inline const std::chrono::milliseconds kSleepTimerDialogTimeout = 45s;
750 static inline const std::chrono::milliseconds kIdleTimerDialogTimeout = 45s;
751 static inline const std::chrono::milliseconds kVideoExitDialogTimeout = 2min;
752 static inline const std::chrono::milliseconds kEndOfPlaybackCheckFrequency = 250ms;
753 static inline const std::chrono::milliseconds kEmbedCheckFrequency = 250ms;
754 static inline const std::chrono::milliseconds kSpeedChangeCheckFrequency = 250ms;
755 static inline const std::chrono::milliseconds kErrorRecoveryCheckFrequency = 250ms;
756 static inline const std::chrono::milliseconds kEndOfRecPromptCheckFrequency = 250ms;
757 static inline const std::chrono::milliseconds kSaveLastPlayPosTimeout = 5s;
758 #ifdef USING_VALGRIND
759 static inline const std::chrono::milliseconds kEndOfPlaybackFirstCheckTimer = 1min;
761 static inline const std::chrono::milliseconds kEndOfPlaybackFirstCheckTimer = 5s;