MythTV master
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
DTVRecorder Class Reference

This is a specialization of RecorderBase used to handle MPEG-2, MPEG-4, MPEG-4 AVC, DVB and ATSC streams. More...

#include <libmythtv/recorders/dtvrecorder.h>

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

Public Member Functions

 DTVRecorder (TVRec *rec)
 
 ~DTVRecorder () override
 
void SetOption (const QString &name, const QString &value) override
 Set an specific option. More...
 
void SetOption (const QString &name, int value) override
 handles the "wait_for_seqstart" option. More...
 
void SetOptionsFromProfile (RecordingProfile *profile, const QString &videodev, const QString &audiodev, const QString &vbidev) override
 Sets basic recorder options. More...
 
bool IsErrored (void) override
 Tells us whether an unrecoverable error has been encountered. More...
 
long long GetFramesWritten (void) override
 Returns number of frames written to disk. More...
 
void SetVideoFilters (QString &) override
 Tells recorder which filters to use. More...
 
void Initialize (void) override
 This is called between SetOptionsFromProfile() and run() to initialize any devices, etc. More...
 
int GetVideoFd (void) override
 Returns file descriptor of recorder device. More...
 
virtual void SetStreamData (MPEGStreamData *data)
 
MPEGStreamDataGetStreamData (void) const
 
void Reset (void) override
 Reset the recorder to the startup state. More...
 
void ClearStatistics (void) override
 
RecordingQualityGetRecordingQuality (const RecordingInfo *r) const override
 Returns a report about the current recordings quality. More...
 
void HandlePAT (const ProgramAssociationTable *_pat) override
 
void HandleCAT (const ConditionalAccessTable *) override
 
void HandlePMT (uint progNum, const ProgramMapTable *_pmt) override
 
void HandleEncryptionStatus (uint, bool) override
 
void HandleSingleProgramPAT (ProgramAssociationTable *pat, bool insert) override
 
void HandleSingleProgramPMT (ProgramMapTable *pmt, bool insert) override
 
void HandleSTT (const SystemTimeTable *) override
 
void HandleVCT (uint, const VirtualChannelTable *) override
 
void HandleMGT (const MasterGuideTable *) override
 
void HandleTDT (const TimeDateTable *) override
 
void HandleNIT (const NetworkInformationTable *) override
 
void HandleSDT (uint, const ServiceDescriptionTable *) override
 
bool ProcessTSPacket (const TSPacket &tspacket) override
 
bool ProcessVideoTSPacket (const TSPacket &tspacket) override
 
bool ProcessAudioTSPacket (const TSPacket &tspacket) override
 
bool ProcessAVTSPacket (const TSPacket &tspacket)
 Common code for processing either audio or video packets. More...
 
- Public Member Functions inherited from RecorderBase
 RecorderBase (TVRec *rec)
 
 ~RecorderBase () override
 
void SetFrameRate (double rate)
 Sets the video frame rate. More...
 
void SetRecording (const RecordingInfo *pginfo)
 Changes the Recording from the one set initially with SetOptionsFromProfile(). More...
 
void SetRingBuffer (MythMediaBuffer *Buffer)
 Tells recorder to use an externally created ringbuffer. More...
 
virtual void SetOption (const QString &name, const QString &value)
 Set an specific option. More...
 
virtual void SetOption (const QString &name, int value)
 Set an specific integer option. More...
 
void SetBoolOption (const QString &name, bool value)
 Set an specific boolean option. More...
 
virtual void SetVideoFilters (QString &filters)=0
 Tells recorder which filters to use. More...
 
virtual void SetOptionsFromProfile (RecordingProfile *profile, const QString &videodev, const QString &audiodev, const QString &vbidev)=0
 Sets basic recorder options. More...
 
void SetNextRecording (const RecordingInfo *ri, MythMediaBuffer *Buffer)
 Sets next recording info, to be applied as soon as practical. More...
 
virtual void Initialize (void)=0
 This is called between SetOptionsFromProfile() and run() to initialize any devices, etc. More...
 
void run (void) override=0
 run() starts the recording process, and does not exit until the recording is complete. More...
 
virtual void Reset (void)=0
 Reset the recorder to the startup state. More...
 
virtual bool IsErrored (void)=0
 Tells us whether an unrecoverable error has been encountered. More...
 
virtual long long GetFramesWritten (void)=0
 Returns number of frames written to disk. More...
 
virtual int GetVideoFd (void)=0
 Returns file descriptor of recorder device. More...
 
long long GetKeyframePosition (long long desired) const
 Returns closest keyframe position before the desired frame. More...
 
bool GetKeyframePositions (long long start, long long end, frm_pos_map_t &map) const
 
bool GetKeyframeDurations (long long start, long long end, frm_pos_map_t &map) const
 
virtual void StopRecording (void)
 StopRecording() signals to the recorder that it should stop recording and exit cleanly. More...
 
virtual bool IsRecording (void)
 Tells whether the StartRecorder() loop is running. More...
 
virtual bool IsRecordingRequested (void)
 Tells us if StopRecording() has been called. More...
 
virtual RecordingQualityGetRecordingQuality (const RecordingInfo *ri) const
 Returns a report about the current recordings quality. More...
 
virtual void Pause (bool clear=true)
 Pause tells recorder to pause, it should not block. More...
 
