MythTV  0.27pre
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
DVBChannel Class Reference

Provides interface to the tuning hardware when using DVB drivers. More...

#include <dvbchannel.h>

Inheritance diagram for DVBChannel:
Inheritance graph
[legend]
Collaboration diagram for DVBChannel:
Collaboration graph
[legend]

Public Member Functions

 DVBChannel (const QString &device, TVRec *parent=NULL)
 ~DVBChannel ()
bool Open (void)
 Opens the channel changing hardware for use.
void Close (void)
 Closes the channel changing hardware to use.
bool Init (QString &inputname, QString &startchannel, bool setchan)
void SetPMT (const ProgramMapTable *)
 Tells the Conditional Access Module which streams we wish to decode.
void SetTimeOffset (double offset)
 Tells the Conditional Access Module the offset from the computers utc time to dvb time.
void SetSlowTuning (uint how_slow_in_ms)
bool IsOpen (void) const
 Reports whether channel is already open.
int GetFd (void) const
 Returns file descriptor, -1 if it does not exist.
bool IsTuningParamsProbeSupported (void) const
 Returns true iff tuning info probing is working.
QString GetDevice (void) const
 Returns String representing device, useful for debugging.
QString GetCardNum (void) const
 Returns DVB device number, used to construct filenames for DVB devices.
QString GetFrontendName (void) const
 Returns frontend name as reported by driver.
bool IsMaster (void) const
 Returns true if this is the first of a number of multi-rec devs.
bool HasCRCBug (void) const
 Returns true iff we have a faulty DVB driver that munges PMT.
uint GetMinSignalMonitorDelay (void) const
const DiSEqCDevRotorGetRotor (void) const
 Returns rotor object if it exists, NULL otherwise.
bool HasLock (bool *ok=NULL) const
 Returns true iff we have a signal carrier lock.
double GetSignalStrength (bool *ok=NULL) const
 Returns signal strength in the range [0.0..1.0] (non-calibrated).
double GetSNR (bool *ok=NULL) const
 Returns signal/noise in the range [0..1.0].
double GetBitErrorRate (bool *ok=NULL) const
 Returns # of corrected bits since last call. First call undefined.
double GetUncorrectedBlockCount (bool *ok=NULL) const
 Returns # of uncorrected blocks since last call. First call undefined.
bool SwitchToInput (const QString &inputname, const QString &chan)
bool SwitchToInput (int newcapchannel, bool setstarting)
 Switches to another input on hardware, and sets the channel is setstarting is true.
bool Tune (const DTVMultiplex &tuning, QString inputname)
 This performs the actual frequency tuning and in some cases input switching.
bool Tune (const DTVMultiplex &tuning, uint inputid, bool force_reset=false, bool same_input=false)
 Tunes the card to a frequency but does not deal with PIDs.
bool Retune (void)
bool ProbeTuningParams (DTVMultiplex &tuning) const
 Fetches DTVMultiplex params from driver.
- Public Member Functions inherited from DTVChannel
 DTVChannel (TVRec *parent)
virtual ~DTVChannel ()
virtual bool SetChannelByString (const QString &chan)
virtual bool TuneMultiplex (uint mplexid, QString inputname)
 To be used by the channel scanner and possibly the EIT scanner.
virtual bool Tune (const IPTVTuningData &)
 Performs IPTV Tuning. Only implemented by IPTVChannel.
virtual bool EnterPowerSavingMode (void)
 Enters power saving mode if the card supports it.
virtual bool Tune (const QString &freqid, int finetune)
 This tunes on the frequency Identification parameter for hardware that supports it.
virtual bool Tune (uint64_t frequency, QString inputname)
int GetProgramNumber (void) const
 Returns program number in PAT, -1 if unknown.
uint GetMajorChannel (void) const
 Returns major channel, 0 if unknown.
uint GetMinorChannel (void) const
 Returns minor channel, 0 if unknown.
uint GetOriginalNetworkID (void) const
 Returns DVB original_network_id, 0 if unknown.
