MythTV  master
Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
DTVChannel Class Referenceabstract

Class providing a generic interface to digital tuning hardware. More...

#include <libmythtv/recorders/dtvchannel.h>

Inheritance diagram for DTVChannel:
[legend]
Collaboration diagram for DTVChannel:
[legend]

Public Types

using DTVChannelP = DTVChannel *
 

Public Member Functions

 DTVChannel (TVRec *parent)
 
 ~DTVChannel () override
 
bool SetChannelByString (const QString &chan) override
 
void SetFormat (const QString &format) override
 
QString GetFormat (void)
 
virtual bool TuneMultiplex (uint mplexid, const QString &inputname)
 To be used by the channel scanner and possibly the EIT scanner. More...
 
virtual bool Tune (const DTVMultiplex &tuning)=0
 This performs the actual frequency tuning and in some cases input switching. More...
 
virtual bool Tune (const IPTVTuningData &, bool)
 Performs IPTV Tuning. Only implemented by IPTVChannel. More...
 
virtual bool Tune (const QString &)
 Leave it up to the implementation to map the channnum appropriately. More...
 
virtual bool EnterPowerSavingMode (void)
 Enters power saving mode if the card supports it. More...
 
bool Tune ([[maybe_unused]] const QString &freqid, [[maybe_unused]] int finetune) override
 This tunes on the frequency Identification parameter for hardware that supports it. More...
 
virtual bool Tune ([[maybe_unused]] uint64_t frequency)
 
int GetProgramNumber (void) const
 Returns program number in PAT, -1 if unknown. More...
 
uint GetMajorChannel (void) const
 Returns major channel, 0 if unknown. More...
 
uint GetMinorChannel (void) const
 Returns minor channel, 0 if unknown. More...
 
uint GetOriginalNetworkID (void) const
 Returns DVB original_network_id, 0 if unknown. More...
 
uint GetTransportID (void) const
 Returns DVB transport_stream_id, 0 if unknown. More...
 
QString GetSIStandard (void) const
 Returns PSIP table standard: MPEG, DVB, ATSC, or OpenCable. More...
 
QString GetSuggestedTuningMode (bool is_live_tv) const
 Returns suggested tuning mode: "mpeg", "dvb", or "atsc". More...
 
QString GetTuningMode (void) const
 Returns tuning mode last set by SetTuningMode(). More...
 
virtual std::vector< DTVTunerTypeGetTunerTypes (void) const
 Returns a vector of supported tuning types. More...
 
void GetCachedPids (pid_cache_t &pid_cache) const
 Returns cached MPEG PIDs for last tuned channel. More...
 
void RegisterForMaster (const QString &key)
 
void DeregisterForMaster (const QString &key)
 
virtual bool IsMaster (void) const
 Returns true if this is the first of a number of multi-rec devs. More...
 
virtual bool IsPIDTuningSupported (void) const
 
virtual bool IsIPTV (void) const
 
bool HasGeneratedPAT (void) const
 
bool HasGeneratedPMT (void) const
 
const ProgramAssociationTableGetGeneratedPAT (void) const
 
const ProgramMapTableGetGeneratedPMT (void) const
 
void SetTuningMode (const QString &tuning_mode)
 Sets tuning mode: "mpeg", "dvb", "atsc", etc. More...
 
void SaveCachedPids (const pid_cache_t &pid_cache) const
 Saves MPEG PIDs to cache to database. More...
 
- Public Member Functions inherited from ChannelBase
 ChannelBase (TVRec *parent)
 
virtual ~ChannelBase (void)
 
virtual bool Init (QString &startchannel, bool setchan)
 
virtual bool IsTunable (const QString &channum) const
 
virtual bool Open (void)=0
 Opens the channel changing hardware for use. More...
 
virtual void Close (void)=0
 Closes the channel changing hardware to use. More...
 
virtual bool IsOpen (void) const =0
 Reports whether channel is already open. More...
 