virtual void Unpause (void)
 Unpause tells recorder to unpause. More...
 
virtual bool IsPaused (bool holding_lock=false) const
 Returns true iff recorder is paused. More...
 
virtual bool WaitForPause (std::chrono::milliseconds timeout=1s)
 WaitForPause blocks until recorder is actually paused, or timeout milliseconds elapse. More...
 
double GetFrameRate (void) const
 Returns the latest frame rate. More...
 
virtual bool CheckForRingBufferSwitch (void)
 If requested, switch to new RingBuffer/ProgramInfo objects. More...
 
void SavePositionMap (bool force=false, bool finished=false)
 Save the seektable to the DB. More...
 
- Public Member Functions inherited from MPEGStreamListener
virtual void HandlePAT (const ProgramAssociationTable *pat)=0
 
virtual void HandleCAT (const ConditionalAccessTable *cat)=0
 
virtual void HandlePMT (uint program_num, const ProgramMapTable *pmt)=0
 
virtual void HandleEncryptionStatus (uint program_number, bool encrypted)=0
 
virtual void HandleSplice (const SpliceInformationTable *)
 
virtual void HandleSingleProgramPAT (ProgramAssociationTable *, bool insert)=0
 
virtual void HandleSingleProgramPMT (ProgramMapTable *, bool insert)=0
 
virtual void HandleTDT (const TimeDateTable *)=0
 
virtual void HandleNIT (const NetworkInformationTable *)=0
 
virtual void HandleSDT (uint tsid, const ServiceDescriptionTable *)=0
 
virtual void HandleSTT (const SystemTimeTable *)=0
 
virtual void HandleMGT (const MasterGuideTable *)=0
 
virtual void HandleVCT (uint pid, const VirtualChannelTable *)=0
 
virtual bool ProcessTSPacket (const TSPacket &tspacket)=0
 
virtual bool ProcessVideoTSPacket (const TSPacket &tspacket)=0
 
virtual bool ProcessAudioTSPacket (const TSPacket &tspacket)=0
 
virtual void FindPSKeyFrames (const uint8_t *buffer, uint len)=0
 

Protected Member Functions

virtual void InitStreamData (void)
 
void FinishRecording (void) override
 Flushes the ringbuffer, and if this is not a live LiveTV recording saves the position map and filesize. More...
 
void ResetForNewFile (void) override
 
void HandleKeyframe (int64_t extra)
 This save the current frame to the position maps and handles ringbuffer switching. More...
 
void HandleTimestamps (int stream_id, int64_t pts, int64_t dts)
 
void UpdateFramesWritten (void)
 
void BufferedWrite (const TSPacket &tspacket, bool insert=false)
 
bool FindAudioKeyframes (const TSPacket *tspacket)
 
bool FindMPEG2Keyframes (const TSPacket *tspacket)
 Locates the keyframes and saves them to the position map. More...
 
bool FindH2645Keyframes (const TSPacket *tspacket)
 
void HandleH2645Keyframe (void)
 This save the current frame to the position maps and handles ringbuffer switching. More...
 
void FindPSKeyFrames (const uint8_t *buffer, uint len) override
 
bool FindOtherKeyframes (const TSPacket *tspacket)
 Non-Audio/Video data. More...
 
bool CheckCC (uint pid, uint new_cnt)
 
virtual QString GetSIStandard (void) const
 
virtual void SetCAMPMT (const ProgramMapTable *)
 
virtual void UpdateCAMTimeOffset (void)
 
- Protected Member Functions inherited from RecorderBase
void SetIntOption (RecordingProfile *profile, const QString &name)
 Convenience function used to set integer options from a profile. More...
 
void SetStrOption (RecordingProfile *profile, const QString &name)
 Convenience function used to set QString options from a profile. More...
 
virtual bool PauseAndWait (std::chrono::milliseconds timeout=100ms)
 If m_requestPause is true, sets pause and blocks up to timeout milliseconds or until unpaused, whichever is sooner. More...
 
virtual void ResetForNewFile (void)=0
 
virtual void SetRecordingStatus (RecStatus::Type status, const QString &file, int line)
 
virtual void ClearStatistics (void)
 
virtual void FinishRecording (void)
 
virtual void StartNewFile (void)
 
void SetPositionMapType (MarkTypes type)
 Set seektable type. More...
 
void AspectChange (uint aspect, long long frame)
 Note a change in aspect ratio in the recordedmark table. More...
 
void ResolutionChange (uint width, uint height, long long frame)
 Note a change in video size in the recordedmark table. More...
 
void FrameRateChange (uint framerate, uint64_t frame)
 Note a change in video frame rate in the recordedmark table. More...
 
void VideoScanChange (SCAN_t scan, uint64_t frame)
 Note a change in video scan type in the recordedmark table. More...
 
void VideoCodecChange (AVCodecID vCodec)
 Note a change in video codec. More...
 
void AudioCodecChange (AVCodecID aCodec)
 Note a change in audio codec. More...
 
void SetDuration (std::chrono::milliseconds duration)
 Note the total duration in the recordedmark table. More...
 
void SetTotalFrames (uint64_t total_frames)
 Note the total frames in the recordedmark table. More...
 
void TryWriteProgStartMark (const frm_pos_map_t &durationDeltaCopy)
 