uint GetTransportID (void) const
 Returns DVB transport_stream_id, 0 if unknown.
QString GetSIStandard (void) const
 Returns PSIP table standard: MPEG, DVB, ATSC, or OpenCable.
QString GetSuggestedTuningMode (bool is_live_tv) const
 Returns suggested tuning mode: "mpeg", "dvb", or "atsc".
QString GetTuningMode (void) const
 Returns tuning mode last set by SetTuningMode().
virtual vector< DTVTunerTypeGetTunerTypes (void) const
 Returns a vector of supported tuning types.
void GetCachedPids (pid_cache_t &pid_cache) const
 Returns cached MPEG PIDs for last tuned channel.
void RegisterForMaster (const QString &key)
void DeregisterForMaster (const QString &key)
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 &tuningmode)
 Sets tuning mode: "mpeg", "dvb", "atsc", etc.
void SaveCachedPids (const pid_cache_t &pid_cache) const
 Saves MPEG PIDs to cache to database.
- Public Member Functions inherited from ChannelBase
 ChannelBase (TVRec *parent)
virtual ~ChannelBase (void)
virtual bool IsTunable (const QString &input, const QString &channum) const
virtual void SetFormat (const QString &)
virtual int SetFreqTable (const QString &)
virtual void SetFd (int fd)
 Sets file descriptor.
virtual bool IsExternalChannelChangeSupported (void)
virtual uint GetNextChannel (uint chanid, ChannelChangeDirection direction) const
virtual uint GetNextChannel (const QString &channum, ChannelChangeDirection direction) const
virtual int GetInputByName (const QString &input) const
 Returns number of named input, returns -1 if not found.
virtual QString GetInputByNum (int capchannel) const
 Returns name of numbered input, returns null if not found.
virtual QString GetCurrentName (void) const
virtual int GetChanID (void) const
virtual int GetCurrentInputNum (void) const
virtual QString GetCurrentInput (void) const
virtual int GetNextInputNum (void) const
virtual QString GetNextInput (void) const
virtual QString GetNextInputStartChan (void)
virtual uint GetCurrentSourceID (void) const
virtual uint GetSourceID (int inputID) const
virtual uint GetInputCardID (int inputNum) const
virtual ChannelInfoList GetChannels (int inputNum) const
virtual ChannelInfoList GetChannels (const QString &inputname) const
virtual vector< InputInfoGetFreeInputs (const vector< uint > &excluded_cards) const
 Returns the recorders available inputs.
virtual QStringList GetConnectedInputs (void) const
 Returns names of connected inputs.
bool IsCommercialFree (void) const
 Returns true iff commercial detection is not required.
virtual void Renumber (uint srcid, const QString &oldChanNum, const QString &newChanNum)
 Changes a channum if we have it cached anywhere.
virtual bool SwitchToInput (const QString &input)
virtual bool InitializeInputs (void)
 Fills in input map from DB.
virtual void StoreInputChannels (void)
 Saves current channel as the default channel for the current input.
virtual bool InitPictureAttributes (void)
virtual int GetPictureAttribute (PictureAttribute) const
virtual int ChangePictureAttribute (PictureAdjustType, PictureAttribute, bool up)
bool CheckChannel (const QString &channum, QString &inputName) const
void SetCardID (uint _cardid)
virtual uint GetCardID (void) const
 Returns card id.

Private Types

typedef DVBChannelDVBChannelP
typedef const DVBChannelDVBChannelCP

Private Member Functions

bool Open (DVBChannel *)
void Close (DVBChannel *)
int GetChanID (void) const
 Returns Channel ID.
void CheckOptions (DTVMultiplex &t) const
void CheckFrequency (uint64_t frequency) const
 Checks tuning frequency.
bool CheckModulation (DTVModulation modulation) const
 Return true iff modulation is supported modulation on the frontend.
bool CheckCodeRate (DTVCodeRate rate) const
 Return true iff rate is supported rate on the frontend.
