[Libav-user] Queuing of AVFrame
volich at ukr.net
volich at ukr.net
Fri Jul 25 02:58:38 CEST 2014
Thank you for reply.
frame.c:
int av_frame_ref(AVFrame *dst, const AVFrame *src)
{
...
/* duplicate the frame data if it's not refcounted */
if (!src->buf[0]) {
ret = av_frame_get_buffer(dst, 32);
if (ret < 0)
return ret;
ret = av_frame_copy(dst, src);
if (ret < 0)
av_frame_unref(dst);
return ret;
}
...
}
After avcodec_decode_video2 my frame is not refcounted, so call of av_frame_ref gives me copy of frame.
I just want to my frame is refcounted. How to make this?
--- Исходное сообщение ---
От кого: "wm4" <nfxjfg at googlemail.com>
Дата: 24 июля 2014, 22:21:16
> On Thu, 24 Jul 2014 09:23:46 +0300
> volich at ukr.net wrote:
>
> > Sorry for formating, it was first message.
> >
> > 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(
More information about the Libav-user
mailing list