- Protected Member Functions inherited from MPEGStreamListener
virtual ~MPEGStreamListener ()=default
 
- Protected Member Functions inherited from MPEGSingleProgramStreamListener
virtual ~MPEGSingleProgramStreamListener ()=default
 
- Protected Member Functions inherited from DVBMainStreamListener
virtual ~DVBMainStreamListener ()=default
 
- Protected Member Functions inherited from ATSCMainStreamListener
virtual ~ATSCMainStreamListener ()=default
 
- Protected Member Functions inherited from TSPacketListener
virtual ~TSPacketListener ()=default
 
- Protected Member Functions inherited from TSPacketListenerAV
virtual ~TSPacketListenerAV ()=default
 
- Protected Member Functions inherited from PSStreamListener
virtual ~PSStreamListener ()=default
 

Protected Attributes

int m_streamFd {-1}
 
QString m_recordingType {"all"}
 
MythTimer m_pesTimer
 
QElapsedTimer m_audioTimer
 
uint32_t m_startCode {0xffffffff}
 
int m_firstKeyframe {-1}
 
unsigned long long m_lastGopSeen {0}
 
unsigned long long m_lastSeqSeen {0}
 
unsigned long long m_lastKeyframeSeen {0}
 
unsigned int m_audioBytesRemaining {0}
 
unsigned int m_videoBytesRemaining {0}
 
unsigned int m_otherBytesRemaining {0}
 
int m_progressiveSequence {0}
 
int m_repeatPict {0}
 
bool m_pesSynced {false}
 
bool m_seenSps {false}
 
H2645Parserm_h2645Parser {nullptr}
 
bool m_waitForKeyframeOption {true}
 Wait for the a GOP/SEQ-start before sending data. More...
 
bool m_hasWrittenOtherKeyframe {false}
 
QString m_error
 non-empty iff irrecoverable recording error detected More...
 
MPEGStreamDatam_streamData {nullptr}
 
bool m_bufferPackets {false}
 
std::vector< unsigned char > m_payloadBuffer
 
QRecursiveMutex m_pidLock
 
ProgramAssociationTablem_inputPat {nullptr}
 PAT on input side. More...
 
ProgramMapTablem_inputPmt {nullptr}
 PMT on input side. More...
 
bool m_hasNoAV {false}
 
bool m_recordMpts {false}
 
bool m_recordMptsOnly {false}
 
MythTimer m_recordMptsTimer
 
std::array< uint8_t, 0x1fff+1 > m_streamId {0}
 
std::array< uint8_t, 0x1fff+1 > m_pidStatus {0}
 
std::array< uint8_t, 0x1fff+1 > m_continuityCounter {0}
 
std::vector< TSPacketm_scratch
 
int m_minimumRecordingQuality {95}
 
bool m_usePts {false}
 
std::array< uint64_t, 256 > m_tsCount {0}
 
std::array< int64_t, 256 > m_tsLast {}
 
std::array< int64_t, 256 > m_tsFirst {}
 
std::array< QDateTime, 256 > m_tsFirstDt {}
 
QAtomicInt m_packetCount {0}
 
QAtomicInt m_continuityErrorCount {0}
 
unsigned long long m_framesSeenCount {0}
 
unsigned long long m_framesWrittenCount {0}
 
double m_totalDuration {0.0}
 Total milliseconds that have passed since the start of the recording. More...
 
double m_tdBase {0.0}
 Milliseconds from the start to m_tdTickCount = 0. More...
 
uint64_t m_tdTickCount {0}
 Count of the number of equivalent interlaced fields that have passed since m_tdBase. More...
 
MythAVRational m_tdTickFramerate {0}
 
SCAN_t m_scanType {SCAN_t::UNKNOWN_SCAN}
 
bool m_musicChoice {false}
 
bool m_useIForKeyframe {true}
 
- Protected Attributes inherited from RecorderBase
TVRecm_tvrec {nullptr}
 
MythMediaBufferm_ringBuffer {nullptr}
 
bool m_weMadeBuffer {true}
 
AVContainer m_containerFormat {formatUnknown}
 
AVCodecID m_primaryVideoCodec {AV_CODEC_ID_NONE}
 
AVCodecID m_primaryAudioCodec {AV_CODEC_ID_NONE}
 
QString m_videocodec {"rtjpeg"}
 
QString m_videodevice
 
bool m_ntsc {true}
 
bool m_ntscFrameRate {true}
 
double m_videoFrameRate {29.97}
 
uint m_videoAspect {0}
 
uint m_videoHeight {0}
 
uint m_videoWidth {0}
 
MythAVRational m_frameRate {0}
 
RecordingInfom_curRecording {nullptr}
 
QMutex m_pauseLock
 
bool m_requestPause {false}
 
bool m_paused {false}
 
QWaitCondition m_pauseWait
 
QWaitCondition m_unpauseWait
 
bool m_requestRecording {false}
 True if API call has requested a recording be [re]started. More...
 
bool m_recording {false}
 True while recording is actually being performed. More...
 
QWaitCondition m_recordingWait
 
QMutex m_nextRingBufferLock
 
MythMediaBufferm_nextRingBuffer {nullptr}
 
RecordingInfom_nextRecording {nullptr}
 
MythTimer m_ringBufferCheckTimer
 
MarkTypes m_positionMapType {MARK_GOP_BYFRAME}
 
