| 670 | } |
| 671 | |
| 672 | bool 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 | |
| 701 | int FFMS_VideoSource::Seek(int n) { |
| 702 | int ret = -1; |
nothing calls this directly
no test coverage detected