12 #include <QReadWriteLock>
13 #include <QWaitCondition>
14 #include <QStringList>
20 #include <QRecursiveMutex>
165 static bool IsTVRunning();
167 static bool IsPaused();
169 static void SetFuncPtr(
const char*
Name,
void* Pointer);
170 static int ConfiguredTunerCards();
171 static bool IsTunable(
uint ChanId);
177 bool event(QEvent*
Event)
override;
178 bool eventFilter(QObject* Object, QEvent*
Event)
override;
179 void timerEvent(QTimerEvent*
Event)
override;
181 void HandleOSDClosed(
int OSDType);
187 void onApplicationStateChange(Qt::ApplicationState
State);
188 void customEvent(QEvent*
Event)
override;
189 void VolumeChange(
bool Up,
int NewVolume = -1);
192 void Embed(
bool Embed, QRect Rect = {},
const QStringList& Data = {});
195 static inline QStringList lastProgramStringList = {};
207 bool StartPlaying(std::chrono::milliseconds MaxWait = -1ms);
210 static TV* AcquireRelease(
int& RefCount,
bool Acquire,
bool Create =
false);
213 static QList<QKeyEvent*> ConvertScreenPressKeyMap(
const QString& KeyList);
221 bool ProcessKeypressOrGesture(QEvent*
Event);
222 bool TranslateKeyPressOrGesture(
const QString& Context, QEvent*
Event,
223 QStringList& Actions,
bool IsLiveTV,
224 bool AllowJumps =
true);
226 QStringList& Actions,
bool IsLiveTV);
227 void ProcessNetworkControlCommand(
const QString&
Command);
229 bool HandleTrackAction(
const QString&
Action);
230 bool ActiveHandleAction(
const QStringList& Actions,
bool IsDVD,
bool IsDVDStillFrame);
231 bool BrowseHandleAction(
const QStringList& Actions);
232 void OSDDialogEvent(
int Result,
const QString& Text, QString
Action);
233 bool ToggleHandleAction(
const QStringList& Actions,
bool IsDVD);
234 bool FFRewHandleAction(
const QStringList& Actions);
235 bool ActivePostQHandleAction(
const QStringList& Actions);
236 bool HandleJumpToProgramAction(
const QStringList& Actions);
237 bool SeekHandleAction(
const QStringList& Actions,
bool IsDVD);
238 bool TimeStretchHandleAction(
const QStringList& Actions);
239 bool DiscMenuHandleAction(
const QStringList& Actions)
const;
242 int StartTimer(std::chrono::milliseconds Interval,
int Line);
243 void KillTimer(
int Id);
245 void SetSpeedChangeTimer(std::chrono::milliseconds When,
int Line);
246 void HandleEndOfPlaybackTimerEvent();
247 void HandleEndOfRecordingExitPromptTimerEvent();
248 void HandleVideoExitDialogTimerEvent();
249 void HandlePseudoLiveTVTimerEvent();
250 void HandleSpeedChangeTimerEvent();
251 void ToggleSleepTimer();
252 void ToggleSleepTimer(
const QString& Time);
253 bool HandleLCDTimerEvent();
254 void HandleLCDVolumeTimerEvent();
255 void HandleSaveLastPlayPosEvent();
259 const QString& arg =
"");
260 bool IsTunablePriv(
uint ChanId);
264 const QString & EditArg =
"");
265 QString GetRecordingGroup()
const;
266 void UpdateChannelList(
int GroupID);
270 void ReturnOSDLock()
const;
271 void GetPlayerWriteLock()
const;
272 void GetPlayerReadLock()
const;
273 void ReturnPlayerLock()
const;
276 void ToggleAutoExpire();
285 void HandleStateChange();
287 void ForceNextStateNone();
288 void ScheduleStateChange();
289 void ScheduleInputChange();
299 void PrepareToExitPlayer(
int Line);
300 void SetExitPlayer(
bool SetIt,
bool WantsTo);
303 void DeleteRecorder();
305 bool StartRecorder(std::chrono::milliseconds MaxWait = -1ms);
306 void StopStuff(
bool StopRingBuffer,
bool StopPlayer,
bool StopRecorder);
307 bool StartPlayer(
TVState desiredState);
319 bool IsDeleteAllowed();
322 static void ToggleChannelFavorite();
323 void ToggleChannelFavorite(
const QString &ChangroupName)
const;
325 void ChangeChannel(
uint Chanid,
const QString&
Channum);
327 void ShowPreviousChannel();
328 void PopPreviousChannel(
bool ImmediateChange);
331 void AddKeyToInputQueue(
char Key);
332 void ClearInputQueues(
bool Hideosd);
333 bool CommitQueuedInput();
334 bool ProcessSmartChannel(QString &InputStr);
341 QString GetQueuedInput()
const;
342 int GetQueuedInputAsInt(
bool *
OK =
nullptr,
int Base = 10)
const;
343 QString GetQueuedChanNum()
const;
347 void SwitchSource(
uint Direction);
348 void SwitchInputs(
uint ChanID = 0, QString ChanNum =
"",
uint InputID = 0);
352 void UnpauseLiveTV(
bool Quietly =
false);
354 float DoTogglePauseStart();
355 void DoTogglePauseFinish(
float Time,
bool ShowOSD);
356 void DoTogglePause(
bool ShowOSD);
357 bool DoSetPauseState(
bool Pause);
358 bool ContextIsPaused(
const char* File,
int Location);
365 void DoSeek(
float Time,
const QString &Msg,
bool TimeIsOffset,
bool HonorCutlist);
366 void DoSeek(std::chrono::seconds TimeInSec,
const QString &Msg,
bool TimeIsOffset,
bool HonorCutlist) {
367 DoSeek(TimeInSec.count(), Msg, TimeIsOffset, HonorCutlist); };
368 bool DoPlayerSeek(
float Time);
369 bool DoPlayerSeekToFrame(uint64_t FrameNum);
370 enum ArbSeekWhence { ARBSEEK_SET = 0, ARBSEEK_REWIND, ARBSEEK_FORWARD, ARBSEEK_END };
371 void DoSeekAbsolute(
long long Seconds,
bool HonorCutlist);
372 void DoArbSeek(ArbSeekWhence Whence,
bool HonorCutlist);
378 void ChangeSpeed(
int Direction);
379 void ToggleTimeStretch();
380 void ChangeTimeStretch(
int Dir,
bool AllowEdit =
true);
382 void DVDJumpForward();
384 void ChangeFFRew(
int Direction);
385 void SetFFRew(
int Index);
388 bool AudioSyncHandleAction(
const QStringList& Actions);
391 int GetNumChapters();
392 void GetChapterTimes(QList<std::chrono::seconds> &Times);
393 int GetCurrentChapter();
395 int GetCurrentTitle();
396 std::chrono::seconds GetTitleDuration(
int Title);
397 QString GetTitleName(
int Title);
398 void DoSwitchTitle(
int Title);
400 int GetCurrentAngle();
401 QString GetAngleName(
int Angle);
402 void DoSwitchAngle(
int Angle);
403 void DoJumpChapter(
int Chapter);
406 void DoSkipCommercials(
int Direction);
410 void DoQueueTranscode(
const QString& Profile);
413 bool IsBookmarkAllowed();
414 void SetBookmark(
bool Clear =
false);
418 void ToggleOSD(
bool IncludeStatusOSD);
419 void UpdateOSDProgInfo(
const char *WhichInfo);
420 void UpdateOSDStatus(
const QString& Title,
const QString& Desc,
421 const QString& Value,
int Type,
const QString& Units,
424 void UpdateOSDSeekMessage(
const QString &Msg,
enum OSDTimeout Timeout);
425 void UpdateOSDInput();
426 void UpdateOSDSignal(
const QStringList &List);
427 void UpdateOSDTimeoutMessage();
428 bool CalcPlayerSliderPosition(
osdInfo &
info,
bool paddedFields =
false)
const;
429 void HideOSDWindow(
const char *window);
432 bool SubtitleZoomHandleAction(
const QStringList& Actions);
433 bool SubtitleDelayHandleAction(
const QStringList &Actions);
437 bool PictureAttributeHandleAction(
const QStringList &Actions);
442 void ITVRestart(
bool IsLive);
445 void SetManualZoom(
bool ZoomON,
const QString& Desc);
446 bool ManualZoomHandleAction(
const QStringList &Actions);
449 void StartChannelEditMode();
450 bool HandleOSDChannelEdit(
const QString&
Action);
451 void ChannelEditAutoFill(
InfoMap &Info);
452 void ChannelEditXDSFill(
InfoMap &Info);
455 bool DialogIsVisible(
const QString &Dialog);
456 void HandleOSDInfo(
const QString&
Action);
460 void ShowOSDAskAllow();
461 void HandleOSDAskAllow(
const QString&
Action);
462 void AskAllowRecording(
const QStringList &Msg,
int Timeuntil,
bool HasRec,
bool HasLater);
465 void ShowOSDCutpoint(
const QString &Type);
466 bool HandleOSDCutpoint(
const QString&
Action);
467 void StartProgramEditMode();
470 void ShowOSDAlreadyEditing();
471 void HandleOSDAlreadyEditing(
const QString&
Action,
bool WasPaused);
475 void HandleOSDSleep(
const QString&
Action);
476 void SleepDialogTimeout();
480 void HandleOSDIdle(
const QString&
Action);
481 void IdleDialogTimeout();
484 void ShowOSDStopWatchingRecording();
485 void ShowOSDPromptDeleteRecording(
const QString& Title,
bool Force =
false);
486 bool HandleOSDVideoExit(
const QString&
Action);
489 void StartOsdNavigation();
492 void ShowOSDMenu(
bool isCompact =
false);
493 void FillOSDMenuJumpRec(
const QString &Category =
"",
int Level = 0,
const QString &Selected =
"");
495 const QVector<string_pair> & people);
496 void FillOSDMenuCast(
void);
497 void FillOSDMenuActorShows(
const QString & actor,
int person_id,
498 const QString & category =
"");
499 void PlaybackMenuShow(
const MythTVMenu &Menu,
const QDomNode &Node,
const QDomNode &Selected);
503 void PlaybackMenuInit(
const MythTVMenu& Menu);
504 void PlaybackMenuDeinit(
const MythTVMenu& Menu);
505 static void MenuStrings();
506 void MenuLazyInit(
void* Field);
511 void ShowLCDChannelInfo();
512 void ShowLCDDVDInfo();
520 QString m_dbChannelFormat {
"<num> <sign>"};
521 std::chrono::milliseconds m_dbIdleTimeout {0ms};
522 int m_dbPlaybackExitPrompt {0};
523 uint m_dbAutoexpireDefault {0};
524 bool m_dbAutoSetWatched {
false};
525 bool m_dbEndOfRecExitPrompt {
false};
526 bool m_dbJumpPreferOsd {
true};
527 bool m_dbUseGuiSizeForTv {
false};
528 bool m_dbUseVideoModes {
false};
529 bool m_dbRunJobsOnRemote {
false};
530 bool m_dbContinueEmbedded {
false};
531 bool m_dbBrowseAlways {
false};
534 bool m_dbRememberLastChannelGroup {
false};
537 bool m_smartForward {
false};
538 float m_ffRewRepos {1.0F};
539 bool m_ffRewReverse {
false};
547 mutable bool m_wantsToQuit {
true};
548 bool m_stretchAdjustment {
false};
549 bool m_audiosyncAdjustment {
false};
550 bool m_subtitleZoomAdjustment {
false};
551 bool m_subtitleDelayAdjustment {
false};
552 bool m_zoomMode {
false};
553 bool m_sigMonMode {
false};
554 bool m_endOfRecording {
false};
555 bool m_requestDelete {
false};
556 bool m_allowRerecord {
false};
557 bool m_doSmartForward {
false};
558 bool m_queuedTranscode {
false};
559 bool m_savePosOnExit {
false};
560 bool m_clearPosOnExit {
false};
583 std::chrono::milliseconds m_sleepTimerTimeout {0ms};
584 int m_sleepTimerId {0};
585 int m_sleepDialogTimerId {0};
586 int m_idleTimerId {0};
588 int m_idleDialogTimerId {0};
595 bool m_ccInputMode {
false};
599 bool m_asInputMode {
false};
616 static const int kScreenPressRegionCount = 12;
622 bool m_lockTimerOn {
false};
629 bool m_inPlaylist {
false};
630 bool m_underNetworkControl {
false};
633 bool m_jumpToProgram {
false};
643 bool m_noHardwareDecoders {
false};
656 QRect m_playerBounds;
661 bool m_weDisabledGUI {
false};
664 bool m_ignoreKeyPresses {
false};
665 bool m_savedPause {
false};
672 volatile int m_channelGroupId {-1};
679 volatile int m_lcdTimerId {0};
680 volatile int m_lcdVolumeTimerId {0};
681 volatile int m_networkControlTimerId {0};
682 volatile int m_ccInputTimerId {0};
683 volatile int m_asInputTimerId {0};
684 volatile int m_queueInputTimerId {0};
685 volatile int m_endOfPlaybackTimerId {0};
686 volatile int m_endOfRecPromptTimerId {0};
687 volatile int m_videoExitDialogTimerId {0};
688 volatile int m_pseudoChangeChanTimerId {0};
689 volatile int m_speedChangeTimerId {0};
690 volatile int m_errorRecoveryTimerId {0};
691 mutable volatile int m_exitPlayerTimerId {0};
692 volatile int m_saveLastPlayPosTimerId {0};
693 volatile int m_signalMonitorTimerId {0};
703 bool m_tvmAvsync {
true};
706 bool m_tvmFillAutoDetect {
false};
709 int m_tvmSpeedX100 {100};
711 bool m_tvmIsRecording {
false};
712 bool m_tvmIsRecorded {
false};
713 bool m_tvmIsVideo {
false};
715 bool m_tvmIsPaused {
false};
716 int m_tvmFreeRecorderCount {-1};
717 bool m_tvmIsDvd {
false};
718 bool m_tvmIsBd {
false};
719 bool m_tvmJump {
false};
720 bool m_tvmIsLiveTv {
false};
721 bool m_tvmPreviousChan {
false};
724 int m_tvmNumChapters {0};
725 int m_tvmCurrentChapter {0};
727 int m_tvmNumAngles {0};
728 int m_tvmCurrentAngle {0};
729 int m_tvmNumTitles {0};
730 int m_tvmCurrentTitle {0};
732 bool m_tvmSubsForcedOn {
true};
733 bool m_tvmSubsHaveSubs {
false};
735 bool m_tvmIsOn {
false};
736 bool m_tvmTranscoding {
false};
747 static inline const int kInitFFRWSpeed = 0;
748 static inline const uint kInputKeysMax = 6;
749 static inline const uint kNextSource = 1;
750 static inline const uint kPreviousSource = 2;
752 static inline const std::chrono::milliseconds kInputModeTimeout = 5s;
753 static inline const std::chrono::milliseconds kLCDTimeout = 1s;
754 static inline const std::chrono::milliseconds kBrowseTimeout = 30s;
755 static inline const std::chrono::milliseconds kKeyRepeatTimeout = 300ms;
756 static inline const std::chrono::milliseconds kPrevChanTimeout = 750ms;
757 static inline const std::chrono::milliseconds kSleepTimerDialogTimeout = 45s;
758 static inline const std::chrono::milliseconds kIdleTimerDialogTimeout = 45s;
759 static inline const std::chrono::milliseconds kVideoExitDialogTimeout = 2min;
760 static inline const std::chrono::milliseconds kEndOfPlaybackCheckFrequency = 250ms;
761 static inline const std::chrono::milliseconds kEmbedCheckFrequency = 250ms;
762 static inline const std::chrono::milliseconds kSpeedChangeCheckFrequency = 250ms;
763 static inline const std::chrono::milliseconds kErrorRecoveryCheckFrequency = 250ms;
764 static inline const std::chrono::milliseconds kEndOfRecPromptCheckFrequency = 250ms;
765 static inline const std::chrono::milliseconds kSaveLastPlayPosTimeout = 5s;
766 #ifdef USING_VALGRIND
767 static inline const std::chrono::milliseconds kEndOfPlaybackFirstCheckTimer = 1min;
769 static inline const std::chrono::milliseconds kEndOfPlaybackFirstCheckTimer = 5s;