QMutex m_positionMapLock
 
frm_pos_map_t m_positionMap
 
frm_pos_map_t m_positionMapDelta
 
frm_pos_map_t m_durationMap
 
frm_pos_map_t m_durationMapDelta
 
MythTimer m_positionMapTimer
 
qint64 m_estimatedProgStartMS {0}
 
long long m_lastSavedKeyframe {0}
 
long long m_lastSavedDuration {0}
 
QMutex m_statisticsLock
 
QAtomicInt m_timeOfFirstDataIsSet
 
QDateTime m_timeOfFirstData
 
QAtomicInt m_timeOfLatestDataCount
 
QAtomicInt m_timeOfLatestDataPacketInterval
 
QDateTime m_timeOfLatestData
 
MythTimer m_timeOfLatestDataTimer
 
RecordingGaps m_recordingGaps
 

Static Protected Attributes

static const uint kMaxKeyFrameDistance = 80
 If the number of regular frames detected since the last detected keyframe exceeds this value, then we begin marking random regular frames as keyframes. More...
 
static const unsigned char kPayloadStartSeen = 0x2
 
- Static Protected Attributes inherited from RecorderBase
static constexpr std::chrono::milliseconds kTimeOfLatestDataIntervalTarget { 5s }
 timeOfLatest update interval target in milliseconds. More...
 

Additional Inherited Members

- Public Types inherited from RecorderBase
enum  AspectRatio {
  ASPECT_UNKNOWN = 0x00 , ASPECT_1_1 = 0x01 , ASPECT_4_3 = 0x02 , ASPECT_16_9 = 0x03 ,
  ASPECT_2_21_1 = 0x04 , ASPECT_CUSTOM = 0x05
}
 
- Static Public Member Functions inherited from RecorderBase
static RecorderBaseCreateRecorder (TVRec *tvrec, ChannelBase *channel, RecordingProfile &profile, const GeneralDBOptions &genOpt)
 

Detailed Description

This is a specialization of RecorderBase used to handle MPEG-2, MPEG-4, MPEG-4 AVC, DVB and ATSC streams.

See also
DBox2Recorder, DVBRecorder, FirewireRecorder, HDHRRecoreder, IPTVRecorder

Definition at line 26 of file dtvrecorder.h.

Constructor & Destructor Documentation

◆ DTVRecorder()

DTVRecorder::DTVRecorder ( TVRec rec)
explicit

Definition at line 52 of file dtvrecorder.cpp.

◆ ~DTVRecorder()

DTVRecorder::~DTVRecorder ( void  )
override

Definition at line 67 of file dtvrecorder.cpp.

Member Function Documentation

◆ BufferedWrite()

void DTVRecorder::BufferedWrite ( const TSPacket tspacket,
bool  insert = false 
)
protected

◆ CheckCC()

bool DTVRecorder::CheckCC ( uint  pid,
uint  new_cnt 
)
inlineprotected

Definition at line 225 of file dtvrecorder.h.

Referenced by ProcessAVTSPacket(), and ProcessTSPacket().

◆ ClearStatistics()

void DTVRecorder::ClearStatistics ( void  )
overridevirtual

Reimplemented from RecorderBase.

Definition at line 185 of file dtvrecorder.cpp.

Referenced by ResetForNewFile().

◆ FindAudioKeyframes()

bool DTVRecorder::FindAudioKeyframes ( const TSPacket tspacket)
protected

Definition at line 767 of file dtvrecorder.cpp.

Referenced by ProcessAudioTSPacket().

◆ FindH2645Keyframes()

bool DTVRecorder::FindH2645Keyframes ( const TSPacket tspacket)
protected

Definition at line 873 of file dtvrecorder.cpp.

Referenced by ProcessVideoTSPacket().

◆ FindMPEG2Keyframes()

bool DTVRecorder::FindMPEG2Keyframes ( const TSPacket tspacket)
protected

Locates the keyframes and saves them to the position map.

This searches for three magic integers in the stream. The picture start code 0x00000100, the GOP code 0x000001B8, and the sequence start code 0x000001B3. The GOP code is prefered, but is only required of MPEG1 streams, the sequence start code is a decent fallback for MPEG2 streams, and if all else fails we just look for the picture start codes and call every 16th frame a keyframe.

NOTE: This does not only find keyframes but also tracks the total frames as well. At least a couple times seeking has been broken by short-circuiting the search once a keyframe stream id has been found. This may work on some channels, but will break on others so algorithmic optimizations should be done with great care.

PES header format
byte 0 byte 1 byte 2 byte 3 [byte 4 byte 5]
0x00 0x00 0x01 PESStreamID PES packet length
Contains a listing of PES Stream ID's for various PES Packet types.
Definition: mpegtables.h:45
Returns
Returns true if packet[s] should be output.

Definition at line 406 of file dtvrecorder.cpp.

Referenced by ProcessVideoTSPacket().

◆ FindOtherKeyframes()

bool DTVRecorder::FindOtherKeyframes ( const TSPacket tspacket)
protected

Non-Audio/Video data.

For streams which contain no audio/video, write just 1 key-frame at the start.

Definition at line 807 of file dtvrecorder.cpp.

Referenced by ProcessTSPacket().

◆ FindPSKeyFrames()

