1
mirror of https://github.com/mpv-player/mpv synced 2024-12-28 06:03:45 +01:00

YUY2 BGR32 BGR24 support for vo_x11 if swScaler is used

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4513 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
michael 2002-02-03 14:41:31 +00:00
parent 09a6d6f465
commit ea1bcc2067
2 changed files with 21 additions and 2 deletions

View File

@ -132,6 +132,9 @@ static void draw_alpha_null(int x0,int y0, int w,int h, unsigned char* src, unsi
static SwsContext *swsContext=NULL;
static int useSws=0;
extern int sws_flags;
/*needed so we can output the correct supported formats in query_format()
should perhaps be passed as argument to query_format() */
extern int softzoom;
static XVisualInfo vinfo;
@ -274,7 +277,8 @@ static uint32_t config( uint32_t width,uint32_t height,uint32_t d_width,uint32_t
if ( depth != 15 && depth != 16 && depth != 24 && depth != 32 ) depth=24;
XMatchVisualInfo( mDisplay,mScreen,depth,TrueColor,&vinfo );
if( flags&0x04 && (format==IMGFMT_YV12 || format==IMGFMT_I420 || format==IMGFMT_IYUV)) {
if( flags&0x04 && ( format==IMGFMT_YV12 || format==IMGFMT_I420 || format==IMGFMT_IYUV
|| format==IMGFMT_YUY2 || format==IMGFMT_BGR24 || format==IMGFMT_BGR32)) {
// software scale
if(fullscreen){
image_width=vo_screenwidth;
@ -508,6 +512,16 @@ static uint32_t draw_frame( uint8_t *src[] ){
char *s=src[0];
//printf( "sbpp=%d dbpp=%d depth=%d bpp=%d\n",sbpp,dbpp,depth,bpp );
if(swsContext)
{
int stride[3]= {0,0,0};
if (swsContext->srcFormat==IMGFMT_YUY2) stride[0]=swsContext->srcW*2;
else if(swsContext->srcFormat==IMGFMT_BGR24) stride[0]=swsContext->srcW*3;
else if(swsContext->srcFormat==IMGFMT_BGR32) stride[0]=swsContext->srcW*4;
return draw_slice(src, stride, swsContext->srcW, swsContext->srcH, 0, 0);
}
if( Flip_Flag ){
// flipped BGR
int i;
@ -572,6 +586,11 @@ static uint32_t query_format( uint32_t format )
switch( format )
{
case IMGFMT_BGR24:
case IMGFMT_BGR32:
case IMGFMT_YUY2:
if(softzoom) return 1;
else return 0;
case IMGFMT_I420:
case IMGFMT_IYUV:
case IMGFMT_YV12: return 1;

View File

@ -254,7 +254,7 @@ char* video_driver=NULL; //"mga"; // default
char* audio_driver=NULL;
static int fullscreen=0;
static int vidmode=0;
static int softzoom=0;
int softzoom=0;
static int flip=-1;
// We need this opt_* because the values are then calculated so the options use the opt_*
// and before each file we reset the calculated value using this opt_* values