12 #include <QReadWriteLock>
13 #include <QWaitCondition>
14 #include <QStringList>
20 #include <QRecursiveMutex>
161 static bool IsTVRunning();
163 static bool IsPaused();
165 static void SetFuncPtr(
const char*
Name,
void* Pointer);
166 static int ConfiguredTunerCards();
167 static bool IsTunable(
uint ChanId);
173 bool event(QEvent*
Event)
override;
174 bool eventFilter(QObject* Object, QEvent*
Event)
override;
175 void timerEvent(QTimerEvent*
Event)
override;
177 void HandleOSDClosed(
int OSDType);
183 void onApplicationStateChange(Qt::ApplicationState
State);
184 void customEvent(QEvent*
Event)
override;
185 void VolumeChange(
bool Up,
int NewVolume = -1);
188 void Embed(
bool Embed, QRect Rect = {},
const QStringList& Data = {});
191 static inline QStringList lastProgramStringList = {};
202 bool StartPlaying(std::chrono::milliseconds MaxWait = -1ms);
205 static TV* AcquireRelease(
int& RefCount,
bool Acquire,
bool Create =
false);
208 static QList<QKeyEvent*> ConvertScreenPressKeyMap(
const QString& KeyList);
216 bool ProcessKeypressOrGesture(QEvent*
Event);
217 bool TranslateKeyPressOrGesture(
const QString& Context, QEvent*
Event,
218 QStringList& Actions,
bool IsLiveTV,
219 bool AllowJumps =
true);
221 QStringList& Actions,
bool IsLiveTV);
222 void ProcessNetworkControlCommand(
const QString&
Command);
224 bool HandleTrackAction(
const QString&
Action);
225 bool ActiveHandleAction(
const QStringList& Actions,
bool IsDVD,
bool IsDVDStillFrame);
226 bool BrowseHandleAction(
const QStringList& Actions);
227 void OSDDialogEvent(
int Result,
const QString& Text, QString
Action);
228 bool ToggleHandleAction(
const QStringList& Actions,
bool IsDVD);
229 bool FFRewHandleAction(
const QStringList& Actions);
230 bool ActivePostQHandleAction(
const QStringList& Actions);
231 bool HandleJumpToProgramAction(
const QStringList& Actions);
232 bool SeekHandleAction(
const QStringList& Actions,
bool IsDVD);
233 bool TimeStretchHandleAction(
const QStringList& Actions);
234 bool DiscMenuHandleAction(
const QStringList& Actions)
const;
237 int StartTimer(std::chrono::milliseconds Interval,
int Line);
238 void KillTimer(
int Id);
240 void SetSpeedChangeTimer(std::chrono::milliseconds When,
int Line);
241 void HandleEndOfPlaybackTimerEvent();
242 void HandleEndOfRecordingExitPromptTimerEvent();
243 void HandleVideoExitDialogTimerEvent();
244 void HandlePseudoLiveTVTimerEvent();
245 void HandleSpeedChangeTimerEvent();
246 void ToggleSleepTimer();
247 void ToggleSleepTimer(
const QString& Time);
248 bool HandleLCDTimerEvent();
249 void HandleLCDVolumeTimerEvent();
250 void HandleSaveLastPlayPosEvent();
254 bool IsTunablePriv(
uint ChanId);
258 QString GetRecordingGroup()
const;
259 void UpdateChannelList(
int GroupID);
263 void ReturnOSDLock()
const;
264 void GetPlayerWriteLock()
const;
265 void GetPlayerReadLock()
const;
266 void ReturnPlayerLock()
const;
269 void ToggleAutoExpire();
278 void HandleStateChange();
280 void ForceNextStateNone();
281 void ScheduleStateChange();
282 void ScheduleInputChange();
292 void PrepareToExitPlayer(
int Line);
293 void SetExitPlayer(
bool SetIt,
bool WantsTo);
296 void DeleteRecorder();
298 bool StartRecorder(std::chrono::milliseconds MaxWait = -1ms);
299 void StopStuff(
bool StopRingBuffer,
bool StopPlayer,
bool StopRecorder);
300 bool StartPlayer(
TVState desiredState);
312 bool IsDeleteAllowed();
315 static void ToggleChannelFavorite();
316 void ToggleChannelFavorite(
const QString &ChangroupName)
const;
318 void ChangeChannel(
uint Chanid,
const QString&
Channum);
320 void ShowPreviousChannel();
321 void PopPreviousChannel(
bool ImmediateChange);
324 void AddKeyToInputQueue(
char Key);
325 void ClearInputQueues(
bool Hideosd);
326 bool CommitQueuedInput();
327 bool ProcessSmartChannel(QString &InputStr);
334 QString GetQueuedInput()
const;
335 int GetQueuedInputAsInt(
bool *
OK =
nullptr,
int Base = 10)
const;
336 QString GetQueuedChanNum()
const;
340 void SwitchSource(
uint Direction);
341 void SwitchInputs(
uint ChanID = 0, QString ChanNum =
"",
uint InputID = 0);
345 void UnpauseLiveTV(
bool Quietly =
false);
347 float DoTogglePauseStart();
348 void DoTogglePauseFinish(
float Time,
bool ShowOSD);
349 void DoTogglePause(
bool ShowOSD);
350 bool DoSetPauseState(
bool Pause);
351 bool ContextIsPaused(
const char* File,
int Location);
358 void DoSeek(
float Time,
const QString &Msg,
bool TimeIsOffset,
bool HonorCutlist);
359 void DoSeek(std::chrono::seconds TimeInSec,
const QString &Msg,
bool TimeIsOffset,
bool HonorCutlist) {
360 DoSeek(TimeInSec.count(), Msg, TimeIsOffset, HonorCutlist); };
361 bool DoPlayerSeek(
float Time);
362 bool DoPlayerSeekToFrame(uint64_t FrameNum);
363 enum ArbSeekWhence { ARBSEEK_SET = 0, ARBSEEK_REWIND, ARBSEEK_FORWARD, ARBSEEK_END };
364 void DoSeekAbsolute(
long long Seconds,
bool HonorCutlist);
365 void DoArbSeek(ArbSeekWhence Whence,
bool HonorCutlist);
371 void ChangeSpeed(
int Direction);
372 void ToggleTimeStretch();
373 void ChangeTimeStretch(
int Dir,
bool AllowEdit =
true);
375 void DVDJumpForward();
377 void ChangeFFRew(
int Direction);
378 void SetFFRew(
int Index);
381 bool AudioSyncHandleAction(
const QStringList& Actions);
384 int GetNumChapters();
385 void GetChapterTimes(QList<std::chrono::seconds> &Times);
386 int GetCurrentChapter();
388 int GetCurrentTitle();
389 std::chrono::seconds GetTitleDuration(
int Title);
390 QString GetTitleName(
int Title);
391 void DoSwitchTitle(
int Title);
393 int GetCurrentAngle();
394 QString GetAngleName(
int Angle);
395 void DoSwitchAngle(
int Angle);
396 void DoJumpChapter(
int Chapter);
399 void DoSkipCommercials(
int Direction);
403 void DoQueueTranscode(
const QString& Profile);
406 bool IsBookmarkAllowed();
407 void SetBookmark(
bool Clear =
false);
411 void ToggleOSD(
bool IncludeStatusOSD);
412 void UpdateOSDProgInfo(
const char *WhichInfo);
413 void UpdateOSDStatus(
const QString& Title,
const QString& Desc,
414 const QString& Value,
int Type,
const QString& Units,
417 void UpdateOSDSeekMessage(
const QString &Msg,
enum OSDTimeout Timeout);
418 void UpdateOSDInput();
419 void UpdateOSDSignal(
const QStringList &List);
420 void UpdateOSDTimeoutMessage();
421 bool CalcPlayerSliderPosition(
osdInfo &info,
bool paddedFields =
false)
const;
422 void HideOSDWindow(
const char *window);
425 bool SubtitleZoomHandleAction(
const QStringList& Actions);
426 bool SubtitleDelayHandleAction(
const QStringList &Actions);
430 bool PictureAttributeHandleAction(
const QStringList &Actions);
435 void ITVRestart(
bool IsLive);
438 void SetManualZoom(
bool ZoomON,
const QString& Desc);
439 bool ManualZoomHandleAction(
const QStringList &Actions);
442 void StartChannelEditMode();
443 bool HandleOSDChannelEdit(
const QString&
Action);
444 void ChannelEditAutoFill(
InfoMap &Info);
445 void ChannelEditXDSFill(
InfoMap &Info);
448 bool DialogIsVisible(
const QString &Dialog);
449 void HandleOSDInfo(
const QString&
Action);
453 void ShowOSDAskAllow();
454 void HandleOSDAskAllow(
const QString&
Action);
455 void AskAllowRecording(
const QStringList &Msg,
int Timeuntil,
bool HasRec,
bool HasLater);
458 void ShowOSDCutpoint(
const QString &Type);
459 bool HandleOSDCutpoint(
const QString&
Action);
460 void StartProgramEditMode();
463 void ShowOSDAlreadyEditing();
464 void HandleOSDAlreadyEditing(
const QString&
Action,
bool WasPaused);
468 void HandleOSDSleep(
const QString&
Action);
469 void SleepDialogTimeout();
473 void HandleOSDIdle(
const QString&
Action);
474 void IdleDialogTimeout();
477 void ShowOSDStopWatchingRecording();
478 void ShowOSDPromptDeleteRecording(
const QString& Title,
bool Force =
false);
479 bool HandleOSDVideoExit(
const QString&
Action);
482 void StartOsdNavigation();
485 void ShowOSDMenu(
bool isCompact =
false);
486 void FillOSDMenuJumpRec(
const QString &Category =
"",
int Level = 0,
const QString &Selected =
"");
487 void PlaybackMenuShow(
const MythTVMenu &Menu,
const QDomNode &Node,
const QDomNode &Selected);
491 void PlaybackMenuInit(
const MythTVMenu& Menu);
492 void PlaybackMenuDeinit(
const MythTVMenu& Menu);
493 static void MenuStrings();
494 void MenuLazyInit(
void* Field);
499 void ShowLCDChannelInfo();
500 void ShowLCDDVDInfo();
506 QString m_dbChannelFormat {
"<num> <sign>"};
507 std::chrono::milliseconds m_dbIdleTimeout {0ms};
508 int m_dbPlaybackExitPrompt {0};
509 uint m_dbAutoexpireDefault {0};
510 bool m_dbAutoSetWatched {
false};
511 bool m_dbEndOfRecExitPrompt {
false};
512 bool m_dbJumpPreferOsd {
true};
513 bool m_dbUseGuiSizeForTv {
false};
514 bool m_dbUseVideoModes {
false};
515 bool m_dbRunJobsOnRemote {
false};
516 bool m_dbContinueEmbedded {
false};
517 bool m_dbBrowseAlways {
false};
520 bool m_dbRememberLastChannelGroup {
false};
523 bool m_smartForward {
false};
524 float m_ffRewRepos {1.0F};
525 bool m_ffRewReverse {
false};
533 mutable bool m_wantsToQuit {
true};
534 bool m_stretchAdjustment {
false};
535 bool m_audiosyncAdjustment {
false};
536 bool m_subtitleZoomAdjustment {
false};
537 bool m_subtitleDelayAdjustment {
false};
538 bool m_zoomMode {
false};
539 bool m_sigMonMode {
false};
540 bool m_endOfRecording {
false};
541 bool m_requestDelete {
false};
542 bool m_allowRerecord {
false};
543 bool m_doSmartForward {
false};
544 bool m_queuedTranscode {
false};
545 bool m_savePosOnExit {
false};
546 bool m_clearPosOnExit {
false};
565 std::chrono::milliseconds m_sleepTimerTimeout {0ms};
566 int m_sleepTimerId {0};
567 int m_sleepDialogTimerId {0};
568 int m_idleTimerId {0};
570 int m_idleDialogTimerId {0};
577 bool m_ccInputMode {
false};
581 bool m_asInputMode {
false};
598 static const int kScreenPressRegionCount = 12;
604 bool m_lockTimerOn {
false};
611 bool m_inPlaylist {
false};
612 bool m_underNetworkControl {
false};
615 bool m_jumpToProgram {
false};
625 bool m_noHardwareDecoders {
false};
638 QRect m_playerBounds;
643 bool m_weDisabledGUI {
false};
646 bool m_ignoreKeyPresses {
false};
647 bool m_savedPause {
false};
654 volatile int m_channelGroupId {-1};
661 volatile int m_lcdTimerId {0};
662 volatile int m_lcdVolumeTimerId {0};
663 volatile int m_networkControlTimerId {0};
664 volatile int m_ccInputTimerId {0};
665 volatile int m_asInputTimerId {0};
666 volatile int m_queueInputTimerId {0};
667 volatile int m_endOfPlaybackTimerId {0};
668 volatile int m_endOfRecPromptTimerId {0};
669 volatile int m_videoExitDialogTimerId {0};
670 volatile int m_pseudoChangeChanTimerId {0};
671 volatile int m_speedChangeTimerId {0};
672 volatile int m_errorRecoveryTimerId {0};
673 mutable volatile int m_exitPlayerTimerId {0};
674 volatile int m_saveLastPlayPosTimerId {0};
675 volatile int m_signalMonitorTimerId {0};
685 bool m_tvmAvsync {
true};
688 bool m_tvmFillAutoDetect {
false};
691 int m_tvmSpeedX100 {100};
693 bool m_tvmIsRecording {
false};
694 bool m_tvmIsRecorded {
false};
695 bool m_tvmIsVideo {
false};
697 bool m_tvmIsPaused {
false};
698 int m_tvmFreeRecorderCount {-1};
699 bool m_tvmIsDvd {
false};
700 bool m_tvmIsBd {
false};
701 bool m_tvmJump {
false};
702 bool m_tvmIsLiveTv {
false};
703 bool m_tvmPreviousChan {
false};
706 int m_tvmNumChapters {0};
707 int m_tvmCurrentChapter {0};
709 int m_tvmNumAngles {0};
710 int m_tvmCurrentAngle {0};
711 int m_tvmNumTitles {0};
712 int m_tvmCurrentTitle {0};
714 bool m_tvmSubsForcedOn {
true};
715 bool m_tvmSubsHaveSubs {
false};
717 bool m_tvmIsOn {
false};
718 bool m_tvmTranscoding {
false};
729 static inline const int kInitFFRWSpeed = 0;
730 static inline const uint kInputKeysMax = 6;
731 static inline const uint kNextSource = 1;
732 static inline const uint kPreviousSource = 2;
734 static inline const std::chrono::milliseconds kInputModeTimeout = 5s;
735 static inline const std::chrono::milliseconds kLCDTimeout = 1s;
736 static inline const std::chrono::milliseconds kBrowseTimeout = 30s;
737 static inline const std::chrono::milliseconds kKeyRepeatTimeout = 300ms;
738 static inline const std::chrono::milliseconds kPrevChanTimeout = 750ms;
739 static inline const std::chrono::milliseconds kSleepTimerDialogTimeout = 45s;
740 static inline const std::chrono::milliseconds kIdleTimerDialogTimeout = 45s;
741 static inline const std::chrono::milliseconds kVideoExitDialogTimeout = 2min;
742 static inline const std::chrono::milliseconds kEndOfPlaybackCheckFrequency = 250ms;
743 static inline const std::chrono::milliseconds kEmbedCheckFrequency = 250ms;
744 static inline const std::chrono::milliseconds kSpeedChangeCheckFrequency = 250ms;
745 static inline const std::chrono::milliseconds kErrorRecoveryCheckFrequency = 250ms;
746 static inline const std::chrono::milliseconds kEndOfRecPromptCheckFrequency = 250ms;
747 static inline const std::chrono::milliseconds kSaveLastPlayPosTimeout = 5s;
748 #ifdef USING_VALGRIND
749 static inline const std::chrono::milliseconds kEndOfPlaybackFirstCheckTimer = 1min;
751 static inline const std::chrono::milliseconds kEndOfPlaybackFirstCheckTimer = 5s;