void DTVRecorder::FindPSKeyFrames ( const uint8_t *  buffer,
uint  len 
)
overrideprotectedvirtual

Implements PSStreamListener.

Definition at line 1123 of file dtvrecorder.cpp.

Referenced by MpegRecorder::run().

◆ FinishRecording()

void DTVRecorder::FinishRecording ( void  )
overrideprotectedvirtual

Flushes the ringbuffer, and if this is not a live LiveTV recording saves the position map and filesize.

Reimplemented from RecorderBase.

Definition at line 127 of file dtvrecorder.cpp.

Referenced by ASIRecorder::run(), CetonRecorder::run(), DVBRecorder::run(), ExternalRecorder::run(), FirewireRecorder::run(), HDHRRecorder::run(), ImportRecorder::run(), IPTVRecorder::run(), MpegRecorder::run(), SatIPRecorder::run(), and V4L2encRecorder::run().

◆ GetFramesWritten()

long long DTVRecorder::GetFramesWritten ( void  )
inlineoverridevirtual

Returns number of frames written to disk.

It is not always safe to seek up to this frame in a player because frames may not be written in display order.

Implements RecorderBase.

Reimplemented in ImportRecorder.

Definition at line 49 of file dtvrecorder.h.

Referenced by MpegRecorder::run().

◆ GetRecordingQuality()

RecordingQuality * DTVRecorder::GetRecordingQuality ( const RecordingInfo ri) const
overridevirtual

Returns a report about the current recordings quality.

Reimplemented from RecorderBase.

Reimplemented in ImportRecorder.

Definition at line 1707 of file dtvrecorder.cpp.

◆ GetSIStandard()

virtual QString DTVRecorder::GetSIStandard ( void  ) const
inlineprotectedvirtual

Reimplemented in CetonRecorder, DVBRecorder, HDHRRecorder, and SatIPRecorder.

Definition at line 124 of file dtvrecorder.h.

Referenced by HandlePMT().

◆ GetStreamData()

MPEGStreamData * DTVRecorder::GetStreamData ( void  ) const
inline

◆ GetVideoFd()

int DTVRecorder::GetVideoFd ( void  )
inlineoverridevirtual

Returns file descriptor of recorder device.

This is used by channel when only one open file descriptor is allowed on a device node. This is the case with video4linux devices and similar devices in BSD. It is not needed by newer drivers, such as those used for DVB.

Implements RecorderBase.

Reimplemented in MpegRecorder.

Definition at line 54 of file dtvrecorder.h.

◆ HandleCAT()

void DTVRecorder::HandleCAT ( const ConditionalAccessTable )
inlineoverridevirtual

Implements MPEGStreamListener.

Definition at line 66 of file dtvrecorder.h.

◆ HandleEncryptionStatus()

void DTVRecorder::HandleEncryptionStatus ( uint  ,
bool   
)
inlineoverridevirtual

Implements MPEGStreamListener.

Definition at line 68 of file dtvrecorder.h.

◆ HandleH2645Keyframe()

void DTVRecorder::HandleH2645Keyframe ( void  )
protected

This save the current frame to the position maps and handles ringbuffer switching.

Definition at line 1092 of file dtvrecorder.cpp.

Referenced by FindH2645Keyframes().

◆ HandleKeyframe()

void DTVRecorder::HandleKeyframe ( int64_t  extra)
protected

This save the current frame to the position maps and handles ringbuffer switching.

Definition at line 833 of file dtvrecorder.cpp.

Referenced by FindAudioKeyframes(), FindMPEG2Keyframes(), FindOtherKeyframes(), FindPSKeyFrames(), and ProcessTSPacket().

◆ HandleMGT()

void DTVRecorder::HandleMGT ( const MasterGuideTable )
inlineoverridevirtual

Implements ATSCMainStreamListener.

Definition at line 77 of file dtvrecorder.h.

◆ HandleNIT()

void DTVRecorder::HandleNIT ( const NetworkInformationTable )
inlineoverridevirtual

Implements DVBMainStreamListener.

Definition at line 81 of file dtvrecorder.h.

◆ HandlePAT()

void DTVRecorder::HandlePAT ( const ProgramAssociationTable _pat)
overridevirtual

Implements MPEGStreamListener.

Definition at line 1309 of file dtvrecorder.cpp.

◆ HandlePMT()

void DTVRecorder::HandlePMT ( uint  progNum,
const ProgramMapTable _pmt 
)
overridevirtual

Implements MPEGStreamListener.

Definition at line 1361 of file dtvrecorder.cpp.

◆ HandleSDT()

void DTVRecorder::HandleSDT ( uint  ,
const ServiceDescriptionTable  
)
inlineoverridevirtual

Implements DVBMainStreamListener.

Definition at line 82 of file dtvrecorder.h.

◆ HandleSingleProgramPAT()

void DTVRecorder::HandleSingleProgramPAT ( ProgramAssociationTable pat,
bool  insert 
)
overridevirtual

◆ HandleSingleProgramPMT()

void DTVRecorder::HandleSingleProgramPMT ( ProgramMapTable pmt,
bool  insert 
)
overridevirtual

◆ HandleSTT()

void DTVRecorder::HandleSTT ( const SystemTimeTable )
inlineoverridevirtual

Implements ATSCMainStreamListener.

Definition at line 75 of file dtvrecorder.h.

◆ HandleTDT()