virtual int SetFreqTable (const QString &)
 
virtual void SetFd (int fd)
 Sets file descriptor. More...
 
virtual int GetFd (void) const
 Returns file descriptor, -1 if it does not exist. More...
 
virtual bool Tune (const QString &, int)
 
virtual bool IsExternalChannelChangeInUse (void)
 
virtual uint GetNextChannel (uint chanid, ChannelChangeDirection direction) const
 
virtual uint GetNextChannel (const QString &channum, ChannelChangeDirection direction) const
 
virtual QString GetChannelName (void) const
 
virtual int GetChanID (void) const
 
virtual int GetInputID (void) const
 
virtual QString GetInputName (void) const
 
virtual uint GetSourceID (void) const
 
bool IsCommercialFree (void) const
 Returns true iff commercial detection is not required. More...
 
virtual QString GetDevice (void) const
 Returns String representing device, useful for debugging. More...
 
virtual void Renumber (uint sourceid, const QString &oldChanNum, const QString &newChanNum)
 Changes a channum if we have it cached anywhere. More...
 
virtual bool InitializeInput (void)
 Fills in input map from DB. More...
 
virtual bool Retune (void)
 
virtual void StoreInputChannels (void)
 Saves current channel as the default channel for the current input. More...
 
virtual bool InitPictureAttributes (void)
 
virtual int GetPictureAttribute (PictureAttribute) const
 
virtual int ChangePictureAttribute (PictureAdjustType, PictureAttribute, bool)
 
bool CheckChannel (const QString &channum) const
 
void SetInputID (uint _inputid)
 
int GetMajorID (void)
 

Static Public Member Functions

static DTVChannelGetMasterLock (const QString &key)
 
static void ReturnMasterLock (DTVChannelP &chan)
 
- Static Public Member Functions inherited from ChannelBase
static ChannelBaseCreateChannel (TVRec *tvrec, const GeneralDBOptions &genOpt, const DVBDBOptions &dvbOpt, const FireWireDBOptions &fwOpt, const QString &startchannel, bool enter_power_save_mode, QString &rbFileExt, bool setchan)
 

Protected Types

using MasterMap = QMap< QString, QList< DTVChannel * > >
 

Protected Member Functions

void SetSIStandard (const QString &si_std)
 Sets PSIP table standard: MPEG, DVB, ATSC, or OpenCable. More...
 
void SetDTVInfo (uint atsc_major, uint atsc_minor, uint dvb_orig_netid, uint mpeg_tsid, int mpeg_pnum)
 
void ClearDTVInfo (void)
 
virtual void CheckOptions (DTVMultiplex &) const
 Checks tuning for problems, and tries to fix them. More...
 
void HandleScriptEnd (bool ok) override
 
- Protected Member Functions inherited from ChannelBase
virtual bool IsInputAvailable (uint &mplexid_restriction, uint &chanid_restriction) const
 Switches to another input on hardware, and sets the channel is setstarting is true. More...
 
virtual bool IsExternalChannelChangeSupported (void)
 
bool KillScript (void)
 
void HandleScript (const QString &freqid)
 
uint GetScriptStatus (bool holding_lock=false)
 
bool ChangeExternalChannel (const QString &changer, const QString &freqid)
 
bool ChangeInternalChannel (const QString &freqid, uint cardinputid) const
 

Protected Attributes

QMutex m_dtvinfoLock
 
DTVTunerType m_tunerType {DTVTunerType::kTunerTypeUnknown}
 
QString m_sistandard {"mpeg"}
 PSIP table standard: MPEG, DVB, ATSC, OpenCable. More...
 
QString m_tuningMode
 
QString m_tvFormat
 
int m_currentProgramNum {-1}
 
uint m_currentATSCMajorChannel {0}
 
uint m_currentATSCMinorChannel {0}
 
uint m_currentTransportID {0}
 
uint m_currentOriginalNetworkID {0}
 
