Hello

I have a list like that

struct BuffVideo {
    AVCodecContext  *pCodecCtx;
    AVPicture       *picture;
    struct BuffVideo *next ;
};

I a procedure PushBuffVideo (  AVCodecContext  *pCodecCtx,AVFrame *pFrame )
called like

 avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, &packet);

if(frameFinished) {
     PushBuffVideo( pCodecCtx,pFrame );
}

Inside the PushBuffVideo  (  AVCodecContext  *pCodecCtx,AVFrame *pFrame )
when I want to copy the Picture to the buffer  I do :
        AVPicture pict_src;
        pict_src.data[0] = pFrame->data[0];
        pict_src.data[1] = pFrame->data[1];
        pict_src.data[2] = pFrame->data[2];
        pict_src.linesize[0] = pFrame->linesize[0];
        pict_src.linesize[1] = pFrame->linesize[1];
        pict_src.linesize[2] = pFrame->linesize[2];

if ( avpicture_alloc(buf->picture,  pCodecCtx->pix_fmt,pCodecCtx->width,
pCodecCtx->height) < 0  )
        av_picture_copy(buf->picture,
&pict_src,pCodecCtx->pix_fmt,pCodecCtx->width, pCodecCtx->height);

The next  avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, &packet);
seg fault

Any idea ?

Many thanks


Gilles M
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to