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 
_______________________________________________
Libav-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/libav-user

Reply via email to