MythTV  master
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
V4LChannel Class Reference

Implements tuning for TV cards using the V4L driver API, both versions 1 and 2. More...

#include <v4lchannel.h>

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

Public Member Functions

 V4LChannel (TVRec *parent, const QString &videodevice, const QString &audiodevice="")
 
virtual ~V4LChannel (void)
 
bool Init (QString &startchannel, bool setchan) override
 
bool Open (void) override
 Opens the channel changing hardware for use. More...
 
void Close (void) override
 Closes the channel changing hardware to use. More...
 
bool Tune (const DTVMultiplex &tuning) override
 This performs the actual frequency tuning and in some cases input switching. More...
 
bool Tune (uint64_t frequency) override
 Tunes to a specific frequency (Hz) on a particular input. More...
 
bool Tune (const QString &freqid, int finetune) override
 This tunes on the frequency Identification parameter for hardware that supports it. More...
 
bool Retune (void) override
 Retunes to last tuned frequency. More...
 
void SetFd (int fd) override
 Sets file descriptor. More...
 
void SetFormat (const QString &format) override
 Initializes tuner and modulator variables. More...
 
int SetDefaultFreqTable (const QString &name)
 
bool IsOpen (void) const override
 Reports whether channel is already open. More...
 
int GetFd (void) const override
 Returns file descriptor, -1 if it does not exist. More...
 
QString GetDevice (void) const override
 Returns String representing device, useful for debugging. More...
 
QString GetAudioDevice (void) const
 
QString GetSIStandard (void) const
 
bool InitPictureAttributes (void) override
 
int GetPictureAttribute (PictureAttribute) const override
 
int ChangePictureAttribute (PictureAdjustType, PictureAttribute, bool up) override
 
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...
 
bool Tune (const QString &freqid, int finetune) override
 This tunes on the frequency Identification parameter for hardware that supports it. More...
 
virtual bool Tune (uint64_t frequency)
 
- Public Member Functions inherited from DTVChannel
 DTVChannel (TVRec *parent)
 
virtual ~DTVChannel ()
 
bool SetChannelByString (const QString &chan) 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 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...
 
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 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 IsTunable (const QString &channum) const
 
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 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 void StoreInputChannels (void)
 Saves current channel as the default channel for the current input. More...
 
bool CheckChannel (const QString &channum) const
 
void SetInputID (uint _inputid)
 
int GetMajorID (void)
 

Protected Member Functions

bool IsExternalChannelChangeSupported (void) override
 
- Protected Member Functions inherited from DTVChannel
void SetSIStandard (const QString &)
 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...
 
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)
 

Private Member Functions

void SetFreqTable (const int index)
 
int SetFreqTable (const QString &name) override
 
bool SetInputAndFormat (int inputNum, const QString &newFmt)
 
int GetCurrentChannelNum (const QString &channame)
 
QString GetFormatForChannel (const QString &channum, const QString &inputname)
 
bool InitPictureAttribute (const QString &db_col_name)
 
bool InitializeInputs (void)
 This enumerates the inputs, converts the format string to something the hardware understands, and if the parent pointer is valid retrieves the channels from the database. More...
 

Private Attributes

QString m_device
 
QString m_audio_device
 
int m_videofd {-1}
 
QString m_device_name
 
QString m_driver_name
 
QMap< QString, int > m_pict_attr_default
 
struct CHANLISTm_curList {nullptr}
 
int m_totalChannels {0}
 
bool m_has_stream_io {false}
 
bool m_has_std_io {false}
 
bool m_has_async_io {false}
 
bool m_has_tuner {false}
 
bool m_has_sliced_vbi {false}
 
int m_defaultFreqTable {1}
 
int m_inputNumV4L {0}
 
int m_videoModeV4L2 {0}
 

Additional Inherited Members

- Public Types inherited from DTVChannel
using DTVChannelP = DTVChannel *
 
- Static Public Member Functions inherited from DTVChannel
static DTVChannelGetMasterLock (const QString &key)
 
static void ReturnMasterLock (DTVChannelP &)
 
- 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 inherited from DTVChannel
using MasterMap = QMap< QString, QList< DTVChannel * > >
 
- Protected Attributes inherited from DTVChannel
QMutex m_dtvinfo_lock
 
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_system_lock
 
MythSystemLegacym_system {nullptr}
 
uint m_system_status {0}
 These get mapped from the GENERIC_EXIT_* to these values for use with the signalmonitor code. More...
 
- Static Protected Attributes inherited from DTVChannel
static QReadWriteLock s_master_map_lock
 
static MasterMap s_master_map
 

Detailed Description

Implements tuning for TV cards using the V4L driver API, both versions 1 and 2.

