Go to the documentation of this file.
10 #include <QCoreApplication>
13 #include <QRecursiveMutex>
18 #include <QStringList>
20 #include <QWaitCondition>
62 using tctype_arr = std::array<std::chrono::milliseconds,TCTYPESMAX>;
98 void CheckCallbacks();
99 void SeekingSlow(
int Count);
100 void SeekingComplete();
102 void PauseChanged(
bool Paused);
103 void RequestResetCaptions();
104 void SignalTracksChanged(
uint Type);
111 virtual int OpenFile(
int Retries = 4);
112 virtual bool InitVideo(
void);
113 virtual void ReinitVideo(
bool ForceUpdate);
114 virtual void InitFrameInterval();
117 void SetLength(std::chrono::seconds len) { m_totalLength = len; }
118 void SetFramesPlayed(uint64_t played);
120 void SetWatchingRecording(
bool mode);
121 void SetKeyframeDistance(
int keyframedistance);
122 virtual void SetVideoParams(
int w,
int h,
double fps,
float aspect,
123 bool ForceUpdate,
int ReferenceFrames,
125 const QString& codecName = QString());
126 void SetFileLength(std::chrono::seconds total,
int frames);
127 void SetDuration(std::chrono::seconds duration);
128 void SetFrameRate(
double fps);
136 int GetFreeVideoFrames(
void)
const;
142 std::chrono::seconds
GetLength(
void)
const {
return m_totalLength; }
144 uint64_t GetCurrentFrameCount(
void)
const;
146 virtual uint64_t GetBookmark(
void);
147 QString GetError(
void)
const;
148 QString GetEncodingType(
void)
const;
149 QString GetXDS(
const QString &key)
const;
153 bool GetRawAudioState(
void)
const;
156 bool IsErrored(
void)
const;
157 bool IsPlaying(std::chrono::milliseconds wait_in_msec = 0ms,
158 bool wait_for =
true)
const;
160 bool IsReallyNearEnd(
void)
const;
161 bool IsNearEnd(
void);
162 bool HasTVChainNext(
void)
const;
163 bool IsWatchingInprogress(
void)
const;
181 virtual void ReleaseNextVideoFrame(
MythVideoFrame *buffer, std::chrono::milliseconds timecode,
184 void DiscardVideoFrames(
bool KeyFrame,
bool Flushed);
187 virtual bool HasReachedEof(
void)
const;
188 void SetDisablePassThrough(
bool disabled);
189 void ForceSetupAudioStream(
void);
192 virtual bool PrepareAudioSample(std::chrono::milliseconds &timecode);
201 void EnableForcedSubtitles(
bool enable);
210 void FileChangedCallback();
213 virtual int GetNumChapters(
void);
214 virtual int GetCurrentChapter(
void);
215 virtual void GetChapterTimes(QList<std::chrono::seconds> ×);
234 void SaveTotalDuration(
void);
235 void ResetTotalDuration(
void);
245 void SaveTotalFrames(
void);
246 void SetErrored(
const QString &reason);
250 void OpenDummy(
void);
253 virtual long long CalcMaxFFTime(
long long ff,
bool setjump =
true)
const;
254 long long CalcRWTime(
long long rw)
const;
255 std::chrono::milliseconds TranslatePositionFrameToMs(uint64_t position,
256 bool use_cutlist)
const;
258 bool use_cutlist)
const {
259 return m_deleteMap.TranslatePositionMsToFrame(position,
267 return m_deleteMap.TranslatePositionAbsToRel(position);
270 return m_deleteMap.TranslatePositionRelToAbs(position);
273 return TranslatePositionFrameToMs(position, use_cutlist).count() / 1000.0;
275 uint64_t FindFrame(
float offset,
bool use_cutlist)
const;
279 { m_commBreakMap.SetAutoCommercialSkip(autoskip, m_framesPlayed); }
281 { m_commBreakMap.SkipCommercials(direction); }
284 {
return m_commBreakMap.GetAutoCommercialSkip(); }
287 virtual void ResetPlaying(
bool resetframes =
true);
288 virtual void StopPlaying(
void);
291 bool PauseDecoder(
void);
292 void UnpauseDecoder(
void);
294 bool Play(
float speed = 1.0,
bool normal =
true,
bool unpauseaudio =
true);
297 virtual bool FastForward(
float seconds);
298 virtual bool Rewind(
float seconds);
299 virtual bool JumpToFrame(uint64_t frame);
302 void JumpChapter(
int chapter);
305 virtual bool PrebufferEnoughFrames(
int min_buffers = 0);
306 void SetBuffering(
bool new_buffering);
307 virtual void VideoEnd(
void);
308 virtual void DecoderStart(
bool start_paused);
309 virtual void DecoderLoop(
bool pause);
310 virtual void DecoderEnd(
void);
311 virtual void DecoderPauseCheck(
void);
312 virtual void AudioEnd(
void);
316 bool IsInDelete(uint64_t frame);
323 void SetPlaying(
bool is_playing);
324 void ResetErrored(
void);
327 void PauseVideo(
void);
328 void UnpauseVideo(
void);
329 void PauseBuffer(
void);
330 void UnpauseBuffer(
void);
337 virtual void DoFFRewSkip(
void);
338 bool DecoderGetFrame(
DecodeType decodetype,
bool unsafe =
false);
342 bool UpdateFFRewSkip(
float ffrewScale = 1.0F);
343 virtual void ChangeSpeed(
void);
345 bool DoFastForward(uint64_t frames,
double inaccuracy);
346 bool DoRewind(uint64_t frames,
double inaccuracy);
347 void DoJumpToFrame(uint64_t frame,
double inaccuracy);
350 void WaitForSeek(uint64_t frame, uint64_t seeksnap_wanted);
351 void ClearAfterSeek(
bool clearvideobuffers =
true);
354 virtual bool DoJumpChapter(
int chapter);
355 virtual int64_t GetChapter(
int chapter);
358 void WrapTimecode(std::chrono::milliseconds &timecode,
TCTypes tc_type);
368 QThread *m_playerThread {
nullptr};
370 int m_playerThreadId {0};
382 int64_t m_decoderSeek {-1};
383 bool m_totalDecoderPause {
false};
384 bool m_decoderPaused {
false};
385 bool m_inJumpToProgramPause {
false};
386 bool m_pauseDecoder {
false};
387 bool m_unpauseDecoder {
false};
388 bool volatile m_killDecoder {
false};
389 bool m_decodeOneFrame {
false};
390 bool m_renderOneFrame {
false};
391 bool m_needNewPauseFrame {
false};
392 bool m_bufferPaused {
false};
393 bool m_videoPaused {
false};
394 bool m_allPaused {
false};
395 bool m_playing {
false};
403 bool m_liveTV {
false};
404 bool m_watchingRecording {
false};
405 bool m_transcoding {
false};
406 bool m_hasFullPositionMap {
false};
407 mutable bool m_limitKeyRepeat {
false};
410 int m_jumpChapter {0};
413 uint64_t m_bookmarkSeek {0};
419 long long m_ffTime {0};
423 int m_videobufRetries {0};
424 uint64_t m_framesPlayed {0};
425 uint64_t m_totalFrames {0};
426 std::chrono::seconds m_totalLength {0s};
427 std::chrono::seconds m_totalDuration {0s};
428 long long m_rewindTime {0};
429 std::chrono::milliseconds m_latestVideoTimecode {-1ms};
435 double m_videoFrameRate {29.97};
438 QSize m_videoDispDim {0,0};
439 QSize m_videoDim {0,0};
440 int m_maxReferenceFrames {0};
441 float m_videoAspect {4.0F / 3.0F};
442 float m_forcedVideoAspect {-1};
448 bool m_buffering {
false};
455 int m_ttPageNum {0x888};
462 bool m_captionsEnabledbyDefault {
false};
463 bool m_enableForcedSubtitles {
false};
464 bool m_disableForcedSubtitles {
false};
465 bool m_allowForcedSubtitles {
true};
476 bool m_forcePositionMapSync {
false};
483 float m_nextPlaySpeed {1.0F};
484 float m_playSpeed {1.0F};
485 std::chrono::microseconds m_frameInterval
487 int m_fpsMultiplier {1};
489 int m_ffrewAdjust {0};
490 float m_ffrewScale {1.0F};
491 bool m_fileChanged {
false};
492 bool m_nextNormalSpeed {
true};
493 bool m_normalSpeed {
true};
497 std::chrono::milliseconds m_savedAudioTimecodeOffset {0ms};
500 bool m_isDummy {
false};
503 int m_bufferingCounter {0};
507 void syncWithAudioStretch();
508 bool m_disablePassthrough {
false};
virtual TeletextReader * GetTeletextReader(uint=0)
void SetLength(std::chrono::seconds len)
void(*)(int, void *) StatusCallback
virtual bool PrevTitle(void)
bool AtNormalSpeed(void) const
QRecursiveMutex m_decoderChangeLock
uint64_t TranslatePositionAbsToRel(uint64_t position) const
MythVideoOutput * GetVideoOutput(void)
uint64_t GetTotalFrameCount(void) const
CommBreakMap m_commBreakMap
SubtitleReader m_subReader
static const int kNightModeContrastAdjustment
QWaitCondition m_decoderThreadUnpause
MythPlayerAVSync m_avSync
virtual int GetNumAngles(void) const
virtual bool PrevAngle(void)
virtual InteractiveTV * GetInteractiveTV()
bool IsPaused(void) const
virtual int GetNumTitles(void) const
std::enable_if_t< std::is_floating_point_v< T >, std::chrono::microseconds > microsecondsFromFloat(T value)
Helper function for convert a floating point number to a duration.
virtual QString GetAngleName(int) const
QMap< uint64_t, MarkTypes > frm_dir_map_t
Frame # -> Mark map.
QString m_errorMsg
Reason why NVP exited with a error.
float GetNextPlaySpeed(void) const
float GetFrameRate(void) const
virtual CC708Reader * GetCC708Reader(uint=0)
void SkipCommercials(int direction)
static constexpr size_t TCTYPESMAX
bool GetLimitKeyRepeat(void) const
def scan(profile, smoonURL, gate)
static const double kInaccuracyNone
void SetAutoCommercialSkip(CommSkipMode autoskip)
virtual bool SwitchTitle(int)
float GetPlaySpeed(void) const
uint64_t GetFramesPlayed(void) const
float ComputeSecs(uint64_t position, bool use_cutlist) const
static const int kNightModeBrightenssAdjustment
QSize GetVideoBufferSize(void) const
QRecursiveMutex m_decoderLock
Lock for next_play_speed and next_normal_speed.
CommSkipMode GetAutoCommercialSkip(void)
virtual std::chrono::seconds GetTitleDuration(int) const
std::vector< VideoFrameType > VideoFrameTypes
QMutex m_decoderPauseLock
virtual CC608Reader * GetCC608Reader(uint=0)
virtual bool NextTitle(void)
std::vector< char > TestBufferVec
virtual bool SwitchAngle(int)
bool GetEditMode(void) const
virtual int GetCurrentAngle(void) const
PlayerFlags m_playerFlags
bool GetAllowForcedSubtitles(void) const
DecoderBase * GetDecoder(void)
Returns the stream decoder currently in use.
TeletextReader m_ttxReader
virtual SubtitleReader * GetSubReader(uint=0)
std::array< std::chrono::milliseconds, TCTYPESMAX > tctype_arr
QMap< long long, long long > frm_pos_map_t
Frame # -> File offset map.
virtual int GetCurrentTitle(void) const
std::chrono::seconds GetLength(void) const
static const double kSeekToEndOffset
AudioPlayer * GetAudio(void)
Holds information on recordings and videos.
QWaitCondition m_decoderThreadPause
static const VideoFrameTypes kDefaultRenderFormats
virtual QString GetTitleName(int) const
QSize GetVideoSize(void) const
static const double kInaccuracyEditor
uint64_t TranslatePositionMsToFrame(std::chrono::milliseconds position, bool use_cutlist) const
float GetVideoAspect(void) const
bool FlagIsSet(PlayerFlags arg)
static const double kInaccuracyFull
virtual bool IsInStillFrame() const
const DecoderBase * GetDecoder(void) const
Returns the stream decoder currently in use.
This is the interface between an MHEG engine and a MythTV TV object.
static const double kInaccuracyDefault
int GetFFRewSkip(void) const
QWaitCondition m_playingWaitCond
virtual bool NextAngle(void)
uint64_t TranslatePositionRelToAbs(uint64_t position) const