7#include <QWaitCondition>
26#include "libavcodec/avcodec.h"
60 m_videoFrameRate = rate;
61 m_ntscFrameRate = (29.96 <= rate && 29.98 >= rate);
90 virtual void SetOption(
const QString &name,
const QString &value);
96 virtual void SetOption(
const QString &name,
int value);
103 { SetOption(name,
static_cast<int>(value)); }
120 const QString &videodev,
121 const QString &audiodev,
122 const QString &vbidev) = 0;
145 void run(
void)
override = 0;
188 long long GetKeyframePosition(
long long desired)
const;
189 bool GetKeyframePositions(
191 bool GetKeyframeDurations(
194 virtual void StopRecording(
void);
195 virtual bool IsRecording(
void);
196 virtual bool IsRecordingRequested(
void);
202 virtual void Pause(
bool clear =
true);
203 virtual void Unpause(
void);
204 virtual bool IsPaused(
bool holding_lock =
false)
const;
205 virtual bool WaitForPause(std::chrono::milliseconds
timeout = 1s);
213 virtual bool CheckForRingBufferSwitch(
void);
217 void SavePositionMap(
bool force =
false,
bool finished =
false);
220 ASPECT_UNKNOWN = 0x00,
224 ASPECT_2_21_1 = 0x04,
225 ASPECT_CUSTOM = 0x05,
243 virtual bool PauseAndWait(std::chrono::milliseconds
timeout = 100ms);
247 const QString&
file,
int line);
248 virtual void ClearStatistics(
void);
249 virtual void FinishRecording(
void);
258 void AspectChange(
uint aspect,
long long frame);
262 void ResolutionChange(
uint width,
uint height,
long long frame);
266 void FrameRateChange(
uint framerate, uint64_t frame);
270 void VideoScanChange(
SCAN_t scan, uint64_t frame);
274 void VideoCodecChange(AVCodecID vCodec);
278 void AudioCodecChange(AVCodecID aCodec);
282 void SetDuration(std::chrono::milliseconds duration);
286 void SetTotalFrames(uint64_t total_frames);
288 void TryWriteProgStartMark(
const frm_pos_map_t &durationDeltaCopy);
292 bool m_weMadeBuffer {
true};
295 AVCodecID m_primaryVideoCodec {AV_CODEC_ID_NONE};
296 AVCodecID m_primaryAudioCodec {AV_CODEC_ID_NONE};
297 QString m_videocodec {
"rtjpeg"};
301 bool m_ntscFrameRate {
true};
302 double m_videoFrameRate {29.97};
314 bool m_requestPause {
false};
315 bool m_paused {
false};
319 bool m_requestRecording {
false};
321 bool m_recording {
false};
341 qint64 m_estimatedProgStartMS {0};
342 long long m_lastSavedKeyframe {0};
343 long long m_lastSavedDuration {0};
359 static constexpr std::chrono::milliseconds kTimeOfLatestDataIntervalTarget { 5s };
Abstract class providing a generic interface to tuning hardware.
C++ wrapper for FFmpeg libavutil AVRational.
A QElapsedTimer based timer to replace use of QTime as a timer.
This is the abstract base class for supporting recorder hardware.
virtual void Reset(void)=0
Reset the recorder to the startup state.
virtual void StartNewFile(void)
QAtomicInt m_timeOfLatestDataPacketInterval
virtual void ResetForNewFile(void)=0
virtual void SetVideoFilters(QString &filters)=0
Tells recorder which filters to use.
virtual int GetVideoFd(void)=0
Returns file descriptor of recorder device.
void SetFrameRate(double rate)
Sets the video frame rate.
QMutex m_nextRingBufferLock
frm_pos_map_t m_positionMap
frm_pos_map_t m_durationMapDelta
virtual void Initialize(void)=0
This is called between SetOptionsFromProfile() and run() to initialize any devices,...
QDateTime m_timeOfLatestData
void run(void) override=0
run() starts the recording process, and does not exit until the recording is complete.
MythTimer m_timeOfLatestDataTimer
QDateTime m_timeOfFirstData
double GetFrameRate(void) const
Returns the latest frame rate.
MythTimer m_ringBufferCheckTimer
frm_pos_map_t m_positionMapDelta
virtual void SetOptionsFromProfile(RecordingProfile *profile, const QString &videodev, const QString &audiodev, const QString &vbidev)=0
Sets basic recorder options.
virtual long long GetFramesWritten(void)=0
Returns number of frames written to disk.
frm_pos_map_t m_durationMap
QWaitCondition m_pauseWait
RecordingGaps m_recordingGaps
void SetBoolOption(const QString &name, bool value)
Set an specific boolean option.
MythTimer m_positionMapTimer
QAtomicInt m_timeOfLatestDataCount
QAtomicInt m_timeOfFirstDataIsSet
QWaitCondition m_unpauseWait
void SetPositionMapType(MarkTypes type)
Set seektable type.
QWaitCondition m_recordingWait
virtual bool IsErrored(void)=0
Tells us whether an unrecoverable error has been encountered.
Holds information on a TV Program one might wish to record.
This is the coordinating class of the Recorder Subsystem.
static void clear(SettingsMap &cache, SettingsMap &overrides, const QString &myKey)
def scan(profile, smoonURL, gate)
QMap< long long, long long > frm_pos_map_t
Frame # -> File offset map.
QList< RecordingGap > RecordingGaps