DVBChannelGetMasterLock (void)
const DVBChannelGetMasterLock (void) const

Static Private Member Functions

static void ReturnMasterLock (DVBChannelP &dvbm)
static void ReturnMasterLock (DVBChannelCP &dvbm)

Private Attributes

IsOpenMap is_open
DiSEqCDev diseqc_dev
DiSEqCDevSettings diseqc_settings
DiSEqCDevTreediseqc_tree
DVBCamdvbcam
 Used to decrypt encrypted streams.
QString frontend_name
uint64_t capabilities
uint64_t ext_modulations
uint64_t frequency_minimum
uint64_t frequency_maximum
uint symbol_rate_minimum
uint symbol_rate_maximum
QMutex tune_lock
QMutex hw_lock
DTVMultiplex desired_tuning
 Last tuning options Tune() attempted to send to hardware.
DTVMultiplex prev_tuning
 Last tuning options Tune() succesfully sent to hardware.
uint last_lnb_dev_id
uint tuning_delay
 Extra delay to add for broken drivers.
uint sigmon_delay
 Minimum delay between FE_LOCK checks.
bool first_tune
 Used to force hardware reset.
int fd_frontend
 File descriptor for tuning hardware.
QString device
 DVB Device.
bool has_crc_bug
 true iff our driver munges PMT

Additional Inherited Members

- Public Types inherited from DTVChannel
typedef DTVChannelDTVChannelP
- Static Public Member Functions inherited from DTVChannel
static DTVChannelGetMasterLock (const QString &key)
static void ReturnMasterLock (DTVChannelP &)
- Protected Types inherited from DTVChannel
typedef QMap< QString, QList
< DTVChannel * > > 
MasterMap
- Protected Member Functions inherited from DTVChannel
void SetSIStandard (const QString &)
 Sets PSIP table standard: MPEG, DVB, ATSC, or OpenCable.
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 &tuning) const
 Checks tuning for problems, and tries to fix them.
virtual void HandleScriptEnd (bool ok)
- Static Protected Member Functions inherited from ChannelBase
static void StoreInputChannels (const InputMap &)
 Sets starting channel for the each input in the input map.
- Protected Attributes inherited from DTVChannel
QMutex dtvinfo_lock
DTVTunerType tunerType
QString sistandard
 PSIP table standard: MPEG, DVB, ATSC, OpenCable.
QString tuningMode
int currentProgramNum
uint currentATSCMajorChannel
uint currentATSCMinorChannel
uint currentTransportID
uint currentOriginalNetworkID
ProgramAssociationTablegenPAT
 This is a generated PAT for RAW pid tuning.
ProgramMapTablegenPMT
 This is a generated PMT for RAW pid tuning.
- Static Protected Attributes inherited from DTVChannel
static QReadWriteLock master_map_lock
static MasterMap master_map

Detailed Description

Provides interface to the tuning hardware when using DVB drivers.

Bug:
Only supports single input cards.

Definition at line 29 of file dvbchannel.h.

Member Typedef Documentation

Definition at line 103 of file dvbchannel.h.

typedef const DVBChannel* DVBChannel::DVBChannelCP
private

Definition at line 107 of file dvbchannel.h.

Constructor & Destructor Documentation

DVBChannel::DVBChannel ( const QString &  device,
TVRec parent = NULL 
)

Definition at line 65 of file dvbchannel.cpp.

DVBChannel::~DVBChannel ( )

Definition at line 101 of file dvbchannel.cpp.

Member Function Documentation

bool DVBChannel::Open ( void  )
inlinevirtual

Opens the channel changing hardware for use.

Implements ChannelBase.

Definition at line 35 of file dvbchannel.h.

Referenced by Init(), and Open().

void DVBChannel::Close ( void  )
inlinevirtual

Closes the channel changing hardware to use.

Implements ChannelBase.

Definition at line 36 of file dvbchannel.h.

Referenced by Close(), Open(), and ~DVBChannel().

