changeset 6832:54578e5a8050

... removed from vf's control(), sing struct for equalizer. based on patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>
author arpi
date Sun, 28 Jul 2002 21:30:09 +0000
parents f628e5dca5b9
children a709a7662cd1
files libmpcodecs/dec_video.c libmpcodecs/vf.h libmpcodecs/vf_vo.c
diffstat 3 files changed, 24 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/dec_video.c	Sun Jul 28 16:37:05 2002 +0000
+++ b/libmpcodecs/dec_video.c	Sun Jul 28 21:30:09 2002 +0000
@@ -77,11 +77,15 @@
 int set_video_colors(sh_video_t *sh_video,char *item,int value)
 {
     vf_instance_t* vf=sh_video->vfilter;
+    vf_equalizer_t data;
+
+    data.item = item;
+    data.value = value;
 
     mp_dbg(MSGT_DECVIDEO,MSGL_V,"set video colors %s=%d \n", item, value);
     if (vf)
     {
-	int ret = vf->control(vf, VFCTRL_SET_EQUALIZER, item, (int *)value);
+	int ret = vf->control(vf, VFCTRL_SET_EQUALIZER, &data);
 	if (ret == CONTROL_TRUE)
 	    return(1);
     }
@@ -96,13 +100,18 @@
 int get_video_colors(sh_video_t *sh_video,char *item,int *value)
 {
     vf_instance_t* vf=sh_video->vfilter;
+    vf_equalizer_t data;
+
+    data.item = item;
 
     mp_dbg(MSGT_DECVIDEO,MSGL_V,"get video colors %s \n", item);
     if (vf)
     {
-        int ret = vf->control(vf, VFCTRL_GET_EQUALIZER, item, value);
-	if (ret == CONTROL_TRUE)
+        int ret = vf->control(vf, VFCTRL_GET_EQUALIZER, &data);
+	if (ret == CONTROL_TRUE){
+	    *value = data.value;
 	    return(1);
+	}
     }
     /* try software control */
     if(mpvdec) return mpvdec->control(sh_video,VDCTRL_GET_EQUALIZER, item, value);
--- a/libmpcodecs/vf.h	Sun Jul 28 16:37:05 2002 +0000
+++ b/libmpcodecs/vf.h	Sun Jul 28 21:30:09 2002 +0000
@@ -24,7 +24,7 @@
         int width, int height, int d_width, int d_height,
 	unsigned int flags, unsigned int outfmt);
     int (*control)(struct vf_instance_s* vf,
-        int request, void* data, ...);
+        int request, void* data);
     int (*query_format)(struct vf_instance_s* vf,
         unsigned int fmt);
     void (*get_image)(struct vf_instance_s* vf,
@@ -46,6 +46,12 @@
 // control codes:
 #include "mpc_info.h"
 
+typedef struct vf_seteq_s 
+{
+    char *item;
+    int value;
+} vf_equalizer_t;
+
 #define VFCTRL_QUERY_MAX_PP_LEVEL 4 /* test for postprocessing support (max level) */
 #define VFCTRL_SET_PP_LEVEL 5 /* set postprocessing level */
 #define VFCTRL_SET_EQUALIZER 6 /* set color options (brightness,contrast etc) */
--- a/libmpcodecs/vf_vo.c	Sun Jul 28 16:37:05 2002 +0000
+++ b/libmpcodecs/vf_vo.c	Sun Jul 28 21:30:09 2002 +0000
@@ -1,7 +1,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <stdarg.h>
 
 #include "../config.h"
 #include "../mp_msg.h"
@@ -47,7 +46,7 @@
     return 1;
 }
 
-static int control(struct vf_instance_s* vf, int request, void* data, ...)
+static int control(struct vf_instance_s* vf, int request, void* data)
 {
     switch(request){
 #ifdef USE_OSD
@@ -58,25 +57,15 @@
 #endif
     case VFCTRL_SET_EQUALIZER:
     {
-	va_list ap;
-	int value;
-
+	vf_equalizer_t *eq=data;
 	if(!vo_config_count) return CONTROL_FALSE; // vo not configured?
-	va_start(ap, data);
-	value = va_arg(ap, int);
-	va_end(ap);
-	return((video_out->control(VOCTRL_SET_EQUALIZER, data, (int *)value) == VO_TRUE) ? CONTROL_TRUE : CONTROL_FALSE);
+	return((video_out->control(VOCTRL_SET_EQUALIZER, eq->item, eq->value) == VO_TRUE) ? CONTROL_TRUE : CONTROL_FALSE);
     }
     case VFCTRL_GET_EQUALIZER:
     {
-	va_list ap;
-	int *value;
-
+	vf_equalizer_t *eq=data;
 	if(!vo_config_count) return CONTROL_FALSE; // vo not configured?
-	va_start(ap, data);
-	value = va_arg(ap, int);
-	va_end(ap);
-	return((video_out->control(VOCTRL_GET_EQUALIZER, data, value) == VO_TRUE) ? CONTROL_TRUE : CONTROL_FALSE);
+	return((video_out->control(VOCTRL_GET_EQUALIZER, eq->item, &eq->value) == VO_TRUE) ? CONTROL_TRUE : CONTROL_FALSE);
     }
     }
     // return video_out->control(request,data);