ProgramAssociationTablem_genPAT {nullptr}
 This is a generated PAT for RAW pid tuning. More...
 
ProgramMapTablem_genPMT {nullptr}
 This is a generated PMT for RAW pid tuning. More...
 
- Protected Attributes inherited from ChannelBase
TVRecm_pParent {nullptr}
 
QString m_curChannelName
 
bool m_commFree {false}
 
uint m_inputId {0}
 
uint m_sourceId {0}
 
QString m_name
 
QString m_startChanNum
 
QString m_externalChanger
 
QString m_tuneToChannel
 
ChannelInfoList m_channels
 channels across all inputs More...
 
QMutex m_systemLock
 
MythSystemLegacym_system {nullptr}
 
uint m_systemStatus {0}
 These get mapped from the GENERIC_EXIT_* to these values for use with the signalmonitor code. More...
 

Static Protected Attributes

static QReadWriteLock s_master_map_lock
 
static MasterMap s_master_map
 

Detailed Description

Class providing a generic interface to digital tuning hardware.

Definition at line 33 of file dtvchannel.h.

Member Typedef Documentation

◆ DTVChannelP

Definition at line 125 of file dtvchannel.h.

◆ MasterMap

using DTVChannel::MasterMap = QMap<QString,QList<DTVChannel*> >
protected

Definition at line 177 of file dtvchannel.h.

Constructor & Destructor Documentation

◆ DTVChannel()

DTVChannel::DTVChannel ( TVRec parent)
inlineexplicit

Definition at line 36 of file dtvchannel.h.

◆ ~DTVChannel()

DTVChannel::~DTVChannel ( )
override

Definition at line 18 of file dtvchannel.cpp.

Member Function Documentation

◆ SetChannelByString()

bool DTVChannel::SetChannelByString ( const QString &  chan)
overridevirtual

Implements ChannelBase.

Reimplemented in HDHRChannel.

Definition at line 157 of file dtvchannel.cpp.

Referenced by HDHRChannel::SetChannelByString(), and CetonChannel::SetChannelByString().

◆ SetFormat()

void DTVChannel::SetFormat ( const QString &  format)
inlineoverridevirtual

Reimplemented from ChannelBase.

Reimplemented in V4LChannel.

Definition at line 44 of file dtvchannel.h.

Referenced by SetChannelByString().

◆ GetFormat()

QString DTVChannel::GetFormat ( void  )
inline

◆ TuneMultiplex()

bool DTVChannel::TuneMultiplex ( uint  mplexid,
const QString &  inputname 
)
virtual

To be used by the channel scanner and possibly the EIT scanner.

Definition at line 395 of file dtvchannel.cpp.

Referenced by ChannelScanSM::Tune().

◆ Tune() [1/5]

virtual bool DTVChannel::Tune ( const DTVMultiplex tuning)
pure virtual

This performs the actual frequency tuning and in some cases input switching.

In rare cases such as ASI this does nothing since all the channels are in the same MPTS stream on the same input. But generally you will need to implement this when adding support for new hardware.

Implemented in DVBChannel, CetonChannel, HDHRChannel, V4LChannel, SatIPChannel, IPTVChannel, ExternalChannel, FirewireChannel, and ASIChannel.

Referenced by SetChannelByString(), ChannelScanSM::Tune(), and TuneMultiplex().

◆ Tune() [2/5]

virtual bool DTVChannel::Tune ( const IPTVTuningData ,
bool   
)
inlinevirtual

Performs IPTV Tuning. Only implemented by IPTVChannel.

Reimplemented in IPTVChannel.

Definition at line 58 of file dtvchannel.h.

◆ Tune() [3/5]

virtual bool DTVChannel::Tune ( const QString &  )
inlinevirtual

Leave it up to the implementation to map the channnum appropriately.

Used by the ExternalRecorder.

Reimplemented in ExternalChannel, and SatIPChannel.

Definition at line 63 of file dtvchannel.h.

