7#include <QWaitCondition>
27#include "libavcodec/avcodec.h"
61 m_videoFrameRate = rate;
62 m_ntscFrameRate = (29.96 <= rate && 29.98 >= rate);
91 virtual void SetOption(
const QString &name,
const QString &value);
97 virtual void SetOption(
const QString &name,
int value);
104 { SetOption(name,
static_cast<int>(value)); }
121 const QString &videodev,
122 const QString &audiodev,
123 const QString &vbidev) = 0;
146 void run(
void)
override = 0;
189 long long GetKeyframePosition(
long long desired)
const;
190 bool GetKeyframePositions(
192 bool GetKeyframeDurations(
195 virtual void StopRecording(
void);
196 virtual bool IsRecording(
void);
197 virtual bool IsRecordingRequested(
void);
203 virtual void Pause(
bool clear =
true);
204 virtual void Unpause(
void);
205 virtual bool IsPaused(
bool holding_lock =
false)
const;
206 virtual bool WaitForPause(std::chrono::milliseconds
timeout = 1s);
214 virtual bool CheckForRingBufferSwitch(
void);
218 void SavePositionMap(
bool force =
false,
bool finished =
false);
221 ASPECT_UNKNOWN = 0x00,
225 ASPECT_2_21_1 = 0x04,
226 ASPECT_CUSTOM = 0x05,
244 virtual bool PauseAndWait(std::chrono::milliseconds
timeout = 100ms);
248 const QString&
file,
int line);
249 virtual void ClearStatistics(
void);
250 virtual void FinishRecording(
void);
259 void AspectChange(
uint aspect,
long long frame);
263 void ResolutionChange(
uint width,
uint height,
long long frame);
267 void FrameRateChange(
uint framerate, uint64_t frame);
271 void VideoScanChange(
SCAN_t scan, uint64_t frame);
275 void VideoCodecChange(AVCodecID vCodec);
279 void AudioCodecChange(AVCodecID aCodec);
283 void SetDuration(std::chrono::milliseconds duration);
287 void SetTotalFrames(uint64_t total_frames);
289 void TryWriteProgStartMark(
const frm_pos_map_t &durationDeltaCopy);
293 bool m_weMadeBuffer {
true};
296 AVCodecID m_primaryVideoCodec {AV_CODEC_ID_NONE};
297 AVCodecID m_primaryAudioCodec {AV_CODEC_ID_NONE};
298 QString m_videocodec {
"rtjpeg"};
302 bool m_ntscFrameRate {
true};
303 double m_videoFrameRate {29.97};
315 bool m_requestPause {
false};
316 bool m_paused {
false};
320 bool m_requestRecording {
false};
322 bool m_recording {
false};
342 qint64 m_estimatedProgStartMS {0};
343 long long m_lastSavedKeyframe {0};
344 long long m_lastSavedDuration {0};
360 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