func: int avcodec_default_get_buffer(AVCodecContext *avctx,AVFrame *frame) frame -> type = 1; switch ( avctx -> codec_type )  return video_get_buffer ( avctx , frame ) ; static int video_get_buffer(AVCodecContext *s,AVFrame *pic) int i ; int w = s -> width ; int h = s -> height ; InternalBuffer * buf ; AVCodecInternal * avci = s -> internal ; if ( pic -> data [ 0 ] != ( ( void * ) 0 ) )  if ( avci -> buffer_count >= 32 + 1 )  if ( av_image_check_size ( w , h , 0 , s ) || ( s -> pix_fmt ) < 0 )  if ( ! avci -> buffer )  avci -> buffer = ( av_mallocz ( ( 32 + 1 + 1 ) * sizeof ( InternalBuffer ) ) ); buf = & avci -> buffer [ avci -> buffer_count ]; if ( buf -> base [ 0 ] && ( buf -> width != w || buf -> height != h || ( buf -> pix_fmt ) != ( s -> pix_fmt ) ) )  for (i = 0; i < 8; i++) buf -> data [ i ] = ( ( void * ) 0 ); if ( ! buf -> base [ 0 ] )  int tmpsize ; AVPicture picture ; if ( ! ( s -> flags & 0x4000 ) )  h += 16 * 2; tmpsize = av_image_fill_pointers ( picture . data , s -> pix_fmt , h , ( ( void * ) 0 ) , picture . linesize ); if ( tmpsize < 0 )  memset ( ( buf -> base ) , 0 , sizeof ( buf -> base ) ); memset ( ( buf -> data ) , 0 , sizeof ( buf -> data ) ); for (i = 0; i < 4 && size[i]; i++) buf -> linesize [ i ] = picture . linesize [ i ]; buf -> base [ i ] = ( av_malloc ( ( size [ i ] + 16 + 8 - 1 ) ) ); if ( buf -> base [ i ] == ( ( void * ) 0 ) )  buf -> data [ i ] = buf -> base [ i ]; buf -> data [ i ] = buf -> base [ i ] + ( ( buf -> linesize [ i ] * 16 >> v_shift ) + ( pixel_size * 16 >> h_shift ) + stride_align [ i ] - 1 & ~ ( stride_align [ i ] - 1 ) ); for (; i < 8; i++) buf -> base [ i ] = buf -> data [ i ] = ( ( void * ) 0 ); buf -> linesize [ i ] = 0; avpriv_set_systematic_pal2 ( ( ( uint32_t * ) buf -> data [ 1 ] ) , s -> pix_fmt ); buf -> width = s -> width; buf -> height = s -> height; buf -> pix_fmt = s -> pix_fmt; for (i = 0; i < 8; i++) pic -> base [ i ] = buf -> base [ i ]; pic -> data [ i ] = buf -> data [ i ]; pic -> linesize [ i ] = buf -> linesize [ i ]; pic -> extended_data = pic -> data; av_log ( s , 48 , "default_get_buffer called on pic %p, %d buffers used\n" , pic , avci -> buffer_count ); 