void DTVRecorder::HandleTDT ( const TimeDateTable )
inlineoverridevirtual

Implements DVBMainStreamListener.

Definition at line 80 of file dtvrecorder.h.

◆ HandleTimestamps()

void DTVRecorder::HandleTimestamps ( int  stream_id,
int64_t  pts,
int64_t  dts 
)
protected

Definition at line 650 of file dtvrecorder.cpp.

Referenced by FindMPEG2Keyframes().

◆ HandleVCT()

void DTVRecorder::HandleVCT ( uint  ,
const VirtualChannelTable  
)
inlineoverridevirtual

Implements ATSCMainStreamListener.

Definition at line 76 of file dtvrecorder.h.

◆ Initialize()

void DTVRecorder::Initialize ( void  )
inlineoverridevirtual

This is called between SetOptionsFromProfile() and run() to initialize any devices, etc.

Implements RecorderBase.

Reimplemented in MpegRecorder.

Definition at line 53 of file dtvrecorder.h.

◆ InitStreamData()

void DTVRecorder::InitStreamData ( void  )
protectedvirtual

Reimplemented in FirewireRecorder, ImportRecorder, and MpegRecorder.

Definition at line 232 of file dtvrecorder.cpp.

Referenced by SetStreamData().

◆ IsErrored()

bool DTVRecorder::IsErrored ( void  )
inlineoverridevirtual

◆ ProcessAudioTSPacket()

bool DTVRecorder::ProcessAudioTSPacket ( const TSPacket tspacket)
overridevirtual

Implements TSPacketListenerAV.

Definition at line 1644 of file dtvrecorder.cpp.

Referenced by FirewireRecorder::ProcessTSPacket().

◆ ProcessAVTSPacket()

bool DTVRecorder::ProcessAVTSPacket ( const TSPacket tspacket)

Common code for processing either audio or video packets.

Definition at line 1668 of file dtvrecorder.cpp.

Referenced by ProcessAudioTSPacket(), and ProcessVideoTSPacket().

◆ ProcessTSPacket()

bool DTVRecorder::ProcessTSPacket ( const TSPacket tspacket)
overridevirtual

Implements TSPacketListener.

Reimplemented in FirewireRecorder, and MpegRecorder.

Definition at line 1548 of file dtvrecorder.cpp.

Referenced by MpegRecorder::ProcessTSPacket().

◆ ProcessVideoTSPacket()

bool DTVRecorder::ProcessVideoTSPacket ( const TSPacket tspacket)
overridevirtual

Implements TSPacketListenerAV.

Definition at line 1610 of file dtvrecorder.cpp.

Referenced by FirewireRecorder::ProcessTSPacket().

◆ Reset()

void DTVRecorder::Reset ( void  )
overridevirtual

Reset the recorder to the startup state.

This is used after Pause(bool), WaitForPause() and after the RingBuffer's StopReads() method has been called.

Implements RecorderBase.

Reimplemented in MpegRecorder.

Definition at line 205 of file dtvrecorder.cpp.

◆ ResetForNewFile()

void DTVRecorder::ResetForNewFile ( void  )
overrideprotectedvirtual

◆ SetCAMPMT()

virtual void DTVRecorder::SetCAMPMT ( const ProgramMapTable )
inlineprotectedvirtual

Reimplemented in DVBRecorder.

Definition at line 125 of file dtvrecorder.h.

Referenced by HandlePMT().

◆ SetOption() [1/2]

void DTVRecorder::SetOption ( const QString &  name,
const QString &  value 
)
overridevirtual

Set an specific option.

Base options include: codec, videodevice, tvformat (ntsc,ntsc-jp,pal-m), vbiformat ("none","pal teletext","ntsc").

Reimplemented from RecorderBase.

Reimplemented in V4LRecorder, and MpegRecorder.

Definition at line 92 of file dtvrecorder.cpp.

Referenced by V4LRecorder::SetOption(), ASIRecorder::SetOptionsFromProfile(), SetOptionsFromProfile(), and ImportRecorder::SetOptionsFromProfile().

◆ SetOption() [2/2]

void DTVRecorder::SetOption ( const QString &  name,
int  value 
)
overridevirtual

handles the "wait_for_seqstart" option.

Reimplemented from RecorderBase.

Reimplemented in V4LRecorder, and MpegRecorder.

Definition at line 103 of file dtvrecorder.cpp.

◆ SetOptionsFromProfile()

void DTVRecorder::SetOptionsFromProfile ( RecordingProfile profile,
const QString &  videodev,
const QString &  audiodev,
const QString &  vbidev 
)
overridevirtual

Sets basic recorder options.

SetOptionsFromProfile is used to tell the recorder about the recording profile as well as the devices to use.

Implements RecorderBase.

Reimplemented in FirewireRecorder, ImportRecorder, MpegRecorder, and V4L2encRecorder.

Definition at line 113 of file dtvrecorder.cpp.

◆ SetStreamData()

void DTVRecorder::SetStreamData ( MPEGStreamData data)
virtual

◆ SetVideoFilters()

void DTVRecorder::SetVideoFilters ( QString &  filters)
inlineoverridevirtual

Tells recorder which filters to use.

These filters are used by frame grabber encoders to lower the bitrate while keeping quality good. They must execute quickly so that frames are not lost by the recorder.

Implements RecorderBase.

