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

#include <v4l2encsignalmonitor.h>

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

Public Member Functions

 V4L2encSignalMonitor (int db_cardnum, V4LChannel *_channel, bool _release_stream, uint64_t _flags=0)
 Initializes signal lock and signal values. More...
 
 ~V4L2encSignalMonitor () override
 Stops signal monitoring and table monitoring threads. More...
 
void Stop (void) override
 Stop signal monitoring and table monitoring threads. More...
 
- Public Member Functions inherited from DTVSignalMonitor
 DTVSignalMonitor (int db_cardnum, DTVChannel *_channel, bool _release_stream, uint64_t wait_for_mask)
 
 ~DTVSignalMonitor () override
 
QStringList GetStatusList (void) const override
 Returns QStringList containing all signals and their current values. More...
 
void SetChannel (int major, int minor)
 
int GetMajorChannel () const
 
int GetMinorChannel () const
 
void SetProgramNumber (int progNum)
 
int GetProgramNumber () const
 
void SetDVBService (uint network_id, uint transport_id, int service_id)
 
uint GetTransportID (void) const
 
uint GetNetworkID (void) const
 
int GetServiceID (void) const
 
uint GetDetectedNetworkID (void) const
 
uint GetDetectedTransportID (void) const
 
virtual void SetRotorTarget (float)
 Sets rotor target pos from 0.0 to 1.0. More...
 
virtual void GetRotorStatus (bool &was_moving, bool &is_moving)
 
virtual void SetRotorValue (int)
 
void AddFlags (uint64_t _flags) override
 
void RemoveFlags (uint64_t _flags) override
 
virtual void SetStreamData (MPEGStreamData *data)
 Sets the MPEG stream data for DTVSignalMonitor to use, and connects the table signals to the monitor. More...
 
MPEGStreamDataGetStreamData ()
 Returns the MPEG stream data if it exists. More...
 
ATSCStreamDataGetATSCStreamData ()
 Returns the ATSC stream data if it exists. More...
 
DVBStreamDataGetDVBStreamData ()
 Returns the DVB stream data if it exists. More...
 
ScanStreamDataGetScanStreamData ()
 Returns the scan stream data if it exists. More...
 
const MPEGStreamDataGetStreamData () const
 Returns the MPEG stream data if it exists. More...
 
const ATSCStreamDataGetATSCStreamData () const
 Returns the ATSC stream data if it exists. More...
 
const DVBStreamDataGetDVBStreamData () const
 Returns the DVB stream data if it exists. More...
 
const ScanStreamDataGetScanStreamData () const
 Returns the scan stream data if it exists. More...
 
bool IsAllGood (void) const override
 
void HandlePAT (const ProgramAssociationTable *pat) override
 
void HandleCAT (const ConditionalAccessTable *) override
 
void HandlePMT (uint program_num, const ProgramMapTable *pmt) override
 
void HandleEncryptionStatus (uint pnum, bool enc_status) override
 
void HandleSTT (const SystemTimeTable *stt) override
 
void HandleVCT (uint, const VirtualChannelTable *) override
 
void HandleMGT (const MasterGuideTable *mgt) override
 
void HandleTVCT (uint pid, const TerrestrialVirtualChannelTable *tvct) override
 
void HandleCVCT (uint pid, const CableVirtualChannelTable *cvct) override
 
void HandleRRT (const RatingRegionTable *) override
 
void HandleDCCT (const DirectedChannelChangeTable *) override
 
void HandleDCCSCT (const DirectedChannelChangeSelectionCodeTable *) override
 
void HandleTDT (const TimeDateTable *tdt) override
 
void HandleNIT (const NetworkInformationTable *nit) override
 
void HandleSDT (uint tsid, const ServiceDescriptionTable *sdt) override
 
void IgnoreEncrypted (bool ignore)
 
- Public Member Functions inherited from SignalMonitor
 ~SignalMonitor () override
 Stops monitoring thread. More...
 
 SignalMonitor (int, ChannelBase *, uint64_t, bool)=delete
 
virtual void Start ()
 Start signal monitoring thread. More...
 
bool HasFlags (uint64_t _flags) const
 
bool HasAnyFlag (uint64_t _flags) const
 
uint64_t GetFlags (void) const
 
virtual bool HasExtraSlowTuning (void) const
 
bool GetNotifyFrontend () const
 Returns whether or not a SIGNAL MythEvent is being sent regularly to the frontend. More...
 
std::chrono::milliseconds GetUpdateRate () const
 Returns milliseconds between signal monitoring events. More...
 
int GetSignalStrength (void)
 
bool HasSignalLock (void) const
 Returns true iff scriptStatus.IsGood() and signalLock.IsGood() return true. More...
 
bool IsErrored (void) const
 
void SetNotifyFrontend (bool notify)
 Enables or disables frontend notification of the current signal value. More...
 
void SetMonitoring (TVRec *parent, bool EITscan, bool monitor)
 Indicate if table monitoring is needed. More...
 
void SetUpdateRate (std::chrono::milliseconds msec)
 Sets the number of milliseconds between signal monitoring attempts in the signal monitoring thread. More...
 
void AddListener (SignalMonitorListener *listener)
 
void RemoveListener (SignalMonitorListener *listener)
 
void SendMessage (SignalMonitorMessageType type, const SignalMonitorValue &val)
 
void SendMessageAllGood (void)
 
virtual void EmitStatus (void)
 
- Public Member Functions inherited from MPEGStreamListener
virtual void HandleSplice (const SpliceInformationTable *)
 

Protected Member Functions

 V4L2encSignalMonitor (void)
 
 V4L2encSignalMonitor (const V4L2encSignalMonitor &)
 
void UpdateValues (void) override
 Fills in frontend stats and emits status Qt signals. More...
 
V4LChannelGetV4L2encChannel (void)
 
bool HasLock (void)
 
int StableResolution (void)
 Wait for a stable signal. More...
 
- Protected Member Functions inherited from DTVSignalMonitor
DTVChannelGetDTVChannel (void)
 
void UpdateMonitorValues (void)
 
void UpdateListeningForEIT (void)
 
- Protected Member Functions inherited from SignalMonitor
 SignalMonitor (int _inputid, ChannelBase *_channel, bool _release_stream, uint64_t wait_for_mask)
 Initializes signal lock and signal values. More...
 
void run (void) override
 Basic signal monitoring loop. More...
 
- Protected Member Functions inherited from MThread
int exec (void)
 Enters the qt event loop. call exit or quit to exit thread. More...
 
 MThread (const QString &objectName)
 Standard constructor. More...
 
 MThread (const QString &objectName, QRunnable *runnable)
 Use this constructor if you want the default run() method to run the QRunnable's run() method instead of entering the Qt event loop. More...
 
virtual ~MThread ()
 
 MThread (const MThread &)=delete
 
MThreadoperator= (const MThread &)=delete
 
void RunProlog (void)
 Sets up a thread, call this if you reimplement run(). More...
 
void RunEpilog (void)
 Cleans up a thread's resources, call this if you reimplement run(). More...
 
QThread * qthread (void)
 Returns the thread, this will always return the same pointer no matter how often you restart the thread. More...
 
void setObjectName (const QString &name)
 
QString objectName (void) const
 
void setPriority (QThread::Priority priority)
 
QThread::Priority priority (void) const
 
bool isFinished (void) const
 
bool isRunning (void) const
 
void setStackSize (uint stackSize)
 
uint stackSize (void) const
 
void exit (int retcode=0)
 Use this to exit from the thread if you are using a Qt event loop. More...
 
void start (QThread::Priority p=QThread::InheritPriority)
 Tell MThread to start running the thread in the near future. More...
 
void terminate (void)
 Kill a thread unsafely. More...
 
void quit (void)
 calls exit(0) More...
 
bool wait (std::chrono::milliseconds time=std::chrono::milliseconds::max())
 Wait for the MThread to exit, with a maximum timeout. More...
 
- Protected Member Functions inherited from MPEGStreamListener
virtual ~MPEGStreamListener ()=default
 
- Protected Member Functions inherited from ATSCMainStreamListener
virtual ~ATSCMainStreamListener ()=default
 
- Protected Member Functions inherited from ATSCAuxStreamListener
virtual ~ATSCAuxStreamListener ()=default
 
- Protected Member Functions inherited from DVBMainStreamListener
virtual ~DVBMainStreamListener ()=default
 

Protected Attributes

V4L2util m_v4l2
 
V4L2encStreamHandlerm_streamHandler {nullptr}
 
bool m_isTS {false}
 
- Protected Attributes inherited from DTVSignalMonitor
MPEGStreamDatam_streamData {nullptr}
 
std::vector< uintm_eitPids
 
SignalMonitorValue m_seenPAT
 
