MCPcopy Create free account
hub / github.com/FFMS/ffms2 / Seek

Method Seek

src/core/videosource.cpp:701–728  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

699}
700
701int FFMS_VideoSource::Seek(int n) {
702 int ret = -1;
703
704 Delay.Reset();
705 if (Stage != DecodeStage::INITIALIZE_SOURCE)
706 Stage = DecodeStage::INITIALIZE;
707
708 if (!SeekByPos || Frames[n].FilePos < 0) {
709 ret = av_seek_frame(FormatContext, VideoTrack, Frames[n].PTS, AVSEEK_FLAG_BACKWARD);
710 }
711
712 if (ret < 0 && Frames[n].FilePos >= 0) {
713 ret = av_seek_frame(FormatContext, VideoTrack, Frames[n].FilePos, AVSEEK_FLAG_BYTE);
714 if (ret >= 0)
715 SeekByPos = true;
716 }
717
718 // We always assume seeking is possible if the first seek succeeds
719 avcodec_flush_buffers(CodecContext);
720 ResendPacket = false;
721 av_packet_unref(StashedPacket);
722
723 // When it's 0 we always know what the next frame is (or more exactly should be)
724 if (n == 0)
725 CurrentFrame = 0;
726
727 return ret;
728}
729
730void FFMS_VideoSource::Free() {
731 av_freep(&RPUBuffer);

Callers

nothing calls this directly

Calls 1

ResetMethod · 0.80

Tested by

no test coverage detected