Reimplemented in MpegRecorder.

Definition at line 52 of file dtvrecorder.h.

◆ UpdateCAMTimeOffset()

virtual void DTVRecorder::UpdateCAMTimeOffset ( void  )
inlineprotectedvirtual

Reimplemented in DVBRecorder.

Definition at line 126 of file dtvrecorder.h.

Referenced by HandleSTT(), and HandleTDT().

◆ UpdateFramesWritten()

void DTVRecorder::UpdateFramesWritten ( void  )
protected

Member Data Documentation

◆ kMaxKeyFrameDistance

const uint DTVRecorder::kMaxKeyFrameDistance = 80
staticprotected

If the number of regular frames detected since the last detected keyframe exceeds this value, then we begin marking random regular frames as keyframes.

Definition at line 221 of file dtvrecorder.h.

Referenced by FindMPEG2Keyframes(), and FindPSKeyFrames().

◆ kPayloadStartSeen

const unsigned char DTVRecorder::kPayloadStartSeen = 0x2
staticprotected

Definition at line 222 of file dtvrecorder.h.

Referenced by ProcessAVTSPacket().

◆ m_audioBytesRemaining

unsigned int DTVRecorder::m_audioBytesRemaining {0}
protected

Definition at line 141 of file dtvrecorder.h.

Referenced by FindPSKeyFrames(), and ResetForNewFile().

◆ m_audioTimer

QElapsedTimer DTVRecorder::m_audioTimer
protected

Definition at line 135 of file dtvrecorder.h.

Referenced by FindAudioKeyframes().

◆ m_bufferPackets

bool DTVRecorder::m_bufferPackets {false}
protected

◆ m_continuityCounter

std::array<uint8_t,0x1fff + 1> DTVRecorder::m_continuityCounter {0}
protected

◆ m_continuityErrorCount

QAtomicInt DTVRecorder::m_continuityErrorCount {0}
mutableprotected

◆ m_error

QString DTVRecorder::m_error
protected

◆ m_firstKeyframe

int DTVRecorder::m_firstKeyframe {-1}
protected

◆ m_framesSeenCount

unsigned long long DTVRecorder::m_framesSeenCount {0}
protected

◆ m_framesWrittenCount

unsigned long long DTVRecorder::m_framesWrittenCount {0}
protected

◆ m_h2645Parser

H2645Parser* DTVRecorder::m_h2645Parser {nullptr}
protected

◆ m_hasNoAV

bool DTVRecorder::m_hasNoAV {false}
protected

Definition at line 175 of file dtvrecorder.h.

Referenced by HandlePMT(), and ProcessTSPacket().

◆ m_hasWrittenOtherKeyframe

bool DTVRecorder::m_hasWrittenOtherKeyframe {false}
protected

Definition at line 157 of file dtvrecorder.h.

Referenced by FindOtherKeyframes(), and ResetForNewFile().

◆ m_inputPat

ProgramAssociationTable* DTVRecorder::m_inputPat {nullptr}
protected

PAT on input side.

Definition at line 172 of file dtvrecorder.h.

Referenced by HandlePAT(), and ~DTVRecorder().

◆ m_inputPmt

ProgramMapTable* DTVRecorder::m_inputPmt {nullptr}
protected

◆ m_lastGopSeen

unsigned long long DTVRecorder::m_lastGopSeen {0}
protected

Definition at line 138 of file dtvrecorder.h.

Referenced by FindMPEG2Keyframes(), FindPSKeyFrames(), and ResetForNewFile().

◆ m_lastKeyframeSeen

unsigned long long DTVRecorder::m_lastKeyframeSeen {0}
protected

◆ m_lastSeqSeen

unsigned long long DTVRecorder::m_lastSeqSeen {0}
protected

Definition at line 139 of file dtvrecorder.h.

Referenced by FindMPEG2Keyframes(), FindPSKeyFrames(), and ResetForNewFile().

◆ m_minimumRecordingQuality

int DTVRecorder::m_minimumRecordingQuality {95}
protected

Definition at line 187 of file dtvrecorder.h.

Referenced by DTVRecorder().

◆ m_musicChoice

bool DTVRecorder::m_musicChoice {false}
protected

Definition at line 213 of file dtvrecorder.h.

Referenced by FindMPEG2Keyframes(), and HandleTimestamps().

◆ m_otherBytesRemaining

unsigned int DTVRecorder::m_otherBytesRemaining {0}
protected

Definition at line 143 of file dtvrecorder.h.

Referenced by FindPSKeyFrames(), and ResetForNewFile().

◆ m_packetCount

QAtomicInt DTVRecorder::m_packetCount {0}
mutableprotected

◆ m_payloadBuffer

std::vector<unsigned char> DTVRecorder::m_payloadBuffer
protected

◆ m_pesSynced

bool DTVRecorder::m_pesSynced {false}
protected

Definition at line 150 of file dtvrecorder.h.

Referenced by FindH2645Keyframes().

◆ m_pesTimer

MythTimer DTVRecorder::m_pesTimer
protected

Definition at line 134 of file dtvrecorder.h.

Referenced by FindH2645Keyframes().

◆ m_pidLock

QRecursiveMutex DTVRecorder::m_pidLock
mutableprotected

Definition at line 170 of file dtvrecorder.h.

