Thread: [Mplayerxp-cvslog] SF.net SVN: mplayerxp:[589] mplayerxp/libvo2
Brought to you by:
olov
From: <nic...@us...> - 2012-12-21 10:48:22
|
Revision: 589 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=589&view=rev Author: nickols_k Date: 2012-12-21 10:48:09 +0000 (Fri, 21 Dec 2012) Log Message: ----------- convert MSG_* into mpxp_ostream compatible output Modified Paths: -------------- mplayerxp/libvo2/aspect.cpp mplayerxp/libvo2/font_load.cpp mplayerxp/libvo2/osd_render.cpp mplayerxp/libvo2/screenshot.cpp mplayerxp/libvo2/sub.cpp mplayerxp/libvo2/vidix_system.cpp mplayerxp/libvo2/vo_fbdev.cpp mplayerxp/libvo2/vo_msg.h mplayerxp/libvo2/vo_null.cpp mplayerxp/libvo2/vo_opengl.cpp mplayerxp/libvo2/vo_sdl.cpp mplayerxp/libvo2/vo_vesa.cpp mplayerxp/libvo2/vo_x11.cpp mplayerxp/libvo2/vo_xv.cpp mplayerxp/libvo2/x11_system.cpp Modified: mplayerxp/libvo2/aspect.cpp =================================================================== --- mplayerxp/libvo2/aspect.cpp 2012-12-20 17:02:24 UTC (rev 588) +++ mplayerxp/libvo2/aspect.cpp 2012-12-21 10:48:09 UTC (rev 589) @@ -3,12 +3,6 @@ using namespace mpxp; /* Stuff for correct aspect scaling. */ #include "aspect.h" - -//#define ASPECT_DEBUG - -#ifdef ASPECT_DEBUG -#include <stdio.h> -#endif #include "vo_msg.h" namespace mpxp { @@ -49,8 +43,8 @@ uint32_t tmpw; #ifdef ASPECT_DEBUG - MSG_DBG2("aspect(0) fitin: %dx%d zoom: %d \n",screenw,screenh,zoom); - MSG_DBG2("aspect(1) wh: %dx%d (org: %dx%d)\n",srcw,srch,prew,preh); + mpxp_dbg2<<"aspect(0) fitin: "<<screenw<<"x"<<screenh<<" zoom: "<<zoom<<std::endl; + mpxp_dbg2<<"aspect(1) wh: "<<srcw<<"x"<<srch<<" (org: "<<prew<<"x"<<preh<<")"<<std::endl; #endif if(zoom){ if(prew >= preh) { @@ -71,7 +65,7 @@ } srch+= srch%2; // round #ifdef ASPECT_DEBUG - MSG_DBG2("aspect(2) wh: %dx%d (org: %dx%d)\n",srcw,srch,prew,preh); + mpxp_dbg2<<"aspect(2) wh: "<<srcw<<"x"<<srch<<" (org: "<<prew<<"x"<<preh<<")"<<std::hex; #endif if(srch>screenh || srch<orgh){ if(zoom) @@ -87,7 +81,7 @@ } } #ifdef ASPECT_DEBUG - MSG_DBG2("aspect(3) wh: %dx%d (org: %dx%d)\n",srcw,srch,prew,preh); + mpxp_dbg2<<"aspect(3) wh: "<<srcw<<"x"<<srch<<" (org: "<<prew<<"x"<<preh<<")"<<std::endl; #endif } } // namesapce mpxp Modified: mplayerxp/libvo2/font_load.cpp =================================================================== --- mplayerxp/libvo2/font_load.cpp 2012-12-20 17:02:24 UTC (rev 588) +++ mplayerxp/libvo2/font_load.cpp 2012-12-21 10:48:09 UTC (rev 589) @@ -27,7 +27,7 @@ if(raw->w == 0) /* 2 bytes were not enough for the width... read 4 bytes from the end of the header */ raw->w = ((head[28]*0x100 + head[29])*0x100 + head[30])*0x100 + head[31]; if(raw->c>256) { delete raw; fclose(f); return NULL; } // too many colors!? - MSG_V("RAW: %s %d x %d, %d colors\n",name,raw->w,raw->h,raw->c); + mpxp_v<<"RAW: "<<name<<" "<<raw->w<<" x "<<raw->h<<", "<<raw->c<<" colors"<<std::endl; if(raw->c){ raw->pal=new unsigned char [raw->c*3]; fread(raw->pal,3,raw->c,f); @@ -59,7 +59,7 @@ f=fopen(fname,"rt"); if(!f) { - MSG_ERR("font: can't open file: %s\n",fname); + mpxp_err<<"font: can't open file: "<<fname<<std::endl; delete desc; return NULL; } @@ -118,11 +118,11 @@ int len=strlen(p[0]); if(len && len<63 && p[0][len-1]==']'){ strcpy(section,p[0]); - MSG_V("font: Reading section: %s\n",section); + mpxp_v<<"font: Reading section: "<<section<<std::endl; if(strcmp(section,"[files]")==0){ ++fontdb; if(fontdb>=16) { - MSG_ERR("font: Too many bitmaps defined!\n"); + mpxp_err<<"font: Too many bitmaps defined!"<<std::endl; delete desc; return NULL; } @@ -157,7 +157,7 @@ snprintf(cp,strlen(default_dir)+strlen(p[1])+2,"%s/%s", default_dir,p[1]); if (!((desc->pic_a[fontdb]=load_raw(cp,verbose)))){ - MSG_ERR("Can't load font bitmap: %s\n",p[1]); + mpxp_err<<"Can't load font bitmap: "<<p[1]<<std::endl; delete cp; delete desc; return NULL; @@ -183,7 +183,7 @@ snprintf(cp,strlen(default_dir)+strlen(p[1])+2,"%s/%s", default_dir,p[1]); if (!((desc->pic_b[fontdb]=load_raw(cp,verbose)))){ - MSG_ERR("Can't load font bitmap: %s\n",p[1]); + mpxp_err<<"Can't load font bitmap: "<<p[1]<<std::endl; delete cp; delete desc; return NULL; @@ -220,7 +220,7 @@ int end=atoi(p[2]); if(sub_data.unicode && (chr>=0x80)) chr=(chr<<8)+p[0][1]; else if(strlen(p[0])!=1) chr=strtol(p[0],NULL,0); - if(end<start) MSG_ERR("error in font desc: end<start for char '%c'\n",chr); + if(end<start) mpxp_err<<"error in font desc: end<start for char '"<<chr<<"'"<<std::endl; else { desc->start[chr]=start; desc->width[chr]=end-start+1; @@ -230,12 +230,12 @@ continue; } } - MSG_ERR("Syntax error in font desc: %s\n",sor); + mpxp_err<<"Syntax error in font desc: "<<sor<<std::endl; } fclose(f); for(i=0;i<=fontdb;i++){ if(!desc->pic_a[i] || !desc->pic_b[i]){ - MSG_ERR("font: Missing bitmap(s) for sub-font #%d\n",i); + mpxp_err<<"font: Missing bitmap(s) for sub-font #"<<i<<std::endl; delete desc; return NULL; } @@ -243,7 +243,7 @@ int f=factor*256.0f; int size=desc->pic_a[i]->w*desc->pic_a[i]->h; int j; - MSG_V("font: resampling alpha by factor %5.3f (%d) ",factor,f);fflush(stdout); + mpxp_v<<"font: resampling alpha by factor "<<factor<<" ("<<f<<")"<<std::endl; for(j=0;j<size;j++){ int x=desc->pic_a[i]->bmp[j]; // alpha int y=desc->pic_b[i]->bmp[j]; // bitmap @@ -263,7 +263,7 @@ desc->pic_a[i]->bmp[j]=x; // desc->pic_b[i]->bmp[j]=0; // hack } - MSG_V("DONE!\n"); + mpxp_v<<"DONE!"<<std::endl; if(!desc->height) desc->height=desc->pic_a[i]->h; } @@ -278,7 +278,7 @@ desc->font[' ']=-1; desc->width[' ']=desc->spacewidth; - MSG_OK("Font %s loaded successfully! (%d chars)\n",fname,chardb); + mpxp_ok<<"Font "<<fname<<" loaded successfully! ("<<chardb<<" chars)"<<std::endl; return desc; } Modified: mplayerxp/libvo2/osd_render.cpp =================================================================== --- mplayerxp/libvo2/osd_render.cpp 2012-12-20 17:02:24 UTC (rev 588) +++ mplayerxp/libvo2/osd_render.cpp 2012-12-21 10:48:09 UTC (rev 589) @@ -116,7 +116,7 @@ } void OSD_Render::get_draw_alpha(unsigned fmt) { - MSG_DBG2("get_draw_alpha(%s)\n",vo_format_name(fmt)); + mpxp_dbg2<<"get_draw_alpha("<<vo_format_name(fmt)<<")"<<std::endl; switch(fmt) { case IMGFMT_BGR15: case IMGFMT_RGB15: @@ -150,7 +150,7 @@ draw_alpha_ptr=draw_alpha_uyvy_ptr; break; default: - MSG_ERR("draw alpha for %s fourcc not implemented yet!",vo_format_name(fmt)); + mpxp_err<<"draw alpha for "<<vo_format_name(fmt)<<" fourcc not implemented yet!"<<std::endl; draw_alpha_ptr=vo_draw_alpha_null; break; } @@ -170,7 +170,7 @@ #ifdef __AVX__ if(gCpuCaps.hasSSE41) { - MSG_V("Using SSE4 Optimized OnScreenDisplay\n"); + mpxp_v<<"Using SSE4 Optimized OnScreenDisplay"<<std::endl; draw_alpha_yv12_ptr=vo_draw_alpha_yv12_AVX; draw_alpha_yuy2_ptr=vo_draw_alpha_yuy2_AVX; draw_alpha_rgb24_ptr=vo_draw_alpha_rgb24_AVX; @@ -181,7 +181,7 @@ #ifdef __SSE4_1__ if(gCpuCaps.hasSSE41) { - MSG_V("Using SSE4 Optimized OnScreenDisplay\n"); + mpxp_v<<"Using SSE4 Optimized OnScreenDisplay"<<std::endl; draw_alpha_yv12_ptr=vo_draw_alpha_yv12_SSE4; draw_alpha_yuy2_ptr=vo_draw_alpha_yuy2_SSE4; draw_alpha_rgb24_ptr=vo_draw_alpha_rgb24_SSE4; @@ -192,7 +192,7 @@ #ifdef __SSSE3__ if(gCpuCaps.hasSSSE3) { - MSG_V("Using SSSE3 Optimized OnScreenDisplay\n"); + mpxp_v<<"Using SSSE3 Optimized OnScreenDisplay"<<std::endl; draw_alpha_yv12_ptr=vo_draw_alpha_yv12_SSSE3; draw_alpha_yuy2_ptr=vo_draw_alpha_yuy2_SSSE3; draw_alpha_rgb24_ptr=vo_draw_alpha_rgb24_SSSE3; @@ -203,7 +203,7 @@ #ifdef __SSE3__ if(gCpuCaps.hasSSE3) { - MSG_V("Using SSE3 Optimized OnScreenDisplay\n"); + mpxp_v<<"Using SSE3 Optimized OnScreenDisplay"<<std::endl; draw_alpha_yv12_ptr=vo_draw_alpha_yv12_SSE3; draw_alpha_yuy2_ptr=vo_draw_alpha_yuy2_SSE3; draw_alpha_rgb24_ptr=vo_draw_alpha_rgb24_SSE3; @@ -214,7 +214,7 @@ #ifdef __SSE2__ if(gCpuCaps.hasSSE2) { - MSG_V("Using SSE2 Optimized OnScreenDisplay\n"); + mpxp_v<<"Using SSE2 Optimized OnScreenDisplay"<<std::endl; draw_alpha_yv12_ptr=vo_draw_alpha_yv12_SSE2; draw_alpha_yuy2_ptr=vo_draw_alpha_yuy2_SSE2; draw_alpha_rgb24_ptr=vo_draw_alpha_rgb24_SSE2; @@ -226,7 +226,7 @@ #ifdef __SSE__ if(gCpuCaps.hasMMX2) { - MSG_V("Using MMX (with tiny bit MMX2) Optimized OnScreenDisplay\n"); + mpxp_v<<"Using MMX (with tiny bit MMX2) Optimized OnScreenDisplay"<<std::endl; draw_alpha_yv12_ptr=vo_draw_alpha_yv12_SSE; draw_alpha_yuy2_ptr=vo_draw_alpha_yuy2_SSE; draw_alpha_rgb24_ptr=vo_draw_alpha_rgb24_SSE; @@ -237,7 +237,7 @@ //#ifdef __MMX__ //if(gCpuCaps.hasMMX) //{ -// MSG_V("Using MMX (with tiny bit MMX2) Optimized OnScreenDisplay\n"); +// mpxp_v<<"Using MMX (with tiny bit MMX2) Optimized OnScreenDisplay"<<std::endl; // draw_alpha_yv12_ptr=vo_draw_alpha_yv12_MMX; // draw_alpha_yuy2_ptr=vo_draw_alpha_yuy2_MMX; // draw_alpha_rgb24_ptr=vo_draw_alpha_rgb24_MMX; @@ -247,7 +247,7 @@ //#endif #endif { - MSG_V("Using generic OnScreenDisplay\n"); + mpxp_v<<"Using generic OnScreenDisplay"<<std::endl; draw_alpha_yv12_ptr=vo_draw_alpha_yv12_c; draw_alpha_yuy2_ptr=vo_draw_alpha_yuy2_c; draw_alpha_rgb24_ptr=vo_draw_alpha_rgb24_c; Modified: mplayerxp/libvo2/screenshot.cpp =================================================================== --- mplayerxp/libvo2/screenshot.cpp 2012-12-20 17:02:24 UTC (rev 588) +++ mplayerxp/libvo2/screenshot.cpp 2012-12-21 10:48:09 UTC (rev 589) @@ -56,21 +56,20 @@ png.info_ptr = png_create_info_struct(png.png_ptr); if (!png.png_ptr) { - MSG_V("PNG Failed to init png pointer\n"); - png.status = pngdata::ERROR; - return png; + mpxp_v<<"PNG Failed to init png pointer"<<std::endl; + png.status = pngdata::ERROR; + return png; } if (!png.info_ptr) { - MSG_V("PNG Failed to init png infopointer\n"); - png_destroy_write_struct(&png.png_ptr, - (png_infopp)NULL); - png.status = pngdata::ERROR; - return png; + mpxp_v<<"PNG Failed to init png infopointer"<<std::endl; + png_destroy_write_struct(&png.png_ptr,(png_infopp)NULL); + png.status = pngdata::ERROR; + return png; } if (setjmp(png.png_ptr->jmpbuf)) { - MSG_V("PNG Internal error!\n"); + mpxp_v<<"PNG Internal error!"<<std::endl; png_destroy_write_struct(&png.png_ptr, &png.info_ptr); fclose(png.fp); png.status = pngdata::ERROR; @@ -79,12 +78,12 @@ png.fp = fopen (fname, "wb"); if (png.fp == NULL) { - MSG_ERR("\nPNG Error opening %s for writing!\n", strerror(errno)); + mpxp_err<<"PNG Error opening "<<strerror(errno)<<" for writing!"<<std::endl; png.status = pngdata::ERROR; return png; } - MSG_V("PNG Init IO\n"); + mpxp_v<<"PNG Init IO"<<std::endl; png_init_io(png.png_ptr, png.fp); /* set the zlib compression level */ @@ -94,11 +93,11 @@ 8, PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); - MSG_V("PNG Write Info\n"); + mpxp_v<<"PNG Write Info"<<std::endl; png_write_info(png.png_ptr, png.info_ptr); if(sshot.cspace) { - MSG_V("PNG Set BGR Conversion\n"); + mpxp_v<<"PNG Set BGR Conversion"<<std::endl; png_set_bgr(png.png_ptr); } @@ -109,10 +108,10 @@ static uint8_t destroy_png(struct pngdata png) { - MSG_V("PNG Write End\n"); + mpxp_v<<"PNG Write End"<<std::endl; png_write_end(png.png_ptr, png.info_ptr); - MSG_V("PNG Destroy Write Struct\n"); + mpxp_v<<"PNG Destroy Write Struct"<<std::endl; png_destroy_write_struct(&png.png_ptr, &png.info_ptr); fclose (png.fp); @@ -199,31 +198,31 @@ #endif ); if(!sws) { - MSG_ERR("vo_png: Can't initialize SwScaler\n"); + mpxp_err<<"vo_png: Can't initialize SwScaler"<<std::endl; return MPXP_False; } sshot.image_width = w; sshot.image_height = h; if(!(image_data = new uint8_t[sshot.image_width*sshot.image_height*3])) { - MSG_ERR("vo_png: Can't allocate temporary buffer\n"); + mpxp_err<<"vo_png: Can't allocate temporary buffer"<<std::endl; return MPXP_False; } #ifdef HAVE_PNG if((mp_conf.z_compression >= 0) && (mp_conf.z_compression <= 9)) { if(mp_conf.z_compression == 0) { - MSG_HINT("PNG Warning: compression level set to 0, compression disabled!\n"); - MSG_HINT("PNG Info: Use the -z <n> switch to set compression level from 0 to 9.\n"); - MSG_HINT("PNG Info: (0 = no compression, 1 = fastest, lowest - 9 best, slowest compression)\n"); + mpxp_hint<<"PNG Warning: compression level set to 0, compression disabled!"<<std::endl; + mpxp_hint<<"PNG Info: Use the -z <n> switch to set compression level from 0 to 9."<<std::endl; + mpxp_hint<<"PNG Info: (0 = no compression, 1 = fastest, lowest - 9 best, slowest compression)"<<std::endl; } } else { - MSG_WARN("PNG Warning: compression level out of range setting to 1!\n"); - MSG_WARN("PNG Info: Use the -z <n> switch to set compression level from 0 to 9.\n"); - MSG_WARN("PNG Info: (0 = no compression, 1 = fastest, lowest - 9 best, slowest compression)\n"); + mpxp_warn<<"PNG Warning: compression level out of range setting to 1!"<<std::endl; + mpxp_warn<<"PNG Info: Use the -z <n> switch to set compression level from 0 to 9."<<std::endl; + mpxp_warn<<"PNG Info: (0 = no compression, 1 = fastest, lowest - 9 best, slowest compression)"<<std::endl; mp_conf.z_compression = Z_BEST_SPEED; } - MSG_V("PNG Compression level %i\n", mp_conf.z_compression); + mpxp_v<<"PNG Compression level "<<mp_conf.z_compression<<std::endl; #endif dstStride[0]=sshot.image_width*3; dstStride[1]= @@ -241,16 +240,12 @@ #ifdef HAVE_PNG png = create_png(buf); - if(png.status){ - MSG_ERR("PNG Error in create_png\n"); - } + if(png.status) mpxp_err<<"PNG Error in create_png"<<std::endl; - { - png_byte *row_pointers[sshot.image_height]; - unsigned bppmul = (bpp+7)/8; - for ( k = 0; k < sshot.image_height; k++ ) row_pointers[k] = &image_data[sshot.image_width*k*bppmul]; - png_write_image(png.png_ptr, row_pointers); - } + png_byte *row_pointers[sshot.image_height]; + unsigned bppmul = (bpp+7)/8; + for ( k = 0; k < sshot.image_height; k++ ) row_pointers[k] = &image_data[sshot.image_width*k*bppmul]; + png_write_image(png.png_ptr, row_pointers); destroy_png(png); #else Modified: mplayerxp/libvo2/sub.cpp =================================================================== --- mplayerxp/libvo2/sub.cpp 2012-12-20 17:02:24 UTC (rev 588) +++ mplayerxp/libvo2/sub.cpp 2012-12-21 10:48:09 UTC (rev 589) @@ -320,7 +320,7 @@ } if (k==MAX_UCS){ len=j; // end here - MSG_WARN("\nMAX_UCS exceeded!\n"); + mpxp_warn<<std::endl<<"MAX_UCS exceeded!"<<std::endl; } if (!c) c++; // avoid UCS 0 if (c==' '){ @@ -474,9 +474,7 @@ if(obj->bbox.y2>dys) obj->bbox.y2=dys; if(obj->flags&OSDFLAG_VISIBLE) // debug: - MSG_DBG2("OSD update: %d;%d %dx%d \n", - obj->bbox.x1,obj->bbox.y1,obj->bbox.x2-obj->bbox.x1, - obj->bbox.y2-obj->bbox.y1); + mpxp_dbg2<<"OSD update: "<<obj->bbox.x1<<";"<<obj->bbox.y1<<" "<<(obj->bbox.x2-obj->bbox.x1)<<"x"<<(obj->bbox.y2-obj->bbox.y1)<<std::endl; } // check if visibility changed: if(vis != (obj->flags&OSDFLAG_VISIBLE) ) obj->flags|=OSDFLAG_CHANGED; @@ -486,7 +484,7 @@ } if(obj->flags&OSDFLAG_CHANGED){ chg|=1<<obj->type; - MSG_DBG2("OSD chg: %d V: %s pb:%d \n",obj->type,(obj->flags&OSDFLAG_VISIBLE)?"yes":"no",vo->osd_progbar_type); + mpxp_dbg2<<"OSD chg: "<<obj->type<<" V: "<<((obj->flags&OSDFLAG_VISIBLE)?"yes":"no")<<" pb:"<<vo->osd_progbar_type<<std::endl; } obj=obj->next; } Modified: mplayerxp/libvo2/vidix_system.cpp =================================================================== --- mplayerxp/libvo2/vidix_system.cpp 2012-12-20 17:02:24 UTC (rev 588) +++ mplayerxp/libvo2/vidix_system.cpp 2012-12-21 10:48:09 UTC (rev 589) @@ -12,6 +12,8 @@ * This file contains vidix interface to any mplayer's VO plugin. * (Partly based on vesa_lvo.c from mplayer's package) */ +#include <iomanip> + #include <errno.h> #include <inttypes.h> #include <sys/ioctl.h> @@ -46,26 +48,26 @@ mp_conf.verbose)) { int err; - MSG_DBG2("vidix_preinit(%s) was called\n",drvname.c_str()); + mpxp_dbg2<<"vidix_preinit("<<drvname<<") was called"<<std::endl; if(vidix->version() != VIDIX_VERSION) { - MSG_FATAL("You have wrong version of VIDIX library\n"); + mpxp_fatal<<"You have wrong version of VIDIX library"<<std::endl; exit_player("Vidix"); } if(vidix->is_error()) { - MSG_FATAL("Couldn't find working VIDIX driver\n"); + mpxp_fatal<<"Couldn't find working VIDIX driver"<<std::endl; exit_player("Vidix"); } if((err=vidix->get_capabilities()) != 0) { - MSG_FATAL("Couldn't get capability: %s\n",strerror(err)); + mpxp_fatal<<"Couldn't get capability: "<<strerror(err)<<std::endl; exit_player("Vidix"); } - else MSG_V("Driver capability: %X\n",vidix->cap.flags); - MSG_V("Using: %s by %s\n",vidix->cap.name,vidix->cap.author); + else mpxp_v<<"Driver capability: "<<std::hex<<vidix->cap.flags<<std::endl; + mpxp_v<<"Using: "<<vidix->cap.name<<" by "<<vidix->cap.author<<std::endl; } Vidix_System::~Vidix_System() { size_t i; - MSG_DBG2("vidix_term() was called\n"); + mpxp_dbg2<<"vidix_term() was called"<<std::endl; stop(); if(vo_conf.use_bm) { for(i=0;i<vo_conf.xp_buffs;i++) { @@ -74,8 +76,7 @@ bm_buffs[i]=NULL; } if(bm_slow_frames) - MSG_WARN("from %u frames %u were copied through memcpy()\n" - ,bm_total_frames,bm_slow_frames); + mpxp_warn<<"from "<<bm_total_frames<<" frames "<<bm_slow_frames<<" were copied through memcpy()"<<std::endl; } } @@ -83,25 +84,18 @@ { int err; if((err=vidix->playback_on())!=0) { - MSG_FATAL("Can't start playback: %s\n",strerror(err)); + mpxp_fatal<<"Can't start playback: "<<strerror(err)<<std::endl; return -1; } video_on=1; if (vidix->cap.flags & FLAG_EQUALIZER) { - MSG_V("vo_gamma_brightness=%i\n" - "vo_gamma_saturation=%i\n" - "vo_gamma_contrast=%i\n" - "vo_gamma_hue=%i\n" - "vo_gamma_red_intensity=%i\n" - "vo_gamma_green_intensity=%i\n" - "vo_gamma_blue_intensity=%i\n" - ,vo_conf.gamma.brightness - ,vo_conf.gamma.saturation - ,vo_conf.gamma.contrast - ,vo_conf.gamma.hue - ,vo_conf.gamma.red_intensity - ,vo_conf.gamma.green_intensity - ,vo_conf.gamma.blue_intensity); + mpxp_v<<"vo_gamma_brightness="<<vo_conf.gamma.brightness<<std::endl; + mpxp_v<<"vo_gamma_saturation="<<vo_conf.gamma.saturation<<std::endl; + mpxp_v<<"vo_gamma_contrast="<<vo_conf.gamma.contrast<<std::endl; + mpxp_v<<"vo_gamma_hue="<<vo_conf.gamma.hue<<std::endl; + mpxp_v<<"vo_gamma_red_intensity="<<vo_conf.gamma.red_intensity<<std::endl; + mpxp_v<<"vo_gamma_green_intensity="<<vo_conf.gamma.green_intensity<<std::endl; + mpxp_v<<"vo_gamma_blue_intensity="<<vo_conf.gamma.blue_intensity<<std::endl; /* To use full set of priv.video_eq.cap */ if(vidix->get_eq() == 0) { vidix->video_eq.brightness = vo_conf.gamma.brightness; @@ -122,7 +116,7 @@ { int err; if((err=vidix->playback_off())!=0) { - MSG_ERR("Can't stop playback: %s\n",strerror(err)); + mpxp_err<<"Can't stop playback: "<<strerror(err)<<std::endl; return -1; } video_on=0; @@ -133,11 +127,11 @@ { int err,i; int dma_busy; - MSG_DBG2("vidix_copy_dma(%u,%i) was called\n",idx,sync_mode); + mpxp_dbg2<<"vidix_copy_dma("<<idx<<","<<sync_mode<<") was called"<<std::endl; bm_total_frames++; if(idx > vidix->playback.num_frames-1 && vidix->playback.num_frames>1) { - MSG_FATAL("\nDetected internal error!\n" - "Request to copy %u frame into %u array\n",idx,vidix->playback.num_frames); + mpxp_fatal<<"Detected internal error!"<<std::endl; + mpxp_fatal<<"Request to copy "<<idx<<" frame into "<<vidix->playback.num_frames<<" array"<<std::endl; return; } dma_busy = vidix->dma_status(); @@ -158,23 +152,23 @@ err=vidix->dma_copy_frame(); if(err) { /* We can switch back to DR here but for now exit */ - MSG_FATAL("\nerror '%s' occured during DMA transfer\n" - "Please send BUGREPORT to developers!!!\n",strerror(err)); + mpxp_fatal<<"error '"<<strerror(err)<<"' occured during DMA transfer"<<std::endl; + mpxp_fatal<<"Please send BUGREPORT to developers!!!"<<std::endl; exit(EXIT_FAILURE); /* it's OK vidix_term will be called */ } #if 0 - printf("frame is DMA copied\n"); + mpxp_info<<"frame is DMA copied"<<std::endl; #endif } else { memcpy(reinterpret_cast<any_t*>(reinterpret_cast<long>(vidix->playback.dga_addr)+vidix->playback.offsets[0]),bm_buffs[idx],vidix->playback.frame_size); - MSG_WARN("DMA frame is memcpy() copied\n"); + mpxp_warn<<"DMA frame is memcpy() copied"<<std::endl; bm_slow_frames++; } } MPXP_Rc Vidix_System::select_frame(unsigned idx) { - MSG_DBG2("vidix_select_frame() was called\n"); + mpxp_dbg2<<"vidix_select_frame() was called"<<std::endl; if(vo_conf.use_bm == 1) copy_dma(idx,0); else vidix->frame_select(idx); return MPXP_Ok; @@ -182,7 +176,7 @@ MPXP_Rc Vidix_System::query_fourcc(vo_query_fourcc_t* format) { - MSG_DBG2("query_format was called: %x (%s)\n",format->fourcc,vo_format_name(format->fourcc)); + mpxp_dbg2<<"query_format was called: "<<std::hex<<format->fourcc<<" ("<<vo_format_name(format->fourcc)<<")"<<std::endl; vidix->fourcc.fourcc = format->fourcc; vidix->fourcc.srcw = format->w; vidix->fourcc.srch = format->h; @@ -194,7 +188,7 @@ MPXP_Rc Vidix_System::grkey_support() const { MPXP_Rc retval = (vidix->fourcc.flags & VID_CAP_COLORKEY)?MPXP_Ok:MPXP_False; - MSG_DBG2("query_grkey_support: %i\n",retval); + mpxp_dbg2<<"query_grkey_support: "<<retval<<std::endl; return retval; } @@ -308,18 +302,14 @@ int err; static int video_clean=0; uint32_t apitch; - MSG_DBG2("vidix_init() was called\n" - "src_w=%u src_h=%u dest_x_y_w_h = %u %u %u %u\n" - "format=%s dest_bpp=%u vid_w=%u vid_h=%u\n" - ,src_width,src_height,x_org,y_org,dst_width,dst_height - ,vo_format_name(format),dest_bpp,vid_w,vid_h); + mpxp_dbg2<<"vidix_init() was called"<<std::endl; + mpxp_dbg2<<"src_w="<<src_width<<" src_h="<<src_height<<" dest_x_y_w_h = "<<x_org<<" "<<y_org<<" "<<dst_width<<" "<<dst_height<<std::endl; + mpxp_dbg2<<"format="<<vo_format_name(format)<<" dest_bpp="<<dest_bpp<<" vid_w="<<vid_w<<" vid_h="<<vid_h<<std::endl; if(((vidix->cap.maxwidth != -1) && (vid_w > (unsigned)vidix->cap.maxwidth)) || ((vidix->cap.minwidth != -1) && (vid_w < (unsigned)vidix->cap.minwidth)) || ((vidix->cap.maxheight != -1) && (vid_h > (unsigned)vidix->cap.maxheight)) || ((vidix->cap.minwidth != -1 ) && (vid_h < (unsigned)vidix->cap.minheight))) { - MSG_FATAL("video server has unsupported resolution (%dx%d), supported: %dx%d-%dx%d\n", - vid_w, vid_h, vidix->cap.minwidth, vidix->cap.minheight, - vidix->cap.maxwidth, vidix->cap.maxheight); + mpxp_fatal<<"video server has unsupported resolution ("<<vid_w<<"x"<<vid_h<<"), supported: "<<vidix->cap.maxwidth<<"x"<<vidix->cap.minwidth<<"-"<<vidix->cap.minheight<<"x"<<vidix->cap.maxheight<<std::endl; return MPXP_False; } vidix->fourcc.fourcc = format; @@ -338,18 +328,15 @@ default: err=1; break; } if(err) { - MSG_FATAL("video server has unsupported color depth by vidix (%d)\n" - ,vidix->fourcc.depth); - return MPXP_False; + mpxp_fatal<<"video server has unsupported color depth by vidix ("<<vidix->fourcc.depth<<")"<<std::endl; + return MPXP_False; } if((dst_width > src_width || dst_height > src_height) && (vidix->cap.flags & FLAG_UPSCALER) != FLAG_UPSCALER) { - MSG_FATAL("vidix driver can't upscale image (%d%d -> %d%d)\n", - src_width, src_height, dst_width, dst_height); + mpxp_fatal<<"vidix driver can't upscale image ("<<src_width<<"x"<<src_height<<" -> "<<dst_width<<"x"<<dst_height<<")"<<std::endl; return MPXP_False; } if((dst_width > src_width || dst_height > src_height) && (vidix->cap.flags & FLAG_DOWNSCALER) != FLAG_DOWNSCALER) { - MSG_FATAL("vidix driver can't downscale image (%d%d -> %d%d)\n", - src_width, src_height, dst_width, dst_height); + mpxp_fatal<<"vidix driver can't downscale image ("<<src_width<<"x"<<src_height<<" -> "<<dst_width<<"x"<<dst_height<<")"<<std::endl; return MPXP_False; } image_width = src_width; @@ -372,10 +359,10 @@ if(vidix->playback.num_frames > vo_conf.xp_buffs) vidix->playback.num_frames = vo_conf.xp_buffs; vidix->playback.src.pitch.y = vidix->playback.src.pitch.u = vidix->playback.src.pitch.v = 0; if((err=vidix->config_playback())!=0) { - MSG_FATAL("Can't configure playback: %s\n",strerror(err)); + mpxp_fatal<<"Can't configure playback: "<<strerror(err)<<std::endl; return MPXP_False; } - MSG_V("using %d buffers\n", vidix->playback.num_frames); + mpxp_v<<"using "<<vidix->playback.num_frames<<" buffers"<<std::endl; /* configure busmastering */ if(vo_conf.use_bm) { if(vidix->cap.flags & FLAG_DMA) { @@ -384,12 +371,12 @@ for(i=0;i<vo_conf.xp_buffs;i++) { if(!bm_buffs[i]) bm_buffs[i] = new(alignmem,psize) uint8_t[vidix->playback.frame_size]; if(!(bm_buffs[i])) { - MSG_ERR("Can't allocate memory for busmastering\n"); + mpxp_err<<"Can't allocate memory for busmastering"<<std::endl; return MPXP_False; } if(mlock(bm_buffs[i],vidix->playback.frame_size) != 0) { unsigned j; - MSG_WARN("Can't lock memory for busmastering\n"); + mpxp_warn<<"Can't lock memory for busmastering"<<std::endl; for(j=0;j<i;j++) munlock(bm_buffs[i],vidix->playback.frame_size); bm_locked=0; } @@ -398,10 +385,10 @@ bm_total_frames=bm_slow_frames=0; } else - MSG_ERR("Can not configure bus mastering: your driver is not DMA capable\n"); + mpxp_err<<"Can not configure bus mastering: your driver is not DMA capable"<<std::endl; vo_conf.use_bm = 0; } - if(vo_conf.use_bm) MSG_OK("using BUSMASTERING\n"); + if(vo_conf.use_bm) mpxp_ok<<"using BUSMASTERING"<<std::endl; mem = static_cast<uint8_t*>(vidix->playback.dga_addr); if(!video_clean) { @@ -411,7 +398,7 @@ memset(mem + vidix->playback.offsets[i], 0x80, vidix->playback.frame_size); video_clean=1; } - MSG_DBG2("vidix returns pitches %u %u %u\n",vidix->playback.dest.pitch.y,vidix->playback.dest.pitch.u,vidix->playback.dest.pitch.v); + mpxp_dbg2<<"vidix returns pitches "<<vidix->playback.dest.pitch.y<<" "<<vidix->playback.dest.pitch.u<<" "<<vidix->playback.dest.pitch.v<<std::endl; switch(format) { case IMGFMT_Y800: case IMGFMT_YVU9: Modified: mplayerxp/libvo2/vo_fbdev.cpp =================================================================== --- mplayerxp/libvo2/vo_fbdev.cpp 2012-12-20 17:02:24 UTC (rev 588) +++ mplayerxp/libvo2/vo_fbdev.cpp 2012-12-21 10:48:09 UTC (rev 589) @@ -9,7 +9,7 @@ * Some idea and code borrowed from Chris Lawrence's ppmtofb-0.27 */ -#define FBDEV "fbdev: " +static const char* FBDEV= "fbdev: "; #include <stdio.h> #include <stdlib.h> @@ -39,15 +39,6 @@ #include "vo_msg.h" namespace mpxp { -#define PRINT_LINENUM //MSG_DBG2(" at line %d\n", line_num) - -#define MAX_NR_TOKEN 16 - -#define MAX_LINE_LEN 1000 - -#define RET_EOF -1 -#define RET_EOL -2 - struct priv_conf_t { priv_conf_t(); ~priv_conf_t() {} @@ -60,9 +51,14 @@ const char* monitor_dotclock_str; }; static priv_conf_t priv_conf; +static const int MAX_NR_TOKEN=16; +static const int MAX_LINE_LEN=1000; +static const int RET_EOF=-1; +static const int RET_EOL=-2; priv_conf_t::priv_conf_t() { mode_cfgfile = "/etc/priv.modes"; } +inline void PRINT_LINENUM(int line_num) { mpxp_dbg2<<" at line "<<line_num<<std::endl; } static const mrl_config_t fbconf[]= { @@ -88,11 +84,11 @@ static int __FASTCALL__ validate_mode(fb_mode_t *m) { if (!m->xres) { - MSG_V("needs geometry "); + mpxp_v<<"needs geometry "; return 0; } if (!m->pixclock) { - MSG_V("needs timings "); + mpxp_v<<"needs timings "; return 0; } return 1; @@ -213,26 +209,26 @@ if (!priv_conf.dev_name && !(priv_conf.dev_name = getenv("FRAMEBUFFER"))) priv_conf.dev_name = (char *)"/dev/fb0"; - MSG_DBG2(FBDEV "using %s\n", priv_conf.dev_name); + mpxp_dbg2<<FBDEV<< "using "<<priv_conf.dev_name<<std::endl; - if ((dev_fd = open(priv_conf.dev_name, O_RDWR)) == -1) { - MSG_ERR(FBDEV "Can't open %s: %s\n", priv_conf.dev_name, strerror(errno)); + if ((dev_fd = ::open(priv_conf.dev_name, O_RDWR)) == -1) { + mpxp_err<<FBDEV<< "Can't open "<<priv_conf.dev_name<<": "<<strerror(errno)<<std::endl; goto err_out; } - if (ioctl(dev_fd, FBIOGET_VSCREENINFO, &vinfo)) { - MSG_ERR(FBDEV "Can't get VSCREENINFO: %s\n", strerror(errno)); + if (::ioctl(dev_fd, FBIOGET_VSCREENINFO, &vinfo)) { + mpxp_err<<FBDEV<< "Can't get VSCREENINFO: "<<strerror(errno)<<std::endl; goto err_out_fd; } orig_vinfo = vinfo; - if ((tty_fd = open("/dev/tty", O_RDWR)) < 0) { - MSG_DBG2(FBDEV "notice: Can't open /dev/tty: %s\n", strerror(errno)); + if ((tty_fd = ::open("/dev/tty", O_RDWR)) < 0) { + mpxp_dbg2<<FBDEV<< "notice: Can't open /dev/tty: "<<strerror(errno)<<std::endl; } bpp = vinfo.bits_per_pixel; if (bpp == 8 && !vo_conf.dbpp) { - MSG_ERR(FBDEV "8 bpp output is not supported.\n"); + mpxp_err<<FBDEV<< "8 bpp output is not supported."<<std::endl; goto err_out_tty_fd; } @@ -242,7 +238,7 @@ if (vo_conf.dbpp) { if (vo_conf.dbpp != 15 && vo_conf.dbpp != 16 && vo_conf.dbpp != 24 && vo_conf.dbpp != 32) { - MSG_ERR(FBDEV "can't switch to %d bpp\n", vo_conf.dbpp); + mpxp_err<<FBDEV<< "can't switch to "<<vo_conf.dbpp<<" bpp"<<std::endl; goto err_out_fd; } bpp = vo_conf.dbpp; @@ -252,10 +248,10 @@ fb_works = MPXP_Ok; return MPXP_Ok; err_out_tty_fd: - close(tty_fd); + ::close(tty_fd); tty_fd = -1; err_out_fd: - close(dev_fd); + ::close(dev_fd); dev_fd = -1; err_out: fb_preinit_done = 1; @@ -266,27 +262,27 @@ FBDev_VO_Interface::~FBDev_VO_Interface() { unsigned i; - MSG_V(FBDEV "uninit\n"); + mpxp_v<<FBDEV<< "uninit"<<std::endl; if (cmap_changed) { - if (ioctl(dev_fd, FBIOPUTCMAP, &oldcmap)) - MSG_ERR(FBDEV "Can't restore original cmap\n"); + if (::ioctl(dev_fd, FBIOPUTCMAP, &oldcmap)) + mpxp_err<<FBDEV<< "Can't restore original cmap"<<std::endl; cmap_changed = 0; } for(i=0;i<total_fr;i++) delete next_frame[i]; - if (ioctl(dev_fd, FBIOGET_VSCREENINFO, &vinfo)) - MSG_ERR(FBDEV "ioctl FBIOGET_VSCREENINFO: %s\n", strerror(errno)); + if (::ioctl(dev_fd, FBIOGET_VSCREENINFO, &vinfo)) + mpxp_err<<FBDEV<< "ioctl FBIOGET_VSCREENINFO: "<<strerror(errno)<<std::endl; orig_vinfo.xoffset = vinfo.xoffset; orig_vinfo.yoffset = vinfo.yoffset; - if (ioctl(dev_fd, FBIOPUT_VSCREENINFO, &orig_vinfo)) - MSG_ERR(FBDEV "Can't reset original fb_var_screeninfo: %s\n", strerror(errno)); + if (::ioctl(dev_fd, FBIOPUT_VSCREENINFO, &orig_vinfo)) + mpxp_err<<FBDEV<< "Can't reset original fb_var_screeninfo: "<<strerror(errno)<<std::endl; if (tty_fd >= 0) { - if (ioctl(tty_fd, KDSETMODE, KD_TEXT) < 0) - MSG_ERR(FBDEV "Can't restore text mode: %s\n", strerror(errno)); + if (::ioctl(tty_fd, KDSETMODE, KD_TEXT) < 0) + mpxp_err<<FBDEV<< "Can't restore text mode: "<<strerror(errno)<<std::endl; } if (vt_doit) vt_set_textarea(0, orig_vinfo.yres); - close(tty_fd); - close(dev_fd); - if(frame_buffer) munmap(frame_buffer,size); + ::close(tty_fd); + ::close(dev_fd); + if(frame_buffer) ::munmap(frame_buffer,size); #ifdef CONFIG_VIDIX if(vidix) delete vidix; #endif @@ -301,7 +297,7 @@ #ifdef CONFIG_VIDIX if(!vidix_name.empty()) { if(!(vidix=new(zeromem) Vidix_System(vidix_name))) { - MSG_ERR("Cannot initialze vidix with '%s' argument\n",vidix_name.c_str()); + mpxp_err<<"Cannot initialze vidix with '"<<vidix_name<<"' argument"<<std::endl; exit_player("Vidix error"); } } @@ -317,7 +313,7 @@ char c; if (num >= MAX_NR_TOKEN) { - MSG_ERR("get_token(): max >= MAX_NR_TOKEN!"); + mpxp_err<<"get_token(): max >= MAX_NR_TOKEN!"<<std::endl; goto out_eof; } @@ -361,30 +357,24 @@ static fb_mode_t *fb_modes = NULL; static int nr_modes = 0; +static void check_in_mode_def(int in_mode_def) { if (!in_mode_def) mpxp_dbg2<<"'needs 'mode' first"<<std::endl; } + int FBDev_VO_Interface::parse_fbmode_cfg(const std::string& cfgfile) { -#define CHECK_IN_MODE_DEF\ - do {\ - if (!in_mode_def) {\ - MSG_DBG2("'needs 'mode' first");\ - goto err_out_print_linenum;\ - }\ - } while (0) - fb_mode_t *_mode = NULL; char *endptr; // strtoul()... int in_mode_def = 0; int tmp, i; - MSG_DBG2("Reading %s: ", cfgfile.c_str()); + mpxp_dbg2<<"Reading "<<cfgfile.c_str()<<":"; if ((fp = fopen(cfgfile.c_str(), "r")) == NULL) { - MSG_ERR("can't open '%s': %s\n", cfgfile.c_str(), strerror(errno)); + mpxp_err<<"can't open '"<<cfgfile<<"': "<<strerror(errno)<<std::endl; return -1; } if ((line = new char[MAX_LINE_LEN + 1]) == NULL) { - MSG_ERR("can't get memory for 'line': %s\n", strerror(errno)); + mpxp_err<<"can't get memory for 'line': "<<strerror(errno)<<std::endl; return -2; } @@ -400,15 +390,14 @@ if (tmp == RET_EOL) continue; if (!strcmp(token[0], "mode")) { if (in_mode_def) { - MSG_ERR("'endmode' required"); + mpxp_err<<"'endmode' required"<<std::endl; goto err_out_print_linenum; } if (!validate_mode(_mode)) goto err_out_not_valid; loop_enter: if (!(fb_modes = (fb_mode_t *) mp_realloc(fb_modes, sizeof(fb_mode_t) * (nr_modes + 1)))) { - MSG_ERR("can't mp_realloc 'fb_modes' (nr_modes = %d):" - " %s\n", nr_modes, strerror(errno)); + mpxp_err<<"can't mp_realloc 'fb_modes' (nr_modes = "<<nr_modes<<")"<<strerror(errno)<<std::endl; goto err_out; } _mode=fb_modes + nr_modes; @@ -418,17 +407,17 @@ if (get_token(1) < 0) goto err_out_parse_error; for (i = 0; i < nr_modes - 1; i++) { if (!strcmp(token[0], fb_modes[i].name)) { - MSG_ERR("mode name '%s' isn't unique", token[0]); + mpxp_err<<"mode name '"<<token[0]<<"' isn't unique"<<std::endl; goto err_out_print_linenum; } } if (!(_mode->name = mp_strdup(token[0]))) { - MSG_ERR("can't mp_strdup -> 'name': %s\n", strerror(errno)); + mpxp_err<<"can't mp_strdup -> 'name': "<<strerror(errno)<<std::endl; goto err_out; } in_mode_def = 1; } else if (!strcmp(token[0], "geometry")) { - CHECK_IN_MODE_DEF; + check_in_mode_def(in_mode_def); goto err_out_print_linenum; if (get_token(5) < 0) goto err_out_parse_error; _mode->xres = strtoul(token[0], &endptr, 0); if (*endptr) goto err_out_parse_error; @@ -441,7 +430,7 @@ _mode->depth = strtoul(token[4], &endptr, 0); if (*endptr) goto err_out_parse_error; } else if (!strcmp(token[0], "timings")) { - CHECK_IN_MODE_DEF; + check_in_mode_def(in_mode_def); goto err_out_print_linenum; if (get_token(7) < 0) goto err_out_parse_error; _mode->pixclock = strtoul(token[0], &endptr, 0); if (*endptr) goto err_out_parse_error; @@ -458,47 +447,47 @@ _mode->vslen = strtoul(token[6], &endptr, 0); if (*endptr) goto err_out_parse_error; } else if (!strcmp(token[0], "endmode")) { - CHECK_IN_MODE_DEF; + check_in_mode_def(in_mode_def); goto err_out_print_linenum; in_mode_def = 0; } else if (!strcmp(token[0], "accel")) { - CHECK_IN_MODE_DEF; + check_in_mode_def(in_mode_def); goto err_out_print_linenum; if (get_token(1) < 0) goto err_out_parse_error; /* * it's only used for text acceleration * so we just ignore it. */ } else if (!strcmp(token[0], "hsync")) { - CHECK_IN_MODE_DEF; + check_in_mode_def(in_mode_def); goto err_out_print_linenum; if (get_token(1) < 0) goto err_out_parse_error; if (!strcmp(token[0], "low")) _mode->sync &= ~FB_SYNC_HOR_HIGH_ACT; else if(!strcmp(token[0], "high")) _mode->sync |= FB_SYNC_HOR_HIGH_ACT; else goto err_out_parse_error; } else if (!strcmp(token[0], "vsync")) { - CHECK_IN_MODE_DEF; + check_in_mode_def(in_mode_def); goto err_out_print_linenum; if (get_token(1) < 0) goto err_out_parse_error; if (!strcmp(token[0], "low")) _mode->sync &= ~FB_SYNC_VERT_HIGH_ACT; else if(!strcmp(token[0], "high")) _mode->sync |= FB_SYNC_VERT_HIGH_ACT; else goto err_out_parse_error; } else if (!strcmp(token[0], "csync")) { - CHECK_IN_MODE_DEF; + check_in_mode_def(in_mode_def); goto err_out_print_linenum; if (get_token(1) < 0) goto err_out_parse_error; if (!strcmp(token[0], "low")) _mode->sync &= ~FB_SYNC_COMP_HIGH_ACT; else if(!strcmp(token[0], "high")) _mode->sync |= FB_SYNC_COMP_HIGH_ACT; else goto err_out_parse_error; } else if (!strcmp(token[0], "extsync")) { - CHECK_IN_MODE_DEF; + check_in_mode_def(in_mode_def); goto err_out_print_linenum; if (get_token(1) < 0) goto err_out_parse_error; if (!strcmp(token[0], "false")) _mode->sync &= ~FB_SYNC_EXT; else if(!strcmp(token[0], "true")) _mode->sync |= FB_SYNC_EXT; else goto err_out_parse_error; } else if (!strcmp(token[0], "laced")) { - CHECK_IN_MODE_DEF; + check_in_mode_def(in_mode_def); goto err_out_print_linenum; if (get_token(1) < 0) goto err_out_parse_error; if (!strcmp(token[0], "false")) _mode->vmode = FB_VMODE_NONINTERLACED; else if (!strcmp(token[0], "true")) _mode->vmode = FB_VMODE_INTERLACED; else goto err_out_parse_error; } else if (!strcmp(token[0], "double")) { - CHECK_IN_MODE_DEF; + check_in_mode_def(in_mode_def); goto err_out_print_linenum; if (get_token(1) < 0) goto err_out_parse_error; if (!strcmp(token[0], "false")) ; else if (!strcmp(token[0], "true")) _mode->vmode = FB_VMODE_DOUBLE; @@ -507,14 +496,14 @@ } if (!validate_mode(_mode)) goto err_out_not_valid; out: - MSG_DBG2("%d modes\n", nr_modes); + mpxp_dbg2<<nr_modes<<"modes"<<std::endl; delete line; fclose(fp); return nr_modes; err_out_parse_error: - MSG_ERR("parse error"); + mpxp_err<<"parse error"; err_out_print_linenum: - PRINT_LINENUM; + PRINT_LINENUM(line_num); err_out: if (fb_modes) { delete fb_modes; @@ -525,7 +514,7 @@ delete fp; return -2; err_out_not_valid: - MSG_ERR("previous mode is not correct"); + mpxp_err<<"previous mode is not correct"<<std::endl; goto err_out_print_linenum; } @@ -572,21 +561,21 @@ float d = dcf(m); int ret = 1; - MSG_DBG2(FBDEV "mode %dx%d:", m->xres, m->yres); + mpxp_dbg2<<FBDEV<< "mode "<<m->xres<<"x"<<m->yres<<":"; if (!in_range(hfreq, h)) { ret = 0; - MSG_DBG2(" hsync out of range."); + mpxp_dbg2<<" hsync out of range."; } if (!in_range(vfreq, v)) { ret = 0; - MSG_DBG2(" vsync out of range."); + mpxp_dbg2<<" vsync out of range."; } if (!in_range(dotclock, d)) { ret = 0; - MSG_DBG2(" dotclock out of range."); + mpxp_dbg2<<" dotclock out of range."; } - if (ret) MSG_DBG2(" hsync, vsync, dotclock ok.\n"); - else MSG_DBG2("\n"); + if (ret) mpxp_dbg2<<" hsync, vsync, dotclock ok."<<std::endl; + else mpxp_dbg2<<std::endl; return ret; } @@ -597,7 +586,7 @@ fb_mode_t *best = fb_modes; fb_mode_t *curr; - MSG_DBG2(FBDEV "Searching for first working mode\n"); + mpxp_dbg2<<FBDEV<< "Searching for first working mode"<<std::endl; for (i = 0; i < nr_modes; i++, best++) if (mode_works(best, hfreq, vfreq, dotclock)) @@ -608,34 +597,32 @@ if (i == nr_modes - 1) return best; - MSG_DBG2(FBDEV "First working mode: %dx%d\n", best->xres, best->yres); - MSG_DBG2(FBDEV "Searching for better modes\n"); + mpxp_dbg2<<FBDEV<< "First working mode: "<<best->xres<<"x"<<best->yres<<std::endl; + mpxp_dbg2<<FBDEV<< "Searching for better modes"<<std::endl; for (curr = best + 1; i < nr_modes - 1; i++, curr++) { if (!mode_works(curr, hfreq, vfreq, dotclock)) continue; - MSG_DBG2(FBDEV); + mpxp_dbg2<<FBDEV; if (best->xres < xres || best->yres < yres) { if (curr->xres > best->xres || curr->yres > best->yres) { - MSG_DBG2("better than %dx%d, which is too small.\n", - best->xres, best->yres); + mpxp_dbg2<<"better than "<<best->xres<<"x"<<best->yres<<", which is too small."<<std::endl; best = curr; - } else MSG_DBG2("too small.\n"); + } else mpxp_dbg2<<"too small."<<std::endl; } else if (curr->xres == best->xres && curr->yres == best->yres && vsf(curr) > vsf(best)) { - MSG_DBG2("faster screen refresh.\n"); + mpxp_dbg2<<"faster screen refresh."<<std::endl; best = curr; } else if ((curr->xres <= best->xres && curr->yres <= best->yres) && (curr->xres >= xres && curr->yres >= yres)) { - MSG_DBG2("better than %dx%d, which is too large.\n", - best->xres, best->yres); + mpxp_dbg2<<"better than "<<best->xres<<"x"<<best->yres<<", which is too large."<<std::endl; best = curr; } else { - if (curr->xres < xres || curr->yres < yres) MSG_DBG2("too small.\n"); - else if (curr->xres > best->xres || curr->yres > best->yres) MSG_DBG2("too large.\n"); - else MSG_DBG2("it's worse, don't know why.\n"); + if (curr->xres < xres || curr->yres < yres) mpxp_dbg2<<"too small."<<std::endl; + else if (curr->xres > best->xres || curr->yres > best->yres) mpxp_dbg2<<"too large."<<std::endl; + else mpxp_dbg2<<"it's worse, don't know why."<<std::endl; } } return best; @@ -704,7 +691,7 @@ for (i = 0; *endptr; i++) { if (*s == ',') goto out_err; if (!(r = (range_t *) mp_realloc(r, sizeof(*r) * (i + 2)))) { - MSG_ERR("can't mp_realloc 'r'\n"); + mpxp_err<<"can't mp_realloc 'r'"<<std::endl; return NULL; } tmp_min = strtod(s, const_cast<char**>(&endptr)); @@ -768,7 +755,7 @@ red = new uint16_t [cols]; if(!red) { - MSG_ERR("Can't allocate red palette with %d entries.\n", cols); + mpxp_err<<"Can't allocate red palette with "<<cols<<" entries"<<std::endl; return NULL; } for(i=0; i< rcols; i++) @@ -776,7 +763,7 @@ green = new uint16_t[cols]; if(!green) { - MSG_ERR("Can't allocate green palette with %d entries.\n", cols); + mpxp_err<<"Can't allocate green palette with "<<cols<<" entries"<<std::endl; delete red; return NULL; } @@ -785,7 +772,7 @@ blue = new uint16_t[cols]; if(!blue) { - MSG_ERR("Can't allocate blue palette with %d entries.\n", cols); + mpxp_err<<"Can't allocate blue palette with "<<cols<<" entries"<<std::endl; delete red; delete green; return NULL; @@ -795,7 +782,7 @@ cmap = new struct fb_cmap; if(!cmap) { - MSG_ERR("Can't allocate color map\n"); + mpxp_err<<"Can't allocate color map"<<std::endl; delete red; delete green; delete blue; @@ -814,69 +801,57 @@ void FBDev_VO_Interface::lots_of_printf() const { - MSG_V(FBDEV "var info:\n"); - MSG_V(FBDEV "xres: %u\n", vinfo.xres); - MSG_V(FBDEV "yres: %u\n", vinfo.yres); - MSG_V(FBDEV "xres_virtual: %u\n", vinfo.xres_virtual); - MSG_V(FBDEV "yres_virtual: %u\n", vinfo.yres_virtual); - MSG_V(FBDEV "xoffset: %u\n", vinfo.xoffset); - MSG_V(FBDEV "yoffset: %u\n", vinfo.yoffset); - MSG_V(FBDEV "bits_per_pixel: %u\n", vinfo.bits_per_pixel); - MSG_V(FBDEV "grayscale: %u\n", vinfo.grayscale); - MSG_V(FBDEV "red: %lu %lu %lu\n", - (unsigned long) vinfo.red.offset, - (unsigned long) vinfo.red.length, - (unsigned long) vinfo.red.msb_right); - MSG_V(FBDEV "green: %lu %lu %lu\n", - (unsigned long) vinfo.green.offset, - (unsigned long) vinfo.green.length, - (unsigned long) vinfo.green.msb_right); - MSG_V(FBDEV "blue: %lu %lu %lu\n", - (unsigned long) vinfo.blue.offset, - (unsigned long) vinfo.blue.length, - (unsigned long) vinfo.blue.msb_right); - MSG_V(FBDEV "transp: %lu %lu %lu\n", - (unsigned long) vinfo.transp.offset, - (unsigned long) vinfo.transp.length, - (unsigned long) vinfo.transp.msb_right); - MSG_V(FBDEV "nonstd: %u\n", vinfo.nonstd); - MSG_DBG2(FBDEV "activate: %u\n", vinfo.activate); - MSG_DBG2(FBDEV "height: %u\n", vinfo.height); - MSG_DBG2(FBDEV "width: %u\n", vinfo.width); - MSG_DBG2(FBDEV "accel_flags: %u\n", vinfo.accel_flags); - MSG_DBG2(FBDEV "timing:\n"); - MSG_DBG2(FBDEV "pixclock: %u\n", vinfo.pixclock); - MSG_DBG2(FBDEV "left_margin: %u\n", vinfo.left_margin); - MSG_DBG2(FBDEV "right_margin: %u\n", vinfo.right_margin); - MSG_DBG2(FBDEV "upper_margin: %u\n", vinfo.upper_margin); - MSG_DBG2(FBDEV "lower_margin: %u\n", vinfo.lower_margin); - MSG_DBG2(FBDEV "hsync_len: %u\n", vinfo.hsync_len); - MSG_DBG2(FBDEV "vsync_len: %u\n", vinfo.vsync_len); - MSG_DBG2(FBDEV "sync: %u\n", vinfo.sync); - MSG_DBG2(FBDEV "vmode: %u\n", vinfo.vmode); - MSG_V(FBDEV "fix info:\n"); - MSG_V(FBDEV "framebuffer size: %d bytes\n", finfo.smem_len); - MSG_V(FBDEV "type: %lu\n", (unsigned long) finfo.type); - MSG_V(FBDEV "type_aux: %lu\n", (unsigned long) finfo.type_aux); - MSG_V(FBDEV "visual: %lu\n", (unsigned long) finfo.visual); - MSG_V(FBDEV "line_length: %lu bytes\n", (unsigned long) finfo.line_length); - MSG_DBG2(FBDEV "id: %.16s\n", finfo.id); - MSG_DBG2(FBDEV "smem_start: %p\n", (any_t*) finfo.smem_start); - MSG_DBG2(FBDEV "xpanstep: %u\n", finfo.xpanstep); - MSG_DBG2(FBDEV "ypanstep: %u\n", finfo.ypanstep); - MSG_DBG2(FBDEV "ywrapstep: %u\n", finfo.ywrapstep); - MSG_DBG2(FBDEV "mmio_start: %p\n", (any_t*) finfo.mmio_start); - MSG_DBG2(FBDEV "mmio_len: %u bytes\n", finfo.mmio_len); - MSG_DBG2(FBDEV "accel: %u\n", finfo.accel); - MSG_V(FBDEV "priv.bpp: %d\n", bpp); - MSG_V(FBDEV "priv.real_bpp: %d\n", real_bpp); - MSG_V(FBDEV "priv.pixel_size: %d bytes\n",pixel_size); - MSG_V(FBDEV "other:\n"); - MSG_V(FBDEV "priv.in_width: %d\n", in_width); - MSG_V(FBDEV "priv.in_height: %d\n", in_height); - MSG_V(FBDEV "priv.out_width: %d\n", out_width); - MSG_V(FBDEV "priv.out_height: %d\n", out_height); - MSG_V(FBDEV "priv.last_row: %d\n", last_row); + mpxp_v<<FBDEV<< "var info:"<<std::endl; + mpxp_v<<FBDEV<< "xres: "<<vinfo.xres<<std::endl; + mpxp_v<<FBDEV<< "yres: "<<vinfo.yres<<std::endl; + mpxp_v<<FBDEV<< "xres_virtual: "<<vinfo.xres_virtual<<std::endl; + mpxp_v<<FBDEV<< "yres_virtual: "<<vinfo.yres_virtual<<std::endl; + mpxp_v<<FBDEV<< "xoffset: "<<vinfo.xoffset<<std::endl; + mpxp_v<<FBDEV<< "yoffset: "<<vinfo.yoffset<<std::endl; + mpxp_v<<FBDEV<< "bits_per_pixel: "<<vinfo.bits_per_pixel<<std::endl; + mpxp_v<<FBDEV<< "grayscale: "<<vinfo.grayscale<<std::endl; + mpxp_v<<FBDEV<< "red: "<<vinfo.red.offset<<" "<<vinfo.red.length<<" "<<vinfo.red.msb_right<<std::endl; + mpxp_v<<FBDEV<< "green: "<<vinfo.green.offset<<" "<<vinfo.green.length<<" "<<vinfo.green.msb_right<<std::endl; + mpxp_v<<FBDEV<< "blue: "<<vinfo.blue.offset<<" "<<vinfo.blue.length<<" "<<vinfo.blue.msb_right<<std::endl; + mpxp_v<<FBDEV<< "transp: "<<vinfo.transp.offset<<" "<<vinfo.transp.length<<" "<<vinfo.transp.msb_right<<std::endl; + mpxp_v<<FBDEV<< "nonstd: "<<vinfo.nonstd<<std::endl; + mpxp_dbg2<<FBDEV<< "activate: "<<vinfo.activate<<std::endl; + mpxp_dbg2<<FBDEV<< "height: "<<vinfo.height<<std::endl; + mpxp_dbg2<<FBDEV<< "width: "<<vinfo.width<<std::endl; + mpxp_dbg2<<FBDEV<< "accel_flags: "<<vinfo.accel_flags<<std::endl; + mpxp_dbg2<<FBDEV<< "timing:"<<std::endl; + mpxp_dbg2<<FBDEV<< "pixclock: "<<vinfo.pixclock<<std::endl; + mpxp_dbg2<<FBDEV<< "left_margin: "<<vinfo.left_margin<<std::endl; + mpxp_dbg2<<FBDEV<< "right_margin: "<<vinfo.right_margin<<std::endl; + mpxp_dbg2<<FBDEV<< "upper_margin: "<<vinfo.upper_margin<<std::endl; + mpxp_dbg2<<FBDEV<< "lower_margin: "<<vinfo.lower_margin<<std::endl; + mpxp_dbg2<<FBDEV<< "hsync_len: "<<vinfo.hsync_len<<std::endl; + mpxp_dbg2<<FBDEV<< "vsync_len: "<<vinfo.vsync_len<<std::endl; + mpxp_dbg2<<FBDEV<< "sync: "<<vinfo.sync<<std::endl; + mpxp_dbg2<<FBDEV<< "vmode: "<<vinfo.vmode<<std::endl; + mpxp_v<<FBDEV<< "fix info:"<<std::endl; + mpxp_v<<FBDEV<< "framebuffer size: "<<finfo.smem_len<<" bytes"<<std::endl; + mpxp_v<<FBDEV<< "type: "<<finfo.type<<std::endl; + mpxp_v<<FBDEV<< "type_aux: "<<finfo.type_aux<<std::endl; + mpxp_v<<FBDEV<< "visual: "<<finfo.visual<<std::endl; + mpxp_v<<FBDEV<< "line_length: "<<finfo.line_length<<" bytes"<<std::endl; + mpxp_dbg2<<FBDEV<< "id: "<<finfo.id<<std::endl; + mpxp_dbg2<<FBDEV<< "smem_start: "<<std::hex<<reinterpret_cast<any_t*>(finfo.smem_start)<<std::endl; + mpxp_dbg2<<FBDEV<< "xpanstep: "<<finfo.xpanstep<<std::endl; + mpxp_dbg2<<FBDEV<< "ypanstep: "<<finfo.ypanstep<<std::endl; + mpxp_dbg2<<FBDEV<< "ywrapstep: "<<finfo.ywrapstep<<std::endl; + mpxp_dbg2<<FBDEV<< "mmio_start: "<<std::hex<<reinterpret_cast<any_t*>(finfo.mmio_start)<<std::endl; + mpxp_dbg2<<FBDEV<< "mmio_len: "<<finfo.mmio_len<<" bytes"<<std::endl; + mpxp_dbg2<<FBDEV<< "accel: "<<finfo.accel<<std::endl; + mpxp_v<<FBDEV<< "priv.bpp: "<<bpp<<std::endl; + mpxp_v<<FBDEV<< "priv.real_bpp: "<<real_bpp<<std::endl; + mpxp_v<<FBDEV<< "priv.pixel_size: "<<pixel_size<<" bytes"<<std::endl; + mpxp_v<<FBDEV<< "other:"<<std::endl; + mpxp_v<<FBDEV<< "priv.in_width: "<<in_width<<std::endl; + mpxp_v<<FBDEV<< "priv.in_height: "<<in_height<<std::endl; + mpxp_v<<FBDEV<< "priv.out_width: "<<out_width<<std::endl; + mpxp_v<<FBDEV<< "priv.out_height: "<<out_height<<std::endl; + mpxp_v<<FBDEV<< "priv.last_row: "<<last_row<<std::endl; } void FBDev_VO_Interface::vt_set_textarea(int u, int l) @@ -888,9 +863,9 @@ int lrow = l / 16; if (mp_conf.verbose > 1) - MSG_DBG2(FBDEV "vt_set_textarea(%d,%d): %d,%d\n", u, l, urow, lrow); - fprintf(vt_fp, "\33[%d;%dr\33[%d;%dH", urow, lrow, lrow, 0); - fflush(vt_fp); + mpxp_dbg2<<FBDEV<< "vt_set_textarea("<<u<<","<<l<<"): "<<urow<<","<<lrow<<std::endl; + ::fprintf(vt_fp, "\33[%d;%dr\33[%d;%dH", urow, lrow, lrow, 0); + ::fflush(vt_fp); } MPXP_Rc FBDev_VO_Interface::configure(uint32_t width, uint32_t height, uint32_t d_width, @@ -904,13 +879,13 @@ UNUSED(title); srcFourcc = format; if((int)pre_init_err == MPXP_Error) { - MSG_ERR(FBDEV "Internal fatal error: init() was called before preinit()\n"); + mpxp_err<<FBDEV<< "Internal fatal error: init() was called before preinit()"<<std::endl; return MPXP_False; } if (pre_init_err!=MPXP_Ok) return MPXP_False; if (priv_conf.mode_name && !flags&VOFLAG_MODESWITCHING) { - MSG_ERR(FBDEV "-fbmode can only be used with -vm\n"); + mpxp_err<<FBDEV<< "-fbmode can only be used with -vm"<<std::endl; return MPXP_False; } if ((flags&VOFLAG_MODESWITCHING) && (parse_fbmode_cfg(priv_conf.mode_cfgfile) < 0)) return MPXP_False; @@ -927,7 +902,7 @@ if (priv_conf.mode_name) { if (!(mode = find_mode_by_name(priv_conf.mode_name))) { - MSG_ERR(FBDEV "can't find requested video mode\n"); + mpxp_err<<FBDEV<< "can't find requested video mode"<<std::endl; return MPXP_False; } fb_mode2fb_vinfo(mode, &vinfo); @@ -936,18 +911,16 @@ monitor_vfreq = str2range(priv_conf.monitor_vfreq_str); monitor_dotclock = str2range(priv_conf.monitor_dotclock_str); if (!monitor_hfreq || !monitor_vfreq || !monitor_dotclock) { - MSG_ERR(FBDEV "you have to specify the capabilities of" - " the monitor.\n"); + mpxp_err<<FBDEV<< "you have to specify the capabilities of the monitor."<<std::endl; return MPXP_False; } if (!(mode = find_best_mode(out_width, out_height, monitor_hfreq, monitor_vfreq, monitor_dotclock))) { - MSG_ERR(FBDEV "can't find best video mode\n"); + mpxp_err<<FBDEV<< "can't find best video mode"<<std::endl; return MPXP_False; } - MSG_ERR(FBDEV "using mode %dx%d @ %.1fHz\n", mode->xres, - mode->yres, vsf(mode)); + mpxp_err<<FBDEV<< "using mode "<<mode->xres<<"x"<<mode->yres<<" @ "<<vsf(mode)<<"Hz"<<std::endl; fb_mode2fb_vinfo(mode, &vinfo); } bpp_we_want = bpp; @@ -955,16 +928,16 @@ vinfo.xres_virtual = vinfo.xres; vinfo.yres_virtual = vinfo.yres; - if (tty_fd >= 0 && ioctl(tty_fd, KDSETMODE, KD_GRAPHICS) < 0) { - MSG_DBG2(FBDEV "Can't set graphics mode: %s\n", strerror(errno)); - close(tty_fd); + if (tty_fd >= 0 && ::ioctl(tty_fd, KDSETMODE, KD_GRAPHICS) < 0) { + mpxp_dbg2<<FBDEV<< "Can't set graphics mode: "<<strerror(errno)<<std::endl; + ::close(tty_fd); tty_fd = -1; } - if (ioctl(dev_fd, FBIOPUT_VSCREENINFO, &vinfo)) { - MSG_ERR(FBDEV "Can't put VSCREENINFO: %s\n", strerror(errno)); - if (tty_fd >= 0 && ioctl(tty_fd, KDSETMODE, KD_TEXT) < 0) { - MSG_ERR(FBDEV "Can't restore text mode: %s\n", strerror(errno)); + if (::ioctl(dev_fd, FBIOPUT_VSCREENINFO, &vinfo)) { + mpxp_err<<FBDEV<< "Can't put VSCREENINFO: "<<strerror(errno)<<std::endl; + if (tty_fd >= 0 && ::ioctl(tty_fd, KDSETMODE, KD_TEXT) < 0) { + mpxp_err<<FBDEV<< "Can't restore text mode: "<<strerror(errno)<<std::endl; } return MPXP_False; } @@ -974,8 +947,7 @@ vinfo.blue.length; bpp = (pixel_size == 4) ? 32 : real_bpp; if (bpp_we_want != bpp) - MSG_ERR(FBDEV "requested %d bpp, got %d bpp!!!\n", - bpp_we_want, bpp); + mpxp_err<<FBDEV<< "requested "<<bpp_we_want<<" bpp, got "<<bpp<<" bpp!!!"<<std::endl; switch (bpp) { case 32: @@ -994,8 +966,7 @@ } if ((flags&VOFLAG_FLIPPING) && ((((pixel_format & 0xff) + 7) / 8) != pixel_size)) { - MSG_ERR(FBDEV "Flipped output with depth conversion is not " - "supported\n"); + mpxp_err<<FBDEV<< "Flipped output with depth conversion is not supported"<<std::endl; return MPXP_False; } @@ -1003,29 +974,29 @@ yres = vinfo.yres; last_row = (xres-out_height) / 2; - if (ioctl(dev_fd, FBIOGET_FSCREENINFO, &finfo)) { - MSG_ERR(FBDEV "Can't get FSCREENINFO: %s\n", strerror(errno)); + if (::ioctl(dev_fd, FBIOGET_FSCREENINFO, &finfo)) { + mpxp_err<<FBDEV<< "Can't get FSCREENINFO: "<<strerror(errno)<<std::endl; return MPXP_False; } lots_of_printf(); if (finfo.type != FB_TYPE_PACKED_PIXELS) { - MSG_ERR(FBDEV "type %d not supported\n", finfo.type); + mpxp_err<<FBDEV<< "type "<<finfo.type<<" not supported"<<std::endl; return MPXP_False; } switch (finfo.visual) { case FB_VISUAL_TRUECOLOR: break; case FB_VISUAL_DIRECTCOLOR: - MSG_DBG2(FBDEV "creating cmap for directcolor\n"); - if (ioctl(dev_fd, FBIOGETCMAP, &oldcmap)) { - MSG_ERR(FBDEV "can't get cmap: %s\n",strerror(errno)); + mpxp_dbg2<<FBDEV<< "creating cmap for directcolor"<<std::endl; + if (::ioctl(dev_fd, FBIOGETCMAP, &oldcmap)) { + mpxp_err<<FBDEV<< "can't get cmap: "<<strerror(errno)<<std::endl; return MPXP_False; } if (!(cmap = make_directcolor_cmap(&vinfo))) return MPXP_False; - if (ioctl(dev_fd, FBIOPUTCMAP, cmap)) { - MSG_ERR(FBDEV "can't put cmap: %s\n",strerror(errno)); + if (::ioctl(dev_fd, FBIOPUTCMAP, cmap)) { + mpxp_err<<FBDEV<< "can't put cmap: "<<strerror(errno)<<std::endl; return MPXP_False; } cmap_changed = 1; @@ -1035,7 +1006,7 @@ delete cmap; break; default: - MSG_ERR(FBDEV "visual: %d not yet supported\n",finfo.visual); + mpxp_err<<FBDEV<< "visual: "<<finfo.visual<<" not yet supported"<<std::endl; return MPXP_False; } @@ -1064,12 +1035,12 @@ if(vidix->configure(width,height,x_offset,y_offset,out_width, out_height,format,bpp, xres,yres) != MPXP_Ok) { - MSG_ERR(FBDEV "Can't initialize VIDIX driver\n"); + mpxp_err<<FBDEV<< "Can't initialize VIDIX driver"<<std::endl; return MPXP_False; - } else MSG_V(FBDEV "Using VIDIX\n"); - if ((frame_buffer = (uint8_t *) mmap(0, size, PROT_READ | PROT_WRITE, + } else mpxp_v<<FBDEV<< "Using VIDIX"<<std::endl; + if ((frame_buffer = (uint8_t *) ::mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, dev_fd, 0)) == (uint8_t *) -1) { - MSG_ERR(FBDEV "Can't mmap %s: %s\n", priv_conf.dev_name, strerror(errno)); + mpxp_err<<FBDEV<< "Can't mmap "<<priv_conf.dev_name<<": "<<strerror(errno)<<std::endl; return MPXP_False; } memset(frame_buffer, 0, line_len * yres); @@ -1077,31 +1048,31 @@ } else #endif { - if ((frame_buffer = (uint8_t *) mmap(0, size, PROT_READ | PROT_WRITE, + if ((frame_buffer = (uint8_t *) ::mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, dev_fd, 0)) == (uint8_t *) -1) { - MSG_ERR(FBDEV "Can't mmap %s: %s\n", priv_conf.dev_name, strerror(errno)); + mpxp_err<<FBDEV<< "Can't mmap "<<priv_conf.dev_name<<": "<<strerror(errno)<<std::endl; return MPXP_False; } if(out_width > xres) out_width=xres; if(out_height > yres) out_width=yres; L123123875 = frame_buffer + x_offset * pixel_size + y_offset * line_len; - MSG_DBG2(FBDEV "frame_buffer @ %p\n", frame_buffer); - MSG_DBG2(FBDEV "L123123875 @ %p\n", L123123875); - MSG_V(FBDEV "pixel per line: %d\n", line_len / pixel_size); + mpxp_dbg2<<FBDEV<< "frame_buffer @ "<<std::hex<<reinterpret_cast<long>(frame_buffer)<<std::endl; + mpxp_dbg2<<FBDEV<< "L123123875 @ "<<std::hex<<reinterpret_cast<long>(L123123875)<<std::endl; + mpxp_v<<FBDEV<< "pixel per line: "<<(line_len/pixel_size)<<std::endl; total_fr=vo_conf.xp_buffs; for(i=0;i<total_fr;i++) if (!(next_frame[i] = (uint8_t *) mp_malloc(out_width * out_height * pixel_size))) { - MSG_ERR(FBDEV "Can't mp_malloc next_frame: %s\n", strerror(errno)); + mpxp_err<<FBDEV<< "Can't mp_malloc next_frame: "<<strerror(errno)<<std::endl; return MPXP_False; } } if (vt_doit && (vt_fd = open("/dev/tty", O_WRONLY)) == -1) { - MSG_ERR(FBDEV "can't open /dev/tty: %s\n", strerror(errno)); + mpxp_err<<FBDEV<< "can't open /dev/tty: "<<strerror(errno)<<std::endl; vt_doit = 0; } if (vt_doit && !(vt_fp = fdopen(vt_fd, "w"))) { - MSG_ERR(FBDEV "can't fdopen /dev/tty: %s\n", strerror(errno)); + mpxp_err<<FBDEV<< "can't fdopen /dev/tty: "<<strerror(errno)<<std::endl; vt_doit = 0; } Modified: mplayerxp/libvo2/vo_msg.h =================================================================== --- mplayerxp/libvo2/vo_msg.h 2012-12-20 17:02:24 UTC (rev 588) +++ mplayerxp/libvo2/vo_msg.h 2012-12-21 10:48:09 UTC (rev 589) @@ -1,9 +1,6 @@ -#ifndef VO_MSG_H -#define VO_MSG_H +#ifndef VO_MSG_H_INCLUDED +#define VO_MSG_H_INCLUDED 1 -#ifndef MSGT_CLASS -#define MSGT_CLASS MSGT_VO -#endif #include "mpxp_msg.h" namespace mpxp { Modified: mplayerxp/libvo2/vo_null.cpp =================================================================== --- mplayerxp/libvo2/vo_null.cpp 2012-12-20 17:02:24 UTC (rev 588) +++ mplayerxp/libvo2/vo_null.cpp 2012-12-21 10:48:09 UTC (rev 589) @@ -123,8 +123,8 @@ if(!bm_buffs[i]) bm_buffs[i] = new(alignmem,getpagesize()) uint8_t[frame_size]; if(!(bm_buffs[i])) { - MSG_ERR("Can't allocate memory for busmastering\n"); - return MPXP_False; + mpxp_err<<"Can't allocate memory for busmastering"<<std::endl; + return MPXP_False; } } return MPXP_Ok; @@ -142,7 +142,7 @@ Null_VO_Interface::Null_VO_Interface(const std::string& arg) :VO_Interface(arg) { - if(!arg.empty()) MSG_ERR("vo_null: Unknown subdevice: %s\n",arg.c_str()); + if(!arg.empty()) mpxp_err<<"vo_null: Unknown subdevice: "<<arg<<std::endl; } void Null_VO_Interface::get_surface_caps(dri_surface_cap_t *caps) const Modified: mplayerxp/libvo2/vo_opengl.cpp =================================================================== --- mplayerxp/libvo2/vo_opengl.cpp 2012-12-20 17:02:24 UTC (rev 588) +++ mplayerxp/libvo2/vo_opengl.cpp 2012-12-21 10:48:09 UTC (rev 589) @@ -150,7 +150,7 @@ } void OpenGL_VO_Interface::resize(int x,int y) const { - MSG_V("[gl] Resize: %dx%d\n",x,y); + mpxp_v<<"[gl] Resize: "<<x<<"x"<<y<<std::endl; gl_init_fb(0, 0, x, y); glClear(GL_COLOR_BUFFER_BIT); } @@ -241,13 +241,13 @@ MPXP_Rc OpenGL_VO_Interface::query_format( vo_query_fourcc_t* format ) const { - MSG_DBG2("vo_opengl: query_format was called: %x (%s)\n",format->fourcc,vo_format_name(format->fourcc)); + mpxp_dbg2<<"vo_opengl: query_format was ca... [truncated message content] |
From: <nic...@us...> - 2012-12-21 11:05:26
|
Revision: 590 http://mplayerxp.svn.sourceforge.net/mplayerxp/?rev=590&view=rev Author: nickols_k Date: 2012-12-21 11:05:14 +0000 (Fri, 21 Dec 2012) Log Message: ----------- remove #defines Modified Paths: -------------- mplayerxp/libvo2/screenshot.cpp mplayerxp/libvo2/sub.cpp mplayerxp/libvo2/vo_opengl.cpp mplayerxp/libvo2/vo_sdl.cpp mplayerxp/libvo2/vo_vesa.cpp mplayerxp/libvo2/vo_xv.cpp mplayerxp/libvo2/x11_system.cpp Modified: mplayerxp/libvo2/screenshot.cpp =================================================================== --- mplayerxp/libvo2/screenshot.cpp 2012-12-21 10:48:09 UTC (rev 589) +++ mplayerxp/libvo2/screenshot.cpp 2012-12-21 11:05:14 UTC (rev 590) @@ -31,8 +31,8 @@ #include "postproc/vf_scale.h" #include "vo_msg.h" -#define RGB 0 -#define BGR 1 +static const int RGB=0; +static const int BGR=1; typedef struct sshot_priv_s { int cspace; unsigned image_width,image_height; Modified: mplayerxp/libvo2/sub.cpp =================================================================== --- mplayerxp/libvo2/sub.cpp 2012-12-21 10:48:09 UTC (rev 589) +++ mplayerxp/libvo2/sub.cpp 2012-12-21 11:05:14 UTC (rev 590) @@ -14,7 +14,6 @@ #include "sub.h" #include "libmpsub/spudec.h" #include "libmpsub/vobsub.h" -#define MSGT_CLASS MSGT_OSD #include "vo_msg.h" namespace mpxp { @@ -79,7 +78,7 @@ } } -#define OSD_NAV_BOX_ALPHA 0x7f +static const int OSD_NAV_BOX_ALPHA=0x7f; static void vo_update_nav (mp_osd_obj_t *obj, int dxs, int dys) { int len; Modified: mplayerxp/libvo2/vo_opengl.cpp =================================================================== --- mplayerxp/libvo2/vo_opengl.cpp 2012-12-21 10:48:09 UTC (rev 589) +++ mplayerxp/libvo2/vo_opengl.cpp 2012-12-21 11:05:14 UTC (rev 590) @@ -113,6 +113,12 @@ #endif } +static const float FOVY=60.0f; +static const float ASPECT=1.0f; +static const float Z_NEAR=0.1f; +static const float Z_FAR=100.0f; +static const float Z_CAMERA=0.869f; + void OpenGL_VO_Interface::gl_init_fb(unsigned x,unsigned y,unsigned d_width,unsigned d_height) const { float sx = (GLfloat) (d_width-x) / (GLfloat)image_width; @@ -124,12 +130,6 @@ glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); -#define FOVY 60.0f -#define ASPECT 1.0f -#define Z_NEAR 0.1f -#define Z_FAR 100.0f -#define Z_CAMERA 0.869f - glViewport(x, y, d_width, d_height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); Modified: mplayerxp/libvo2/vo_sdl.cpp =================================================================== --- mplayerxp/libvo2/vo_sdl.cpp 2012-12-21 10:48:09 UTC (rev 589) +++ mplayerxp/libvo2/vo_sdl.cpp 2012-12-21 11:05:14 UTC (rev 590) @@ -102,7 +102,7 @@ //#define BUGGY_SDL //defined by configure /* MONITOR_ASPECT MUST BE FLOAT */ -#define MONITOR_ASPECT 4.0/3.0 +static const float MONITOR_ASPECT=4.0f/3.0f; #include <stdio.h> #include <stdlib.h> @@ -819,7 +819,7 @@ * returns : doesn't return **/ -#define shift_key (event.key.keysym.mod==(KMOD_LSHIFT||KMOD_RSHIFT)) +static int shift_key(const SDL_Event& event) { return event.key.keysym.mod==(KMOD_LSHIFT||KMOD_RSHIFT); } uint32_t SDL_VO_Interface::check_events (const vo_resize_t* vrest){ SDL_Event event; SDLKey keypressed = SDLKey(0); @@ -863,7 +863,7 @@ case SDLK_DOWN: mplayer_put_key(KEY_DOWN); break; case SDLK_LEFT: mplayer_put_key(KEY_LEFT); break; case SDLK_RIGHT: mplayer_put_key(KEY_RIGHT); break; - case SDLK_LESS: mplayer_put_key(shift_key?'>':'<'); break; + case SDLK_LESS: mplayer_put_key(shift_key(event)?'>':'<'); break; case SDLK_GREATER: mplayer_put_key('>'); break; case SDLK_ASTERISK: case SDLK_KP_MULTIPLY: @@ -915,8 +915,8 @@ /*case SDLK_o: mplayer_put_key('o');break; case SDLK_SPACE: mplayer_put_key(' ');break; case SDLK_p: mplayer_put_key('p');break;*/ - case SDLK_7: mplayer_put_key(shift_key?'/':'7'); - case SDLK_PLUS: mplayer_put_key(shift_key?'*':'+'); + case SDLK_7: mplayer_put_key(shift_key(event)?'/':'7'); + case SDLK_PLUS: mplayer_put_key(shift_key(event)?'*':'+'); case SDLK_KP_PLUS: mplayer_put_key('+');break; case SDLK_MINUS: case SDLK_KP_MINUS: mplayer_put_key('-');break; @@ -938,7 +938,7 @@ case SDLK_DOWN: mplayer_put_key(KEY_DOWN);break; case SDLK_LEFT: mplayer_put_key(KEY_LEFT);break; case SDLK_RIGHT: mplayer_put_key(KEY_RIGHT);break; - case SDLK_LESS: mplayer_put_key(shift_key?'>':'<'); break; + case SDLK_LESS: mplayer_put_key(shift_key(event)?'>':'<'); break; case SDLK_GREATER: mplayer_put_key('>'); break; case SDLK_ASTERISK: case SDLK_KP_MULTIPLY: mplayer_put_key('*'); break; @@ -957,7 +957,6 @@ } return retval; } -#undef shift_key /* Erase (paint it black) the rectangle specified by x, y, w and h in the surface or overlay which is used for OSD Modified: mplayerxp/libvo2/vo_vesa.cpp =================================================================== --- mplayerxp/libvo2/vo_vesa.cpp 2012-12-21 10:48:09 UTC (rev 589) +++ mplayerxp/libvo2/vo_vesa.cpp 2012-12-21 11:05:14 UTC (rev 590) @@ -188,8 +188,8 @@ } } -#define MOVIE_MODE (MODE_ATTR_COLOR | MODE_ATTR_GRAPHICS) -#define FRAME_MODE (MODE_WIN_RELOCATABLE | MODE_WIN_WRITEABLE) +static const int MOVIE_MODE=(MODE_ATTR_COLOR | MODE_ATTR_GRAPHICS); +static const int FRAME_MODE=(MODE_WIN_RELOCATABLE | MODE_WIN_WRITEABLE); void VESA_VO_Interface::vesa_term() { @@ -308,8 +308,8 @@ return MPXP_Ok; } -#define SUBDEV_NODGA 0x00000001UL -#define SUBDEV_FORCEDGA 0x00000002UL +static const int SUBDEV_NODGA=0x00000001UL; +static const int SUBDEV_FORCEDGA=0x00000002UL; std::string VESA_VO_Interface::parse_sub_device(const std::string& sd) { subdev_flags = 0; Modified: mplayerxp/libvo2/vo_xv.cpp =================================================================== --- mplayerxp/libvo2/vo_xv.cpp 2012-12-21 10:48:09 UTC (rev 589) +++ mplayerxp/libvo2/vo_xv.cpp 2012-12-21 11:05:14 UTC (rev 590) @@ -134,10 +134,10 @@ } /* unofficial gatos extensions */ -#define FOURCC_RGBA32 0x41424752 -#define FOURCC_RGB24 0x00000000 -#define FOURCC_RGBT16 0x54424752 -#define FOURCC_RGB16 0x32424752 +static const uint32_t FOURCC_RGBA32 =0x41424752; +static const uint32_t FOURCC_RGB24 =0x00000000; +static const uint32_t FOURCC_RGBT16 =0x54424752; +static const uint32_t FOURCC_RGB16 =0x32424752; /* * connect to server, create and map window, Modified: mplayerxp/libvo2/x11_system.cpp =================================================================== --- mplayerxp/libvo2/x11_system.cpp 2012-12-21 10:48:09 UTC (rev 589) +++ mplayerxp/libvo2/x11_system.cpp 2012-12-21 11:05:14 UTC (rev 590) @@ -563,33 +563,35 @@ } // ----- Motif header: ------- -#define MWM_HINTS_FUNCTIONS (1L << 0) -#define MWM_HINTS_DECORATIONS (1L << 1) -#define MWM_HINTS_INPUT_MODE (1L << 2) -#define MWM_HINTS_STATUS (1L << 3) +enum { + MWM_HINTS_FUNCTIONS =(1L << 0), + MWM_HINTS_DECORATIONS =(1L << 1), + MWM_HINTS_INPUT_MODE =(1L << 2), + MWM_HINTS_STATUS =(1L << 3), -#define MWM_FUNC_ALL (1L << 0) -#define MWM_FUNC_RESIZE (1L << 1) -#define MWM_FUNC_MOVE (1L << 2) -#define MWM_FUNC_MINIMIZE (1L << 3) -#define MWM_FUNC_MAXIMIZE (1L << 4) -#define MWM_FUNC_CLOSE (1L << 5) + MWM_FUNC_ALL =(1L << 0), + MWM_FUNC_RESIZE =(1L << 1), + MWM_FUNC_MOVE =(1L << 2), + MWM_FUNC_MINIMIZE =(1L << 3), + MWM_FUNC_MAXIMIZE =(1L << 4), + MWM_FUNC_CLOSE =(1L << 5), -#define MWM_DECOR_ALL (1L << 0) -#define MWM_DECOR_BORDER (1L << 1) -#define MWM_DECOR_RESIZEH (1L << 2) -#define MWM_DECOR_TITLE (1L << 3) -#define MWM_DECOR_MENU (1L << 4) -#define MWM_DECOR_MINIMIZE (1L << 5) -#define MWM_DECOR_MAXIMIZE (1L << 6) + MWM_DECOR_ALL =(1L << 0), + MWM_DECOR_BORDER =(1L << 1), + MWM_DECOR_RESIZEH =(1L << 2), + MWM_DECOR_TITLE =(1L << 3), + MWM_DECOR_MENU =(1L << 4), + MWM_DECOR_MINIMIZE =(1L << 5), + MWM_DECOR_MAXIMIZE =(1L << 6), -#define MWM_INPUT_MODELESS 0 -#define MWM_INPUT_PRIMARY_APPLICATION_MODAL 1 -#define MWM_INPUT_SYSTEM_MODAL 2 -#define MWM_INPUT_FULL_APPLICATION_MODAL 3 -#define MWM_INPUT_APPLICATION_MODAL MWM_INPUT_PRIMARY_APPLICATION_MODAL + MWM_INPUT_MODELESS =0, + MWM_INPUT_PRIMARY_APPLICATION_MODAL =1, + MWM_INPUT_SYSTEM_MODAL =2, + MWM_INPUT_FULL_APPLICATION_MODAL =3, + MWM_INPUT_APPLICATION_MODAL=MWM_INPUT_PRIMARY_APPLICATION_MODAL, -#define MWM_TEAROFF_WINDOW (1L<<0) + MWM_TEAROFF_WINDOW =(1L<<0) +}; // Note: always d==0 ! void X11_System::decoration(int d) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |