12#include <QReadWriteLock>
13#include <QWaitCondition>
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);
178 bool event(QEvent*
Event)
override;
179 bool eventFilter(QObject* Object, QEvent*
Event)
override;
180 void timerEvent(QTimerEvent*
Event)
override;
182 void HandleOSDClosed(
int OSDType);
188 void onApplicationStateChange(Qt::ApplicationState
State);
189 void customEvent(QEvent*
Event)
override;
190 void VolumeChange(
bool Up,
int NewVolume = -1);
193 void Embed(
bool Embed, QRect Rect = {},
const QStringList& Data = {});
196 static inline QStringList lastProgramStringList = {};
208 bool StartPlaying(std::chrono::milliseconds MaxWait = -1ms);
211 static TV* AcquireRelease(
int& RefCount,
bool Acquire,
bool Create =
false);
214 static QList<QKeyEvent*> ConvertScreenPressKeyMap(
const QString& KeyList);
222 bool ProcessKeypressOrGesture(QEvent*
Event);
223 bool TranslateKeyPressOrGesture(
const QString& Context, QEvent*
Event,
224 QStringList& Actions,
bool IsLiveTV,
225 bool AllowJumps =
true);
227 QStringList& Actions,
bool IsLiveTV);
228 void ProcessNetworkControlCommand(
const QString&
Command);
230 bool HandleTrackAction(
const QString&
Action);
231 bool ActiveHandleAction(
const QStringList& Actions,
bool IsDVD,
bool IsDVDStillFrame);
232 bool BrowseHandleAction(
const QStringList& Actions);
233 void OSDDialogEvent(
int Result,
const QString& Text, QString
Action);
234 bool ToggleHandleAction(
const QStringList& Actions,
bool IsDVD);
235 bool FFRewHandleAction(
const QStringList& Actions);
236 bool ActivePostQHandleAction(
const QStringList& Actions);
237 bool HandleJumpToProgramAction(
const QStringList& Actions);
238 bool SeekHandleAction(
const QStringList& Actions,
bool IsDVD);
239 bool TimeStretchHandleAction(
const QStringList& Actions);
240 bool DiscMenuHandleAction(
const QStringList& Actions)
const;
243 int StartTimer(std::chrono::milliseconds Interval,
int Line);
244 void KillTimer(
int Id);
246 void SetSpeedChangeTimer(std::chrono::milliseconds When,
int Line);
247 void HandleEndOfPlaybackTimerEvent();
248 void HandleEndOfRecordingExitPromptTimerEvent();
249 void HandleVideoExitDialogTimerEvent();
250 void HandlePseudoLiveTVTimerEvent();
251 void HandleSpeedChangeTimerEvent();
252 void ToggleSleepTimer();
253 void ToggleSleepTimer(
const QString& Time);
254 bool HandleLCDTimerEvent();
255 void HandleLCDVolumeTimerEvent();
256 void HandleSaveLastPlayPosEvent();
260 const QString& arg =
"");
261 bool IsTunablePriv(
uint ChanId);
265 const QString & EditArg =
"");
266 QString GetRecordingGroup()
const;
267 void UpdateChannelList(
int GroupID);
271 void ReturnOSDLock()
const;
272 void GetPlayerWriteLock()
const;
273 void GetPlayerReadLock()
const;
274 void ReturnPlayerLock()
const;
277 void ToggleAutoExpire();
286 void HandleStateChange();
288 void ForceNextStateNone();
289 void ScheduleStateChange();
290 void ScheduleInputChange();
300 void PrepareToExitPlayer(
int Line);
301 void SetExitPlayer(
bool SetIt,
bool WantsTo);
306 bool StartRecorder(std::chrono::milliseconds MaxWait = -1ms);
307 void StopStuff(
bool StopRingBuffer,
bool StopPlayer,
bool StopRecorder);
308 bool StartPlayer(
TVState desiredState);
320 bool IsDeleteAllowed();
323 static void ToggleChannelFavorite();
324 void ToggleChannelFavorite(
const QString &ChangroupName)
const;
326 void ChangeChannel(
uint Chanid,
const QString&
Channum);
328 void ShowPreviousChannel();
329 void PopPreviousChannel(
bool ImmediateChange);
332 void AddKeyToInputQueue(
char Key);
333 void ClearInputQueues(
bool Hideosd);
334 bool CommitQueuedInput();
335 bool ProcessSmartChannel(QString &InputStr);
342 QString GetQueuedInput()
const;
343 int GetQueuedInputAsInt(
bool *
OK =
nullptr,
int Base = 10)
const;
344 QString GetQueuedChanNum()
const;
348 void SwitchSource(
uint Direction);
349 void SwitchInputs(
uint ChanID = 0, QString ChanNum =
"",
uint InputID = 0);
353 void UnpauseLiveTV(
bool Quietly =
false);
355 float DoTogglePauseStart();
356 void DoTogglePauseFinish(
float Time,
bool ShowOSD);
357 void DoTogglePause(
bool ShowOSD);
358 bool DoSetPauseState(
bool Pause);
359 bool ContextIsPaused(
const char* File,
int Location);
366 void DoSeek(
float Time,
const QString &Msg,
bool TimeIsOffset,
bool HonorCutlist);
367 void DoSeek(std::chrono::seconds TimeInSec,
const QString &Msg,
bool TimeIsOffset,
bool HonorCutlist) {
368 DoSeek(TimeInSec.count(), Msg, TimeIsOffset, HonorCutlist); };
369 bool DoPlayerSeek(
float Time);
370 bool DoPlayerSeekToFrame(uint64_t FrameNum);
371 enum ArbSeekWhence { ARBSEEK_SET = 0, ARBSEEK_REWIND, ARBSEEK_FORWARD, ARBSEEK_END };
372 void DoSeekAbsolute(
long long Seconds,
bool HonorCutlist);
373 void DoArbSeek(ArbSeekWhence Whence,
bool HonorCutlist);
379 void ChangeSpeed(
int Direction);
380 void ToggleTimeStretch();
381 void ChangeTimeStretch(
int Dir,
bool AllowEdit =
true);
383 void DVDJumpForward();
385 void ChangeFFRew(
int Direction);
386 void SetFFRew(
int Index);
389 bool AudioSyncHandleAction(
const QStringList& Actions);
392 int GetNumChapters();
393 void GetChapterTimes(QList<std::chrono::seconds> &Times);
394 int GetCurrentChapter();
396 int GetCurrentTitle();
397 std::chrono::seconds GetTitleDuration(
int Title);
398 QString GetTitleName(
int Title);
399 void DoSwitchTitle(
int Title);
401 int GetCurrentAngle();
402 QString GetAngleName(
int Angle);
403 void DoSwitchAngle(
int Angle);
404 void DoJumpChapter(
int Chapter);
407 void DoSkipCommercials(
int Direction);
411 void DoQueueTranscode(
const QString& Profile);
414 bool IsBookmarkAllowed();
415 void SetBookmark(
bool Clear =
false);
419 void ToggleOSD(
bool IncludeStatusOSD);
420 void UpdateOSDProgInfo(
const char *WhichInfo);
421 void UpdateOSDStatus(
const QString& Title,
const QString& Desc,
422 const QString& Value,
int Type,
const QString& Units,
425 void UpdateOSDSeekMessage(
const QString &Msg,
enum OSDTimeout Timeout);
426 void UpdateOSDInput();
427 void UpdateOSDSignal(
const QStringList &List);
428 void UpdateOSDTimeoutMessage();
429 bool CalcPlayerSliderPosition(
osdInfo &
info,
bool paddedFields =
false)
const;
430 void HideOSDWindow(
const char *window);
433 bool SubtitleZoomHandleAction(
const QStringList& Actions);
434 bool SubtitleDelayHandleAction(
const QStringList &Actions);
438 bool PictureAttributeHandleAction(
const QStringList &Actions);
443 void ITVRestart(
bool IsLive);
446 void SetManualZoom(
bool ZoomON,
const QString& Desc);
447 bool ManualZoomHandleAction(
const QStringList &Actions);
450 void StartChannelEditMode();
451 bool HandleOSDChannelEdit(
const QString&
Action);
452 void ChannelEditAutoFill(
InfoMap &Info);
453 void ChannelEditXDSFill(
InfoMap &Info);
456 bool DialogIsVisible(
const QString &Dialog);
457 void HandleOSDInfo(
const QString&
Action);
461 void ShowOSDAskAllow();
462 void HandleOSDAskAllow(
const QString&
Action);
463 void AskAllowRecording(
const QStringList &Msg,
int Timeuntil,
bool HasRec,
bool HasLater);
466 void ShowOSDCutpoint(
const QString &Type);
467 bool HandleOSDCutpoint(
const QString&
Action);
468 void StartProgramEditMode();
471 void ShowOSDAlreadyEditing();
472 void HandleOSDAlreadyEditing(
const QString&
Action,
bool WasPaused);
476 void HandleOSDSleep(
const QString&
Action);
477 void SleepDialogTimeout();
481 void HandleOSDIdle(
const QString&
Action);
482 void IdleDialogTimeout();
485 void ShowOSDStopWatchingRecording();
486 void ShowOSDPromptDeleteRecording(
const QString& Title,
bool Force =
false);
487 bool HandleOSDVideoExit(
const QString&
Action);
490 void StartOsdNavigation();
493 void ShowOSDMenu(
bool isCompact =
false);
494 void FillOSDMenuJumpRec(
const QString &Category =
"",
int Level = 0,
const QString &Selected =
"");
496 const QVector<string_pair> & people);
497 void FillOSDMenuCast(
void);
498 void FillOSDMenuActorShows(
const QString & actor,
int person_id,
499 const QString & category =
"");
500 void PlaybackMenuShow(
const MythTVMenu &Menu,
const QDomNode &Node,
const QDomNode &Selected);
504 void PlaybackMenuInit(
const MythTVMenu& Menu);
505 void PlaybackMenuDeinit(
const MythTVMenu& Menu);
506 static void MenuStrings();
507 void MenuLazyInit(
void* Field);
512 void ShowLCDChannelInfo();
513 void ShowLCDDVDInfo();
522 QString m_dbChannelFormat {
"<num> <sign>"};
523 std::chrono::milliseconds m_dbIdleTimeout {0ms};
524 int m_dbPlaybackExitPrompt {0};
525 uint m_dbAutoexpireDefault {0};
526 bool m_dbAutoSetWatched {
false};
527 bool m_dbEndOfRecExitPrompt {
false};
528 bool m_dbJumpPreferOsd {
true};
529 bool m_dbUseGuiSizeForTv {
false};
530 bool m_dbUseVideoModes {
false};
531 bool m_dbRunJobsOnRemote {
false};
532 bool m_dbContinueEmbedded {
false};
533 bool m_dbBrowseAlways {
false};
536 bool m_dbRememberLastChannelGroup {
false};
539 bool m_smartForward {
false};
540 float m_ffRewRepos {1.0F};
541 bool m_ffRewReverse {
false};
549 mutable bool m_wantsToQuit {
true};
550 bool m_stretchAdjustment {
false};
551 bool m_audiosyncAdjustment {
false};
552 bool m_subtitleZoomAdjustment {
false};
553 bool m_subtitleDelayAdjustment {
false};
554 bool m_zoomMode {
false};
555 bool m_sigMonMode {
false};
556 bool m_endOfRecording {
false};
557 bool m_requestDelete {
false};
558 bool m_allowRerecord {
false};
559 bool m_doSmartForward {
false};
560 bool m_queuedTranscode {
false};
561 bool m_savePosOnExit {
false};
562 bool m_clearPosOnExit {
false};
585 std::chrono::milliseconds m_sleepTimerTimeout {0ms};
586 int m_sleepTimerId {0};
587 int m_sleepDialogTimerId {0};
589 int m_idleTimerId {0};
590 int m_idleDialogTimerId {0};
597 bool m_ccInputMode {
false};
601 bool m_asInputMode {
false};
618 static const int kScreenPressRegionCount = 12;
624 bool m_lockTimerOn {
false};
631 bool m_inPlaylist {
false};
632 bool m_underNetworkControl {
false};
635 bool m_jumpToProgram {
false};
645 bool m_noHardwareDecoders {
false};
663 bool m_weDisabledGUI {
false};
666 bool m_ignoreKeyPresses {
false};
667 bool m_savedPause {
false};
674 volatile int m_channelGroupId {-1};
681 volatile int m_lcdTimerId {0};
682 volatile int m_lcdVolumeTimerId {0};
683 volatile int m_networkControlTimerId {0};
684 volatile int m_ccInputTimerId {0};
685 volatile int m_asInputTimerId {0};
686 volatile int m_queueInputTimerId {0};
687 volatile int m_endOfPlaybackTimerId {0};
688 volatile int m_endOfRecPromptTimerId {0};
689 volatile int m_videoExitDialogTimerId {0};
690 volatile int m_pseudoChangeChanTimerId {0};
691 volatile int m_speedChangeTimerId {0};
692 volatile int m_errorRecoveryTimerId {0};
693 mutable volatile int m_exitPlayerTimerId {0};
694 volatile int m_saveLastPlayPosTimerId {0};
695 volatile int m_signalMonitorTimerId {0};
705 bool m_tvmAvsync {
true};
708 bool m_tvmFillAutoDetect {
false};
711 int m_tvmSpeedX100 {100};
713 bool m_tvmIsRecording {
false};
714 bool m_tvmIsRecorded {
false};
715 bool m_tvmIsVideo {
false};
717 bool m_tvmIsPaused {
false};
718 int m_tvmFreeRecorderCount {-1};
719 bool m_tvmIsDvd {
false};
720 bool m_tvmIsBd {
false};
721 bool m_tvmJump {
false};
722 bool m_tvmIsLiveTv {
false};
723 bool m_tvmPreviousChan {
false};
726 int m_tvmNumChapters {0};
727 int m_tvmCurrentChapter {0};
729 int m_tvmNumAngles {0};
730 int m_tvmCurrentAngle {0};
731 int m_tvmNumTitles {0};
732 int m_tvmCurrentTitle {0};
734 bool m_tvmSubsForcedOn {
true};
735 bool m_tvmSubsHaveSubs {
false};
737 bool m_tvmIsOn {
false};
738 bool m_tvmTranscoding {
false};
749 static inline const int kInitFFRWSpeed = 0;
750 static inline const uint kInputKeysMax = 6;
751 static inline const uint kNextSource = 1;
752 static inline const uint kPreviousSource = 2;
754 static inline const std::chrono::milliseconds kInputModeTimeout = 5s;
755 static inline const std::chrono::milliseconds kLCDTimeout = 1s;
756 static inline const std::chrono::milliseconds kBrowseTimeout = 30s;
757 static inline const std::chrono::milliseconds kKeyRepeatTimeout = 300ms;
758 static inline const std::chrono::milliseconds kPrevChanTimeout = 750ms;
759 static inline const std::chrono::milliseconds kSleepTimerDialogTimeout = 45s;
760 static inline const std::chrono::milliseconds kIdleTimerDialogTimeout = 45s;
761 static inline const std::chrono::milliseconds kVideoExitDialogTimeout = 2min;
762 static inline const std::chrono::milliseconds kEndOfPlaybackCheckFrequency = 250ms;
763 static inline const std::chrono::milliseconds kEmbedCheckFrequency = 250ms;
764 static inline const std::chrono::milliseconds kSpeedChangeCheckFrequency = 250ms;
765 static inline const std::chrono::milliseconds kErrorRecoveryCheckFrequency = 250ms;
766 static inline const std::chrono::milliseconds kEndOfRecPromptCheckFrequency = 250ms;
767 static inline const std::chrono::milliseconds kSaveLastPlayPosTimeout = 5s;
769 static inline const std::chrono::milliseconds kEndOfPlaybackFirstCheckTimer = 1min;
771 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
static const std::vector< SleepTimerInfo > s_sleepTimes
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.
MythTimer m_keyRepeatTimer
Queue of unprocessed key presses.
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)
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
QVector< string_pair > m_guest_stars
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
void(*)(TV *, bool, bool) EMBEDRETURNVOIDFINDER
@ kStartTVIgnoreLastPlayPos
@ kStartTVIgnoreProgStart
@ kStartTVByNetworkCommand
NoRecorderMsg
Type of message displayed in ShowNoRecorderDialog()
@ kNoRecorders
No free recorders.
@ kNoCurrRec
No current recordings.
@ kNoTuners
No capture cards configured.