diff options
author | Uoti Urpala <uau@symbol.nonexistent.invalid> | 2008-04-02 18:51:38 +0300 |
---|---|---|
committer | Uoti Urpala <uau@symbol.nonexistent.invalid> | 2008-04-23 13:41:03 +0300 |
commit | dbe080ec9f05cd216f4217c81409a37d3f4db969 (patch) | |
tree | 48861e98ea8a195781e314b7b96923509c35b0f1 /libvo/mga_common.c | |
parent | 530df550e4af63fce126001c5509d931d9ee65f9 (diff) | |
download | mpv-dbe080ec9f05cd216f4217c81409a37d3f4db969.tar.bz2 mpv-dbe080ec9f05cd216f4217c81409a37d3f4db969.tar.xz |
Change VOCTRL_[GET|SET]_EQUALIZER argument passing
These were the only voctrl types with more than one argument. The
second argument was passed using variable arguments. Change them to
use a single argument (address of a struct containing both old
arguments). This makes forwarding the arguments to other functions
easier and allows simplifying code.
Diffstat (limited to 'libvo/mga_common.c')
-rw-r--r-- | libvo/mga_common.c | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/libvo/mga_common.c b/libvo/mga_common.c index b150b18012..1677104c9e 100644 --- a/libvo/mga_common.c +++ b/libvo/mga_common.c @@ -240,11 +240,12 @@ 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()"); @@ -254,15 +255,13 @@ static int control(uint32_t request, void *data, ...) // 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); @@ -278,12 +277,12 @@ 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()"); @@ -291,16 +290,12 @@ static int control(uint32_t request, void *data, ...) 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; } |