diff options
Diffstat (limited to 'libvo/mga_common.c')
-rw-r--r-- | libvo/mga_common.c | 52 |
1 files changed, 24 insertions, 28 deletions
diff --git a/libvo/mga_common.c b/libvo/mga_common.c index 13b73d1b45..a40f934ee5 100644 --- a/libvo/mga_common.c +++ b/libvo/mga_common.c @@ -23,6 +23,7 @@ #include "libmpcodecs/vf_scale.h" #include "mp_msg.h" #include "help_mp.h" +#include "old_vo_wrapper.h" // mga_vid drawing functions static void set_window( void ); /* forward declaration to kill warnings */ @@ -242,11 +243,11 @@ static void mga_fullscreen(void) mga_vid_config.x_org=(vo_screenwidth-w)/2; mga_vid_config.y_org=(vo_screenheight-h)/2; if ( ioctl( f,MGA_VID_CONFIG,&mga_vid_config ) ) - mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_MGA_ErrorInConfigIoctl ); + mp_tmsg(MSGT_VO,MSGL_WARN, "[MGA] error in mga_vid_config ioctl (wrong mga_vid.o version?)" ); } #endif -static int control(uint32_t request, void *data, ...) +static int control(uint32_t request, void *data) { switch (request) { case VOCTRL_QUERY_FORMAT: @@ -257,36 +258,35 @@ static int control(uint32_t request, void *data, ...) return draw_image(data); case VOCTRL_SET_EQUALIZER: { - va_list ap; short value; uint32_t luma,prev; + struct voctrl_set_equalizer_args *args = data; - if ( strcmp( data,"brightness" ) && strcmp( data,"contrast" ) ) return VO_FALSE; + if (strcmp(args->name, "brightness") && strcmp(args->name, "contrast")) + return VO_FALSE; if (ioctl(f,MGA_VID_GET_LUMA,&prev)) { perror("Error in mga_vid_config ioctl()"); - mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_MGA_CouldNotGetLumaValuesFromTheKernelModule); + mp_tmsg(MSGT_VO,MSGL_WARN, "[MGA] Could not get luma values from the kernel module!\n"); return VO_FALSE; } // printf("GET: 0x%4X 0x%4X \n",(prev>>16),(prev&0xffff)); - va_start(ap, data); - value = va_arg(ap, int); - va_end(ap); + value = args->value; // printf("value: %d -> ",value); value=((value+100)*255)/200-128; // maps -100=>-128 and +100=>127 // printf("%d \n",value); - if(!strcmp(data,"contrast")) + if (!strcmp(args->name, "contrast")) luma = (prev&0xFFFF0000)|(value&0xFFFF); else luma = (prev&0xFFFF)|(value<<16); if (ioctl(f,MGA_VID_SET_LUMA,luma)) { perror("Error in mga_vid_config ioctl()"); - mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_MGA_CouldNotSetLumaValuesFromTheKernelModule); + mp_tmsg(MSGT_VO,MSGL_WARN, "[MGA] Could not set luma values from the kernel module!\n"); return VO_FALSE; } @@ -295,29 +295,25 @@ static int control(uint32_t request, void *data, ...) case VOCTRL_GET_EQUALIZER: { - va_list ap; - int * value; short val; uint32_t luma; + struct voctrl_get_equalizer_args *args = data; - if ( strcmp( data,"brightness" ) && strcmp( data,"contrast" ) ) return VO_FALSE; + if (strcmp(args->name, "brightness") && strcmp(args->name, "contrast")) + return VO_FALSE; if (ioctl(f,MGA_VID_GET_LUMA,&luma)) { perror("Error in mga_vid_config ioctl()"); - mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_MGA_CouldNotGetLumaValuesFromTheKernelModule); + mp_tmsg(MSGT_VO,MSGL_WARN, "[MGA] Could not get luma values from the kernel module!\n"); return VO_FALSE; } - if ( !strcmp( data,"contrast" ) ) + if (!strcmp(args->name, "contrast")) val=(luma & 0xFFFF); else val=(luma >> 16); - va_start(ap, data); - value = va_arg(ap, int*); - va_end(ap); - - *value = (val*200)/255; + *args->valueptr = (val*200)/255; return VO_TRUE; } @@ -327,7 +323,7 @@ static int control(uint32_t request, void *data, ...) if (vo_screenwidth && vo_screenheight) mga_fullscreen(); else - mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_MGA_ScreenWidthHeightUnknown); + mp_tmsg(MSGT_VO,MSGL_WARN, "[MGA] Screen width/height unknown!\n"); return VO_TRUE; case VOCTRL_GET_PANSCAN: if ( !vo_fs ) return VO_FALSE; @@ -384,7 +380,7 @@ static int mga_init(int width,int height,unsigned int format){ mga_vid_config.frame_size = ((width + 31) & ~31) * height * 2; mga_vid_config.format=MGA_VID_FORMAT_UYVY; break; default: - mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_MGA_InvalidOutputFormat,format); + mp_tmsg(MSGT_VO,MSGL_WARN, "[MGA] invalid output format %0X\n",format); return -1; } @@ -402,7 +398,7 @@ static int mga_init(int width,int height,unsigned int format){ if(width > 1024 && height > 1024) { - mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_MGA_ResolutionTooHigh); + mp_tmsg(MSGT_VO,MSGL_ERR, "[MGA] Source resolution exceeds 1023x1023 in at least one dimension.\n[MGA] Rescale in software or use -lavdopts lowres=1.\n"); return -1; } else if(height <= 1024) { @@ -413,13 +409,13 @@ static int mga_init(int width,int height,unsigned int format){ if(mga_vid_config.card_type != MGA_G550) { // we don't have a G550, so our resolution is too high - mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_MGA_ResolutionTooHigh); + mp_tmsg(MSGT_VO,MSGL_ERR, "[MGA] Source resolution exceeds 1023x1023 in at least one dimension.\n[MGA] Rescale in software or use -lavdopts lowres=1.\n"); return -1; } else { // there is a deeper problem // we have a G550, but still couldn't configure mga_vid perror("Error in mga_vid_config ioctl()"); - mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_MGA_IncompatibleDriverVersion); + mp_tmsg(MSGT_VO,MSGL_WARN, "[MGA] Your mga_vid driver version is incompatible with this MPlayer version!\n"); return -1; } // if we arrived here, then we could successfully configure mga_vid @@ -430,7 +426,7 @@ static int mga_init(int width,int height,unsigned int format){ if (ioctl(f,MGA_VID_CONFIG,&mga_vid_config)) { perror("Error in mga_vid_config ioctl()"); - mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_MGA_IncompatibleDriverVersion); + mp_tmsg(MSGT_VO,MSGL_WARN, "[MGA] Your mga_vid driver version is incompatible with this MPlayer version!\n"); return -1; } } @@ -474,7 +470,7 @@ static int preinit(const char *vo_subdevice) if(f == -1) { perror("open"); - mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_MGA_CouldntOpen,devname); + mp_tmsg(MSGT_VO,MSGL_WARN, "[MGA] Couldn't open: %s\n",devname); return -1; } @@ -484,7 +480,7 @@ static int preinit(const char *vo_subdevice) ioctl(f,MGA_VID_GET_VERSION,&ver); if(MGA_VID_VERSION != ver) { - mp_msg(MSGT_VO, MSGL_ERR, MSGTR_LIBVO_MGA_mgavidVersionMismatch, ver, MGA_VID_VERSION); + mp_tmsg(MSGT_VO, MSGL_ERR, "[MGA] mismatch between kernel (%u) and MPlayer (%u) mga_vid driver versions\n", ver, MGA_VID_VERSION); return -1; } |