comparison libvo/vo_xv.c @ 6743:5c6cc735c946

check if the available buffers are big enough in get_image
author michael
date Wed, 17 Jul 2002 00:54:31 +0000
parents 65f26506053d
children a7c9c075abb6
comparison
equal deleted inserted replaced
6742:93bce3460e2a 6743:5c6cc735c946
744 static uint32_t get_image(mp_image_t *mpi){ 744 static uint32_t get_image(mp_image_t *mpi){
745 if(mpi->type==MP_IMGTYPE_STATIC && num_buffers>1) return VO_FALSE; // it is not static 745 if(mpi->type==MP_IMGTYPE_STATIC && num_buffers>1) return VO_FALSE; // it is not static
746 if(mpi->type==MP_IMGTYPE_IPB && num_buffers<3 && mpi->flags&MP_IMGFLAG_READABLE) return VO_FALSE; // not enough 746 if(mpi->type==MP_IMGTYPE_IPB && num_buffers<3 && mpi->flags&MP_IMGFLAG_READABLE) return VO_FALSE; // not enough
747 if(mpi->type==MP_IMGTYPE_IP && num_buffers<2 && mpi->flags&MP_IMGFLAG_READABLE) return VO_FALSE; // not enough 747 if(mpi->type==MP_IMGTYPE_IP && num_buffers<2 && mpi->flags&MP_IMGFLAG_READABLE) return VO_FALSE; // not enough
748 if(mpi->imgfmt!=image_format || mpi->imgfmt==IMGFMT_BGR24) return VO_FALSE; // needs conversion :( 748 if(mpi->imgfmt!=image_format || mpi->imgfmt==IMGFMT_BGR24) return VO_FALSE; // needs conversion :(
749 if( xvimage[current_buf]->pitches[0]*mpi->height
750 > xvimage[current_buf]->offsets[1] - xvimage[current_buf]->offsets[0]) return VO_FALSE; //buffer to small
751 if( xvimage[current_buf]->pitches[0] < mpi->width /*FIXME non yv12*/) return VO_FALSE; //buffer to small
749 // if(mpi->flags&MP_IMGFLAG_READABLE) return VO_FALSE; // slow video ram 752 // if(mpi->flags&MP_IMGFLAG_READABLE) return VO_FALSE; // slow video ram
750 if( (mpi->flags&(MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_ACCEPT_WIDTH)) || 753 if( (mpi->flags&(MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_ACCEPT_WIDTH)) ||
751 (mpi->width*(mpi->bpp/8)==xvimage[current_buf]->pitches[0]) ){ 754 (mpi->width*(mpi->bpp/8)==xvimage[current_buf]->pitches[0]) ){
752 mpi->planes[0]=xvimage[current_buf]->data+xvimage[current_buf]->offsets[0]; 755 mpi->planes[0]=xvimage[current_buf]->data+xvimage[current_buf]->offsets[0];
753 mpi->stride[0]=xvimage[current_buf]->pitches[0]; 756 mpi->stride[0]=xvimage[current_buf]->pitches[0];