1 /*****************************************************************************
2 * video.c: video decoder using ffmpeg library
3 *****************************************************************************
4 * Copyright (C) 1999-2001 VideoLAN
5 * $Id: video.c,v 1.21 2003/04/20 11:57:13 gbazin Exp $
7 * Authors: Laurent Aimar <fenrir@via.ecp.fr>
8 * Gildas Bazin <gbazin@netcourrier.com>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
23 *****************************************************************************/
25 /*****************************************************************************
27 *****************************************************************************/
28 #include <stdlib.h> /* malloc(), free() */
33 #include <vlc/decoder.h>
34 #include <vlc/input.h>
38 #ifdef HAVE_SYS_TIMES_H
39 # include <sys/times.h>
43 #ifdef HAVE_FFMPEG_AVCODEC_H
44 # include <ffmpeg/avcodec.h>
52 # ifdef HAVE_POSTPROC_POSTPROCESS_H
53 # include <postproc/postprocess.h>
55 # include <libpostproc/postprocess.h>
58 # include "postprocessing/postprocessing.h"
64 /*****************************************************************************
66 *****************************************************************************/
67 static void ffmpeg_CopyPicture( picture_t *, AVFrame *, vdec_thread_t * );
70 static void ffmpeg_PostProcPicture( vdec_thread_t *, picture_t * );
73 /* direct rendering */
74 static int ffmpeg_GetFrameBuf ( struct AVCodecContext *, AVFrame *);
75 static void ffmpeg_ReleaseFrameBuf ( struct AVCodecContext *, AVFrame *);
77 /*****************************************************************************
79 *****************************************************************************/
81 static inline uint32_t ffmpeg_PixFmtToChroma( int i_ff_chroma )
83 /* FIXME FIXME some of them are wrong */
88 return( VLC_FOURCC('I','4','2','0') );
90 return( VLC_FOURCC('R','V','2','4') );
93 return( VLC_FOURCC('I','4','2','2') );
95 return( VLC_FOURCC('I','4','4','4') );
105 static vout_thread_t *ffmpeg_CreateVout( vdec_thread_t *p_vdec,
106 AVCodecContext *p_context )
108 vout_thread_t *p_vout;
109 unsigned int i_width = p_context->width;
110 unsigned int i_height = p_context->height;
111 uint32_t i_chroma = ffmpeg_PixFmtToChroma( p_context->pix_fmt );
112 unsigned int i_aspect;
114 if( !i_width || !i_height )
116 return( NULL ); /* Can't create a new vout without display size */
121 /* we make conversion if possible*/
122 i_chroma = VLC_FOURCC('I','4','2','0');
125 i_aspect = VOUT_ASPECT_FACTOR * p_context->aspect_ratio;
128 i_aspect = VOUT_ASPECT_FACTOR * i_width / i_height;
131 /* Spawn a video output if there is none. First we look for our children,
132 * then we look for any other vout that might be available. */
133 p_vout = vout_Request( p_vdec->p_fifo, NULL,
134 i_width, i_height, i_chroma, i_aspect );
136 if( p_vdec->pp_mode && !p_vdec->pp_context )
138 int32_t i_cpu = p_vdec->p_fifo->p_libvlc->i_cpu;
141 if( i_cpu & CPU_CAPABILITY_MMX )
143 i_flags |= PP_CPU_CAPS_MMX;
145 if( i_cpu & CPU_CAPABILITY_MMXEXT )
147 i_flags |= PP_CPU_CAPS_MMX2;
149 if( i_cpu & CPU_CAPABILITY_3DNOW )
151 i_flags |= PP_CPU_CAPS_3DNOW;
154 switch( p_context->pix_fmt )
156 case PIX_FMT_YUV444P:
157 i_flags |= PP_FORMAT_444;
159 case PIX_FMT_YUV422P:
160 i_flags |= PP_FORMAT_422;
162 case PIX_FMT_YUV411P:
163 i_flags |= PP_FORMAT_411;
166 i_flags |= PP_FORMAT_420;
170 p_vdec->pp_context = pp_get_context( i_width, i_height, i_flags );
177 /*****************************************************************************
179 * Functions that initialize, decode and end the decoding process
181 * Functions exported for ffmpeg.c
182 * * E_( InitThread_Video )
183 * * E_( DecodeThread )
184 * * E_( EndThread_Video )
185 *****************************************************************************/
187 /*****************************************************************************
188 * InitThread: initialize vdec output thread
189 *****************************************************************************
190 * This function is called from decoder_Run and performs the second step
191 * of the initialization. It returns 0 on success. Note that the thread's
192 * flag are not modified inside this function.
194 * ffmpeg codec will be open, some memory allocated. But Vout is not yet
195 * open (done after the first decoded frame)
196 *****************************************************************************/
197 int E_( InitThread_Video )( vdec_thread_t *p_vdec )
200 p_vdec->p_ff_pic = avcodec_alloc_frame();
202 if( ( p_vdec->p_format = (BITMAPINFOHEADER *)p_vdec->p_fifo->p_bitmapinfoheader) != NULL )
204 /* ***** Fill p_context with init values ***** */
205 p_vdec->p_context->width = p_vdec->p_format->biWidth;
206 p_vdec->p_context->height = p_vdec->p_format->biHeight;
210 msg_Warn( p_vdec->p_fifo, "display informations missing" );
211 p_vdec->p_format = NULL;
215 /* ***** Get configuration of ffmpeg plugin ***** */
216 i_tmp = config_GetInt( p_vdec->p_fifo, "ffmpeg-workaround-bugs" );
217 p_vdec->p_context->workaround_bugs = __MAX( __MIN( i_tmp, 99 ), 0 );
219 i_tmp = config_GetInt( p_vdec->p_fifo, "ffmpeg-error-resilience" );
220 p_vdec->p_context->error_resilience = __MAX( __MIN( i_tmp, 99 ), -1 );
222 if( config_GetInt( p_vdec->p_fifo, "grayscale" ) )
224 p_vdec->p_context->flags|= CODEC_FLAG_GRAY;
227 p_vdec->b_hurry_up = config_GetInt(p_vdec->p_fifo, "ffmpeg-hurry-up");
229 p_vdec->b_direct_rendering = 0;
231 /* CODEC_FLAG_TRUNCATED */
233 /* FIXME search real LIBAVCODEC_BUILD */
234 #if LIBAVCODEC_BUILD >= 4662
235 if( p_vdec->p_codec->capabilities & CODEC_CAP_TRUNCATED )
237 p_vdec->p_context->flags |= CODEC_FLAG_TRUNCATED;
240 /* ***** Open the codec ***** */
241 if( avcodec_open(p_vdec->p_context, p_vdec->p_codec) < 0 )
243 msg_Err( p_vdec->p_fifo, "cannot open codec (%s)",
244 p_vdec->psz_namecodec );
245 return( VLC_EGENERIC );
249 msg_Dbg( p_vdec->p_fifo, "ffmpeg codec (%s) started",
250 p_vdec->psz_namecodec );
253 if( config_GetInt( p_vdec->p_fifo, "ffmpeg-dr" ) &&
254 p_vdec->p_codec->capabilities & CODEC_CAP_DR1 &&
255 ffmpeg_PixFmtToChroma( p_vdec->p_context->pix_fmt ) )
257 /* FIXME: some codecs set pix_fmt only after a frame
258 * has been decoded. */
260 msg_Dbg( p_vdec->p_fifo, "using direct rendering" );
261 p_vdec->b_direct_rendering = 1;
262 p_vdec->p_context->flags|= CODEC_FLAG_EMU_EDGE;
263 p_vdec->p_context->get_buffer = ffmpeg_GetFrameBuf;
264 p_vdec->p_context->release_buffer = ffmpeg_ReleaseFrameBuf;
265 p_vdec->p_context->opaque = p_vdec;
269 /* ***** init this codec with special data ***** */
270 if( p_vdec->p_format &&
271 p_vdec->p_format->biSize > sizeof(BITMAPINFOHEADER) )
274 int i_size = p_vdec->p_format->biSize - sizeof(BITMAPINFOHEADER);
276 if( p_vdec->i_codec_id == CODEC_ID_MPEG4 )
278 avcodec_decode_video( p_vdec->p_context, p_vdec->p_ff_pic,
280 (void *)&p_vdec->p_format[1],
285 p_vdec->p_context->extradata_size = i_size;
286 p_vdec->p_context->extradata = malloc( i_size );
287 memcpy( p_vdec->p_context->extradata,
288 &p_vdec->p_format[1],
293 /* ***** Load post processing ***** */
295 p_vdec->pp_context = NULL;
296 p_vdec->pp_mode = NULL;
298 /* for now we cannot do postproc and dr */
299 if( config_GetInt( p_vdec->p_fifo, "ffmpeg-pp-q" ) > 0 && !p_vdec->b_direct_rendering )
301 int i_quality = config_GetInt( p_vdec->p_fifo, "ffmpeg-pp-q" );
302 char *psz_name = config_GetPsz( p_vdec->p_fifo, "ffmpeg-pp-name" );
307 psz_name = strdup( "default" );
309 else if( *psz_name == '\0' )
312 psz_name = strdup( "default" );
316 p_vdec->pp_mode = pp_get_mode_by_name_and_quality( psz_name, i_quality );
318 if( !p_vdec->pp_mode )
320 msg_Err( p_vdec->p_fifo, "failed geting mode for postproc" );
324 msg_Info( p_vdec->p_fifo, "postproc activated" );
330 msg_Dbg( p_vdec->p_fifo, "no postproc" );
334 /* get overridding settings */
335 p_vdec->i_pp_mode = 0;
336 if( config_GetInt( p_vdec->p_fifo, "ffmpeg-db-yv" ) )
337 p_vdec->i_pp_mode |= PP_DEBLOCK_Y_V;
338 if( config_GetInt( p_vdec->p_fifo, "ffmpeg-db-yh" ) )
339 p_vdec->i_pp_mode |= PP_DEBLOCK_Y_H;
340 if( config_GetInt( p_vdec->p_fifo, "ffmpeg-db-cv" ) )
341 p_vdec->i_pp_mode |= PP_DEBLOCK_C_V;
342 if( config_GetInt( p_vdec->p_fifo, "ffmpeg-db-ch" ) )
343 p_vdec->i_pp_mode |= PP_DEBLOCK_C_H;
344 if( config_GetInt( p_vdec->p_fifo, "ffmpeg-dr-y" ) )
345 p_vdec->i_pp_mode |= PP_DERING_Y;
346 if( config_GetInt( p_vdec->p_fifo, "ffmpeg-dr-c" ) )
347 p_vdec->i_pp_mode |= PP_DERING_C;
349 if( ( config_GetInt( p_vdec->p_fifo, "ffmpeg-pp-q" ) > 0 )||
350 ( config_GetInt( p_vdec->p_fifo, "ffmpeg-pp-auto" ) )||
351 ( p_vdec->i_pp_mode != 0 ) )
353 /* check if the codec support postproc. */
354 switch( p_vdec->i_codec_id )
356 case( CODEC_ID_MSMPEG4V1 ):
357 case( CODEC_ID_MSMPEG4V2 ):
358 case( CODEC_ID_MSMPEG4V3 ):
359 case( CODEC_ID_MPEG4 ):
360 case( CODEC_ID_H263 ):
361 // case( CODEC_ID_H263P ): I don't use it up to now
362 case( CODEC_ID_H263I ):
363 /* Ok we can make postprocessing :)) */
364 /* first try to get a postprocess module */
365 p_vdec->p_pp = vlc_object_create( p_vdec->p_fifo,
366 sizeof( postprocessing_t ) );
367 p_vdec->p_pp->psz_object_name = "postprocessing";
368 p_vdec->p_pp->p_module =
369 module_Need( p_vdec->p_pp, "postprocessing", "$ffmpeg-pp" );
371 if( !p_vdec->p_pp->p_module )
373 msg_Warn( p_vdec->p_fifo,
374 "no suitable postprocessing module" );
375 vlc_object_destroy( p_vdec->p_pp );
377 p_vdec->i_pp_mode = 0;
381 /* get mode upon quality */
383 p_vdec->p_pp->pf_getmode(
384 config_GetInt( p_vdec->p_fifo, "ffmpeg-pp-q" ),
385 config_GetInt( p_vdec->p_fifo, "ffmpeg-pp-auto" )
390 p_vdec->i_pp_mode = 0;
391 msg_Warn( p_vdec->p_fifo,
392 "Post processing unsupported for this codec" );
398 return( VLC_SUCCESS );
401 /*****************************************************************************
402 * DecodeThread: Called to decode one frame
403 *****************************************************************************
404 * We have to get a frame stored in a pes, give it to ffmpeg decoder and send
405 * the image to the output.
406 *****************************************************************************/
407 void E_( DecodeThread_Video )( vdec_thread_t *p_vdec )
414 picture_t *p_pic; /* videolan picture */
418 /* TODO implement it in a better way */
419 /* A good idea could be to decode all I pictures and see for the other */
420 if( ( p_vdec->b_hurry_up )&& ( p_vdec->i_frame_late > 4 ) )
423 if( p_vdec->i_frame_late < 8 )
425 p_vdec->p_context->hurry_up = 2;
429 /* too much late picture, won't decode
430 but break picture until a new I, and for mpeg4 ...*/
431 p_vdec->i_frame_late--; /* needed else it will never be decrease */
432 input_ExtractPES( p_vdec->p_fifo, NULL );
439 p_vdec->p_context->hurry_up = 0;
442 if( !p_vdec->p_context->width || !p_vdec->p_context->height )
444 p_vdec->p_context->hurry_up = 5;
449 input_ExtractPES( p_vdec->p_fifo, &p_pes );
452 p_vdec->p_fifo->b_error = 1;
456 if( p_vdec->i_codec_id == CODEC_ID_MPEG1VIDEO )
460 p_vdec->pts = p_pes->i_dts;
461 p_vdec->i_frame_count = 0;
468 p_vdec->pts = p_pes->i_pts;
469 p_vdec->i_frame_count = 0;
475 p_vdec->pts = p_pes->i_pts;
476 p_vdec->i_frame_count = 0;
479 i_frame_size = p_pes->i_pes_size;
481 if( i_frame_size > 0 )
485 /* XXX Don't forget that ffmpeg required a little more bytes
486 * that the real frame size */
487 i_need = i_frame_size + 16 + p_vdec->i_buffer;
488 if( p_vdec->i_buffer_size < i_need)
490 p_last = p_vdec->p_buffer;
491 p_vdec->p_buffer = malloc( i_need );
492 p_vdec->i_buffer_size = i_need;
493 if( p_vdec->i_buffer > 0 )
495 memcpy( p_vdec->p_buffer, p_last, p_vdec->i_buffer );
500 E_( GetPESData )( p_vdec->p_buffer + p_vdec->i_buffer,
503 memset( p_vdec->p_buffer + p_vdec->i_buffer + i_frame_size,
507 input_DeletePES( p_vdec->p_fifo->p_packets_mgt, p_pes );
508 } while( i_frame_size <= 0 );
510 i_frame_size += p_vdec->i_buffer;
513 i_used = avcodec_decode_video( p_vdec->p_context,
520 msg_Dbg( p_vdec->p_fifo,
521 "used:%d framesize:%d (%s picture)",
522 i_used, i_frame_size, b_gotpicture ? "got":"no got" );
526 msg_Warn( p_vdec->p_fifo, "cannot decode one frame (%d bytes)",
528 p_vdec->i_frame_error++;
529 p_vdec->i_buffer = 0;
532 else if( i_used < i_frame_size )
534 memmove( p_vdec->p_buffer,
535 p_vdec->p_buffer + i_used,
536 p_vdec->i_buffer_size - i_used );
538 p_vdec->i_buffer = i_frame_size - i_used;
542 p_vdec->i_buffer = 0;
547 p_vdec->i_frame_count++;
551 i_frame_size -= i_used;
553 /* Update frame late count*/
554 if( p_vdec->pts <= mdate() )
556 p_vdec->i_frame_late++;
560 p_vdec->i_frame_late = 0;
563 if( !b_gotpicture || p_vdec->p_ff_pic->linesize[0] == 0 || !b_drawpicture )
568 if( !p_vdec->b_direct_rendering )
570 p_vdec->p_vout = ffmpeg_CreateVout( p_vdec, p_vdec->p_context );
571 if( !p_vdec->p_vout )
573 msg_Err( p_vdec->p_fifo, "cannot create vout" );
574 p_vdec->p_fifo->b_error = 1; /* abort */
578 /* Get a new picture */
579 while( !(p_pic = vout_CreatePicture( p_vdec->p_vout, 0, 0, 0 ) ) )
581 if( p_vdec->p_fifo->b_die || p_vdec->p_fifo->b_error )
585 msleep( VOUT_OUTMEM_SLEEP );
588 /* fill p_picture_t from AVVideoFrame and do chroma conversion
590 ffmpeg_CopyPicture( p_pic, p_vdec->p_ff_pic, p_vdec );
592 #ifndef LIBAVCODEC_PP
593 /* Do post-processing if requested (with old code)*/
595 if( ( p_vdec->i_pp_mode )&&
596 ( ( p_vdec->p_vout->render.i_chroma ==
597 VLC_FOURCC( 'I','4','2','0' ) )||
598 ( p_vdec->p_vout->render.i_chroma ==
599 VLC_FOURCC( 'Y','V','1','2' ) ) ) )
601 p_vdec->p_pp->pf_postprocess( p_pic,
602 p_vdec->p_ff_pic->qscale_table,
603 p_vdec->p_ff_pic->qstride,
611 p_pic = (picture_t *)p_vdec->p_ff_pic->opaque;
614 /* fix date calculation */
615 if( p_vdec->pts > 0 )
619 if( p_vdec->p_context->frame_rate > 0 )
621 #if LIBAVCODEC_BUILD >= 4662
622 i_pts += (uint64_t)1000000 *
623 ( p_vdec->i_frame_count - 1) /
624 DEFAULT_FRAME_RATE_BASE /
625 p_vdec->p_context->frame_rate;
627 i_pts += (uint64_t)1000000 *
628 ( p_vdec->i_frame_count - 1) /
630 p_vdec->p_context->frame_rate;
636 i_pts = mdate() + DEFAULT_PTS_DELAY; // FIXME
639 vout_DatePicture( p_vdec->p_vout,
643 /* Send decoded frame to vout */
644 vout_DisplayPicture( p_vdec->p_vout, p_pic );
646 if( i_frame_size > 0 )
648 goto usenextdata; /* try to use all data */
652 /*****************************************************************************
653 * EndThread: thread destruction
654 *****************************************************************************
655 * This function is called when the thread ends after a sucessful
657 *****************************************************************************/
658 void E_( EndThread_Video )( vdec_thread_t *p_vdec )
662 if( p_vdec->pp_mode )
664 pp_free_mode( p_vdec->pp_mode );
665 if( p_vdec->pp_context )
667 pp_free_context( p_vdec->pp_context );
673 /* release postprocessing module */
674 module_Unneed( p_vdec->p_pp, p_vdec->p_pp->p_module );
675 vlc_object_destroy( p_vdec->p_pp );
680 if( p_vdec->p_ff_pic )
682 free( p_vdec->p_ff_pic );
685 /* We are about to die. Reattach video output to p_vlc. */
686 vout_Request( p_vdec->p_fifo, p_vdec->p_vout, 0, 0, 0, 0 );
689 /*****************************************************************************
690 * ffmpeg_CopyPicture: copy a picture from ffmpeg internal buffers to a
691 * picture_t structure (when not in direct rendering mode).
692 *****************************************************************************/
693 static void ffmpeg_CopyPicture( picture_t *p_pic,
695 vdec_thread_t *p_vdec )
706 if( ffmpeg_PixFmtToChroma( p_vdec->p_context->pix_fmt ) )
709 if( p_vdec->pp_mode && p_vdec->pp_context )
711 uint8_t *src[3], *dst[3];
712 int i_src_stride[3], i_dst_stride[3];
714 for( i_plane = 0; i_plane < p_pic->i_planes; i_plane++ )
716 src[i_plane] = p_ff_pic->data[i_plane];
717 dst[i_plane] = p_pic->p[i_plane].p_pixels;
719 i_src_stride[i_plane] = p_ff_pic->linesize[i_plane];
720 i_dst_stride[i_plane] = p_pic->p[i_plane].i_pitch;
722 pp_postprocess( src, i_src_stride,
724 p_vdec->p_context->width, p_vdec->p_context->height,
725 p_ff_pic->qscale_table, p_ff_pic->qstride,
726 p_vdec->pp_mode, p_vdec->pp_context,
727 p_ff_pic->pict_type );
732 for( i_plane = 0; i_plane < p_pic->i_planes; i_plane++ )
734 p_src = p_ff_pic->data[i_plane];
735 p_dst = p_pic->p[i_plane].p_pixels;
736 i_src_stride = p_ff_pic->linesize[i_plane];
737 i_dst_stride = p_pic->p[i_plane].i_pitch;
739 i_size = __MIN( i_src_stride, i_dst_stride );
740 for( i_line = 0; i_line < p_pic->p[i_plane].i_lines; i_line++ )
742 p_vdec->p_fifo->p_vlc->pf_memcpy( p_dst, p_src, i_size );
743 p_src += i_src_stride;
744 p_dst += i_dst_stride;
753 /* we need to convert to I420 */
754 switch( p_vdec->p_context->pix_fmt )
759 case( PIX_FMT_YUV410P ):
760 case( PIX_FMT_YUV411P ):
761 for( i = 0; i < p_pic->i_planes; i++ )
763 dest_pic.data[i] = p_pic->p[i].p_pixels;
764 dest_pic.linesize[i] = p_pic->p[i].i_pitch;
766 img_convert( &dest_pic, PIX_FMT_YUV420P,
767 (AVPicture *)p_ff_pic,
768 p_vdec->p_context->pix_fmt,
769 p_vdec->p_context->width,
770 p_vdec->p_context->height );
773 msg_Err( p_vdec->p_fifo, "don't know how to convert chroma %i",
774 p_vdec->p_context->pix_fmt );
775 p_vdec->p_fifo->b_error = 1;
781 /*****************************************************************************
782 * ffmpeg_GetFrameBuf: callback used by ffmpeg to get a frame buffer.
783 * (used for direct rendering)
784 *****************************************************************************/
785 static int ffmpeg_GetFrameBuf( struct AVCodecContext *p_context,
788 vdec_thread_t *p_vdec = (vdec_thread_t *)p_context->opaque;
791 /* Check and (re)create if needed our vout */
792 p_vdec->p_vout = ffmpeg_CreateVout( p_vdec, p_vdec->p_context );
793 if( !p_vdec->p_vout )
795 msg_Err( p_vdec->p_fifo, "cannot create vout" );
796 p_vdec->p_fifo->b_error = 1; /* abort */
799 p_vdec->p_vout->render.b_allow_modify_pics = 0;
801 /* Get a new picture */
802 while( !(p_pic = vout_CreatePicture( p_vdec->p_vout, 0, 0, 0 ) ) )
804 if( p_vdec->p_fifo->b_die || p_vdec->p_fifo->b_error )
808 msleep( VOUT_OUTMEM_SLEEP );
810 p_vdec->p_context->draw_horiz_band= NULL;
812 p_ff_pic->opaque = (void*)p_pic;
813 p_ff_pic->type = FF_BUFFER_TYPE_USER;
814 p_ff_pic->data[0] = p_pic->p[0].p_pixels;
815 p_ff_pic->data[1] = p_pic->p[1].p_pixels;
816 p_ff_pic->data[2] = p_pic->p[2].p_pixels;
817 p_ff_pic->data[3] = NULL; /* alpha channel but I'm not sure */
819 p_ff_pic->linesize[0] = p_pic->p[0].i_pitch;
820 p_ff_pic->linesize[1] = p_pic->p[1].i_pitch;
821 p_ff_pic->linesize[2] = p_pic->p[2].i_pitch;
822 p_ff_pic->linesize[3] = 0;
824 if( p_ff_pic->reference != 0 )
826 vout_LinkPicture( p_vdec->p_vout, p_pic );
828 /* FIXME what is that, should give good value */
829 p_ff_pic->age = 256*256*256*64; // FIXME FIXME from ffmpeg
834 static void ffmpeg_ReleaseFrameBuf( struct AVCodecContext *p_context,
837 vdec_thread_t *p_vdec = (vdec_thread_t *)p_context->opaque;
840 //msg_Dbg( p_vdec->p_fifo, "ffmpeg_ReleaseFrameBuf" );
841 p_pic = (picture_t*)p_ff_pic->opaque;
843 p_ff_pic->data[0] = NULL;
844 p_ff_pic->data[1] = NULL;
845 p_ff_pic->data[2] = NULL;
846 p_ff_pic->data[3] = NULL;
848 vout_UnlinkPicture( p_vdec->p_vout, p_pic );