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

#include <cetonrecorder.h>

Inheritance diagram for CetonRecorder:
Inheritance graph
Collaboration diagram for CetonRecorder:
Collaboration graph

Public Member Functions

 CetonRecorder (TVRec *rec, CetonChannel *channel)
void run (void) override
 run() starts the recording process, and does not exit until the recording is complete. More...
bool Open (void)
void Close (void)
void StartNewFile (void) override
bool IsOpen (void) const
QString GetSIStandard (void) const override
- Public Member Functions inherited from DTVRecorder
 DTVRecorder (TVRec *rec)
virtual ~DTVRecorder ()
void SetOption (const QString &opt, 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 &, const QString &) 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 *sd)
MPEGStreamDataGetStreamData (void) const
void Reset (void) override
 Reset the recorder to the startup state. More...
void ClearStatistics (void) override
RecordingQualityGetRecordingQuality (const RecordingInfo *) const override
 Returns a report about the current recordings quality. More...
void HandlePAT (const ProgramAssociationTable *) override
void HandleCAT (const ConditionalAccessTable *) override
void HandlePMT (uint pid, const ProgramMapTable *) 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)
virtual ~RecorderBase ()
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 (RingBuffer *rbuf)
 Tells recorder to use an externally created ringbuffer. More...
void SetNextRecording (const RecordingInfo *, RingBuffer *)
 Sets next recording info, to be applied as soon as practical. 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 &) const
bool GetKeyframeDurations (long long start, long long end, frm_pos_map_t &) 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 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 (int timeout=1000)
 WaitForPause blocks until recorder is actually paused, or timeout milliseconds elapse. More...
double GetFrameRate (void) const
 Returns the latest frame rate. More...
virtual void 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 HandleSplice (const SpliceInformationTable *)

Private Member Functions

void ReaderPaused (int fd)
bool PauseAndWait (int timeout=100) override
 If request_pause is true, sets pause and blocks up to timeout milliseconds or until unpaused, whichever is sooner. More...

Private Attributes


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, const RecordingProfile &profile, const GeneralDBOptions &genOpt)
- Protected Member Functions inherited from DTVRecorder
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 FindH264Keyframes (const TSPacket *tspacket)
 This searches the TS packet to identify keyframes. More...
void HandleH264Keyframe (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 cc)
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 void SetRecordingStatus (RecStatus::Type status, const QString &file, int line)
void SetPositionMapType (MarkTypes type)
 Set seektable type. More...
