[][src]Function stainless_ffmpeg_sys::avcodec_decode_video2

pub unsafe extern "C" fn avcodec_decode_video2(
    avctx: *mut AVCodecContext,
    picture: *mut AVFrame,
    got_picture_ptr: *mut c_int,
    avpkt: *const AVPacket
) -> c_int

Decode the video frame of size avpkt->size from avpkt->data into picture. Some decoders may support multiple frames in a single AVPacket, such decoders would then just decode the first frame.

@warning The input buffer must be AV_INPUT_BUFFER_PADDING_SIZE larger than the actual read bytes because some optimized bitstream readers read 32 or 64 bits at once and could read over the end.

@warning The end of the input buffer buf should be set to 0 to ensure that no overreading happens for damaged MPEG streams.

@note Codecs which have the AV_CODEC_CAP_DELAY capability set have a delay between input and output, these need to be fed with avpkt->data=NULL, avpkt->size=0 at the end to return the remaining frames.

@note The AVCodecContext MUST have been opened with @ref avcodec_open2() before packets may be fed to the decoder.

@param avctx the codec context @param[out] picture The AVFrame in which the decoded video frame will be stored. Use av_frame_alloc() to get an AVFrame. The codec will allocate memory for the actual bitmap by calling the AVCodecContext.get_buffer2() callback. When AVCodecContext.refcounted_frames is set to 1, the frame is reference counted and the returned reference belongs to the caller. The caller must release the frame using av_frame_unref() when the frame is no longer needed. The caller may safely write to the frame if av_frame_is_writable() returns 1. When AVCodecContext.refcounted_frames is set to 0, the returned reference belongs to the decoder and is valid only until the next call to this function or until closing or flushing the decoder. The caller may not write to it.

@param[in] avpkt The input AVPacket containing the input buffer. You can create such packet with av_init_packet() and by then setting data and size, some decoders might in addition need other fields like flags&AV_PKT_FLAG_KEY. All decoders are designed to use the least fields possible. @param[in,out] got_picture_ptr Zero if no frame could be decompressed, otherwise, it is nonzero. @return On error a negative value is returned, otherwise the number of bytes used or zero if no frame could be decompressed.

@deprecated Use avcodec_send_packet() and avcodec_receive_frame().