MythTV master
encoderlink.h
Go to the documentation of this file.
1#ifndef ENCODERLINK_H_
2#define ENCODERLINK_H_
3
4// C++ headers
5#include <utility>
6#include <vector> // for vector
7
8// QT headers
9#include <QDateTime> // for QDateTime
10#include <QMutex> // for QMutex
11#include <QString> // for QString
12
14#include "libmythtv/tv.h" // for SleepStatus, etc
15#include "libmythtv/videoouttypes.h" // for PictureAttribute
16
17class TVRec;
18class PlaybackSock;
19class LiveTVChain;
20class InputInfo;
21class ProgramInfo;
22
24{
25 public:
26 EncoderLink(int inputid, PlaybackSock *lsock, QString lhostname);
27 EncoderLink(int inputid, TVRec *ltv);
28
30
32 void SetSocket(PlaybackSock *lsock);
34 PlaybackSock *GetSocket(void) { return m_sock; }
35
37 void SetSleepStatus(SleepStatus newStatus);
39 QDateTime GetSleepStatusTime(void) const { return m_sleepStatusTime; }
41 QDateTime GetLastSleepTime(void) const { return m_lastSleepTime; }
43 void SetLastWakeTime(QDateTime newTime) { m_lastWakeTime = std::move(newTime); }
45 QDateTime GetLastWakeTime(void) const { return m_lastWakeTime; }
46
48 QString GetHostName(void) const { return m_hostname; }
50 bool IsLocal(void) const { return m_local; }
52 bool IsConnected(void) const { return (IsLocal() || m_sock!=nullptr); }
54 bool IsAwake(void) const { return (m_sleepStatus == sStatus_Awake); }
56 bool IsAsleep(void) const { return (m_sleepStatus & sStatus_Asleep) != 0; }
58 bool IsWaking(void) const { return (m_sleepStatus == sStatus_Waking); }
60 bool IsFallingAsleep(void) const
63 bool CanSleep(void) const { return (m_sleepStatus != sStatus_Undefined); }
64
66 SleepStatus GetSleepStatus(void) const { return (m_sleepStatus); }
67
69 int GetInputID(void) const { return m_inputid; }
71 TVRec *GetTVRec(void) { return m_tv; }
72
74 bool GoToSleep(void);
75 int LockTuner(void);
78 void FreeTuner(void) { m_locked = false; }
81 bool IsTunerLocked(void) const { return m_locked; }
82
83 bool CheckFile(ProgramInfo *pginfo);
84 long long GetMaxBitrate(void);
85 std::chrono::milliseconds SetSignalMonitoringRate(std::chrono::milliseconds rate, int notifyFrontend);
86
87 bool IsBusy(InputInfo *busy_input = nullptr, std::chrono::seconds time_buffer = 5s);
88 bool IsBusyRecording(void);
89
91 uint GetFlags(void);
92 bool IsRecording(const ProgramInfo *rec); // scheduler call only.
93
94 bool MatchesRecording(const ProgramInfo *rec);
95 void RecordPending(const ProgramInfo *rec, std::chrono::seconds secsleft, bool hasLater);
98 void StopRecording(bool killFile = false);
99 void FinishRecording(void);
100 void FrontendReady(void);
101 void CancelNextRecording(bool cancel);
102 bool WouldConflict(const ProgramInfo *rec);
103
104 bool IsReallyRecording(void);
106 float GetFramerate(void);
107 long long GetFramesWritten(void);
108 long long GetFilePosition(void);
109 int64_t GetKeyframePosition(uint64_t desired);
110 bool GetKeyframePositions(int64_t start, int64_t end, frm_pos_map_t &map);
111 bool GetKeyframeDurations(int64_t start, int64_t end, frm_pos_map_t &map);
112 void SpawnLiveTV(LiveTVChain *chain, bool pip, QString startchan);
113 QString GetChainID(void);
114 void StopLiveTV(void);
115 void PauseRecorder(void);
116 void SetLiveRecording(int recording);
117 void SetNextLiveTVDir(const QString& dir);
118 QString GetInput(void) const;
119 QString SetInput(QString input);
120 void ToggleChannelFavorite(const QString &changroup);
121 void ChangeChannel(ChannelChangeDirection channeldirection);
122 void SetChannel(const QString &name);
125 PictureAttribute attr,
126 bool direction);
127 bool CheckChannel(const QString &name);
128 bool ShouldSwitchToAnotherInput(const QString &channelid);
129 bool CheckChannelPrefix(const QString &prefix, uint &complete_valid_channel_on_rec,
130 bool &is_extra_char_useful, QString &needed_spacer);
131 void GetNextProgram(BrowseDirection direction,
132 QString &title, QString &subtitle, QString &desc,
133 QString &category, QString &starttime,
134 QString &endtime, QString &callsign, QString &iconpath,
135 QString &channelname, uint &chanid,
136 QString &seriesid, QString &programid);
137 bool GetChannelInfo(uint &chanid, uint &sourceid,
138 QString &callsign, QString &channum,
139 QString &channame, QString &xmltv) const;
140 bool SetChannelInfo(uint chanid, uint sourceid,
141 const QString& oldchannum,
142 const QString& callsign, const QString& channum,
143 const QString& channame, const QString& xmltv);
144
145 bool AddChildInput(uint childid);
146
147 private:
148 bool HasSockAndIncrRef();
149 bool HasSockAndDecrRef();
150
152
155 QString m_hostname;
156
157 TVRec *m_tv {nullptr};
158
159 bool m_local {false};
160 bool m_locked {false};
161
165 QDateTime m_lastWakeTime;
166
170};
171
172#endif
Keeps track of recordings in a current LiveTV instance.
Definition: livetvchain.h:33
Holds information on recordings and videos.
Definition: programinfo.h:70
This is the coordinating class of the Recorder Subsystem.
Definition: tv_rec.h:143
unsigned int uint
Definition: compat.h:68
QMap< long long, long long > frm_pos_map_t
Frame # -> File offset map.
Definition: programtypes.h:44
SleepStatus
SleepStatus is an enumeration of the awake/sleep status of a slave.
Definition: tv.h:100
@ sStatus_Asleep
A slave is considered asleep when it is not awake and not undefined.
Definition: tv.h:107
@ sStatus_Awake
A slave is awake when it is connected to the master.
Definition: tv.h:103
@ sStatus_Waking
A slave is marked as waking when the master runs the slave's wakeup command.
Definition: tv.h:115
@ sStatus_Undefined
A slave's sleep status is undefined when it has never connected to the master backend or is not able ...
Definition: tv.h:120
@ sStatus_FallingAsleep
A slave is marked as falling asleep when told to shutdown by the master.
Definition: tv.h:111
BrowseDirection
Used to request ProgramInfo for channel browsing.
Definition: tv.h:41
PictureAdjustType
Definition: tv.h:124
ChannelChangeDirection
ChannelChangeDirection is an enumeration of possible channel changing directions.
Definition: tv.h:32
TVState
TVState is an enumeration of the states used by TV and TVRec.
Definition: tv.h:54
PictureAttribute