El día 6 de noviembre de 2009 08:36, Gustavo González
<[email protected]> escribió:

> Question: If I have an AVPicture instance and I need
> to create an AVFrame containing the image from
> the AVPicture variable, what I have to do? Is this possible?

Watching this code:

http://www.csps.com.ar/mms/plugins/output/mpeg/mpeg.cpp

I found this way:

static AVPicture pic;
...
// In some way, you already got var "pic" initialized

// Define your AVFrame
AVFrame *yuv_buf;

/* prepare an AVPicture out of our buffers */
yuv_buf = avcodec_alloc_frame();
/* the lower the better quality, but also larger images => slower to transfer */
yuv_buf->quality = 0;

/* copy the data from avpicture to avframe */
for (int i=0; i<4; ++i){
      yuv_buf->data[i]= pic.data[i];
      yuv_buf->linesize[i]= pic.linesize[i];
}

Now you got the content of AVPicture pic in AVFrame yuv_buf.
I haven't test this code, but I guess it should work!

-- 
============================
  Gustavo Gonzalez
  [email protected]
============================
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to