SignalMonitorValue m_seenPMT
 
SignalMonitorValue m_seenMGT
 
SignalMonitorValue m_seenVCT
 
SignalMonitorValue m_seenNIT
 
SignalMonitorValue m_seenSDT
 
SignalMonitorValue m_seenCrypt
 
SignalMonitorValue m_matchingPAT
 
SignalMonitorValue m_matchingPMT
 
SignalMonitorValue m_matchingMGT
 
SignalMonitorValue m_matchingVCT
 
SignalMonitorValue m_matchingNIT
 
SignalMonitorValue m_matchingSDT
 
SignalMonitorValue m_matchingCrypt
 
int m_majorChannel {-1}
 
int m_minorChannel {-1}
 
uint m_networkID {0}
 
uint m_transportID {0}
 
uint m_detectedNetworkID {0}
 
uint m_detectedTransportID {0}
 
int m_programNumber {-1}
 
QList< uint64_t > m_seenTableCrc
 
bool m_ignoreEncrypted {false}
 
- Protected Attributes inherited from SignalMonitor
ChannelBasem_channel {nullptr}
 
TVRecm_pParent {nullptr}
 
int m_inputid
 
volatile uint64_t m_flags
 
bool m_releaseStream
 
std::chrono::milliseconds m_updateRate {25ms}
 
std::chrono::milliseconds m_minimumUpdateRate {5ms}
 
bool m_updateDone {false}
 
bool m_notifyFrontend {true}
 
bool m_tablemon {false}
 
bool m_eitScan {false}
 
QString m_error
 
SignalMonitorValue m_signalLock
 
SignalMonitorValue m_signalStrength
 
SignalMonitorValue m_scriptStatus
 
std::vector< SignalMonitorListener * > m_listeners
 
QMutex m_startStopLock
 
QWaitCondition m_startStopWait
 
volatile bool m_running {false}
 
volatile bool m_exit {false}
 
QRecursiveMutex m_statusLock
 
QMutex m_listenerLock
 
- Protected Attributes inherited from MThread
MThreadInternalm_thread {nullptr}
 
QRunnable * m_runnable {nullptr}
 
bool m_prologExecuted {true}
 
bool m_epilogExecuted {true}
 

Private Attributes

int m_strength {0}
 
std::chrono::milliseconds m_stableTime {1500ms}
 
int m_width {0}
 
int m_height {0}
 
uint m_lockCnt {0}
 
MythTimer m_timer
 
QDateTime m_statusTime
 

Additional Inherited Members

- Static Public Member Functions inherited from SignalMonitor
static bool IsRequired (const QString &cardtype)
 Returns true iff the card type supports signal monitoring. More...
 
static bool IsSupported (const QString &cardtype)
 
static SignalMonitorInit (const QString &cardtype, int db_cardnum, ChannelBase *channel, bool release_stream)
 
- Static Public Attributes inherited from SignalMonitor
static const uint64_t kDTVSigMon_PATSeen = 0x0000000001ULL
 We've seen a PAT, which maps MPEG program numbers to pids where we find PMTs. More...
 
static const uint64_t kDTVSigMon_PMTSeen = 0x0000000002ULL
 We've seen a PMT, which maps program to audio, video and other stream PIDs. More...
 
static const uint64_t kDTVSigMon_MGTSeen = 0x0000000004ULL
 We've seen a MGT, which tells us on which PIDs to find VCT and other ATSC tables. More...
 
static const uint64_t kDTVSigMon_VCTSeen = 0x0000000008ULL
 We've seen a VCT, which maps ATSC Channels to MPEG program numbers, and provides additional data. More...
 
static const uint64_t kDTVSigMon_TVCTSeen = 0x0000000010ULL
 We've seen a TVCT, the terrestrial version of the VCT. More...
 
static const uint64_t kDTVSigMon_CVCTSeen = 0x0000000020ULL
 We've seen a CVCT, the cable version of the VCT. More...
 
static const uint64_t kDTVSigMon_NITSeen = 0x0000000040ULL
 We've seen a NIT, which tells us where to find SDT and other DVB tables. More...
 
static const uint64_t kDTVSigMon_SDTSeen = 0x0000000080ULL
 We've seen a SDT, which maps DVB Channels to MPEG program numbers, and provides additional data. More...
 
static const uint64_t kFWSigMon_PowerSeen = 0x0000000100ULL
 We've seen the FireWire STB power state. More...
 
