Go to the documentation of this file.
2 #ifndef RECORDERBASE_H_
3 #define RECORDERBASE_H_
7 #include <QWaitCondition>
25 #include "libavcodec/avcodec.h"
79 m_videoFrameRate = rate;
80 m_ntscFrameRate = (29.96 <= rate && 29.98 >= rate);
81 m_frameRate =
FrameRate(lround(rate * 100), 100);
109 virtual void SetOption(
const QString &name,
const QString &value);
115 virtual void SetOption(
const QString &name,
int value);
122 { SetOption(name,
static_cast<int>(value)); }
130 virtual void SetVideoFilters(QString &filters) = 0;
139 const QString &videodev,
140 const QString &audiodev,
141 const QString &vbidev) = 0;
158 virtual void Initialize(
void) = 0;
164 void run(
void)
override = 0;
171 virtual void Reset(
void) = 0;
174 virtual bool IsErrored(
void) = 0;
181 virtual long long GetFramesWritten(
void) = 0;
191 virtual int GetVideoFd(
void) = 0;
207 long long GetKeyframePosition(
long long desired)
const;
208 bool GetKeyframePositions(
210 bool GetKeyframeDurations(
213 virtual void StopRecording(
void);
214 virtual bool IsRecording(
void);
215 virtual bool IsRecordingRequested(
void);
221 virtual void Pause(
bool clear =
true);
222 virtual void Unpause(
void);
223 virtual bool IsPaused(
bool holding_lock =
false)
const;
224 virtual bool WaitForPause(std::chrono::milliseconds
timeout = 1s);
232 virtual bool CheckForRingBufferSwitch(
void);
236 void SavePositionMap(
bool force =
false,
bool finished =
false);
239 ASPECT_UNKNOWN = 0x00,
243 ASPECT_2_21_1 = 0x04,
244 ASPECT_CUSTOM = 0x05,
262 virtual bool PauseAndWait(std::chrono::milliseconds
timeout = 100ms);
264 virtual void ResetForNewFile(
void) = 0;
266 const QString&
file,
int line);
267 virtual void ClearStatistics(
void);
268 virtual void FinishRecording(
void);
277 void AspectChange(
uint aspect,
long long frame);
281 void ResolutionChange(
uint width,
uint height,
long long frame);
285 void FrameRateChange(
uint framerate, uint64_t frame);
289 void VideoScanChange(
SCAN_t scan, uint64_t frame);
293 void VideoCodecChange(AVCodecID vCodec);
297 void AudioCodecChange(AVCodecID aCodec);
301 void SetDuration(std::chrono::milliseconds duration);
305 void SetTotalFrames(uint64_t total_frames);
307 void TryWriteProgStartMark(
const frm_pos_map_t &durationDeltaCopy);
311 bool m_weMadeBuffer {
true};
314 AVCodecID m_primaryVideoCodec {AV_CODEC_ID_NONE};
315 AVCodecID m_primaryAudioCodec {AV_CODEC_ID_NONE};
316 QString m_videocodec {
"rtjpeg"};
320 bool m_ntscFrameRate {
true};
321 double m_videoFrameRate {29.97};
333 bool m_requestPause {
false};
334 bool m_paused {
false};
338 bool m_requestRecording {
false};
340 bool m_recording {
false};
360 qint64 m_estimatedProgStartMS {0};
361 long long m_lastSavedKeyframe {0};
362 long long m_lastSavedDuration {0};
378 static constexpr std::chrono::milliseconds kTimeOfLatestDataIntervalTarget { 5s };
MythTimer m_positionMapTimer
MythTimer m_timeOfLatestDataTimer
void SetPositionMapType(MarkTypes type)
Set seektable type.
QDateTime m_timeOfLatestData
double toDouble(void) const
A QElapsedTimer based timer to replace use of QTime as a timer.
Holds information on a TV Program one might wish to record.
QAtomicInt m_timeOfLatestDataPacketInterval
def scan(profile, smoonURL, gate)
bool isNonzero(void) const
QWaitCondition m_recordingWait
frm_pos_map_t m_durationMapDelta
MythTimer m_ringBufferCheckTimer
bool operator==(const FrameRate other) const
Abstract class providing a generic interface to tuning hardware.
RecordingGaps m_recordingGaps
bool operator!=(const FrameRate other) const
void SetBoolOption(const QString &name, bool value)
Set an specific boolean option.
double GetFrameRate(void) const
Returns the latest frame rate.
static void clear(SettingsMap &cache, SettingsMap &overrides, const QString &myKey)
void run(const QString &name, Class *object, void(Class::*fn)())
frm_pos_map_t m_durationMap
QMutex m_nextRingBufferLock
frm_pos_map_t m_positionMap
QMap< long long, long long > frm_pos_map_t
Frame # -> File offset map.
frm_pos_map_t m_positionMapDelta
FrameRate(uint n, uint d=1)
void SetFrameRate(double rate)
Sets the video frame rate.
QWaitCondition m_pauseWait
QDateTime m_timeOfFirstData
virtual void StartNewFile(void)
QAtomicInt m_timeOfFirstDataIsSet
This is the abstract base class for supporting recorder hardware.
This is the coordinating class of the Recorder Subsystem.
QString toString(void) const
static const iso6937table * d
QWaitCondition m_unpauseWait
QList< RecordingGap > RecordingGaps
QAtomicInt m_timeOfLatestDataCount