bool DVBChannel::Init ( QString &  inputname,
QString &  startchannel,
bool  setchan 
)
virtual

Reimplemented from ChannelBase.

Definition at line 297 of file dvbchannel.cpp.

void DVBChannel::SetPMT ( const ProgramMapTable pmt)

Tells the Conditional Access Module which streams we wish to decode.

Definition at line 492 of file dvbchannel.cpp.

Referenced by DVBSignalMonitor::HandlePMT(), DVBRecorder::SetCAMPMT(), and ChannelScanSM::TestNextProgramEncryption().

void DVBChannel::SetTimeOffset ( double  offset)

Tells the Conditional Access Module the offset from the computers utc time to dvb time.

Definition at line 504 of file dvbchannel.cpp.

Referenced by DVBSignalMonitor::HandleSTT(), DVBSignalMonitor::HandleTDT(), and DVBRecorder::UpdateCAMTimeOffset().

void DVBChannel::SetSlowTuning ( uint  how_slow_in_ms)
inline

Definition at line 43 of file dvbchannel.h.

bool DVBChannel::IsOpen ( void  ) const
virtual

Reports whether channel is already open.

Implements ChannelBase.

Definition at line 291 of file dvbchannel.cpp.

Referenced by Init().

int DVBChannel::GetFd ( void  ) const
inlinevirtual

Returns file descriptor, -1 if it does not exist.

Reimplemented from ChannelBase.

Definition at line 48 of file dvbchannel.h.

bool DVBChannel::IsTuningParamsProbeSupported ( void  ) const

Returns true iff tuning info probing is working.

Definition at line 836 of file dvbchannel.cpp.

Referenced by IsTuningParamsProbeSupported().

QString DVBChannel::GetDevice ( void  ) const
inlinevirtual

Returns String representing device, useful for debugging.

Reimplemented from ChannelBase.

Definition at line 51 of file dvbchannel.h.

QString DVBChannel::GetCardNum ( void  ) const
inline

Returns DVB device number, used to construct filenames for DVB devices.

Definition at line 53 of file dvbchannel.h.

Referenced by DVBSignalMonitor::DVBSignalMonitor().

QString DVBChannel::GetFrontendName ( void  ) const

Returns frontend name as reported by driver.

Definition at line 826 of file dvbchannel.cpp.

bool DVBChannel::IsMaster ( void  ) const
virtual

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

Reimplemented from DTVChannel.

Definition at line 1146 of file dvbchannel.cpp.

bool DVBChannel::HasCRCBug ( void  ) const
inline

Returns true iff we have a faulty DVB driver that munges PMT.

Definition at line 58 of file dvbchannel.h.

uint DVBChannel::GetMinSignalMonitorDelay ( void  ) const
inline

Definition at line 59 of file dvbchannel.h.

Referenced by DVBSignalMonitor::DVBSignalMonitor().

const DiSEqCDevRotor * DVBChannel::GetRotor ( void  ) const
bool DVBChannel::HasLock ( bool ok = NULL) const

Returns true iff we have a signal carrier lock.

Definition at line 974 of file dvbchannel.cpp.

Referenced by DVBSignalMonitor::DVBSignalMonitor(), HasLock(), and DVBSignalMonitor::UpdateValues().

double DVBChannel::GetSignalStrength ( bool ok = NULL) const

Returns signal strength in the range [0.0..1.0] (non-calibrated).

Definition at line 1002 of file dvbchannel.cpp.

Referenced by GetSignalStrength(), and DVBSignalMonitor::UpdateValues().

double DVBChannel::GetSNR ( bool ok = NULL) const

Returns signal/noise in the range [0..1.0].

Some drivers report the actual ratio, while others report the dB, but in this case some weak signals may report a very high S/N since negative dB are not supported by MythTV or the 4.0 version of the DVB API due to the large number of drivers that ignored the fact that this was a signed number in the 3.0 API.

Definition at line 1031 of file dvbchannel.cpp.

