[Libav-user] Decoding/encoding api

Timur Guseynov s1.sam.1.93 at gmail.com
Thu Sep 15 16:51:22 EEST 2016


I'm a bit confused with decoding/encoding api. I've read this
<https://ffmpeg.org/doxygen/3.1/group__lavc__encdec.html> documentation and
it says "Receive output in a loop. Periodically call one of the
avcodec_receive_*()...".

avcodec_receive_frame() docs say "the function will always call
av_frame_unref(frame) before doing anything else." The same goes for
avcodec_receive_packet().

So, for example, I will write such code:

AVCodecContext *codecContext;
AVPacket *packet;
AVFrame *frame;
// allocating codec context, getting packet
.................................
//
avcodec_send_packet(codecContext, packet);
while(avcodec_receive_frame(codecContext, frame) == 0)
{
}

Will this code be functioning right?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20160915/70d25adc/attachment.html>


More information about the Libav-user mailing list