Referenced by HandlePAT(), and HandlePMT().

◆ m_pidStatus

std::array<uint8_t,0x1fff + 1> DTVRecorder::m_pidStatus {0}
protected

Definition at line 182 of file dtvrecorder.h.

Referenced by ProcessAVTSPacket().

◆ m_progressiveSequence

int DTVRecorder::m_progressiveSequence {0}
protected

Definition at line 146 of file dtvrecorder.h.

Referenced by FindMPEG2Keyframes(), and ResetForNewFile().

◆ m_recordingType

QString DTVRecorder::m_recordingType {"all"}
protected

Definition at line 131 of file dtvrecorder.h.

Referenced by MpegRecorder::run(), and SetOption().

◆ m_recordMpts

bool DTVRecorder::m_recordMpts {false}
protected

◆ m_recordMptsOnly

bool DTVRecorder::m_recordMptsOnly {false}
protected

◆ m_recordMptsTimer

MythTimer DTVRecorder::m_recordMptsTimer
protected

Definition at line 180 of file dtvrecorder.h.

Referenced by ProcessTSPacket().

◆ m_repeatPict

int DTVRecorder::m_repeatPict {0}
protected

Definition at line 147 of file dtvrecorder.h.

Referenced by FindMPEG2Keyframes(), ResetForNewFile(), and UpdateFramesWritten().

◆ m_scanType

SCAN_t DTVRecorder::m_scanType {SCAN_t::UNKNOWN_SCAN}
protected

Definition at line 209 of file dtvrecorder.h.

Referenced by FindH2645Keyframes().

◆ m_scratch

std::vector<TSPacket> DTVRecorder::m_scratch
protected

Definition at line 184 of file dtvrecorder.h.

Referenced by HandleSingleProgramPAT(), and HandleSingleProgramPMT().

◆ m_seenSps

bool DTVRecorder::m_seenSps {false}
protected

◆ m_startCode

uint32_t DTVRecorder::m_startCode {0xffffffff}
protected

◆ m_streamData

MPEGStreamData* DTVRecorder::m_streamData {nullptr}
protected

◆ m_streamFd

int DTVRecorder::m_streamFd {-1}
protected

Definition at line 129 of file dtvrecorder.h.

Referenced by GetVideoFd().

◆ m_streamId

std::array<uint8_t,0x1fff + 1> DTVRecorder::m_streamId {0}
protected

Definition at line 181 of file dtvrecorder.h.

Referenced by HandleSingleProgramPMT(), ProcessTSPacket(), and ProcessVideoTSPacket().

◆ m_tdBase

double DTVRecorder::m_tdBase {0.0}
protected

Milliseconds from the start to m_tdTickCount = 0.

Definition at line 200 of file dtvrecorder.h.

Referenced by ClearStatistics(), and UpdateFramesWritten().

◆ m_tdTickCount

uint64_t DTVRecorder::m_tdTickCount {0}
protected

Count of the number of equivalent interlaced fields that have passed since m_tdBase.

Note
This needs to be divied by 2 to get the number of frames corresponding to m_tdTickFramerate.

Definition at line 207 of file dtvrecorder.h.

Referenced by ClearStatistics(), and UpdateFramesWritten().

◆ m_tdTickFramerate

MythAVRational DTVRecorder::m_tdTickFramerate {0}
protected

Definition at line 208 of file dtvrecorder.h.

Referenced by ClearStatistics(), and UpdateFramesWritten().

◆ m_totalDuration

double DTVRecorder::m_totalDuration {0.0}
protected

Total milliseconds that have passed since the start of the recording.

Definition at line 198 of file dtvrecorder.h.

Referenced by ClearStatistics(), FinishRecording(), HandleH2645Keyframe(), HandleKeyframe(), and UpdateFramesWritten().

◆ m_tsCount

std::array<uint64_t,256> DTVRecorder::m_tsCount {0}
protected

Definition at line 189 of file dtvrecorder.h.

Referenced by ClearStatistics(), and HandleTimestamps().

◆ m_tsFirst

std::array<int64_t,256> DTVRecorder::m_tsFirst {}
protected

Definition at line 191 of file dtvrecorder.h.

Referenced by ClearStatistics(), FindMPEG2Keyframes(), and HandleTimestamps().

◆ m_tsFirstDt

std::array<QDateTime,256> DTVRecorder::m_tsFirstDt {}
protected

Definition at line 192 of file dtvrecorder.h.

Referenced by HandleTimestamps().

◆ m_tsLast

std::array<int64_t,256> DTVRecorder::m_tsLast {}
protected

Definition at line 190 of file dtvrecorder.h.

Referenced by ClearStatistics(), FindMPEG2Keyframes(), and HandleTimestamps().

◆ m_useIForKeyframe

bool DTVRecorder::m_useIForKeyframe {true}
protected

◆ m_usePts

bool DTVRecorder::m_usePts {false}
protected

Definition at line 188 of file dtvrecorder.h.

Referenced by HandleTimestamps().

◆ m_videoBytesRemaining

unsigned int DTVRecorder::m_videoBytesRemaining {0}
protected

Definition at line 142 of file dtvrecorder.h.

Referenced by FindPSKeyFrames(), and ResetForNewFile().

◆ m_waitForKeyframeOption

bool DTVRecorder::m_waitForKeyframeOption {true}
protected

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