The input AVPacket. Usually, this will be a single video * frame, or several complete audio frames. * Ownership of the packet remains with the caller, and the * decoder will not write to the packet. The decoder may create * a reference to the packet data (or copy it if the packet is * not reference-counted). * Unlike with older APIs, the packet is always fully consumed, * and if it contains multiple frames (e.g. some audio codecs), * will require you to call avcodec_receive_frame() multiple * times afterwards before you can send a new packet. * It can be NULL (or an AVPacket with data set to NULL and * size set to 0); in this case, it is considered a flush * packet, which signals the end of the stream. Sending the * first flush packet will return success. Subsequent ones are * unnecessary and will return AVERROR_EOF. If the decoder * still has frames buffered, it will return them after sending * a flush packet.
时间: 2024-02-11 11:30:08 浏览: 160
C++队列缓存AVpacket.zip
这段描述是关于avcodec_send_packet函数中的AVPacket参数的解释。该参数通常包含一个视频帧或多个完整的音频帧,数据的所有权归调用者所有,解码器不会对数据进行写操作。解码器可能会创建一个对数据的引用(如果数据没有引用计数,则会复制数据)。与旧的API不同的是,该函数始终会完全消耗输入的AVPacket,如果该Packet包含多个帧(例如某些音频编解码器),则需要在调用该函数之后多次调用avcodec_receive_frame(),直到可以发送新的AVPacket。如果AVPacket为NULL,或者其中的数据为NULL且大小为0,则该函数被视为flush packet,用于表示数据流的结束。发送第一个flush packet将返回成功。后续的flush packet是不必要的,将会返回AVERROR_EOF。如果解码器仍然有缓冲的帧,则在发送flush packet之后将返回这些帧。
阅读全文