◆ EnterPowerSavingMode()

virtual bool DTVChannel::EnterPowerSavingMode ( void  )
inlinevirtual

Enters power saving mode if the card supports it.

Reimplemented in IPTVChannel, ExternalChannel, CetonChannel, HDHRChannel, and SatIPChannel.

Definition at line 65 of file dtvchannel.h.

Referenced by ChannelBase::CreateChannel(), and TVRec::TeardownRecorder().

◆ Tune() [4/5]

bool DTVChannel::Tune ( [[maybe_unused] ] const QString &  freqid,
[[maybe_unused] ] int  finetune 
)
inlineoverride

This tunes on the frequency Identification parameter for hardware that supports it.

This is only called when there is no frequency set. This is used to implement "Channel Numbers" in analog tuning scenarios and to implement "Virtual Channels" in the OCUR and Firewire tuners.

Definition at line 75 of file dtvchannel.h.

◆ Tune() [5/5]

virtual bool DTVChannel::Tune ( [[maybe_unused] ] uint64_t  frequency)
inlinevirtual

Definition at line 81 of file dtvchannel.h.

◆ GetProgramNumber()

int DTVChannel::GetProgramNumber ( void  ) const
inline

Returns program number in PAT, -1 if unknown.

Definition at line 89 of file dtvchannel.h.

Referenced by ASIRecorder::ASIRecorder(), and TVRec::SetupDTVSignalMonitor().

◆ GetMajorChannel()

uint DTVChannel::GetMajorChannel ( void  ) const
inline

Returns major channel, 0 if unknown.

Definition at line 93 of file dtvchannel.h.

Referenced by TVRec::SetupDTVSignalMonitor().

◆ GetMinorChannel()

uint DTVChannel::GetMinorChannel ( void  ) const
inline

Returns minor channel, 0 if unknown.

Definition at line 97 of file dtvchannel.h.

Referenced by ASIRecorder::ASIRecorder(), and TVRec::SetupDTVSignalMonitor().

◆ GetOriginalNetworkID()

uint DTVChannel::GetOriginalNetworkID ( void  ) const
inline

Returns DVB original_network_id, 0 if unknown.

Definition at line 101 of file dtvchannel.h.

Referenced by TVRec::SetupDTVSignalMonitor().

◆ GetTransportID()

uint DTVChannel::GetTransportID ( void  ) const
inline

Returns DVB transport_stream_id, 0 if unknown.

Definition at line 105 of file dtvchannel.h.

Referenced by TVRec::SetupDTVSignalMonitor().

◆ GetSIStandard()

QString DTVChannel::GetSIStandard ( void  ) const

◆ GetSuggestedTuningMode()

QString DTVChannel::GetSuggestedTuningMode ( bool  is_live_tv) const

Returns suggested tuning mode: "mpeg", "dvb", or "atsc".

Definition at line 57 of file dtvchannel.cpp.

Referenced by TVRec::TuningFrequency().

◆ GetTuningMode()

QString DTVChannel::GetTuningMode ( void  ) const

Returns tuning mode last set by SetTuningMode().

Definition at line 73 of file dtvchannel.cpp.

Referenced by TVRec::SetupDTVSignalMonitor().

◆ GetTunerTypes()

std::vector< DTVTunerType > DTVChannel::GetTunerTypes ( void  ) const
virtual

Returns a vector of supported tuning types.

Reimplemented in CetonChannel, HDHRChannel, and ASIChannel.

Definition at line 79 of file dtvchannel.cpp.

Referenced by ChannelScanSM::GuessDTVTunerType().

◆ GetCachedPids()

void DTVChannel::GetCachedPids ( pid_cache_t pid_cache) const

Returns cached MPEG PIDs for last tuned channel.

Parameters
pid_cacheList of PIDs with their TableID types is returned in pid_cache.

Definition at line 97 of file dtvchannel.cpp.

Referenced by ApplyCachedPids(), and TVRec::SetupDTVSignalMonitor().

