MythTV
master
|
Implements tuning for TV cards using the V4L driver API, both versions 1 and 2. More...
#include <libmythtv/recorders/v4lchannel.h>
Public Member Functions | |
V4LChannel (TVRec *parent, QString videodevice, QString audiodevice="") | |
~V4LChannel (void) override | |
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 |
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 |
bool | InitPictureAttributes (void) override |
int | GetPictureAttribute (PictureAttribute attr) const override |
int | ChangePictureAttribute (PictureAdjustType type, PictureAttribute attr, 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 ([[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) |
Public Member Functions inherited from DTVChannel | |
DTVChannel (TVRec *parent) | |
~DTVChannel () override | |
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... | |
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< DTVTunerType > | GetTunerTypes (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 ProgramAssociationTable * | GetGeneratedPAT (void) const |
const ProgramMapTable * | GetGeneratedPMT (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) |
Static Public Member Functions | |
static QString | GetSIStandard (void) |
Static Public Member Functions inherited from DTVChannel | |
static DTVChannel * | GetMasterLock (const QString &key) |
static void | ReturnMasterLock (DTVChannelP &chan) |
Static Public Member Functions inherited from ChannelBase | |
static ChannelBase * | CreateChannel (TVRec *tvrec, const GeneralDBOptions &genOpt, const DVBDBOptions &dvbOpt, const FireWireDBOptions &fwOpt, const QString &startchannel, bool enter_power_save_mode, QString &rbFileExt, bool setchan) |
Protected Member Functions | |
bool | IsExternalChannelChangeSupported (void) override |
Protected Member Functions inherited from DTVChannel | |
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... | |
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 |
Private Member Functions | |
void | SetFreqTable (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) |
Private Attributes | |
QString | m_device |
QString | m_audioDevice |
int | m_videoFd {-1} |
QString | m_deviceName |
QString | m_driverName |
QMap< QString, int > | m_pictAttrDefault |
CHANLIST_vec | m_curList |
bool | m_hasStreamIO {false} |
bool | m_hasStdIO {false} |
bool | m_hasAsyncIO {false} |
bool | m_hasTuner {false} |
bool | m_hasSlicedVbi {false} |
int | m_defaultFreqTable {1} |
int | m_inputNumV4L {0} |
int | m_videoModeV4L2 {0} |
Additional Inherited Members | |
Public Types inherited from DTVChannel | |
using | DTVChannelP = DTVChannel * |
Protected Types inherited from DTVChannel | |
using | MasterMap = QMap< QString, QList< DTVChannel * > > |
Protected Attributes inherited from DTVChannel | |
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} |
ProgramAssociationTable * | m_genPAT {nullptr} |
This is a generated PAT for RAW pid tuning. More... | |
ProgramMapTable * | m_genPMT {nullptr} |
This is a generated PMT for RAW pid tuning. More... | |
Protected Attributes inherited from ChannelBase | |
TVRec * | m_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 |
MythSystemLegacy * | m_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 inherited from DTVChannel | |
static QReadWriteLock | s_master_map_lock |
static MasterMap | s_master_map |
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 30 of file v4lchannel.h.
|
inline |
Definition at line 33 of file v4lchannel.h.
|
override |
Definition at line 37 of file v4lchannel.cpp.
Reimplemented from ChannelBase.
Definition at line 42 of file v4lchannel.cpp.
|
overridevirtual |
Opens the channel changing hardware for use.
Implements ChannelBase.
Definition at line 52 of file v4lchannel.cpp.
Referenced by SetFormat().
|
overridevirtual |
Closes the channel changing hardware to use.
Implements ChannelBase.
Definition at line 108 of file v4lchannel.cpp.
Referenced by Open(), SetFd(), and ~V4LChannel().
|
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 373 of file v4lchannel.cpp.
Referenced by Tune().
|
override |
Tunes to a specific frequency (Hz) on a particular input.
frequency | Frequency in Hz, this is divided by 62.5 kHz or 62.5 Hz depending on the modulator and sent to the hardware. |
Definition at line 387 of file v4lchannel.cpp.
|
overridevirtual |
Reimplemented from ChannelBase.
Definition at line 352 of file v4lchannel.cpp.
|
overridevirtual |
Retunes to last tuned frequency.
NOTE: This only works for V4L2 and only for analog tuning.
Reimplemented from ChannelBase.
Definition at line 444 of file v4lchannel.cpp.
|
overridevirtual |
Sets file descriptor.
Reimplemented from ChannelBase.
Definition at line 115 of file v4lchannel.cpp.
|
overridevirtual |
Initializes tuner and modulator variables.
format | One 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.
int V4LChannel::SetDefaultFreqTable | ( | const QString & | name | ) |
Definition at line 293 of file v4lchannel.cpp.
Referenced by Init().
|
inlineoverridevirtual |
Reports whether channel is already open.
Implements ChannelBase.
Definition at line 56 of file v4lchannel.h.
|
inlineoverridevirtual |
Returns file descriptor, -1 if it does not exist.
Reimplemented from ChannelBase.
Definition at line 58 of file v4lchannel.h.
Referenced by IsOpen().
|
inlineoverridevirtual |
Returns String representing device, useful for debugging.
Reimplemented from ChannelBase.
Definition at line 60 of file v4lchannel.h.
Referenced by V4L2encRecorder::Open().
|
inline |
Definition at line 62 of file v4lchannel.h.
Referenced by V4L2encRecorder::Open().
|
inlinestatic |
Definition at line 63 of file v4lchannel.h.
|
overridevirtual |
Reimplemented from ChannelBase.
Definition at line 663 of file v4lchannel.cpp.
|
overridevirtual |
Reimplemented from ChannelBase.
Definition at line 671 of file v4lchannel.cpp.
Referenced by ChangePictureAttribute().
|
overridevirtual |
Reimplemented from ChannelBase.
Definition at line 750 of file v4lchannel.cpp.
|
inlineoverrideprotectedvirtual |
Reimplemented from ChannelBase.
Definition at line 72 of file v4lchannel.h.
|
private |
Definition at line 299 of file v4lchannel.cpp.
Referenced by SetDefaultFreqTable(), and SetFreqTable().
|
overrideprivatevirtual |
Reimplemented from ChannelBase.
Definition at line 304 of file v4lchannel.cpp.
|
private |
Definition at line 492 of file v4lchannel.cpp.
Referenced by SetFormat().
|
private |
Definition at line 337 of file v4lchannel.cpp.
Referenced by Tune().
|
private |
Definition at line 469 of file v4lchannel.cpp.
|
private |
Definition at line 589 of file v4lchannel.cpp.
Referenced by InitPictureAttributes().
|
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 226 of file v4lchannel.cpp.
Referenced by Open().
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.
|
inline |
Performs IPTV Tuning. Only implemented by IPTVChannel.
Definition at line 58 of file dtvchannel.h.
|
inline |
Leave it up to the implementation to map the channnum appropriately.
Used by the ExternalRecorder.
Definition at line 63 of file dtvchannel.h.
|
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.
|
inline |
Definition at line 81 of file dtvchannel.h.
|
private |
Definition at line 92 of file v4lchannel.h.
Referenced by GetDevice(), Open(), SetFreqTable(), and Tune().
|
private |
Definition at line 93 of file v4lchannel.h.
Referenced by GetAudioDevice().
|
private |
Definition at line 94 of file v4lchannel.h.
Referenced by ChangePictureAttribute(), Close(), GetFd(), InitializeInputs(), InitPictureAttribute(), Open(), Retune(), SetFd(), SetInputAndFormat(), and Tune().
|
private |
Definition at line 95 of file v4lchannel.h.
Referenced by InitPictureAttribute(), and Open().
|
private |
Definition at line 96 of file v4lchannel.h.
Referenced by Open().
|
private |
Definition at line 97 of file v4lchannel.h.
Referenced by GetPictureAttribute(), and InitPictureAttribute().
|
private |
Definition at line 99 of file v4lchannel.h.
Referenced by GetCurrentChannelNum(), SetFreqTable(), and Tune().
Definition at line 101 of file v4lchannel.h.
Referenced by Open(), and SetInputAndFormat().
Definition at line 102 of file v4lchannel.h.
Referenced by Open().
Definition at line 103 of file v4lchannel.h.
Referenced by Open().
Definition at line 104 of file v4lchannel.h.
Referenced by Open().
Definition at line 105 of file v4lchannel.h.
Referenced by Open().
|
private |
Definition at line 107 of file v4lchannel.h.
Referenced by SetDefaultFreqTable(), and SetFreqTable().
|
private |
Definition at line 108 of file v4lchannel.h.
Referenced by InitializeInputs(), and SetInputAndFormat().
|
private |
Definition at line 109 of file v4lchannel.h.
Referenced by InitializeInputs(), and SetFormat().