1 /*****************************************************************************
2 * video.c: video decoder using ffmpeg library
3 *****************************************************************************
4 * Copyright (C) 1999-2001 VideoLAN
5 * $Id: video.c,v 1.36 2003/07/26 15:34:43 fenrir 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 * );
69 /* direct rendering */
70 static int ffmpeg_GetFrameBuf ( struct AVCodecContext *, AVFrame *);
71 static void ffmpeg_ReleaseFrameBuf ( struct AVCodecContext *, AVFrame *);
73 /*****************************************************************************
75 *****************************************************************************/
77 static inline uint32_t ffmpeg_PixFmtToChroma( int i_ff_chroma )
79 /* FIXME FIXME some of them are wrong */
84 return( VLC_FOURCC('I','4','2','0') );
86 return( VLC_FOURCC('R','V','2','4') );
89 return( VLC_FOURCC('I','4','2','2') );
91 return( VLC_FOURCC('I','4','4','4') );
101 static vout_thread_t *ffmpeg_CreateVout( vdec_thread_t *p_vdec,
102 AVCodecContext *p_context )
104 vout_thread_t *p_vout;
105 unsigned int i_width = p_context->width;
106 unsigned int i_height = p_context->height;
107 uint32_t i_chroma = ffmpeg_PixFmtToChroma( p_context->pix_fmt );
108 unsigned int i_aspect;
110 if( !i_width || !i_height )
112 return( NULL ); /* Can't create a new vout without display size */
117 /* we make conversion if possible*/
118 i_chroma = VLC_FOURCC('I','4','2','0');
121 i_aspect = VOUT_ASPECT_FACTOR * p_context->aspect_ratio;
124 i_aspect = VOUT_ASPECT_FACTOR * i_width / i_height;
127 /* Spawn a video output if there is none. First we look for our children,
128 * then we look for any other vout that might be available. */
129 p_vout = vout_Request( p_vdec->p_fifo, p_vdec->p_vout,
130 i_width, i_height, i_chroma, i_aspect );
132 if( p_vdec->pp_mode && !p_vdec->pp_context )
134 int32_t i_cpu = p_vdec->p_fifo->p_libvlc->i_cpu;
137 if( i_cpu & CPU_CAPABILITY_MMX )
139 i_flags |= PP_CPU_CAPS_MMX;
141 if( i_cpu & CPU_CAPABILITY_MMXEXT )
143 i_flags |= PP_CPU_CAPS_MMX2;
145 if( i_cpu & CPU_CAPABILITY_3DNOW )
147 i_flags |= PP_CPU_CAPS_3DNOW;
150 switch( p_context->pix_fmt )
152 case PIX_FMT_YUV444P:
153 i_flags |= PP_FORMAT_444;
155 case PIX_FMT_YUV422P:
156 i_flags |= PP_FORMAT_422;
158 case PIX_FMT_YUV411P:
159 i_flags |= PP_FORMAT_411;
162 i_flags |= PP_FORMAT_420;
166 p_vdec->pp_context = pp_get_context( i_width, i_height, i_flags );
173 /*****************************************************************************
175 * Functions that initialize, decode and end the decoding process
177 * Functions exported for ffmpeg.c
178 * * E_( InitThread_Video )
179 * * E_( DecodeThread )
180 * * E_( EndThread_Video )
181 *****************************************************************************/
183 /*****************************************************************************
184 * InitThread: initialize vdec output thread
185 *****************************************************************************
186 * This function is called from decoder_Run and performs the second step
187 * of the initialization. It returns 0 on success. Note that the thread's
188 * flag are not modified inside this function.
190 * ffmpeg codec will be open, some memory allocated. But Vout is not yet
191 * open (done after the first decoded frame)
192 *****************************************************************************/
193 static inline void SetDWBE( void *data, uint32_t dw )
197 p[0] = (dw >> 24 )&0xff;
198 p[1] = (dw >> 16 )&0xff;
199 p[2] = (dw >> 8 )&0xff;
203 int E_( InitThread_Video )( vdec_thread_t *p_vdec )
208 p_vdec->p_ff_pic = avcodec_alloc_frame();
210 if( ( p_vdec->p_format =
211 (BITMAPINFOHEADER *)p_vdec->p_fifo->p_bitmapinfoheader) != NULL )
213 /* ***** Fill p_context with init values ***** */
214 p_vdec->p_context->width = p_vdec->p_format->biWidth;
215 p_vdec->p_context->height = p_vdec->p_format->biHeight;
219 msg_Warn( p_vdec->p_fifo, "display informations missing" );
220 p_vdec->p_format = NULL;
223 /* ***** Get configuration of ffmpeg plugin ***** */
224 i_tmp = config_GetInt( p_vdec->p_fifo, "ffmpeg-workaround-bugs" );
225 p_vdec->p_context->workaround_bugs = __MAX( __MIN( i_tmp, 99 ), 0 );
227 i_tmp = config_GetInt( p_vdec->p_fifo, "ffmpeg-error-resilience" );
228 p_vdec->p_context->error_resilience = __MAX( __MIN( i_tmp, 99 ), -1 );
230 if( config_GetInt( p_vdec->p_fifo, "grayscale" ) )
232 p_vdec->p_context->flags|= CODEC_FLAG_GRAY;
235 p_vdec->b_hurry_up = config_GetInt(p_vdec->p_fifo, "ffmpeg-hurry-up");
237 /* CODEC_FLAG_TRUNCATED */
239 /* FIXME search real LIBAVCODEC_BUILD */
240 #if LIBAVCODEC_BUILD >= 4662
241 i_truncated = config_GetInt( p_vdec->p_fifo, "ffmpeg-truncated" );
242 if( i_truncated == 1 )
245 ( i_truncated == -1 && ( p_vdec->p_context->width == 0 || p_vdec->p_context->height == 0 ) ) )
248 p_vdec->p_context->flags |= CODEC_FLAG_TRUNCATED;
252 /* ***** Open the codec ***** */
253 if( avcodec_open(p_vdec->p_context, p_vdec->p_codec) < 0 )
255 msg_Err( p_vdec->p_fifo, "cannot open codec (%s)",
256 p_vdec->psz_namecodec );
257 return( VLC_EGENERIC );
261 msg_Dbg( p_vdec->p_fifo, "ffmpeg codec (%s) started",
262 p_vdec->psz_namecodec );
265 p_vdec->b_direct_rendering = 0;
266 if( config_GetInt( p_vdec->p_fifo, "ffmpeg-dr" ) &&
267 p_vdec->p_codec->capabilities & CODEC_CAP_DR1 &&
268 ffmpeg_PixFmtToChroma( p_vdec->p_context->pix_fmt ) &&
269 /* Apparently direct rendering doesn't work with YUV422P */
270 p_vdec->p_context->pix_fmt != PIX_FMT_YUV422P &&
271 !(p_vdec->p_context->width % 16) && !(p_vdec->p_context->height % 16) )
273 /* Some codecs set pix_fmt only after the 1st frame has been decoded,
274 * so we need to do another check in ffmpeg_GetFrameBuf() */
275 p_vdec->b_direct_rendering = 1;
278 /* ***** Load post processing ***** */
280 p_vdec->pp_context = NULL;
281 p_vdec->pp_mode = NULL;
283 if( config_GetInt( p_vdec->p_fifo, "ffmpeg-pp-q" ) > 0 )
285 int i_quality = config_GetInt( p_vdec->p_fifo, "ffmpeg-pp-q" );
286 char *psz_name = config_GetPsz( p_vdec->p_fifo, "ffmpeg-pp-name" );
290 psz_name = strdup( "default" );
292 else if( *psz_name == '\0' )
295 psz_name = strdup( "default" );
299 pp_get_mode_by_name_and_quality( psz_name, i_quality );
301 if( !p_vdec->pp_mode )
303 msg_Err( p_vdec->p_fifo, "failed geting mode for postproc" );
307 msg_Info( p_vdec->p_fifo, "postproc activated" );
311 /* for now we cannot do postproc and dr */
312 p_vdec->b_direct_rendering = 0;
316 msg_Dbg( p_vdec->p_fifo, "no postproc" );
320 /* ffmpeg doesn't properly release old pictures when frames are skipped */
321 if( p_vdec->b_hurry_up ) p_vdec->b_direct_rendering = 0;
323 if( p_vdec->b_direct_rendering )
325 msg_Dbg( p_vdec->p_fifo, "using direct rendering" );
326 p_vdec->p_context->flags|= CODEC_FLAG_EMU_EDGE;
327 p_vdec->p_context->get_buffer = ffmpeg_GetFrameBuf;
328 p_vdec->p_context->release_buffer = ffmpeg_ReleaseFrameBuf;
329 p_vdec->p_context->opaque = p_vdec;
333 /* ***** init this codec with special data ***** */
334 if( p_vdec->p_format &&
335 p_vdec->p_format->biSize > sizeof(BITMAPINFOHEADER) )
338 int i_size = p_vdec->p_format->biSize - sizeof(BITMAPINFOHEADER);
340 if( p_vdec->i_codec_id == CODEC_ID_MPEG4 )
342 uint8_t *p_vol = malloc( i_size + FF_INPUT_BUFFER_PADDING_SIZE );
344 memcpy( p_vol, &p_vdec->p_format[1], i_size );
345 memset( &p_vol[i_size], 0, FF_INPUT_BUFFER_PADDING_SIZE );
347 avcodec_decode_video( p_vdec->p_context, p_vdec->p_ff_pic,
353 #if LIBAVCODEC_BUILD >= 4666
354 else if( p_vdec->i_codec_id == CODEC_ID_SVQ3 )
358 p_vdec->p_context->extradata_size = i_size + 12;
359 p = p_vdec->p_context->extradata =
360 malloc( p_vdec->p_context->extradata_size );
362 memcpy( &p[0], "SVQ3", 4 );
363 memset( &p[4], 0, 8 );
364 memcpy( &p[12], &p_vdec->p_format[1], i_size );
369 p_vdec->p_context->extradata_size = i_size;
370 p_vdec->p_context->extradata = malloc( i_size + FF_INPUT_BUFFER_PADDING_SIZE );
371 memcpy( p_vdec->p_context->extradata,
372 &p_vdec->p_format[1],
374 memset( &((uint8_t*)p_vdec->p_context->extradata)[i_size], 0, FF_INPUT_BUFFER_PADDING_SIZE );
377 p_vdec->p_vout = NULL;
379 return( VLC_SUCCESS );
382 /*****************************************************************************
383 * DecodeThread: Called to decode one frame
384 *****************************************************************************
385 * We have to get a frame stored in a pes, give it to ffmpeg decoder and send
386 * the image to the output.
387 *****************************************************************************/
388 void E_( DecodeThread_Video )( vdec_thread_t *p_vdec )
395 picture_t *p_pic; /* videolan picture */
399 /* TODO implement it in a better way */
400 /* A good idea could be to decode all I pictures and see for the other */
401 if( ( p_vdec->b_hurry_up )&& ( p_vdec->i_frame_late > 4 ) )
404 if( p_vdec->i_frame_late < 8 )
406 p_vdec->p_context->hurry_up = 2;
410 /* too much late picture, won't decode
411 but break picture until a new I, and for mpeg4 ...*/
412 p_vdec->i_frame_late--; /* needed else it will never be decrease */
413 input_ExtractPES( p_vdec->p_fifo, NULL );
420 p_vdec->p_context->hurry_up = 0;
423 if( p_vdec->i_frame_late > 0 &&
424 mdate() - p_vdec->i_frame_late_start > (mtime_t)5000000 )
426 msg_Err( p_vdec->p_fifo, "more than 5 seconds of late video -> "
427 "dropping (to slow computer ?)" );
430 input_ExtractPES( p_vdec->p_fifo, &p_pes );
433 p_vdec->p_fifo->b_error = 1;
436 i_pts = p_pes->i_pts;
437 input_DeletePES( p_vdec->p_fifo->p_packets_mgt, p_pes );
439 } while( i_pts <= 0 || i_pts < mdate() );
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 + FF_INPUT_BUFFER_PADDING_SIZE + 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, 0, FF_INPUT_BUFFER_PADDING_SIZE );
505 input_DeletePES( p_vdec->p_fifo->p_packets_mgt, p_pes );
506 } while( i_frame_size <= 0 );
508 i_frame_size += p_vdec->i_buffer;
511 i_used = avcodec_decode_video( p_vdec->p_context,
517 if( p_vdec->p_fifo->b_die || p_vdec->p_fifo->b_error ) return;
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++;
557 if( p_vdec->i_frame_late == 1 )
559 p_vdec->i_frame_late_start = mdate();
564 p_vdec->i_frame_late = 0;
567 if( !b_gotpicture || p_vdec->p_ff_pic->linesize[0] == 0 || !b_drawpicture )
572 if( !p_vdec->b_direct_rendering )
574 p_vdec->p_vout = ffmpeg_CreateVout( p_vdec, p_vdec->p_context );
575 if( !p_vdec->p_vout )
577 msg_Err( p_vdec->p_fifo, "cannot create vout" );
578 p_vdec->p_fifo->b_error = 1; /* abort */
582 /* Get a new picture */
583 while( !(p_pic = vout_CreatePicture( p_vdec->p_vout, 0, 0, 0 ) ) )
585 if( p_vdec->p_fifo->b_die || p_vdec->p_fifo->b_error )
589 msleep( VOUT_OUTMEM_SLEEP );
592 /* fill p_picture_t from AVVideoFrame and do chroma conversion
594 ffmpeg_CopyPicture( p_pic, p_vdec->p_ff_pic, p_vdec );
599 p_pic = (picture_t *)p_vdec->p_ff_pic->opaque;
602 /* fix date calculation */
603 if( p_vdec->pts > 0 )
607 if( p_vdec->p_context->frame_rate > 0 )
609 i_pts += (uint64_t)1000000 *
610 ( p_vdec->i_frame_count - 1) /
611 #if LIBAVCODEC_BUILD >= 4662
612 DEFAULT_FRAME_RATE_BASE /
616 p_vdec->p_context->frame_rate;
621 i_pts = mdate() + DEFAULT_PTS_DELAY; // FIXME
624 vout_DatePicture( p_vdec->p_vout,
628 /* Send decoded frame to vout */
629 vout_DisplayPicture( p_vdec->p_vout, p_pic );
631 if( i_frame_size > 0 )
633 goto usenextdata; /* try to use all data */
637 /*****************************************************************************
638 * EndThread: thread destruction
639 *****************************************************************************
640 * This function is called when the thread ends after a sucessful
642 *****************************************************************************/
643 void E_( EndThread_Video )( vdec_thread_t *p_vdec )
647 if( p_vdec->pp_mode )
649 pp_free_mode( p_vdec->pp_mode );
650 if( p_vdec->pp_context )
652 pp_free_context( p_vdec->pp_context );
657 if( p_vdec->p_ff_pic )
659 free( p_vdec->p_ff_pic );
662 /* We are about to die. Reattach video output to p_vlc. */
663 vout_Request( p_vdec->p_fifo, p_vdec->p_vout, 0, 0, 0, 0 );
666 /*****************************************************************************
667 * ffmpeg_CopyPicture: copy a picture from ffmpeg internal buffers to a
668 * picture_t structure (when not in direct rendering mode).
669 *****************************************************************************/
670 static void ffmpeg_CopyPicture( picture_t *p_pic,
672 vdec_thread_t *p_vdec )
683 if( ffmpeg_PixFmtToChroma( p_vdec->p_context->pix_fmt ) )
686 if( p_vdec->pp_mode && p_vdec->pp_context )
688 uint8_t *src[3], *dst[3];
689 int i_src_stride[3], i_dst_stride[3];
691 for( i_plane = 0; i_plane < p_pic->i_planes; i_plane++ )
693 src[i_plane] = p_ff_pic->data[i_plane];
694 dst[i_plane] = p_pic->p[i_plane].p_pixels;
696 i_src_stride[i_plane] = p_ff_pic->linesize[i_plane];
697 i_dst_stride[i_plane] = p_pic->p[i_plane].i_pitch;
699 pp_postprocess( src, i_src_stride,
701 p_vdec->p_context->width,
702 p_vdec->p_context->height,
703 p_ff_pic->qscale_table, p_ff_pic->qstride,
704 p_vdec->pp_mode, p_vdec->pp_context,
705 p_ff_pic->pict_type );
710 for( i_plane = 0; i_plane < p_pic->i_planes; i_plane++ )
712 p_src = p_ff_pic->data[i_plane];
713 p_dst = p_pic->p[i_plane].p_pixels;
714 i_src_stride = p_ff_pic->linesize[i_plane];
715 i_dst_stride = p_pic->p[i_plane].i_pitch;
717 i_size = __MIN( i_src_stride, i_dst_stride );
718 for( i_line = 0; i_line < p_pic->p[i_plane].i_lines; i_line++ )
720 p_vdec->p_fifo->p_vlc->pf_memcpy( p_dst, p_src, i_size );
721 p_src += i_src_stride;
722 p_dst += i_dst_stride;
731 /* we need to convert to I420 */
732 switch( p_vdec->p_context->pix_fmt )
737 case( PIX_FMT_YUV410P ):
738 case( PIX_FMT_YUV411P ):
739 for( i = 0; i < p_pic->i_planes; i++ )
741 dest_pic.data[i] = p_pic->p[i].p_pixels;
742 dest_pic.linesize[i] = p_pic->p[i].i_pitch;
744 img_convert( &dest_pic, PIX_FMT_YUV420P,
745 (AVPicture *)p_ff_pic,
746 p_vdec->p_context->pix_fmt,
747 p_vdec->p_context->width,
748 p_vdec->p_context->height );
751 msg_Err( p_vdec->p_fifo, "don't know how to convert chroma %i",
752 p_vdec->p_context->pix_fmt );
753 p_vdec->p_fifo->b_error = 1;
759 /*****************************************************************************
760 * ffmpeg_GetFrameBuf: callback used by ffmpeg to get a frame buffer.
761 * (used for direct rendering)
762 *****************************************************************************/
763 static int ffmpeg_GetFrameBuf( struct AVCodecContext *p_context,
766 vdec_thread_t *p_vdec = (vdec_thread_t *)p_context->opaque;
769 /* Some codecs set pix_fmt only after the 1st frame has been decoded,
770 * so this check is necessary. */
771 if( !ffmpeg_PixFmtToChroma( p_context->pix_fmt ) ||
772 !(p_vdec->p_context->width % 16) || !(p_vdec->p_context->height % 16) )
774 p_context->get_buffer = avcodec_default_get_buffer;
775 p_context->release_buffer = avcodec_default_release_buffer;
776 p_vdec->b_direct_rendering = 0;
777 msg_Dbg( p_vdec->p_fifo, "disabling direct rendering" );
778 return p_context->get_buffer( p_context, p_ff_pic );
781 /* Check and (re)create our vout if needed */
782 p_vdec->p_vout = ffmpeg_CreateVout( p_vdec, p_vdec->p_context );
783 if( !p_vdec->p_vout )
785 msg_Err( p_vdec->p_fifo, "cannot create vout" );
786 p_vdec->p_fifo->b_error = 1; /* abort */
787 p_context->get_buffer= avcodec_default_get_buffer;
788 return p_context->get_buffer( p_context, p_ff_pic );
790 p_vdec->p_vout->render.b_allow_modify_pics = 0;
792 /* Get a new picture */
793 while( !(p_pic = vout_CreatePicture( p_vdec->p_vout, 0, 0, 0 ) ) )
795 if( p_vdec->p_fifo->b_die || p_vdec->p_fifo->b_error )
797 p_context->get_buffer= avcodec_default_get_buffer;
798 return p_context->get_buffer( p_context, p_ff_pic );
800 msleep( VOUT_OUTMEM_SLEEP );
802 p_vdec->p_context->draw_horiz_band= NULL;
804 p_ff_pic->opaque = (void*)p_pic;
805 p_ff_pic->type = FF_BUFFER_TYPE_USER;
806 p_ff_pic->data[0] = p_pic->p[0].p_pixels;
807 p_ff_pic->data[1] = p_pic->p[1].p_pixels;
808 p_ff_pic->data[2] = p_pic->p[2].p_pixels;
809 p_ff_pic->data[3] = NULL; /* alpha channel but I'm not sure */
811 p_ff_pic->linesize[0] = p_pic->p[0].i_pitch;
812 p_ff_pic->linesize[1] = p_pic->p[1].i_pitch;
813 p_ff_pic->linesize[2] = p_pic->p[2].i_pitch;
814 p_ff_pic->linesize[3] = 0;
816 if( p_ff_pic->reference != 0 )
818 vout_LinkPicture( p_vdec->p_vout, p_pic );
820 /* FIXME what is that, should give good value */
821 p_ff_pic->age = 256*256*256*64; // FIXME FIXME from ffmpeg
826 static void ffmpeg_ReleaseFrameBuf( struct AVCodecContext *p_context,
829 vdec_thread_t *p_vdec = (vdec_thread_t *)p_context->opaque;
832 if( p_ff_pic->type != FF_BUFFER_TYPE_USER )
834 avcodec_default_release_buffer( p_context, p_ff_pic );
838 //msg_Dbg( p_vdec->p_fifo, "ffmpeg_ReleaseFrameBuf" );
839 p_pic = (picture_t*)p_ff_pic->opaque;
841 p_ff_pic->data[0] = NULL;
842 p_ff_pic->data[1] = NULL;
843 p_ff_pic->data[2] = NULL;
844 p_ff_pic->data[3] = NULL;
846 if( p_ff_pic->reference != 0 )
848 vout_UnlinkPicture( p_vdec->p_vout, p_pic );