◆ RegisterForMaster()

void DTVChannel::RegisterForMaster ( const QString &  key)

Definition at line 114 of file dtvchannel.cpp.

Referenced by HDHRChannel::HDHRChannel(), and SatIPChannel::SatIPChannel().

◆ DeregisterForMaster()

void DTVChannel::DeregisterForMaster ( const QString &  key)

Definition at line 121 of file dtvchannel.cpp.

Referenced by HDHRChannel::~HDHRChannel(), and SatIPChannel::~SatIPChannel().

◆ GetMasterLock()

DTVChannel * DTVChannel::GetMasterLock ( const QString &  key)
static

◆ ReturnMasterLock()

void DTVChannel::ReturnMasterLock ( DTVChannelP chan)
static

◆ IsMaster()

virtual bool DTVChannel::IsMaster ( void  ) const
inlinevirtual

Returns true if this is the first of a number of multi-rec devs.

Reimplemented in DVBChannel, HDHRChannel, and SatIPChannel.

Definition at line 129 of file dtvchannel.h.

◆ IsPIDTuningSupported()

virtual bool DTVChannel::IsPIDTuningSupported ( void  ) const
inlinevirtual

Reimplemented in IPTVChannel, ExternalChannel, ASIChannel, and SatIPChannel.

Definition at line 131 of file dtvchannel.h.

Referenced by SetChannelByString().

◆ IsIPTV()

virtual bool DTVChannel::IsIPTV ( void  ) const
inlinevirtual

Reimplemented in IPTVChannel.

Definition at line 133 of file dtvchannel.h.

Referenced by SetChannelByString().

◆ HasGeneratedPAT()

bool DTVChannel::HasGeneratedPAT ( void  ) const
inline

Definition at line 135 of file dtvchannel.h.

Referenced by V4L2encRecorder::run(), ExternalRecorder::run(), and ASIRecorder::run().

◆ HasGeneratedPMT()

bool DTVChannel::HasGeneratedPMT ( void  ) const
inline

Definition at line 136 of file dtvchannel.h.

◆ GetGeneratedPAT()

const ProgramAssociationTable* DTVChannel::GetGeneratedPAT ( void  ) const
inline

Definition at line 137 of file dtvchannel.h.

Referenced by V4L2encRecorder::run(), ExternalRecorder::run(), and ASIRecorder::run().

◆ GetGeneratedPMT()

const ProgramMapTable* DTVChannel::GetGeneratedPMT ( void  ) const
inline

Definition at line 138 of file dtvchannel.h.

Referenced by V4L2encRecorder::run(), ExternalRecorder::run(), and ASIRecorder::run().

◆ SetTuningMode()

void DTVChannel::SetTuningMode ( const QString &  tuning_mode)

Sets tuning mode: "mpeg", "dvb", "atsc", etc.

Definition at line 87 of file dtvchannel.cpp.

Referenced by TVRec::TuningFrequency().

◆ SaveCachedPids()

void DTVChannel::SaveCachedPids ( const pid_cache_t pid_cache) const

Saves MPEG PIDs to cache to database.

Parameters
pid_cacheList of PIDs with their TableID types to be saved.

Definition at line 107 of file dtvchannel.cpp.

Referenced by TVRec::TeardownSignalMonitor().

◆ SetSIStandard()

void DTVChannel::SetSIStandard ( const QString &  si_std)
protected

Sets PSIP table standard: MPEG, DVB, ATSC, or OpenCable.

Definition at line 51 of file dtvchannel.cpp.

Referenced by SetChannelByString(), SatIPChannel::Tune(), HDHRChannel::Tune(), CetonChannel::Tune(), and DVBChannel::Tune().

◆ SetDTVInfo()

void DTVChannel::SetDTVInfo ( uint  atsc_major,
uint  atsc_minor,
uint  dvb_orig_netid,
uint  mpeg_tsid,
int  mpeg_pnum 
)
protected