Referenced by GetSNR(), and DVBSignalMonitor::UpdateValues().

double DVBChannel::GetBitErrorRate ( bool ok = NULL) const

Returns # of corrected bits since last call. First call undefined.

Definition at line 1060 of file dvbchannel.cpp.

Referenced by GetBitErrorRate(), and DVBSignalMonitor::UpdateValues().

double DVBChannel::GetUncorrectedBlockCount ( bool ok = NULL) const

Returns # of uncorrected blocks since last call. First call undefined.

Definition at line 1086 of file dvbchannel.cpp.

Referenced by GetUncorrectedBlockCount(), and DVBSignalMonitor::UpdateValues().

bool DVBChannel::SwitchToInput ( const QString &  inputname,
const QString &  chan 
)
virtual

Reimplemented from ChannelBase.

Definition at line 305 of file dvbchannel.cpp.

bool DVBChannel::SwitchToInput ( int  inputNum,
bool  setstarting 
)
virtual

Switches to another input on hardware, and sets the channel is setstarting is true.

Reimplemented from ChannelBase.

Definition at line 324 of file dvbchannel.cpp.

bool DVBChannel::Tune ( const DTVMultiplex tuning,
QString  inputname 
)
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.

Implements DTVChannel.

Definition at line 511 of file dvbchannel.cpp.

Referenced by Retune(), and Tune().

bool DVBChannel::Tune ( const DTVMultiplex tuning,
uint  inputid,
bool  force_reset = false,
bool  same_input = false 
)

Tunes the card to a frequency but does not deal with PIDs.

This is used by DVB Channel Scanner, the EIT Parser, and by TVRec.

Parameters
tuningInfo on transport to tune to
inputidOptional, forces specific input (for DiSEqC)
force_resetIf true, frequency tuning is done even if it should not be needed.
same_inputOptional, doesn't change input (for retuning).
Returns
true on success, false on failure

Definition at line 640 of file dvbchannel.cpp.

bool DVBChannel::Retune ( void  )
virtual

Reimplemented from ChannelBase.

Definition at line 821 of file dvbchannel.cpp.

Referenced by DVBStreamHandler::RetuneMonitor().

bool DVBChannel::ProbeTuningParams ( DTVMultiplex tuning) const

Fetches DTVMultiplex params from driver.

Note: Only updates tuning on success.

Returns
true on success, false on failure

Definition at line 882 of file dvbchannel.cpp.

Referenced by ProbeTuningParams().

bool DVBChannel::Open ( DVBChannel who)
private

Definition at line 175 of file dvbchannel.cpp.

void DVBChannel::Close ( DVBChannel who)
private

Definition at line 136 of file dvbchannel.cpp.

int DVBChannel::GetChanID ( void  ) const
private

Returns Channel ID.

Bug:
This only works if there is only one input on the card.

Definition at line 940 of file dvbchannel.cpp.

void DVBChannel::CheckOptions ( DTVMultiplex t) const
private

Definition at line 351 of file dvbchannel.cpp.

void DVBChannel::CheckFrequency ( uint64_t  frequency) const
private

Checks tuning frequency.

Definition at line 338 of file dvbchannel.cpp.

Referenced by CheckOptions(), and Tune().

bool DVBChannel::CheckModulation ( DTVModulation  modulation) const
private

Return true iff modulation is supported modulation on the frontend.

Definition at line 469 of file dvbchannel.cpp.

Referenced by CheckOptions().

bool DVBChannel::CheckCodeRate ( DTVCodeRate  rate) const
private

Return true iff rate is supported rate on the frontend.

Definition at line 450 of file dvbchannel.cpp.

Referenced by CheckOptions().

DVBChannel * DVBChannel::GetMasterLock ( void  )
private
void DVBChannel::ReturnMasterLock ( DVBChannelP dvbm)
staticprivate
const DVBChannel * DVBChannel::GetMasterLock ( void  ) const
private

Definition at line 1128 of file dvbchannel.cpp.