static const uint64_t kDTVSigMon_CryptSeen = 0x0000000200ULL
 We've seen something indicating whether the data stream is encrypted. More...
 
static const uint64_t kDTVSigMon_PATMatch = 0x0000001000ULL
 We've seen a PAT matching our requirements. More...
 
static const uint64_t kDTVSigMon_PMTMatch = 0x0000002000ULL
 We've seen a PMT matching our requirements. More...
 
static const uint64_t kDTVSigMon_MGTMatch = 0x0000004000ULL
 We've seen an MGT matching our requirements. More...
 
static const uint64_t kDTVSigMon_VCTMatch = 0x0000008000ULL
 We've seen a VCT matching our requirements. More...
 
static const uint64_t kDTVSigMon_TVCTMatch = 0x0000010000ULL
 We've seen a TVCT matching our requirements. More...
 
static const uint64_t kDTVSigMon_CVCTMatch = 0x0000020000ULL
 We've seen a CVCT matching our requirements. More...
 
static const uint64_t kDTVSigMon_NITMatch = 0x0000040000ULL
 We've seen an NIT matching our requirements. More...
 
static const uint64_t kDTVSigMon_SDTMatch = 0x0000080000ULL
 We've seen an SDT matching our requirements. More...
 
static const uint64_t kFWSigMon_PowerMatch = 0x0000100000ULL
 We've seen a FireWire STB power state matching our requirements. More...
 
static const uint64_t kDTVSigMon_CryptMatch = 0x0000200000ULL
 We've seen unencrypted data in data stream. More...
 
static const uint64_t kDTVSigMon_WaitForPAT = 0x0001000000ULL
 
static const uint64_t kDTVSigMon_WaitForPMT = 0x0002000000ULL
 
static const uint64_t kDTVSigMon_WaitForMGT = 0x0004000000ULL
 
static const uint64_t kDTVSigMon_WaitForVCT = 0x0008000000ULL
 
static const uint64_t kDTVSigMon_WaitForNIT = 0x0010000000ULL
 
static const uint64_t kDTVSigMon_WaitForSDT = 0x0020000000ULL
 
static const uint64_t kSigMon_WaitForSig = 0x0040000000ULL
 
static const uint64_t kFWSigMon_WaitForPower = 0x0080000000ULL
 
static const uint64_t kDTVSigMon_WaitForCrypt =0x0100000000ULL
 
static const uint64_t kDTVSigMon_WaitForAll = 0x01FF000000ULL
 
static const uint64_t kDVBSigMon_WaitForSNR = 0x1000000000ULL
 Wait for the Signal to Noise Ratio to rise above a threshold. More...
 
static const uint64_t kDVBSigMon_WaitForBER = 0x2000000000ULL
 Wait for the Bit Error Rate to fall below a threshold. More...
 
static const uint64_t kDVBSigMon_WaitForUB = 0x4000000000ULL
 Wait for uncorrected FEC blocks to fall below a threshold. More...
 
static const uint64_t kDVBSigMon_WaitForPos = 0x8000000000ULL
 Wait for rotor to complete turning the antenna. More...
 
- Static Protected Member Functions inherited from MThread
static void setTerminationEnabled (bool enabled=true)
 
static void usleep (std::chrono::microseconds time)
 
template<typename R , typename P >
static std::enable_if_t< std::chrono::treat_as_floating_point< R >::value, void > usleep (std::chrono::duration< R, P > time)
 
static void ThreadSetup (const QString &name)
 This is to be called on startup in those few threads that haven't been ported to MThread. More...
 
static void ThreadCleanup (void)
 This is to be called on exit in those few threads that haven't been ported to MThread. More...
 
static void Cleanup (void)
 This will print out all the running threads, call exit(1) on each and then wait up to 5 seconds total for all the threads to exit. More...
 
static void GetAllThreadNames (QStringList &list)
 
static void GetAllRunningThreadNames (QStringList &list)
 

Detailed Description

Definition at line 16 of file v4l2encsignalmonitor.h.

Constructor & Destructor Documentation

◆ V4L2encSignalMonitor() [1/3]

V4L2encSignalMonitor::V4L2encSignalMonitor ( int  db_cardnum,
V4LChannel _channel,
bool  _release_stream,
uint64_t  _flags = 0 
)

Initializes signal lock and signal values.

Start() must be called to actually begin continuous signal monitoring.