Definition at line 33 of file dtvchannel.cpp.

Referenced by ClearDTVInfo(), and SetChannelByString().

◆ ClearDTVInfo()

void DTVChannel::ClearDTVInfo ( void  )
inlineprotected

Definition at line 153 of file dtvchannel.h.

Referenced by SetChannelByString().

◆ CheckOptions()

virtual void DTVChannel::CheckOptions ( DTVMultiplex ) const
inlineprotectedvirtual

Checks tuning for problems, and tries to fix them.

Reimplemented in DVBChannel.

Definition at line 155 of file dtvchannel.h.

Referenced by SetChannelByString(), and TuneMultiplex().

◆ HandleScriptEnd()

void DTVChannel::HandleScriptEnd ( bool  ok)
overrideprotectedvirtual
Note
m_systemLock must be held when this is called

Reimplemented from ChannelBase.

Definition at line 386 of file dtvchannel.cpp.

Member Data Documentation

◆ m_dtvinfoLock

QMutex DTVChannel::m_dtvinfoLock
mutableprotected

◆ m_tunerType

DTVTunerType DTVChannel::m_tunerType {DTVTunerType::kTunerTypeUnknown}
protected

◆ m_sistandard

QString DTVChannel::m_sistandard {"mpeg"}
protected

PSIP table standard: MPEG, DVB, ATSC, OpenCable.

Definition at line 163 of file dtvchannel.h.

Referenced by GetSIStandard(), GetSuggestedTuningMode(), and SetSIStandard().

◆ m_tuningMode

QString DTVChannel::m_tuningMode
protected

Definition at line 164 of file dtvchannel.h.

Referenced by GetTuningMode(), and SetTuningMode().

◆ m_tvFormat

QString DTVChannel::m_tvFormat
protected

Definition at line 165 of file dtvchannel.h.

Referenced by GetFormat(), and SetFormat().

◆ m_currentProgramNum

int DTVChannel::m_currentProgramNum {-1}
protected

Definition at line 166 of file dtvchannel.h.

Referenced by GetProgramNumber(), CetonChannel::SetChannelByString(), and SetDTVInfo().

◆ m_currentATSCMajorChannel

uint DTVChannel::m_currentATSCMajorChannel {0}
protected

Definition at line 167 of file dtvchannel.h.

Referenced by GetMajorChannel(), and SetDTVInfo().

◆ m_currentATSCMinorChannel

uint DTVChannel::m_currentATSCMinorChannel {0}
protected

Definition at line 168 of file dtvchannel.h.

Referenced by GetMinorChannel(), and SetDTVInfo().

◆ m_currentTransportID

uint DTVChannel::m_currentTransportID {0}
protected

Definition at line 169 of file dtvchannel.h.

Referenced by GetTransportID(), and SetDTVInfo().

◆ m_currentOriginalNetworkID

uint DTVChannel::m_currentOriginalNetworkID {0}
protected

Definition at line 170 of file dtvchannel.h.

Referenced by GetOriginalNetworkID(), and SetDTVInfo().

◆ m_genPAT

ProgramAssociationTable* DTVChannel::m_genPAT {nullptr}
protected

This is a generated PAT for RAW pid tuning.

Definition at line 173 of file dtvchannel.h.

Referenced by GetGeneratedPAT(), HasGeneratedPAT(), SetChannelByString(), and ~DTVChannel().

◆ m_genPMT

ProgramMapTable* DTVChannel::m_genPMT {nullptr}
protected

This is a generated PMT for RAW pid tuning.

Definition at line 175 of file dtvchannel.h.

Referenced by GetGeneratedPMT(), HasGeneratedPMT(), SetChannelByString(), and ~DTVChannel().

◆ s_master_map_lock

QReadWriteLock DTVChannel::s_master_map_lock
staticprotected

◆ s_master_map

MasterMap DTVChannel::s_master_map
staticprotected

The documentation for this class was generated from the following files: