[Libav-user] Queuing of AVFrame
volich at ukr.net
volich at ukr.net
Thu Jul 24 08:01:10 CEST 2014
Hi I want to realise AVFrames handling with queue. My code is
int decode( AVCodecContext * codec_ctx, AVPacket *packet ) { AVFrame * frame = av_frame_alloc (); if (!frame) return -1;
int got_frame; int ret = avcodec_decode_video2(codec_ctx, frame, &got_frame, packet); if (ret >= 0 && got_frame ) {
/* Allocate buffer references */ for ( int i = 0 ; i < 3 ; i++) { uint8_t *data = frame->data[i]; int size = frame->linesize[i] * frame->height; frame->buf[i] = av_buffer_create(data, size, av_buffer_default_free, NULL , 0 ); } enqueue(frame); return 0 ; }
av_frame_free(&frame); return -1 ; }
void someFunc() { AVFrame * frame = dequeue ();
.... if (frame) av_frame_free(&frame); }
Is it right?
Regards, Yuriy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20140724/bba977db/attachment.html>
More information about the Libav-user
mailing list