Go to the documentation of this file.
10 #include <QCoreApplication>
13 #if QT_VERSION >= QT_VERSION_CHECK(5,14,0)
14 #include <QRecursiveMutex>
20 #include <QStringList>
21 #include <QWaitCondition>
63 using tctype_arr = std::array<std::chrono::milliseconds,TCTYPESMAX>;
99 void CheckCallbacks();
100 void SeekingSlow(
int Count);
101 void SeekingComplete();
103 void PauseChanged(
bool Paused);
104 void RequestResetCaptions();
105 void SignalTracksChanged(
uint Type);
112 virtual int OpenFile(
int Retries = 4);
113 virtual bool InitVideo(
void);
114 virtual void ReinitVideo(
bool ForceUpdate);
115 virtual void InitFrameInterval();
118 void SetLength(std::chrono::seconds len) { m_totalLength = len; }
119 void SetFramesPlayed(uint64_t played);
121 void SetWatchingRecording(
bool mode);
122 void SetKeyframeDistance(
int keyframedistance);
123 virtual void SetVideoParams(
int w,
int h,
double fps,
float aspect,
124 bool ForceUpdate,
int ReferenceFrames,
126 const QString& codecName = QString());
127 void SetFileLength(std::chrono::seconds total,
int frames);
128 void SetDuration(std::chrono::seconds duration);
129 void SetFrameRate(
double fps);
137 int GetFreeVideoFrames(
void)
const;
143 std::chrono::seconds
GetLength(
void)
const {
return m_totalLength; }
145 uint64_t GetCurrentFrameCount(
void)
const;
147 virtual uint64_t GetBookmark(
void);
148 QString GetError(
void)
const;
149 QString GetEncodingType(
void)
const;
150 QString GetXDS(
const QString &key)
const;
154 bool GetRawAudioState(
void)
const;
157 bool IsErrored(
void)
const;
158 bool IsPlaying(std::chrono::milliseconds wait_in_msec = 0ms,
159 bool wait_for =
true)
const;
161 bool IsReallyNearEnd(
void)
const;
162 bool IsNearEnd(
void);
163 bool HasTVChainNext(
void)
const;
164 bool IsWatchingInprogress(
void)
const;
182 virtual void ReleaseNextVideoFrame(
MythVideoFrame *buffer, std::chrono::milliseconds timecode,
185 void DiscardVideoFrames(
bool KeyFrame,
bool Flushed);
188 virtual bool HasReachedEof(
void)
const;
189 void SetDisablePassThrough(
bool disabled);
190 void ForceSetupAudioStream(
void);
193 virtual bool PrepareAudioSample(std::chrono::milliseconds &timecode);
202 void EnableForcedSubtitles(
bool enable);
204 return m_allowForcedSubtitles && !m_captionsEnabledbyDefault;
214 void FileChangedCallback();
217 virtual int GetNumChapters(
void);
218 virtual int GetCurrentChapter(
void);
219 virtual void GetChapterTimes(QList<std::chrono::seconds> ×);
238 void SaveTotalDuration(
void);
239 void ResetTotalDuration(
void);
249 void SaveTotalFrames(
void);
250 void SetErrored(
const QString &reason);
254 void OpenDummy(
void);
257 virtual long long CalcMaxFFTime(
long long ff,
bool setjump =
true)
const;
258 long long CalcRWTime(
long long rw)
const;
259 std::chrono::milliseconds TranslatePositionFrameToMs(uint64_t position,
260 bool use_cutlist)
const;
262 bool use_cutlist)
const {
263 return m_deleteMap.TranslatePositionMsToFrame(position,
271 return m_deleteMap.TranslatePositionAbsToRel(position);
274 return m_deleteMap.TranslatePositionRelToAbs(position);
277 return TranslatePositionFrameToMs(position, use_cutlist).count() / 1000.0;
279 uint64_t FindFrame(
float offset,
bool use_cutlist)
const;
283 { m_commBreakMap.SetAutoCommercialSkip(autoskip, m_framesPlayed); }
285 { m_commBreakMap.SkipCommercials(direction); }
288 {
return m_commBreakMap.GetAutoCommercialSkip(); }
291 virtual void ResetPlaying(
bool resetframes =
true);
292 virtual void StopPlaying(
void);
295 bool PauseDecoder(
void);
296 void UnpauseDecoder(
void);
298 bool Play(
float speed = 1.0,
bool normal =
true,
bool unpauseaudio =
true);
301 virtual bool FastForward(
float seconds);
302 virtual bool Rewind(
float seconds);
303 virtual bool JumpToFrame(uint64_t frame);
306 void JumpChapter(
int chapter);
309 virtual bool PrebufferEnoughFrames(
int min_buffers = 0);
310 void SetBuffering(
bool new_buffering);
311 virtual void VideoEnd(
void);
312 virtual void DecoderStart(
bool start_paused);
313 virtual void DecoderLoop(
bool pause);
314 virtual void DecoderEnd(
void);
315 virtual void DecoderPauseCheck(
void);
316 virtual void AudioEnd(
void);
320 bool IsInDelete(uint64_t frame);
327 void SetPlaying(
bool is_playing);
328 void ResetErrored(
void);
331 void PauseVideo(
void);
332 void UnpauseVideo(
void);
333 void PauseBuffer(
void);
334 void UnpauseBuffer(
void);
341 virtual void DoFFRewSkip(
void);
342 bool DecoderGetFrame(
DecodeType decodetype,
bool unsafe =
false);
346 bool UpdateFFRewSkip(
float ffrewScale = 1.0F);
347 virtual void ChangeSpeed(
void);
349 bool DoFastForward(uint64_t frames,
double inaccuracy);
350 bool DoRewind(uint64_t frames,
double inaccuracy);
351 void DoJumpToFrame(uint64_t frame,
double inaccuracy);
354 void WaitForSeek(uint64_t frame, uint64_t seeksnap_wanted);
355 void ClearAfterSeek(
bool clearvideobuffers =
true);
358 virtual bool DoJumpChapter(
int chapter);
359 virtual int64_t GetChapter(
int chapter);
362 void WrapTimecode(std::chrono::milliseconds &timecode,
TCTypes tc_type);
367 #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
368 mutable QMutex m_decoderChangeLock {QMutex::Recursive};
376 QThread *m_playerThread {
nullptr};
378 int m_playerThreadId {0};
390 int64_t m_decoderSeek {-1};
391 bool m_totalDecoderPause {
false};
392 bool m_decoderPaused {
false};
393 bool m_inJumpToProgramPause {
false};
394 bool m_pauseDecoder {
false};
395 bool m_unpauseDecoder {
false};
396 bool volatile m_killDecoder {
false};
397 bool m_decodeOneFrame {
false};
398 bool m_renderOneFrame {
false};
399 bool m_needNewPauseFrame {
false};
400 bool m_bufferPaused {
false};
401 bool m_videoPaused {
false};
402 bool m_allPaused {
false};
403 bool m_playing {
false};
411 bool m_liveTV {
false};
412 bool m_watchingRecording {
false};
413 bool m_transcoding {
false};
414 bool m_hasFullPositionMap {
false};
415 mutable bool m_limitKeyRepeat {
false};
418 int m_jumpChapter {0};
421 uint64_t m_bookmarkSeek {0};
427 long long m_ffTime {0};
431 int m_videobufRetries {0};
432 uint64_t m_framesPlayed {0};
433 uint64_t m_totalFrames {0};
434 std::chrono::seconds m_totalLength {0s};
435 std::chrono::seconds m_totalDuration {0s};
436 long long m_rewindTime {0};
437 std::chrono::milliseconds m_latestVideoTimecode {-1ms};
443 double m_videoFrameRate {29.97};
446 QSize m_videoDispDim {0,0};
447 QSize m_videoDim {0,0};
448 int m_maxReferenceFrames {0};
449 float m_videoAspect {4.0F / 3.0F};
450 float m_forcedVideoAspect {-1};
456 bool m_buffering {
false};
463 int m_ttPageNum {0x888};
470 bool m_captionsEnabledbyDefault {
false};
471 bool m_enableForcedSubtitles {
false};
472 bool m_disableForcedSubtitles {
false};
473 bool m_allowForcedSubtitles {
true};
484 bool m_forcePositionMapSync {
false};
490 #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
491 QMutex m_decoderLock {QMutex::Recursive};
495 float m_nextPlaySpeed {1.0F};
496 float m_playSpeed {1.0F};
497 std::chrono::microseconds m_frameInterval
499 int m_fpsMultiplier {1};
501 bool m_ffrewUseRenderOne {
false};
502 int m_ffrewAdjust {0};
503 float m_ffrewScale {1.0F};
504 bool m_fileChanged {
false};
505 bool m_nextNormalSpeed {
true};
506 bool m_normalSpeed {
true};
510 std::chrono::milliseconds m_savedAudioTimecodeOffset {0ms};
513 bool m_isDummy {
false};
516 int m_bufferingCounter {0};
520 void syncWithAudioStretch();
521 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)
bool ForcedSubtitlesFavored(void) const
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