Mercurial > mplayer.hg
comparison libvo/mga_template.c @ 32367:4a890f542e69
Switch (x)mga vo to new libvo API to reduce code duplication and improve
consistency between vos.
Also fixes using it with the GUI, the vo_window would not be set before.
author | reimar |
---|---|
date | Sat, 09 Oct 2010 11:12:53 +0000 |
parents | 56ce48514a75 |
children | 67c00c59eba6 |
comparison
equal
deleted
inserted
replaced
32366:3a6a61ffbb34 | 32367:4a890f542e69 |
---|---|
35 static mga_vid_config_t mga_vid_config; | 35 static mga_vid_config_t mga_vid_config; |
36 static uint8_t *vid_data, *frames[4]; | 36 static uint8_t *vid_data, *frames[4]; |
37 static int f = -1; | 37 static int f = -1; |
38 | 38 |
39 static uint32_t drwX,drwY,drwWidth,drwHeight; | 39 static uint32_t drwX,drwY,drwWidth,drwHeight; |
40 #ifdef VO_XMGA | 40 static uint32_t drwcX,drwcY; |
41 static uint32_t drwBorderWidth,drwDepth; | |
42 #endif | |
43 static uint32_t drwcX,drwcY,dwidth,dheight; | |
44 | 41 |
45 static struct SwsContext *sws_ctx; | 42 static struct SwsContext *sws_ctx; |
46 | 43 |
47 static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){ | 44 static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){ |
48 uint32_t bespitch = (mga_vid_config.src_width + 31) & ~31; | 45 uint32_t bespitch = (mga_vid_config.src_width + 31) & ~31; |
349 // int old_y = vo_panscan_y; | 346 // int old_y = vo_panscan_y; |
350 panscan_calc(); | 347 panscan_calc(); |
351 // if ( old_y != vo_panscan_y ) | 348 // if ( old_y != vo_panscan_y ) |
352 set_window(); | 349 set_window(); |
353 } | 350 } |
351 return VO_TRUE; | |
352 case VOCTRL_UPDATE_SCREENINFO: | |
353 #ifdef VO_XMGA | |
354 update_xinerama_info(); | |
355 #else | |
356 aspect_save_screenres(vo_screenwidth, vo_screenheight); | |
357 #endif | |
354 return VO_TRUE; | 358 return VO_TRUE; |
355 } | 359 } |
356 return VO_NOTIMPL; | 360 return VO_NOTIMPL; |
357 } | 361 } |
358 | 362 |
504 return 0; | 508 return 0; |
505 } | 509 } |
506 | 510 |
507 static void set_window( void ){ | 511 static void set_window( void ){ |
508 | 512 |
509 #ifdef VO_XMGA | 513 drwcX = vo_dx; |
510 if ( WinID ) | 514 drwcY = vo_dy; |
511 { | 515 drwWidth = vo_dwidth; |
512 XGetGeometry( mDisplay,vo_window,&mRoot,&drwX,&drwY,&drwWidth,&drwHeight,&drwBorderWidth,&drwDepth ); | 516 drwHeight = vo_dheight; |
513 mp_msg(MSGT_VO,MSGL_V,"[xmga] x: %d y: %d w: %d h: %d\n",drwX,drwY,drwWidth,drwHeight ); | 517 |
514 drwX=0; drwY=0; | 518 aspect(&drwWidth, &drwHeight, A_WINZOOM); |
515 XTranslateCoordinates( mDisplay,vo_window,mRoot,0,0,&drwcX,&drwcY,&mRoot ); | 519 panscan_calc_windowed(); |
516 mp_msg(MSGT_VO,MSGL_V,"[xmga] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight ); | 520 drwWidth += vo_panscan_x; |
517 | 521 drwHeight += vo_panscan_y; |
518 } | 522 drwWidth = FFMIN(drwWidth, vo_screenwidth); |
519 else | 523 drwHeight = FFMIN(drwHeight, vo_screenheight); |
520 #endif | 524 drwX = (vo_dwidth - drwWidth ) / 2; |
521 { drwX=drwcX=vo_dx; drwY=drwcY=vo_dy; drwWidth=vo_dwidth; drwHeight=vo_dheight; } | 525 drwY = (vo_dheight - drwHeight) / 2; |
522 | 526 drwcX += drwX; |
523 aspect(&dwidth,&dheight,A_NOZOOM); | 527 drwcY += drwY; |
524 if ( vo_fs ) | |
525 { | |
526 aspect(&dwidth,&dheight,A_ZOOM); | |
527 drwX=( vo_screenwidth - (dwidth > vo_screenwidth?vo_screenwidth:dwidth) ) / 2; | |
528 drwcX+=drwX; | |
529 drwY=( vo_screenheight - (dheight > vo_screenheight?vo_screenheight:dheight) ) / 2; | |
530 drwcY+=drwY; | |
531 drwWidth=(dwidth > vo_screenwidth?vo_screenwidth:dwidth); | |
532 drwHeight=(dheight > vo_screenheight?vo_screenheight:dheight); | |
533 mp_msg(MSGT_VO,MSGL_V,"[xmga-fs] dcx: %d dcy: %d dx: %d dy: %d dw: %d dh: %d\n",drwcX,drwcY,drwX,drwY,drwWidth,drwHeight ); | |
534 } | |
535 vo_dwidth=drwWidth; vo_dheight=drwHeight; | |
536 | 528 |
537 #ifdef VO_XMGA | 529 #ifdef VO_XMGA |
538 #ifdef CONFIG_XINERAMA | 530 #ifdef CONFIG_XINERAMA |
539 if(XineramaIsActive(mDisplay)) | 531 if(XineramaIsActive(mDisplay)) |
540 { | 532 { |
590 | 582 |
591 mga_vid_config.x_org=drwcX; | 583 mga_vid_config.x_org=drwcX; |
592 mga_vid_config.y_org=drwcY; | 584 mga_vid_config.y_org=drwcY; |
593 mga_vid_config.dest_width=drwWidth; | 585 mga_vid_config.dest_width=drwWidth; |
594 mga_vid_config.dest_height=drwHeight; | 586 mga_vid_config.dest_height=drwHeight; |
595 if ( vo_panscan > 0.0f && vo_fs ) | |
596 { | |
597 drwX-=vo_panscan_x>>1; | |
598 drwY-=vo_panscan_y>>1; | |
599 drwWidth+=vo_panscan_x; | |
600 drwHeight+=vo_panscan_y; | |
601 | |
602 mga_vid_config.x_org-=vo_panscan_x>>1; | |
603 mga_vid_config.y_org-=vo_panscan_y>>1; | |
604 mga_vid_config.dest_width=drwWidth; | |
605 mga_vid_config.dest_height=drwHeight; | |
606 #ifdef VO_XMGA | |
607 mDrawColorKey(); | |
608 #endif | |
609 } | |
610 if ( ioctl( f,MGA_VID_CONFIG,&mga_vid_config ) ) mp_msg(MSGT_VO,MSGL_WARN,"Error in mga_vid_config ioctl (wrong mga_vid.o version?)" ); | 587 if ( ioctl( f,MGA_VID_CONFIG,&mga_vid_config ) ) mp_msg(MSGT_VO,MSGL_WARN,"Error in mga_vid_config ioctl (wrong mga_vid.o version?)" ); |
611 } | 588 } |