void AspectChange (uint ratio, 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, long long frame)
 Note a change in video frame rate 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 (uint64_t 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 inherited from DTVRecorder
int _stream_fd
QString _recording_type
QTime _audio_timer
uint32_t _start_code
int _first_keyframe
unsigned long long _last_gop_seen
unsigned long long _last_seq_seen
unsigned long long _last_keyframe_seen
unsigned int _audio_bytes_remaining
unsigned int _video_bytes_remaining
unsigned int _other_bytes_remaining
int _progressive_sequence
int _repeat_pict
bool _pes_synced
bool _seen_sps
H264Parser m_h264_parser
bool _wait_for_keyframe_option
 Wait for the a GOP/SEQ-start before sending data. More...
bool _has_written_other_keyframe
QString _error
 non-empty iff irrecoverable recording error detected More...
bool _buffer_packets
vector< unsigned char > _payload_buffer
QMutex _pid_lock
 PAT on input side. More...
 PMT on input side. More...
bool _has_no_av
int _record_mpts
bool _record_mpts_only
unsigned char _stream_id [0x1fff+1]
unsigned char _pid_status [0x1fff+1]
unsigned char _continuity_counter [0x1fff+1]
vector< TSPacket_scratch
int _minimum_recording_quality
bool _use_pts
uint64_t _ts_count [256]
int64_t _ts_last [256]
int64_t _ts_first [256]
QDateTime _ts_first_dt [256]
QAtomicInt _packet_count
QAtomicInt _continuity_error_count
unsigned long long _frames_seen_count
unsigned long long _frames_written_count
double _total_duration
double _td_base
uint64_t _td_tick_count
FrameRate _td_tick_framerate
bool music_choice
- Protected Attributes inherited from RecorderBase
bool weMadeBuffer
AVContainer m_containerFormat
AVCodecID m_primaryVideoCodec
AVCodecID m_primaryAudioCodec
QString videocodec
QString videodevice
bool ntsc
bool ntsc_framerate
double video_frame_rate
uint m_videoAspect
uint m_videoHeight
uint m_videoWidth
FrameRate m_frameRate
QMutex pauseLock
bool request_pause
bool paused
QWaitCondition pauseWait
QWaitCondition unpauseWait
bool request_recording
 True if API call has requested a recording be [re]started. More...
bool recording
 True while recording is actually being performed. More...
QWaitCondition recordingWait
QMutex nextRingBufferLock
MythTimer ringBufferCheckTimer
MarkTypes positionMapType
QMutex positionMapLock
frm_pos_map_t positionMap
frm_pos_map_t positionMapDelta
frm_pos_map_t durationMap
frm_pos_map_t durationMapDelta
MythTimer positionMapTimer
qint64 estimatedProgStartMS
long long lastSavedKeyframe
long long lastSavedDuration
QMutex statisticsLock
QAtomicInt timeOfFirstDataIsSet
QDateTime timeOfFirstData
QAtomicInt timeOfLatestDataCount
QAtomicInt timeOfLatestDataPacketInterval
QDateTime timeOfLatestData
MythTimer timeOfLatestDataTimer
RecordingGaps recordingGaps
- Static Protected Attributes inherited from DTVRecorder
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 const uint kTimeOfLatestDataIntervalTarget = 5000
 timeOfLatest update interval target in milliseconds. More...

Detailed Description

Definition at line 20 of file cetonrecorder.h.

Constructor & Destructor Documentation

◆ CetonRecorder()

CetonRecorder::CetonRecorder ( TVRec rec,
CetonChannel channel 

Definition at line 18 of file cetonrecorder.cpp.

Member Function Documentation

◆ run()

void CetonRecorder::run ( void  )

run() starts the recording process, and does not exit until the recording is complete.

See also

Implements RecorderBase.

Definition at line 59 of file cetonrecorder.cpp.

◆ Open()

bool CetonRecorder::Open ( void  )

Definition at line 23 of file cetonrecorder.cpp.

Referenced by run().

◆ Close()

void CetonRecorder::Close ( void  )

Definition at line 41 of file cetonrecorder.cpp.

Referenced by run().

◆ StartNewFile()

void CetonRecorder::StartNewFile ( void  )

Reimplemented from RecorderBase.

Definition at line 52 of file cetonrecorder.cpp.

Referenced by run().

◆ IsOpen()

bool CetonRecorder::IsOpen ( void  ) const

Definition at line 31 of file cetonrecorder.h.

Referenced by Close(), and Open().

◆ GetSIStandard()

QString CetonRecorder::GetSIStandard ( void  ) const

Reimplemented from DTVRecorder.

Definition at line 160 of file cetonrecorder.cpp.

◆ ReaderPaused()

void CetonRecorder::ReaderPaused ( int  fd)

◆ PauseAndWait()

bool CetonRecorder::PauseAndWait ( int  timeout = 100)

If request_pause is true, sets pause and blocks up to timeout milliseconds or until unpaused, whichever is sooner.

This is the where we actually do the pausing. For most recorders that need to do something special on pause, this is the method to overide.

timeoutnumber of milliseconds to wait defaults to 100.
true if recorder is paused.

Reimplemented from RecorderBase.

Definition at line 132 of file cetonrecorder.cpp.

Referenced by run().

Member Data Documentation

◆ _channel

CetonChannel* CetonRecorder::_channel

Definition at line 40 of file cetonrecorder.h.

Referenced by GetSIStandard(), and Open().

◆ _stream_handler

CetonStreamHandler* CetonRecorder::_stream_handler

Definition at line 41 of file cetonrecorder.h.

Referenced by Close(), IsOpen(), Open(), PauseAndWait(), and run().

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