comparison libvo/vo_x11.c @ 6692:ad521fb49a5e

-vm -fs -zoom fix, set correct vm screenres in aspect code (similar to xv fix).
author atmos4
date Wed, 10 Jul 2002 04:11:59 +0000
parents 11e216bee07b
children 48acc88bf4cc
comparison
equal deleted inserted replaced
6691:34f22bad2a19 6692:ad521fb49a5e
270 //printf( "w: %d h: %d\n\n",vo_dwidth,vo_dheight ); 270 //printf( "w: %d h: %d\n\n",vo_dwidth,vo_dheight );
271 271
272 XGetWindowAttributes( mDisplay,mRootWin,&attribs ); 272 XGetWindowAttributes( mDisplay,mRootWin,&attribs );
273 depth=attribs.depth; 273 depth=attribs.depth;
274 274
275 if ( depth != 15 && depth != 16 && depth != 24 && depth != 32 ) depth=24; 275 if ( depth != 8 && depth != 15 && depth != 16 && depth != 24 && depth != 32 ) depth=24;
276 XMatchVisualInfo( mDisplay,mScreen,depth,TrueColor,&vinfo ); 276 XMatchVisualInfo( mDisplay,mScreen,depth,TrueColor,&vinfo );
277 277
278 /* set image size (which is indeed neither the input nor output size), 278 /* set image size (which is indeed neither the input nor output size),
279 if zoom is on it will be changed during draw_slice anyway so we dont dupplicate the aspect code here 279 if zoom is on it will be changed during draw_slice anyway so we dont dupplicate the aspect code here
280 */ 280 */
304 vo_vm_switch(vm_width, vm_height,&modeline_width, &modeline_height); 304 vo_vm_switch(vm_width, vm_height,&modeline_width, &modeline_height);
305 vo_dx=(vo_screenwidth-modeline_width)/2; 305 vo_dx=(vo_screenwidth-modeline_width)/2;
306 vo_dy=(vo_screenheight-modeline_height)/2; 306 vo_dy=(vo_screenheight-modeline_height)/2;
307 vo_dwidth=modeline_width; 307 vo_dwidth=modeline_width;
308 vo_dheight=modeline_height; 308 vo_dheight=modeline_height;
309 aspect_save_screenres(modeline_width,modeline_height);
309 } 310 }
310 #endif 311 #endif
311 bg=WhitePixel( mDisplay,mScreen ); 312 bg=WhitePixel( mDisplay,mScreen );
312 fg=BlackPixel( mDisplay,mScreen ); 313 fg=BlackPixel( mDisplay,mScreen );
313 314
393 out_format= IMGFMT_BGR15; 394 out_format= IMGFMT_BGR15;
394 }else{ 395 }else{
395 draw_alpha_fnc=draw_alpha_16; 396 draw_alpha_fnc=draw_alpha_16;
396 out_format= IMGFMT_BGR16; 397 out_format= IMGFMT_BGR16;
397 }break; 398 }break;
399 case 8: draw_alpha_fnc=draw_alpha_null;
400 out_format= IMGFMT_BGR8; break;
398 default: draw_alpha_fnc=draw_alpha_null; 401 default: draw_alpha_fnc=draw_alpha_null;
399 } 402 }
400 403
401 /* always allocate swsContext as size could change between frames */ 404 /* always allocate swsContext as size could change between frames */
402 swsContext= getSwsContextFromCmdLine(width, height, in_format, width, height, out_format ); 405 swsContext= getSwsContextFromCmdLine(width, height, in_format, width, height, out_format );
403 406
404 // printf( "X11 color mask: R:%lX G:%lX B:%lX\n",myximage->red_mask,myximage->green_mask,myximage->blue_mask ); 407 printf( "X11 bpp: %d color mask: R:%lX G:%lX B:%lX\n",bpp,myximage->red_mask,myximage->green_mask,myximage->blue_mask );
405 408
406 // If we have blue in the lowest bit then obviously RGB 409 // If we have blue in the lowest bit then obviously RGB
407 mode=( ( myximage->blue_mask & 0x01 ) != 0 ) ? MODE_RGB : MODE_BGR; 410 mode=( ( myximage->blue_mask & 0x01 ) != 0 ) ? MODE_RGB : MODE_BGR;
408 #ifdef WORDS_BIGENDIAN 411 #ifdef WORDS_BIGENDIAN
409 if ( myximage->byte_order != MSBFirst ) 412 if ( myximage->byte_order != MSBFirst )
413 { 416 {
414 mode=( ( myximage->blue_mask & 0x01 ) != 0 ) ? MODE_BGR : MODE_RGB; 417 mode=( ( myximage->blue_mask & 0x01 ) != 0 ) ? MODE_BGR : MODE_RGB;
415 // printf( "No support for non-native XImage byte order!\n" ); 418 // printf( "No support for non-native XImage byte order!\n" );
416 // return -1; 419 // return -1;
417 } 420 }
418 421 // hack-atmos
422 mode=MODE_RGB;
419 #ifdef WORDS_BIGENDIAN 423 #ifdef WORDS_BIGENDIAN
420 if(mode==MODE_BGR && bpp!=32){ 424 if(mode==MODE_BGR && bpp!=32){
421 mp_msg(MSGT_VO,MSGL_ERR,"BGR%d not supported, please contact the developers\n", bpp); 425 mp_msg(MSGT_VO,MSGL_ERR,"BGR%d not supported, please contact the developers\n", bpp);
422 return -1; 426 return -1;
423 } 427 }
525 529
526 static uint32_t draw_frame( uint8_t *src[] ){ 530 static uint32_t draw_frame( uint8_t *src[] ){
527 int stride[3]= {0,0,0}; 531 int stride[3]= {0,0,0};
528 532
529 if (in_format==IMGFMT_YUY2) stride[0]=srcW*2; 533 if (in_format==IMGFMT_YUY2) stride[0]=srcW*2;
534 else if(in_format==IMGFMT_BGR8) stride[0]=srcW;
530 else if(in_format==IMGFMT_BGR15) stride[0]=srcW*2; 535 else if(in_format==IMGFMT_BGR15) stride[0]=srcW*2;
531 else if(in_format==IMGFMT_BGR16) stride[0]=srcW*2; 536 else if(in_format==IMGFMT_BGR16) stride[0]=srcW*2;
532 else if(in_format==IMGFMT_BGR24) stride[0]=srcW*3; 537 else if(in_format==IMGFMT_BGR24) stride[0]=srcW*3;
533 else if(in_format==IMGFMT_BGR32) stride[0]=srcW*4; 538 else if(in_format==IMGFMT_BGR32) stride[0]=srcW*4;
534 539
564 } 569 }
565 570
566 static uint32_t query_format( uint32_t format ) 571 static uint32_t query_format( uint32_t format )
567 { 572 {
568 mp_msg(MSGT_VO,MSGL_DBG2,"vo_x11: query_format was called: %x (%s)\n",format,vo_format_name(format)); 573 mp_msg(MSGT_VO,MSGL_DBG2,"vo_x11: query_format was called: %x (%s)\n",format,vo_format_name(format));
574 #if 0
569 if (IMGFMT_IS_BGR(format)) 575 if (IMGFMT_IS_BGR(format))
570 { 576 {
571 if (IMGFMT_BGR_DEPTH(format) == 8) 577 if (IMGFMT_BGR_DEPTH(format) == 8)
572 return 0; 578 return 3;
573 if (IMGFMT_BGR_DEPTH(format) == vo_depthonscreen) 579 if (IMGFMT_BGR_DEPTH(format) == vo_depthonscreen)
574 return 3|VFCAP_OSD|VFCAP_SWSCALE|VFCAP_FLIP; 580 return 3|VFCAP_OSD|VFCAP_SWSCALE|VFCAP_FLIP;
575 else 581 else
576 return 1|VFCAP_OSD|VFCAP_SWSCALE|VFCAP_FLIP; 582 return 1|VFCAP_OSD|VFCAP_SWSCALE|VFCAP_FLIP;
577 } 583 }
584 #endif
578 585
579 switch( format ) 586 switch( format )
580 { 587 {
588 // case IMGFMT_BGR8:
581 // case IMGFMT_BGR15: 589 // case IMGFMT_BGR15:
582 // case IMGFMT_BGR16: 590 // case IMGFMT_BGR16:
583 // case IMGFMT_BGR24: 591 // case IMGFMT_BGR24:
584 // case IMGFMT_BGR32: 592 // case IMGFMT_BGR32:
585 // return 0x2; 593 // return 3|VFCAP_SWSCALE|VFCAO_FLIP;
586 // case IMGFMT_YUY2: 594 // case IMGFMT_YUY2:
587 case IMGFMT_I420: 595 case IMGFMT_I420:
588 case IMGFMT_IYUV: 596 case IMGFMT_IYUV:
589 case IMGFMT_YV12: 597 case IMGFMT_YV12:
590 return 1|VFCAP_OSD|VFCAP_SWSCALE; 598 return 1|VFCAP_OSD|VFCAP_SWSCALE;
640 vo_x11_fullscreen(); 648 vo_x11_fullscreen();
641 return VO_TRUE; 649 return VO_TRUE;
642 } 650 }
643 return VO_NOTIMPL; 651 return VO_NOTIMPL;
644 } 652 }
653