This class supports a wide range of tuning hardware including frame grabbers (whose output requires encoding), hardware encoders, digital cameras, and non-encoding hardware which simply records pre-encoded broadcast streams.

Definition at line 32 of file v4lchannel.h.

Constructor & Destructor Documentation

◆ V4LChannel()

V4LChannel::V4LChannel ( TVRec parent,
const QString &  videodevice,
const QString &  audiodevice = "" 
)
inline

Definition at line 35 of file v4lchannel.h.

◆ ~V4LChannel()

V4LChannel::~V4LChannel ( void  )
virtual

Definition at line 37 of file v4lchannel.cpp.

Member Function Documentation

◆ Init()

bool V4LChannel::Init ( QString &  startchannel,
bool  setchan 
)
overridevirtual

Reimplemented from ChannelBase.

Definition at line 42 of file v4lchannel.cpp.

◆ Open()

bool V4LChannel::Open ( void  )
overridevirtual

Opens the channel changing hardware for use.

Implements ChannelBase.

Definition at line 52 of file v4lchannel.cpp.

◆ Close()

void V4LChannel::Close ( void  )
overridevirtual

Closes the channel changing hardware to use.

Implements ChannelBase.

Definition at line 107 of file v4lchannel.cpp.

Referenced by ~V4LChannel().

◆ Tune() [1/8]

bool V4LChannel::Tune ( const DTVMultiplex tuning)
overridevirtual

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 377 of file v4lchannel.cpp.

◆ Tune() [2/8]

bool V4LChannel::Tune ( uint64_t  frequency)
overridevirtual

Tunes to a specific frequency (Hz) on a particular input.

Note
This function always uses modulator zero.
Unlike digital tuning functions this accepts the visual carrier frequency and not the center frequency.
Parameters
frequencyFrequency in Hz, this is divided by 62.5 kHz or 62.5 Hz depending on the modulator and sent to the hardware.

Reimplemented from DTVChannel.

Definition at line 391 of file v4lchannel.cpp.

◆ Tune() [3/8]

bool V4LChannel::Tune ( const QString &  freqid,
int  finetune 
)
overridevirtual

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.

Reimplemented from DTVChannel.

Definition at line 356 of file v4lchannel.cpp.

◆ Retune()

bool V4LChannel::Retune ( void  )
overridevirtual

Retunes to last tuned frequency.

NOTE: This only works for V4L2 and only for analog tuning.

Reimplemented from ChannelBase.

Definition at line 448 of file v4lchannel.cpp.

◆ SetFd()

void V4LChannel::SetFd ( int  fd)
overridevirtual

Sets file descriptor.

Reimplemented from ChannelBase.

Definition at line 114 of file v4lchannel.cpp.

◆ SetFormat()

void V4LChannel::SetFormat ( const QString &  format)
overridevirtual

Initializes tuner and modulator variables.

Parameters
formatOne of twelve formats: "NTSC", "NTSC-JP", "ATSC", "SECAM", "PAL", "PAL-BG", "PAL-DK", "PAL-I", "PAL-60", "PAL-NC", "PAL-M", or "PAL-N"

Reimplemented from DTVChannel.

Definition at line 271 of file v4lchannel.cpp.

◆ SetDefaultFreqTable()

int V4LChannel::SetDefaultFreqTable ( const QString &  name)

Definition at line 293 of file v4lchannel.cpp.

◆ IsOpen()

bool V4LChannel::IsOpen ( void  ) const
inlineoverridevirtual

Reports whether channel is already open.

Implements ChannelBase.

Definition at line 57 of file v4lchannel.h.

◆ GetFd()

int V4LChannel::GetFd ( void  ) const
inlineoverridevirtual

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

Reimplemented from ChannelBase.

Definition at line 59 of file v4lchannel.h.

◆ GetDevice()

QString V4LChannel::GetDevice ( void  ) const
inlineoverridevirtual

Returns String representing device, useful for debugging.

Reimplemented from ChannelBase.

Definition at line 61 of file v4lchannel.h.

Referenced by V4L2encRecorder::Open().

◆ GetAudioDevice()

QString V4LChannel::GetAudioDevice ( void  ) const
inline

Definition at line 63 of file v4lchannel.h.

Referenced by V4L2encRecorder::Open().

◆ GetSIStandard()

QString V4LChannel::GetSIStandard ( void  ) const
inline

Definition at line 64 of file v4lchannel.h.

◆ InitPictureAttributes()

bool V4LChannel::InitPictureAttributes ( void  )
overridevirtual

Reimplemented from ChannelBase.

Definition at line 667 of file v4lchannel.cpp.

◆ GetPictureAttribute()

int V4LChannel::GetPictureAttribute ( PictureAttribute  attr) const
overridevirtual

Reimplemented from ChannelBase.

Definition at line 675 of file v4lchannel.cpp.

