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

Method DecodePacket

src/core/videosource.cpp:672–699  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

670}
671
672bool FFMS_VideoSource::DecodePacket(AVPacket *Packet) {
673 std::swap(DecodeFrame, LastDecodedFrame);
674 ResendPacket = false;
675
676 int PacketNum = Frames.FrameFromPTS(Frames.UseDTS ? Packet->dts : Packet->pts, true);
677 bool PacketHidden = !!(Packet->flags & AV_PKT_FLAG_DISCARD) || (PacketNum != -1 && Frames[PacketNum].MarkedHidden);
678 bool SecondField = PacketNum != -1 && Frames[PacketNum].SecondField;
679
680 int Ret = avcodec_send_packet(CodecContext, Packet);
681 if (Ret == AVERROR(EAGAIN)) {
682 // Send queue is full, so stash packet to resend on the next call.
683 ResendPacket = true;
684 } else if (Ret == 0) {
685 Delay.Increment(PacketHidden, SecondField);
686 }
687
688 Ret = avcodec_receive_frame(CodecContext, DecodeFrame);
689 if (Ret == 0) {
690 Delay.Decrement();
691 } else {
692 std::swap(DecodeFrame, LastDecodedFrame);
693 }
694
695 if (Ret == 0 && Stage == DecodeStage::INITIALIZE)
696 Stage = DecodeStage::APPLY_DELAY;
697
698 return Ret == 0;
699}
700
701int FFMS_VideoSource::Seek(int n) {
702 int ret = -1;

Callers

nothing calls this directly

Calls 3

FrameFromPTSMethod · 0.80
IncrementMethod · 0.80
DecrementMethod · 0.80

Tested by

no test coverage detected