Go to the documentation of this file.
17 #define LOC QString("CommFlagPlayer: ")
24 QMutexLocker locker(&
s_lock);
32 QMutexLocker locker(&
s_lock);
40 QMutexLocker locker(&
s_lock);
46 QMutexLocker locker(&
s_lock);
62 uint64_t myFramesPlayed = 0;
63 uint64_t pmap_first = 0;
64 uint64_t pmap_last = 0;
87 LOG(VB_GENERAL, LOG_ERR,
"RebuildSeekTable unable to initialize video");
94 std::chrono::milliseconds save_timeout { 1s + 1ms };
107 std::cout <<
"\r \r" << std::flush;
110 bool usingIframes =
false;
113 if (inuse_timer.
elapsed() > 2534ms)
122 if (save_timer.
elapsed() > save_timeout)
125 if (myFramesPlayed - pmap_last > 5000)
126 std::this_thread::sleep_for(200ms);
131 pmap_last = myFramesPlayed;
135 pmap_first = pmap_last + 1;
147 float elapsed = flagTime.
elapsed().count() * 0.001F;
148 auto flagFPS = (elapsed > 0.0F) ?
static_cast<int>(myFramesPlayed / elapsed) : 0;
149 auto percentage =
static_cast<int>(myFramesPlayed * 100 /
m_totalFrames);
151 (*Callback)(percentage, Opaque);
155 QString str = QString(
"\r%1%/%2fps \r").arg(percentage,3).arg(flagFPS,5);
156 std::cout << qPrintable(str) << std::flush;
158 else if (percentage % 10 == 0 && prevperc != percentage)
160 prevperc = percentage;
161 LOG(VB_COMMFLAG, LOG_INFO, QString(
"Progress %1% @ %2fps").arg(percentage,3).arg(flagFPS,5));
168 QString str = QString(
"\r%1 \r").arg(myFramesPlayed,6);
169 std::cout << qPrintable(str) << std::flush;
171 else if (myFramesPlayed % 1000 == 0)
173 LOG(VB_COMMFLAG, LOG_INFO, QString(
"Frames processed %1").arg(myFramesPlayed));
194 std::cout <<
"No I-frames found, rewinding..." << std::endl;
197 pmap_first = pmap_last = myFramesPlayed = 0;
204 std::cout <<
"\r \r" << std::flush;
236 if (FrameNumber >= 0)
246 std::this_thread::sleep_for(10ms);
247 if ((tries & 10) == 10)
248 LOG(VB_PLAYBACK, LOG_INFO,
LOC +
"Waited 100ms for video frame");
static QHash< DecoderBase *, uint > s_count
void(*)(int, void *) StatusCallback
std::chrono::milliseconds elapsed(void)
Returns milliseconds elapsed since last start() or restart()
void TrackTotalDuration(bool track)
void UnlockPlayingInfo(const char *file, int line) const
MythDecoderThread * m_decoderThread
static void Wait(DecoderBase *Decoder)
A QElapsedTimer based timer to replace use of QTime as a timer.
virtual int OpenFile(int Retries=4)
uint64_t SavePositionMapDelta(long long first_frame, long long last_frame)
void SaveTotalFrames(void)
void start(void)
starts measuring elapsed time.
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
void UpdateInUseMark(bool force=false)
EofState GetEof(void) const
static const double kInaccuracyNone
MythCommFlagPlayer(PlayerContext *Context, PlayerFlags Flags=kNoFlags)
bool RebuildSeekTable(bool ShowPercentage=true, StatusCallback Callback=nullptr, void *Opaque=nullptr)
virtual int ValidVideoFrames() const
Returns number of frames that are fully decoded.
ProgramInfo * m_playingInfo
Currently playing info.
bool DecoderGetFrame(DecodeType decodetype, bool unsafe=false)
void LockPlayingInfo(const char *file, int line) const
MythVideoOutput * m_videoOutput
virtual bool InitVideo(void)
std::chrono::milliseconds restart(void)
Returns milliseconds elapsed since last start() or restart() and resets the count.
void ClearAfterSeek(bool clearvideobuffers=true)
This is to support seeking...
PlayerContext * m_playerCtx
static QWaitCondition s_wait
void DoJumpToFrame(uint64_t frame, double inaccuracy)
virtual void StartDisplayingFrame()
Tell GetLastShownFrame() to return the next frame from the head of the queue of frames to display.
void ClearPositionMap(MarkTypes type) const
void SetPlaying(bool is_playing)
MythRebuildSaver(DecoderBase *Decoder, uint64_t First, uint64_t Last)
void SaveTotalDuration(void)
virtual void Reset(bool reset_video_data, bool seek_reset, bool reset_file)
virtual MythVideoFrame * GetLastShownFrame()
Returns frame from the head of the ready to be displayed queue, if StartDisplayingFrame has been call...
static MThreadPool * globalInstance(void)
long long GetFramesRead(void) const
virtual bool DoRewind(long long desiredFrame, bool discardFrames=true)
bool HasPositionMap(void) const
void start(QRunnable *runnable, const QString &debugName, int priority=0)
MythVideoFrame * GetRawVideoFrame(long long FrameNumber=-1)
Returns a specific frame from the video.
virtual void SetIdrOnlyKeyframes(bool)
bool volatile m_killDecoder
virtual void DecoderStart(bool start_paused)
static uint GetCount(DecoderBase *Decoder)
struct exc__state * m_last