◆ ChangePictureAttribute()

int V4LChannel::ChangePictureAttribute ( PictureAdjustType  type,
PictureAttribute  attr,
bool  up 
)
overridevirtual

Reimplemented from ChannelBase.

Definition at line 754 of file v4lchannel.cpp.

◆ IsExternalChannelChangeSupported()

bool V4LChannel::IsExternalChannelChangeSupported ( void  )
inlineoverrideprotectedvirtual

Reimplemented from ChannelBase.

Definition at line 73 of file v4lchannel.h.

◆ SetFreqTable() [1/2]

void V4LChannel::SetFreqTable ( const int  index)
private

Definition at line 299 of file v4lchannel.cpp.

◆ SetFreqTable() [2/2]

int V4LChannel::SetFreqTable ( const QString &  name)
overrideprivatevirtual

Reimplemented from ChannelBase.

Definition at line 305 of file v4lchannel.cpp.

◆ SetInputAndFormat()

bool V4LChannel::SetInputAndFormat ( int  inputNum,
const QString &  newFmt 
)
private

Definition at line 496 of file v4lchannel.cpp.

◆ GetCurrentChannelNum()

int V4LChannel::GetCurrentChannelNum ( const QString &  channame)
private

Definition at line 341 of file v4lchannel.cpp.

◆ GetFormatForChannel()

QString V4LChannel::GetFormatForChannel ( const QString &  channum,
const QString &  inputname 
)
private

Definition at line 473 of file v4lchannel.cpp.

◆ InitPictureAttribute()

bool V4LChannel::InitPictureAttribute ( const QString &  db_col_name)
private

Definition at line 593 of file v4lchannel.cpp.

◆ InitializeInputs()

bool V4LChannel::InitializeInputs ( void  )
private

This enumerates the inputs, converts the format string to something the hardware understands, and if the parent pointer is valid retrieves the channels from the database.

Definition at line 225 of file v4lchannel.cpp.

◆ Tune() [4/8]

virtual bool DTVChannel::Tune

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.

◆ Tune() [5/8]

virtual bool DTVChannel::Tune
inline

Performs IPTV Tuning. Only implemented by IPTVChannel.

Definition at line 59 of file dtvchannel.h.

◆ Tune() [6/8]

virtual bool DTVChannel::Tune
inline

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

Used by the ExternalRecorder.

Definition at line 64 of file dtvchannel.h.

◆ Tune() [7/8]

bool DTVChannel::Tune
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 76 of file dtvchannel.h.

◆ Tune() [8/8]

virtual bool DTVChannel::Tune
inline

Definition at line 82 of file dtvchannel.h.

Member Data Documentation

◆ m_device

QString V4LChannel::m_device
private

Definition at line 93 of file v4lchannel.h.

◆ m_audio_device

QString V4LChannel::m_audio_device
private

Definition at line 94 of file v4lchannel.h.

◆ m_videofd

int V4LChannel::m_videofd {-1}
private

Definition at line 95 of file v4lchannel.h.

◆ m_device_name

QString V4LChannel::m_device_name
private

Definition at line 96 of file v4lchannel.h.

◆ m_driver_name

QString V4LChannel::m_driver_name
private

Definition at line 97 of file v4lchannel.h.

◆ m_pict_attr_default

QMap<QString,int> V4LChannel::m_pict_attr_default
private

Definition at line 98 of file v4lchannel.h.

◆ m_curList

struct CHANLIST* V4LChannel::m_curList {nullptr}
private

Definition at line 100 of file v4lchannel.h.

◆ m_totalChannels

int V4LChannel::m_totalChannels {0}
private

Definition at line 101 of file v4lchannel.h.

◆ m_has_stream_io

bool V4LChannel::m_has_stream_io {false}
private

Definition at line 103 of file v4lchannel.h.

◆ m_has_std_io

bool V4LChannel::m_has_std_io {false}
private

Definition at line 104 of file v4lchannel.h.

◆ m_has_async_io

bool V4LChannel::m_has_async_io {false}
private

Definition at line 105 of file v4lchannel.h.

◆ m_has_tuner

bool V4LChannel::m_has_tuner {false}
private

Definition at line 106 of file v4lchannel.h.

◆ m_has_sliced_vbi

bool V4LChannel::m_has_sliced_vbi {false}
private

Definition at line 107 of file v4lchannel.h.

◆ m_defaultFreqTable

int V4LChannel::m_defaultFreqTable {1}
private

Definition at line 109 of file v4lchannel.h.

◆ m_inputNumV4L

int V4LChannel::m_inputNumV4L {0}
private

Definition at line 110 of file v4lchannel.h.

◆ m_videoModeV4L2

int V4LChannel::m_videoModeV4L2 {0}
private

Definition at line 111 of file v4lchannel.h.


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