Mercurial > mplayer.hg
changeset 28646:9b58b40350f7
Cosmetics. Remove all trailing whitespaces
and convert the few tabs into spaces.
author | iive |
---|---|
date | Sat, 21 Feb 2009 00:30:53 +0000 |
parents | 5baf473d1a09 |
children | b2794b4576c7 |
files | libvo/vo_svga.c |
diffstat | 1 files changed, 61 insertions(+), 61 deletions(-) [+] |
line wrap: on
line diff
--- a/libvo/vo_svga.c Fri Feb 20 23:46:24 2009 +0000 +++ b/libvo/vo_svga.c Sat Feb 21 00:30:53 2009 +0000 @@ -24,22 +24,22 @@ /* Wrangings: - - 1bpp doesn't work right for me with '-double' and svgalib 1.4.3, + - 1bpp doesn't work right for me with '-double' and svgalib 1.4.3, but works OK with svgalib 1.9.17 - - The HW acceleration is not tested - svgalibs supports few chipsets, - and i don't have any of them. If it works for you then let me know. + - The HW acceleration is not tested - svgalibs supports few chipsets, + and i don't have any of them. If it works for you then let me know. I will remove this warning after confirm its status. - retrace sync works only in doublebuffer mode. - the retrace sync may slow down decoding a lot - mplayer is blocked while waiting for retrace - denoise3d fails to find common colorspace, use -vf denoise3d,scale - + TODO: - let choose_best_mode take aspect into account - set palette from mpi->palette or mpi->plane[1] - make faster OSD black bars clear - need some OSD changes - Make nicer CONFIG parsing - - change video mode logical width to match img->stride[0] - for HW only + - change video mode logical width to match img->stride[0] - for HW only */ #include <stdio.h> @@ -68,7 +68,7 @@ #include <assert.h> //silence warnings, probably it have to go in some global header -#define UNUSED(x) ((void)(x)) +#define UNUSED(x) ((void)(x)) static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src, @@ -142,9 +142,9 @@ force_vm=force_native=squarepix=0; sync_flip=vo_vsync; blackbar_osd=0; - + if(arg)while(*arg) { -#ifdef CONFIG_VIDIX +#ifdef CONFIG_VIDIX if(memcmp(arg,"vidix",5)==0) { i=6; while(arg[i] && arg[i]!=':') i++; @@ -160,7 +160,7 @@ arg+=2; if( *arg == ':' ) arg++; } - + if(!strncmp(arg,"native",6)) { force_native=1; arg+=6; @@ -178,7 +178,7 @@ arg+=7; if( *arg == ':' ) arg++; } - + if(*arg) { i=0; while(arg[i] && arg[i]!=':')i++; @@ -189,7 +189,7 @@ force_vm=vga_getmodenumber(s); if(force_vm>0) { if( mp_msg_test(MSGT_VO,MSGL_V) ) mp_msg(MSGT_VO,MSGL_V, "vo_svga: Forcing mode %i\n",force_vm); - }else{ + }else{ force_vm = 0; } } @@ -197,7 +197,7 @@ if(*arg==':')arg++; } } - + rez = vga_init(); if(rez != 0){ mp_msg(MSGT_VO,MSGL_ERR, "vo_svga: vga_init() returned error=%d\n",rez); @@ -213,7 +213,7 @@ if( mp_msg_test(MSGT_VO,MSGL_DBG3) ) mp_msg(MSGT_VO,MSGL_DBG3, "vo_svga: clearing box %d,%d - %d,%d with HW acceleration\n", x,y,w,h); - if(mode_capabilities&CAP_ACCEL_BACKGR) + if(mode_capabilities&CAP_ACCEL_BACKGR) vga_accel(ACCEL_SYNC); vga_accel(ACCEL_SETFGCOLOR,0);//black vga_accel(ACCEL_FILLBOX,x,y,w,h); @@ -254,7 +254,7 @@ assert((cpage>=0)&&(cpage<max_pages)); return VO_TRUE; //it's already done } -// if (mpi->flags&MP_IMGFLAGS_DRAWBACK) +// if (mpi->flags&MP_IMGFLAGS_DRAWBACK) // return VO_TRUE;//direct render method 2 //find a free page to draw into @@ -263,16 +263,16 @@ if(page>=0) cpage=page; PageStore[cpage].locks=PAGE_BUSY; -// these variables are used in loops +// these variables are used in loops x = mpi->x; y = mpi->y; w = mpi->w; h = mpi->h; - stride = mpi->stride[0]; + stride = mpi->stride[0]; rgbplane = mpi->planes[0] + y*stride + (x*mpi->bpp)/8; x+=x_pos;//center y+=y_pos; - + if(mpi->bpp >= 8){//for modes<8 use only native if( (mode_capabilities&CAP_ACCEL_PUTIMAGE) && (x==0) && (w==mpi->width) && (stride == mode_stride) ){ //only monolite image can be accelerated @@ -286,13 +286,13 @@ vga_accel(ACCEL_PUTIMAGE,x,y+PageStore[cpage].yoffset,w,h,rgbplane); return VO_TRUE; } - + if( mode_capabilities&CAP_LINEAR){ -//DIRECT +//DIRECT if( mp_msg_test(MSGT_VO,MSGL_DBG3) ) mp_msg(MSGT_VO,MSGL_DBG3, "vo_svga: using Direct memcpy (x=%d,y=%d,w=%d,h=%d)\n",x,y,w,h); bytesperline=(w*mpi->bpp)/8; - base=PageStore[cpage].vbase + (y*mode_stride) + (x*mpi->bpp)/8; + base=PageStore[cpage].vbase + (y*mode_stride) + (x*mpi->bpp)/8; for(i=0;i<h;i++){ mem2agpcpy(base,rgbplane,bytesperline); @@ -300,9 +300,9 @@ rgbplane+=stride; } return VO_TRUE; - } + } }//(modebpp>=8 - + //NATIVE { @@ -310,7 +310,7 @@ length=(w*mpi->bpp)/8; //one byte per pixel! svgalib innovation if(mpi->imgfmt==IMGFMT_RG4B || mpi->imgfmt==IMGFMT_BG4B) length=w; - + if( mp_msg_test(MSGT_VO,MSGL_DBG3) ) mp_msg(MSGT_VO,MSGL_DBG3, "vo_svga: using Native vga_draw(x=%d,y=%d,w=%d,h=%d)\n",x,y,w,h); y+=PageStore[cpage].yoffset;//y position of the page beggining @@ -330,7 +330,7 @@ case 32768: return 15; case 65536: return 16; case 1<<24: return 8*vminfo->bytesperpixel; - } + } return 0; } @@ -354,7 +354,7 @@ if( (vminfo->width < req_w) || (vminfo->height < req_h) ) continue; badness=(vminfo->width * vminfo->height) - (req_h * req_w); //put here aspect calculations - if(squarepix) + if(squarepix) if( vminfo->width*3 != vminfo->height*4 ) continue; if( bestmode==0 || prev_badness >= badness ){//modeX etc... @@ -385,7 +385,7 @@ { va_list ap; int value; - + va_start(ap, data); value = va_arg(ap, int); va_end(ap); @@ -396,7 +396,7 @@ { va_list ap; int *value; - + va_start(ap, data); value = va_arg(ap, int*); va_end(ap); @@ -421,24 +421,24 @@ int32_t req_h = height;// (d_height > 0 ? d_height : height); uint16_t vid_mode = 0; int32_t req_bpp; - + uint32_t accflags; if( mp_msg_test(MSGT_VO,MSGL_V) ) mp_msg(MSGT_VO,MSGL_V, "vo_svga: config(%i, %i, %i, %i, %08x, %s, %08x)\n", width, height, d_width, d_height, flags, title, format); //Only RGB modes supported - if (!IMGFMT_IS_RGB(format) && !IMGFMT_IS_BGR(format)) {assert(0);return -1;} + if (!IMGFMT_IS_RGB(format) && !IMGFMT_IS_BGR(format)) {assert(0);return -1;} req_bpp = IMGFMT_BGR_DEPTH(format); - + if( vo_dbpp!=0 && vo_dbpp!=req_bpp) {assert(0);return-1;} - + if(!force_vm) { if ( mp_msg_test(MSGT_VO,MSGL_V) ) { mp_msg(MSGT_VO,MSGL_V, "vo_svga: Looking for the best resolution...\n"); mp_msg(MSGT_VO,MSGL_V, "vo_svga: req_w: %d, req_h: %d, bpp: %d\n",req_w,req_h,req_bpp); } vid_mode=find_best_svga_mode(req_w,req_h,req_bpp); - if(vid_mode==0) + if(vid_mode==0) return 1; modeinfo=vga_getmodeinfo(vid_mode); }else{//force_vm @@ -456,10 +456,10 @@ } } mode_bpp=bpp_from_vminfo(modeinfo); - + mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_SVGA_Vidmode, vid_mode,modeinfo->width,modeinfo->height,mode_bpp); - + if (vga_setmode(vid_mode) == -1) { mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_SVGA_VgasetmodeFailed,vid_mode); uninit(); @@ -476,7 +476,7 @@ int i; for(i=0; i<16; i++) vga_setpalette(i, ((i>>3)&1)*63, ((i>>1)&3)*21, (i&1)*63); - } + } //if we change the logical width, we should know the granularity stride_granularity=8;//according to man vga_logicalwidth if(modeinfo->flags & EXT_INFO_AVAILABLE){ @@ -496,7 +496,7 @@ mode_capabilities|=CAP_ACCEL_BACKGR;//can draw in backgraund } } - if(modeinfo->flags & IS_LINEAR){ + if(modeinfo->flags & IS_LINEAR){ mode_capabilities|=CAP_LINEAR; //don't use bank & vga_draw } else{ @@ -517,13 +517,13 @@ mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_SVGA_VideoModeHasHardwareAcceleration); mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_SVGA_IfItWorksForYouIWouldLikeToKnow); } - + //here is the place to handle strides for accel_ modes; mode_stride=modeinfo->linewidth; -//we may try to set a bigger stride for video mode that will match the mpi->stride, +//we may try to set a bigger stride for video mode that will match the mpi->stride, //this way we will transfer more data, but HW put_image can do it in backgraund! -//now let's see how many pages we can use +//now let's see how many pages we can use max_pages = modeinfo->maxpixels/(modeinfo->height * modeinfo->width); if(max_pages > MAXPAGES) max_pages = MAXPAGES; if(!vo_doublebuffering) max_pages=1; @@ -544,7 +544,7 @@ } PageStore[i].yoffset = i * modeinfo->height;//starting y offset PageStore[i].vbase = GRAPH_MEM + i*modeinfo->height*mode_stride; //memory base address - PageStore[i].doffset = dof; //display offset + PageStore[i].doffset = dof; //display offset PageStore[i].locks = PAGE_EMPTY; } } @@ -568,27 +568,27 @@ #ifdef CONFIG_VIDIX - if(vidix_name[0]){ - vidix_init(width, height, x_pos, y_pos, modeinfo->width, modeinfo->height, + if(vidix_name[0]){ + vidix_init(width, height, x_pos, y_pos, modeinfo->width, modeinfo->height, format, mode_bpp, modeinfo->width,modeinfo->height); mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_SVGA_UsingVidix,width,height, modeinfo->width,modeinfo->height); vidix_start(); - /*set colorkey*/ + /*set colorkey*/ if(vidix_grkey_support()){ vidix_grkey_get(&gr_key); gr_key.key_op = KEYS_PUT; if (!(vo_colorkey & 0xFF000000)) { - gr_key.ckey.op = CKEY_TRUE; - gr_key.ckey.red = (vo_colorkey & 0x00FF0000) >> 16; - gr_key.ckey.green = (vo_colorkey & 0x0000FF00) >> 8; - gr_key.ckey.blue = vo_colorkey & 0x000000FF; + gr_key.ckey.op = CKEY_TRUE; + gr_key.ckey.red = (vo_colorkey & 0x00FF0000) >> 16; + gr_key.ckey.green = (vo_colorkey & 0x0000FF00) >> 8; + gr_key.ckey.blue = vo_colorkey & 0x000000FF; } else - gr_key.ckey.op = CKEY_FALSE; + gr_key.ckey.op = CKEY_FALSE; vidix_grkey_set(&gr_key); - } + } } -#endif +#endif vga_setdisplaystart(0); return 0; @@ -617,18 +617,18 @@ //only modes with bytesperpixel>0 can draw OSD if(modeinfo->bytesperpixel==0) return; if(!(mode_capabilities&CAP_LINEAR)) return;//force_native will remove OSD - + if(blackbar_osd){ //111 //3 4 //222 - svga_clear_box(0,0 + PageStore[cpage].yoffset, + svga_clear_box(0,0 + PageStore[cpage].yoffset, modeinfo->width, y_pos); svga_clear_box(0, image_height + y_pos + PageStore[cpage].yoffset, modeinfo->width, modeinfo->height-(image_height+ y_pos)); svga_clear_box(0, y_pos + PageStore[cpage].yoffset, x_pos, image_height); - svga_clear_box(image_width + x_pos, y_pos + PageStore[cpage].yoffset, + svga_clear_box(image_width + x_pos, y_pos + PageStore[cpage].yoffset, modeinfo->width-(x_pos+image_width), image_height); // vo_remove_text(modeinfo->width, modeinfo->height, clear_alpha); vo_draw_text(modeinfo->width, modeinfo->height, draw_alpha); @@ -648,7 +648,7 @@ vga_waitretrace(); } vga_setdisplaystart(PageStore[cpage].doffset); - + old_page=cpage;//cpage will be overwriten on next draw_image } @@ -672,7 +672,7 @@ if ( mp_msg_test(MSGT_VO,MSGL_DBG4) ) mp_msg(MSGT_VO,MSGL_DBG4, "vo_svga: query_format=%X \n",format); //only RGB modes supported - if( (!IMGFMT_IS_RGB(format)) && (!IMGFMT_IS_BGR(format)) ) return 0; + if( (!IMGFMT_IS_RGB(format)) && (!IMGFMT_IS_BGR(format)) ) return 0; // Reject different endian #ifdef WORDS_BIGENDIAN @@ -715,15 +715,15 @@ x0+=x_pos; y0+=y_pos; } - + if( mp_msg_test(MSGT_VO,MSGL_DBG4) ) mp_msg(MSGT_VO,MSGL_DBG4, "vo_svga: OSD draw in page %d\n",cpage); base=PageStore[cpage].vbase + y0*mode_stride + x0*modeinfo->bytesperpixel; switch (mode_bpp) { - case 32: + case 32: vo_draw_alpha_rgb32(w, h, src, srca, stride, base, mode_stride); break; - case 24: + case 24: vo_draw_alpha_rgb24(w, h, src, srca, stride, base, mode_stride); break; case 16: @@ -738,11 +738,11 @@ static uint32_t get_image(mp_image_t *mpi){ int page; - if(!IMGFMT_IS_BGR(mpi->imgfmt) && !IMGFMT_IS_RGB(mpi->imgfmt) ){ + if(!IMGFMT_IS_BGR(mpi->imgfmt) && !IMGFMT_IS_RGB(mpi->imgfmt) ){ assert(0);//should never happen return VO_FALSE; } - + if ( ( (mpi->type != MP_IMGTYPE_STATIC) && (mpi->type != MP_IMGTYPE_TEMP)) || (mpi->flags & MP_IMGFLAG_PLANAR) || @@ -761,7 +761,7 @@ mpi->flags |= MP_IMGFLAG_DIRECT; mpi->stride[0] = mode_stride; - mpi->planes[0] = PageStore[page].vbase + + mpi->planes[0] = PageStore[page].vbase + y_pos*mode_stride + (x_pos*mpi->bpp)/8; mpi->priv=(void *)page; if( mp_msg_test(MSGT_VO,MSGL_DBG3) )