Parameters
db_cardnumRecorder number to monitor, if this is less than 0, SIGNAL events will not be sent to the frontend even if SetNotifyFrontend(true) is called.
_channelV4lChannel for card
_flagsFlags to start with

Definition at line 39 of file v4l2encsignalmonitor.cpp.

◆ ~V4L2encSignalMonitor()

V4L2encSignalMonitor::~V4L2encSignalMonitor ( )
override

Stops signal monitoring and table monitoring threads.

Definition at line 65 of file v4l2encsignalmonitor.cpp.

◆ V4L2encSignalMonitor() [2/3]

V4L2encSignalMonitor::V4L2encSignalMonitor ( void  )
protected

◆ V4L2encSignalMonitor() [3/3]

V4L2encSignalMonitor::V4L2encSignalMonitor ( const V4L2encSignalMonitor )
protected

Member Function Documentation

◆ Stop()

void V4L2encSignalMonitor::Stop ( void  )
overridevirtual

Stop signal monitoring and table monitoring threads.

Reimplemented from SignalMonitor.

Definition at line 76 of file v4l2encsignalmonitor.cpp.

Referenced by ~V4L2encSignalMonitor().

◆ UpdateValues()

void V4L2encSignalMonitor::UpdateValues ( void  )
overrideprotectedvirtual

Fills in frontend stats and emits status Qt signals.

This is automatically called by run(), after Start() has been used to start the signal monitoring thread.

Reimplemented from SignalMonitor.

Definition at line 93 of file v4l2encsignalmonitor.cpp.

◆ GetV4L2encChannel()

V4LChannel* V4L2encSignalMonitor::GetV4L2encChannel ( void  )
inlineprotected

Definition at line 30 of file v4l2encsignalmonitor.h.

◆ HasLock()

bool V4L2encSignalMonitor::HasLock ( void  )
protected

Definition at line 162 of file v4l2encsignalmonitor.cpp.

Referenced by UpdateValues().

◆ StableResolution()

int V4L2encSignalMonitor::StableResolution ( void  )
protected

Wait for a stable signal.

The HD-PVR will produce garbage if the resolution or audio type changes after it is told to start encoding. m_stableTime is used to designate how long we need to see a stable resolution reported from the HD-PVR driver, before we consider it a good lock. In my testing 2 seconds is safe, while 1 second worked most of the time. –jp

Definition at line 188 of file v4l2encsignalmonitor.cpp.

Member Data Documentation

◆ m_v4l2

V4L2util V4L2encSignalMonitor::m_v4l2
protected

Definition at line 37 of file v4l2encsignalmonitor.h.

Referenced by HasLock(), StableResolution(), and V4L2encSignalMonitor().

◆ m_streamHandler

V4L2encStreamHandler* V4L2encSignalMonitor::m_streamHandler {nullptr}
protected

Definition at line 38 of file v4l2encsignalmonitor.h.

Referenced by Stop(), UpdateValues(), and ~V4L2encSignalMonitor().

◆ m_isTS

bool V4L2encSignalMonitor::m_isTS {false}
protected

Definition at line 39 of file v4l2encsignalmonitor.h.

Referenced by UpdateValues(), and V4L2encSignalMonitor().

◆ m_strength

int V4L2encSignalMonitor::m_strength {0}
private

Definition at line 42 of file v4l2encsignalmonitor.h.

Referenced by HasLock(), and UpdateValues().

◆ m_stableTime

std::chrono::milliseconds V4L2encSignalMonitor::m_stableTime {1500ms}
private

Definition at line 43 of file v4l2encsignalmonitor.h.

Referenced by StableResolution().

◆ m_width

int V4L2encSignalMonitor::m_width {0}
private

Definition at line 44 of file v4l2encsignalmonitor.h.

Referenced by StableResolution().

◆ m_height

int V4L2encSignalMonitor::m_height {0}
private

Definition at line 45 of file v4l2encsignalmonitor.h.

◆ m_lockCnt

uint V4L2encSignalMonitor::m_lockCnt {0}
private

Definition at line 46 of file v4l2encsignalmonitor.h.

Referenced by StableResolution().

◆ m_timer

MythTimer V4L2encSignalMonitor::m_timer
private

Definition at line 47 of file v4l2encsignalmonitor.h.

Referenced by StableResolution().

◆ m_statusTime

QDateTime V4L2encSignalMonitor::m_statusTime
private

Definition at line 48 of file v4l2encsignalmonitor.h.

Referenced by StableResolution().


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