static void DVBChannel::ReturnMasterLock ( DVBChannelCP dvbm)
staticprivate

Member Data Documentation

IsOpenMap DVBChannel::is_open
private

Definition at line 112 of file dvbchannel.h.

Referenced by Close(), IsOpen(), Open(), and ~DVBChannel().

DiSEqCDev DVBChannel::diseqc_dev
private

Definition at line 115 of file dvbchannel.h.

Referenced by Open().

DiSEqCDevSettings DVBChannel::diseqc_settings
private

Definition at line 116 of file dvbchannel.h.

Referenced by GetRotor(), and Tune().

DiSEqCDevTree* DVBChannel::diseqc_tree
private
DVBCam* DVBChannel::dvbcam
private

Used to decrypt encrypted streams.

Definition at line 118 of file dvbchannel.h.

Referenced by Close(), DVBChannel(), SetPMT(), SetTimeOffset(), and ~DVBChannel().

QString DVBChannel::frontend_name
private

Definition at line 121 of file dvbchannel.h.

Referenced by GetFrontendName(), and Open().

uint64_t DVBChannel::capabilities
private

Definition at line 122 of file dvbchannel.h.

Referenced by CheckCodeRate(), CheckModulation(), CheckOptions(), Open(), and Tune().

uint64_t DVBChannel::ext_modulations
private

Definition at line 123 of file dvbchannel.h.

Referenced by Open().

uint64_t DVBChannel::frequency_minimum
private

Definition at line 124 of file dvbchannel.h.

Referenced by CheckFrequency(), and Open().

uint64_t DVBChannel::frequency_maximum
private

Definition at line 125 of file dvbchannel.h.

Referenced by CheckFrequency(), and Open().

uint DVBChannel::symbol_rate_minimum
private

Definition at line 126 of file dvbchannel.h.

Referenced by CheckOptions(), and Open().

uint DVBChannel::symbol_rate_maximum
private

Definition at line 127 of file dvbchannel.h.

Referenced by CheckOptions(), and Open().

QMutex DVBChannel::tune_lock
mutableprivate

Definition at line 130 of file dvbchannel.h.

Referenced by Tune().

QMutex DVBChannel::hw_lock
mutableprivate

Definition at line 131 of file dvbchannel.h.

Referenced by Close(), IsTuningParamsProbeSupported(), Open(), ProbeTuningParams(), and Tune().

DTVMultiplex DVBChannel::desired_tuning
private

Last tuning options Tune() attempted to send to hardware.

Definition at line 133 of file dvbchannel.h.

Referenced by Retune(), and Tune().

DTVMultiplex DVBChannel::prev_tuning
private

Last tuning options Tune() succesfully sent to hardware.

Definition at line 135 of file dvbchannel.h.

Referenced by Tune().

uint DVBChannel::last_lnb_dev_id
private

Definition at line 137 of file dvbchannel.h.

Referenced by Tune().

uint DVBChannel::tuning_delay
private

Extra delay to add for broken drivers.

Definition at line 139 of file dvbchannel.h.

Referenced by SetSlowTuning(), and Tune().

uint DVBChannel::sigmon_delay
private

Minimum delay between FE_LOCK checks.

Definition at line 140 of file dvbchannel.h.

Referenced by DVBChannel(), and GetMinSignalMonitorDelay().

bool DVBChannel::first_tune
private

Used to force hardware reset.

Definition at line 141 of file dvbchannel.h.

Referenced by Open(), and Tune().

int DVBChannel::fd_frontend
private
QString DVBChannel::device
private

DVB Device.

Definition at line 145 of file dvbchannel.h.

Referenced by DVBChannel(), GetCardNum(), GetDevice(), GetMasterLock(), Open(), and ~DVBChannel().

bool DVBChannel::has_crc_bug
private

true iff our driver munges PMT

Definition at line 146 of file dvbchannel.h.

Referenced by DVBChannel(), and HasCRCBug().


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