... removed from vf's control(), sing struct for equalizer. based on patch by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@6833 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
arpi 2002-07-28 21:30:09 +00:00
parent 574cd16de4
commit 60d27c02ed
3 changed files with 24 additions and 20 deletions

View File

@ -77,11 +77,15 @@ void set_video_quality(sh_video_t *sh_video,int quality){
int set_video_colors(sh_video_t *sh_video,char *item,int value) int set_video_colors(sh_video_t *sh_video,char *item,int value)
{ {
vf_instance_t* vf=sh_video->vfilter; 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); mp_dbg(MSGT_DECVIDEO,MSGL_V,"set video colors %s=%d \n", item, value);
if (vf) 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) if (ret == CONTROL_TRUE)
return(1); return(1);
} }
@ -96,13 +100,18 @@ int set_video_colors(sh_video_t *sh_video,char *item,int value)
int get_video_colors(sh_video_t *sh_video,char *item,int *value) int get_video_colors(sh_video_t *sh_video,char *item,int *value)
{ {
vf_instance_t* vf=sh_video->vfilter; 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); mp_dbg(MSGT_DECVIDEO,MSGL_V,"get video colors %s \n", item);
if (vf) if (vf)
{ {
int ret = vf->control(vf, VFCTRL_GET_EQUALIZER, item, value); int ret = vf->control(vf, VFCTRL_GET_EQUALIZER, &data);
if (ret == CONTROL_TRUE) if (ret == CONTROL_TRUE){
*value = data.value;
return(1); return(1);
}
} }
/* try software control */ /* try software control */
if(mpvdec) return mpvdec->control(sh_video,VDCTRL_GET_EQUALIZER, item, value); if(mpvdec) return mpvdec->control(sh_video,VDCTRL_GET_EQUALIZER, item, value);

View File

@ -24,7 +24,7 @@ typedef struct vf_instance_s {
int width, int height, int d_width, int d_height, int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt); unsigned int flags, unsigned int outfmt);
int (*control)(struct vf_instance_s* vf, int (*control)(struct vf_instance_s* vf,
int request, void* data, ...); int request, void* data);
int (*query_format)(struct vf_instance_s* vf, int (*query_format)(struct vf_instance_s* vf,
unsigned int fmt); unsigned int fmt);
void (*get_image)(struct vf_instance_s* vf, void (*get_image)(struct vf_instance_s* vf,
@ -46,6 +46,12 @@ typedef struct vf_instance_s {
// control codes: // control codes:
#include "mpc_info.h" #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_QUERY_MAX_PP_LEVEL 4 /* test for postprocessing support (max level) */
#define VFCTRL_SET_PP_LEVEL 5 /* set postprocessing level */ #define VFCTRL_SET_PP_LEVEL 5 /* set postprocessing level */
#define VFCTRL_SET_EQUALIZER 6 /* set color options (brightness,contrast etc) */ #define VFCTRL_SET_EQUALIZER 6 /* set color options (brightness,contrast etc) */

View File

@ -1,7 +1,6 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdarg.h>
#include "../config.h" #include "../config.h"
#include "../mp_msg.h" #include "../mp_msg.h"
@ -47,7 +46,7 @@ static int config(struct vf_instance_s* vf,
return 1; 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){ switch(request){
#ifdef USE_OSD #ifdef USE_OSD
@ -58,25 +57,15 @@ static int control(struct vf_instance_s* vf, int request, void* data, ...)
#endif #endif
case VFCTRL_SET_EQUALIZER: case VFCTRL_SET_EQUALIZER:
{ {
va_list ap; vf_equalizer_t *eq=data;
int value;
if(!vo_config_count) return CONTROL_FALSE; // vo not configured? if(!vo_config_count) return CONTROL_FALSE; // vo not configured?
va_start(ap, data); return((video_out->control(VOCTRL_SET_EQUALIZER, eq->item, eq->value) == VO_TRUE) ? CONTROL_TRUE : CONTROL_FALSE);
value = va_arg(ap, int);
va_end(ap);
return((video_out->control(VOCTRL_SET_EQUALIZER, data, (int *)value) == VO_TRUE) ? CONTROL_TRUE : CONTROL_FALSE);
} }
case VFCTRL_GET_EQUALIZER: case VFCTRL_GET_EQUALIZER:
{ {
va_list ap; vf_equalizer_t *eq=data;
int *value;
if(!vo_config_count) return CONTROL_FALSE; // vo not configured? if(!vo_config_count) return CONTROL_FALSE; // vo not configured?
va_start(ap, data); return((video_out->control(VOCTRL_GET_EQUALIZER, eq->item, &eq->value) == VO_TRUE) ? CONTROL_TRUE : CONTROL_FALSE);
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(request,data); // return video_out->control(request,data);