Go to the documentation of this file.
11 #define LOC QString("DTVChan[%1](%2): ").arg(m_inputId).arg(GetDevice())
14 using MasterMap = QMap<QString,QList<DTVChannel*> >;
34 uint mpeg_tsid,
int mpeg_pnum)
64 bool useQuickTuning = ((quickTuning != 0U) && is_live_tv) || (quickTuning > 1);
80 std::vector<DTVTunerType> tts;
128 (*mit).removeAll(
this);
129 if (mit.key() == key)
144 return (*mit).front();
158 QString loc =
LOC + QString(
"SetChannelByString(%1): ").arg(channum);
159 LOG(VB_CHANNEL, LOG_INFO, loc);
165 LOG(VB_GENERAL, LOG_ERR, loc +
"Channel object "
166 "will not open, can not change channels.");
174 uint mplexid_restriction = 0;
175 uint chanid_restriction = 0;
178 LOG(VB_GENERAL, LOG_INFO, loc +
179 QString(
"Requested channel '%1' is on input '%2' "
180 "which is in a busy input group")
193 uint64_t frequency = 0;
194 int mpeg_prog_num = 0;
204 tvformat, modulation, freqtable, freqid,
206 si_std, mpeg_prog_num, atsc_major, atsc_minor, tsid, netid,
209 LOG(VB_GENERAL, LOG_ERR, loc +
"Unable to find channel in database.");
214 if ((mplexid_restriction && (mplexid != mplexid_restriction)) ||
215 (!mplexid_restriction &&
216 chanid_restriction && (chanid != chanid_restriction)))
218 LOG(VB_GENERAL, LOG_ERR, loc +
219 QString(
"Requested channel '%1' is not available because "
220 "the tuner is currently in use on another transport.")
229 frequency = (freqid.toULongLong() + finetune) * 1000;
232 bool isFrequency = (frequency > 10000000);
238 if (!isFrequency || hasTuneToChan)
264 if (!
Tune(tuning,
false))
266 LOG(VB_GENERAL, LOG_ERR, loc +
"Tuning to IPTV URL");
271 else if (
m_name.contains(
"composite", Qt::CaseInsensitive) ||
272 m_name.contains(
"component", Qt::CaseInsensitive) ||
273 m_name.contains(
"s-video", Qt::CaseInsensitive))
275 LOG(VB_GENERAL, LOG_WARNING, loc +
"You have not set "
276 "an external channel changing"
277 "\n\t\t\tscript for a component|composite|s-video "
278 "input. Channel changing will do nothing.");
280 else if (isFrequency &&
Tune(frequency))
283 else if (isFrequency)
289 LOG(VB_GENERAL, LOG_ERR, loc +
290 "Failed to initialize multiplex options");
295 LOG(VB_GENERAL, LOG_DEBUG, loc +
296 QString(
"Initialize multiplex options m_tunerType:%1 mplexid:%2")
305 LOG(VB_GENERAL, LOG_ERR, loc +
"Tuning to frequency.");
315 ok = freqid.isEmpty() && finetune == 0 ?
316 Tune(channum) :
Tune(freqid, finetune);
320 LOG(VB_CHANNEL, LOG_INFO, loc + ((ok) ?
"success" :
"failure"));
325 if (atsc_minor || (mpeg_prog_num>=0))
328 SetDTVInfo(atsc_major, atsc_minor, netid, tsid, mpeg_prog_num);
336 if (pid_cache.empty())
338 LOG(VB_GENERAL, LOG_ERR, loc +
"PID cache is empty");
343 std::vector<uint> pnum; pnum.push_back(1);
344 std::vector<uint> pid; pid.push_back(9999);
348 std::vector<uint> pids;
349 std::vector<uint>
types;
350 for (
auto & pit : pid_cache)
352 if (!pit.GetStreamID())
354 pids.push_back(pit.GetPID());
355 types.push_back(pit.GetStreamID());
357 pcrpid = pit.GetPID();
359 pcrpid = pit.GetPID();
362 pcrpid = pid_cache[0].GetPID();
virtual std::vector< DTVTunerType > GetTunerTypes(void) const
Returns a vector of supported tuning types.
QMap< QString, QList< DTVChannel * > > MasterMap
virtual void CheckOptions(DTVMultiplex &) const
Checks tuning for problems, and tries to fix them.
void RegisterForMaster(const QString &key)
static void ReturnMasterLock(DTVChannelP &chan)
uint m_currentTransportID
static MasterMap s_master_map
virtual bool Open(void)=0
Opens the channel changing hardware for use.
virtual QString GetInputName(void) const
virtual bool IsIPTV(void) const
virtual bool IsOpen(void) const =0
Reports whether channel is already open.
virtual bool IsPIDTuningSupported(void) const
arg(title).arg(filename).arg(doDelete))
static const struct wl_interface * types[]
static bool GetCachedPids(uint chanid, pid_cache_t &pid_cache)
Returns cached MPEG PIDs when given a Channel ID.
bool SetChannelByString(const QString &chan) override
void DeregisterForMaster(const QString &key)
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
static DTVChannel * GetMasterLock(const QString &key)
static IPTVTuningData GetIPTVTuningData(uint chanid)
virtual bool Tune(const DTVMultiplex &tuning)=0
This performs the actual frequency tuning and in some cases input switching.
virtual bool FillFromDB(DTVTunerType type, uint mplexid)
static bool IsVideo(uint type)
Returns true iff video is an MPEG1/2/3, H264 or open cable video stream.
QString GetTuningMode(void) const
Returns tuning mode last set by SetTuningMode().
virtual bool IsInputAvailable(uint &mplexid_restriction, uint &chanid_restriction) const
Switches to another input on hardware, and sets the channel is setstarting is true.
uint m_currentOriginalNetworkID
void HandleScript(const QString &freqid)
virtual bool InitPictureAttributes(void)
static int GetChanID(int db_mplexid, int service_transport_id, int major_channel, int minor_channel, int program_number)
ProgramMapTable * m_genPMT
This is a generated PMT for RAW pid tuning.
void SaveCachedPids(const pid_cache_t &pid_cache) const
Saves MPEG PIDs to cache to database.
static const int kTunerTypeUnknown
void SetSIStandard(const QString &si_std)
Sets PSIP table standard: MPEG, DVB, ATSC, or OpenCable.
std::vector< pid_cache_item_t > pid_cache_t
virtual bool IsExternalChannelChangeInUse(void)
void SetFormat(const QString &format) override
static ProgramMapTable * Create(uint programNumber, uint basepid, uint pcrpid, uint version, std::vector< uint > pids, std::vector< uint > types)
QString m_sistandard
PSIP table standard: MPEG, DVB, ATSC, OpenCable.
QString GetSIStandard(void) const
Returns PSIP table standard: MPEG, DVB, ATSC, or OpenCable.
static uint GetQuickTuning(uint inputid, const QString &input_name)
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)
void HandleScriptEnd(bool ok) override
static QReadWriteLock s_master_map_lock
virtual bool TuneMultiplex(uint mplexid, const QString &inputname)
To be used by the channel scanner and possibly the EIT scanner.
virtual int SetFreqTable(const QString &)
ProgramAssociationTable * m_genPAT
This is a generated PAT for RAW pid tuning.
void SetTuningMode(const QString &tuning_mode)
Sets tuning mode: "mpeg", "dvb", "atsc", etc.
static ProgramAssociationTable * Create(uint tsid, uint version, const std::vector< uint > &pnum, const std::vector< uint > &pid)
void SetDTVInfo(uint atsc_major, uint atsc_minor, uint dvb_orig_netid, uint mpeg_tsid, int mpeg_pnum)
virtual uint GetSourceID(void) const
Class providing a generic interface to digital tuning hardware.
static bool SaveCachedPids(uint chanid, const pid_cache_t &_pid_cache, bool delete_all=false)
Saves PIDs for PSIP tables to database.
void GetCachedPids(pid_cache_t &pid_cache) const
Returns cached MPEG PIDs for last tuned channel.
bool SetVideoFiltersForChannel(uint sourceid, const QString &channum)
QString GetSuggestedTuningMode(bool is_live_tv) const
Returns suggested tuning mode: "mpeg", "dvb", or "atsc".
uint m_currentATSCMinorChannel
uint m_currentATSCMajorChannel
virtual int GetChanID(void) const