12#define LOC QString("ExternChan[%1](%2): ").arg(m_inputId).arg(m_loc)
22 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"Open()");
32 LOG(VB_GENERAL, LOG_ERR,
LOC +
33 QString(
"Valid stream handler, but app is not open! Resetting."));
48 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Open failed");
54 LOG(VB_RECORD, LOG_INFO,
LOC +
"Opened");
60 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"Close()");
91 LOG(VB_CHANNEL, LOG_INFO,
LOC + QString(
"Tune(%1)").arg(channum));
95 LOG(VB_CHANNEL, LOG_ERR,
LOC +
"Tune failed, not open");
107 LOG(VB_CHANNEL, LOG_ERR,
LOC + QString
108 (
"Failed to retrieve LockTimeout: %1").arg(result));
113 m_tuneTimeout = std::chrono::milliseconds(result.split(
":")[1].toInt());
116 LOG(VB_CHANNEL, LOG_INFO,
LOC + QString(
"Using Tune timeout of %1ms")
120 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"Tuning to " + channum);
127 LOG(VB_CHANNEL, LOG_ERR,
LOC + QString
128 (
"Failed to Tune %1: %2").arg(channum, result));
139 cmd[
"command"] =
"TuneChannel";
140 cmd[
"channum"] = channum;
150 cmd[
"recordid"] = recordid;
160 uint64_t frequency = 0;
162 int mpeg_prog_num = 0;
165 uint dvb_transportid = 0;
166 uint dvb_networkid = 0;
168 bool commfree =
false;
171 tvformat, modulation, freqtable, freqid,
172 finetune, frequency, dtv_si_std,
173 mpeg_prog_num, atsc_major, atsc_minor,
174 dvb_transportid, dvb_networkid,
177 LOG(VB_GENERAL, LOG_ERR,
LOC +
" " +
178 QString(
"Failed to find channel in DB on input '%1' ")
183 cmd[
"chanid"] = chanid;
184 cmd[
"freqid"] = freqid;
185 cmd[
"atsc_major"] = atsc_major;
186 cmd[
"atsc_minor"] = atsc_minor;
187 cmd[
"mplexid"] = mplexid;
192 LOG(VB_CHANNEL, LOG_ERR,
LOC + QString
193 (
"Failed to Tune %1: %2").arg(channum, QString(response)));
197 .toString().startsWith(
"InProgress");
221 LOG(VB_CHANNEL, LOG_DEBUG,
LOC + QString(
"GetScriptStatus() %1")
229 LOG(VB_CHANNEL, LOG_ERR,
LOC + QString
230 (
"Failed to Tune: %1").arg(result));
236 if (result.startsWith(
"OK:InProgress"))
246 LOG(VB_CHANNEL, LOG_DEBUG,
LOC + QString(
"GetScriptStatus() %1 -> %2")
#define LOC
-*- Mode: c++ -*- Class ExternalChannel
uint m_systemStatus
These get mapped from the GENERIC_EXIT_* to these values for use with the signalmonitor code.
virtual int GetInputID(void) const
virtual bool InitializeInput(void)
Fills in input map from DB.
static bool GetChannelData(uint sourceid, uint &chanid, const QString &channum, QString &tvformat, QString &modulation, QString &freqtable, QString &freqid, int &finetune, uint64_t &frequency, QString &dtv_si_std, int &mpeg_prog_num, uint &atsc_major, uint &atsc_minor, uint &dvb_transportid, uint &dvb_networkid, uint &mplexid, bool &commfree)
ExternalStreamHandler * m_streamHandler
~ExternalChannel(void) override
QString GetDevice(void) const override
Returns String representing device, useful for debugging.
bool Tune(const DTVMultiplex &) override
This performs the actual frequency tuning and in some cases input switching.
bool EnterPowerSavingMode(void) override
Enters power saving mode if the card supports it.
bool Open(void) override
Opens the channel changing hardware for use.
void Close(void) override
Closes the channel changing hardware to use.
bool IsOpen(void) const override
Reports whether channel is already open.
std::chrono::milliseconds m_tuneTimeout
QString UpdateDescription(void)
QString GetDescription(void)
static ExternalStreamHandler * Get(const QString &devname, int inputid, int majorid)
QString GetDescription(void)
bool ProcessCommand(const QString &cmd, QString &result, std::chrono::milliseconds timeout=4s, uint retry_cnt=3)
QString UpdateDescription(void)
bool HasTuner(void) const
bool ProcessJson(const QVariantMap &vmsg, QVariantMap &elements, QByteArray &response, std::chrono::milliseconds timeout=4s, uint retry_cnt=3)
int APIVersion(void) const
static void Return(ExternalStreamHandler *&ref, int inputid)
Holds information on recordings and videos.
uint GetRecordingRuleID(void) const
bool HasError(void) const
ProgramInfo * GetRecording(void)
Allocates and returns a ProgramInfo for the current recording.
#define LOG(_MASK_, _LEVEL_, _QSTRING_)