StreamDecoder
One decoder driven explicitly by the caller.
The send/receive shape preserves FFmpeg's state machine: one packet can produce no frames or several frames, and the decoder may need its output queue drained before accepting more input.
A false send means the packet was not consumed: drain receive, then retry the same packet. Send null at input EOF, receive until isDrained, and call flush after every seek only after discarding packets and frames from the old position. Sending a closed packet is rejected at the call site rather than allowing a dangling payload to reach the decoder.
One decoder driven explicitly by the caller.
The send/receive shape preserves FFmpeg's state machine: one packet can produce no frames or several frames, and the decoder may need its output queue drained before accepting more input.
A false send means the packet was not consumed: drain receive, then retry the same packet. Send null at input EOF, receive until isDrained, and call flush after every seek only after discarding packets and frames from the old position. Sending a closed packet is rejected at the call site rather than allowing a dangling payload to reach the decoder.
One decoder, driven by the caller.
The send and receive shape mirrors libavcodec, including the cases a simpler interface cannot express: one packet producing no frames, one packet producing several, and a decoder that must be drained before it accepts more input.
Three rules that are easy to get wrong and expensive to debug:
Drain with receive until it returns null before assuming send will accept anything.
When send returns false the packet was not consumed. Drain, then offer the same packet again. Discarding it loses frames silently.
flush after every seek, and only after the caller has cleared its own queues. Flushing first lets a packet from the old position reach a freshly reset decoder.
One decoder driven explicitly by the caller.
The send/receive shape preserves FFmpeg's state machine: one packet can produce no frames or several frames, and the decoder may need its output queue drained before accepting more input.
A false send means the packet was not consumed: drain receive, then retry the same packet. Send null at input EOF, receive until isDrained, and call flush after every seek only after discarding packets and frames from the old position. Sending a closed packet is rejected at the call site rather than allowing a dangling payload to reach the decoder.
One decoder driven explicitly by the caller.
The send/receive shape preserves FFmpeg's state machine: one packet can produce no frames or several frames, and the decoder may need its output queue drained before accepting more input.
A false send means the packet was not consumed: drain receive, then retry the same packet. Send null at input EOF, receive until isDrained, and call flush after every seek only after discarding packets and frames from the old position. Sending a closed packet is rejected at the call site rather than allowing a dangling payload to reach the decoder.
Properties
Packets and frames this decoder skipped as damaged since it was opened, or since flush.
Packets and frames this decoder skipped as damaged since it was opened, or since flush.
Packets and frames this decoder skipped as damaged since it was opened, or since flush.
Packets and frames this decoder skipped as damaged since it was opened, or since flush.
Packets and frames this decoder skipped as damaged since it was opened, or since flush.
True once this decoder has emitted its last frame and will emit no more without a flush.
Functions
Discards buffered decode state and makes the decoder accept a new seek generation. Call this after clearing old caller-owned queues; doing it first would let an old packet enter a freshly reset decoder. Clears isDrained.
Discards buffered decode state and makes the decoder accept a new seek generation. Call this after clearing old caller-owned queues; doing it first would let an old packet enter a freshly reset decoder. Clears isDrained.
Discards the decoder's internal state.
Discards buffered decode state and makes the decoder accept a new seek generation. Call this after clearing old caller-owned queues; doing it first would let an old packet enter a freshly reset decoder. Clears isDrained.
Returns one owned frame, or null when more input is needed or the decoder is drained. Inspect isDrained to distinguish those two null cases. The frame is an O(1) owned clone and may be queued independently of later decoder calls.
Returns one owned frame, or null when more input is needed or the decoder is drained. Inspect isDrained to distinguish those two null cases. The frame is an O(1) owned clone and may be queued independently of later decoder calls.
Returns one owned frame, or null when more input is needed or the decoder is drained. Inspect isDrained to distinguish those two null cases. The frame is an O(1) owned clone and may be queued independently of later decoder calls.