mirror of
https://github.com/mpv-player/mpv
synced 2025-01-20 21:07:29 +01:00
color equalizer for tv input
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@9664 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
ca400daaf6
commit
f7756121ee
@ -277,6 +277,10 @@ struct config tvopts_conf[]={
|
|||||||
{"outfmt", &tv_param_outfmt, CONF_TYPE_STRING, 0, 0, 0, NULL},
|
{"outfmt", &tv_param_outfmt, CONF_TYPE_STRING, 0, 0, 0, NULL},
|
||||||
{"fps", &tv_param_fps, CONF_TYPE_FLOAT, 0, 0, 100.0, NULL},
|
{"fps", &tv_param_fps, CONF_TYPE_FLOAT, 0, 0, 100.0, NULL},
|
||||||
{"channels", &tv_param_channels, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL},
|
{"channels", &tv_param_channels, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL},
|
||||||
|
{"brightness", &tv_param_brightness, CONF_TYPE_INT, CONF_RANGE, -100, 100, NULL},
|
||||||
|
{"contrast", &tv_param_contrast, CONF_TYPE_INT, CONF_RANGE, -100, 100, NULL},
|
||||||
|
{"hue", &tv_param_hue, CONF_TYPE_INT, CONF_RANGE, -100, 100, NULL},
|
||||||
|
{"saturation", &tv_param_saturation, CONF_TYPE_INT, CONF_RANGE, -100, 100, NULL},
|
||||||
#ifdef HAVE_TV_V4L
|
#ifdef HAVE_TV_V4L
|
||||||
{"amode", &tv_param_amode, CONF_TYPE_INT, CONF_RANGE, 0, 3, NULL},
|
{"amode", &tv_param_amode, CONF_TYPE_INT, CONF_RANGE, 0, 3, NULL},
|
||||||
{"volume", &tv_param_volume, CONF_TYPE_INT, CONF_RANGE, 0, 65535, NULL},
|
{"volume", &tv_param_volume, CONF_TYPE_INT, CONF_RANGE, 0, 65535, NULL},
|
||||||
|
@ -71,6 +71,10 @@ int tv_param_alsa = 0;
|
|||||||
#endif
|
#endif
|
||||||
char* tv_param_adevice = NULL;
|
char* tv_param_adevice = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
int tv_param_brightness = 0;
|
||||||
|
int tv_param_contrast = 0;
|
||||||
|
int tv_param_hue = 0;
|
||||||
|
int tv_param_saturation = 0;
|
||||||
|
|
||||||
/* ================== DEMUX_TV ===================== */
|
/* ================== DEMUX_TV ===================== */
|
||||||
/*
|
/*
|
||||||
@ -443,6 +447,12 @@ int demux_open_tv(demuxer_t *demuxer)
|
|||||||
/* set height */
|
/* set height */
|
||||||
funcs->control(tvh->priv, TVI_CONTROL_VID_GET_HEIGHT, &sh_video->disp_h);
|
funcs->control(tvh->priv, TVI_CONTROL_VID_GET_HEIGHT, &sh_video->disp_h);
|
||||||
|
|
||||||
|
/* set color eq */
|
||||||
|
tv_set_color_options(tvh, TV_COLOR_BRIGHTNESS, tv_param_brightness);
|
||||||
|
tv_set_color_options(tvh, TV_COLOR_HUE, tv_param_hue);
|
||||||
|
tv_set_color_options(tvh, TV_COLOR_SATURATION, tv_param_saturation);
|
||||||
|
tv_set_color_options(tvh, TV_COLOR_CONTRAST, tv_param_contrast);
|
||||||
|
|
||||||
demuxer->video->sh = sh_video;
|
demuxer->video->sh = sh_video;
|
||||||
sh_video->ds = demuxer->video;
|
sh_video->ds = demuxer->video;
|
||||||
demuxer->video->id = 0;
|
demuxer->video->id = 0;
|
||||||
|
@ -42,6 +42,10 @@ extern int tv_param_alsa;
|
|||||||
#endif
|
#endif
|
||||||
extern char* tv_param_adevice;
|
extern char* tv_param_adevice;
|
||||||
#endif
|
#endif
|
||||||
|
extern int tv_param_brightness;
|
||||||
|
extern int tv_param_contrast;
|
||||||
|
extern int tv_param_hue;
|
||||||
|
extern int tv_param_saturation;
|
||||||
|
|
||||||
typedef struct tvi_info_s
|
typedef struct tvi_info_s
|
||||||
{
|
{
|
||||||
|
@ -929,6 +929,12 @@ static int start(priv_t *priv)
|
|||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 2nd order polynomial with p(-100)=0, p(100)=65535, p(0)=y0
|
||||||
|
static int poly(int x, int y0)
|
||||||
|
{
|
||||||
|
return ((65535-2*y0)*x*x+6553500*x+20000*y0)/20000;
|
||||||
|
}
|
||||||
|
|
||||||
static int control(priv_t *priv, int cmd, void *arg)
|
static int control(priv_t *priv, int cmd, void *arg)
|
||||||
{
|
{
|
||||||
mp_msg(MSGT_TV, MSGL_DBG2, "\ndebug: control(priv=%p, cmd=%d, arg=%p)\n",
|
mp_msg(MSGT_TV, MSGL_DBG2, "\ndebug: control(priv=%p, cmd=%d, arg=%p)\n",
|
||||||
@ -1042,19 +1048,19 @@ static int control(priv_t *priv, int cmd, void *arg)
|
|||||||
}
|
}
|
||||||
return(TVI_CONTROL_TRUE);
|
return(TVI_CONTROL_TRUE);
|
||||||
case TVI_CONTROL_VID_SET_BRIGHTNESS:
|
case TVI_CONTROL_VID_SET_BRIGHTNESS:
|
||||||
priv->picture.brightness = (int)*(void **)arg;
|
priv->picture.brightness = 65535*((int)*(void **)arg+100)/200;
|
||||||
control(priv, TVI_CONTROL_VID_SET_PICTURE, 0);
|
control(priv, TVI_CONTROL_VID_SET_PICTURE, 0);
|
||||||
return(TVI_CONTROL_TRUE);
|
return(TVI_CONTROL_TRUE);
|
||||||
case TVI_CONTROL_VID_SET_HUE:
|
case TVI_CONTROL_VID_SET_HUE:
|
||||||
priv->picture.hue = (int)*(void **)arg;
|
priv->picture.hue = 65535*((int)*(void **)arg+100)/200;
|
||||||
control(priv, TVI_CONTROL_VID_SET_PICTURE, 0);
|
control(priv, TVI_CONTROL_VID_SET_PICTURE, 0);
|
||||||
return(TVI_CONTROL_TRUE);
|
return(TVI_CONTROL_TRUE);
|
||||||
case TVI_CONTROL_VID_SET_SATURATION:
|
case TVI_CONTROL_VID_SET_SATURATION:
|
||||||
priv->picture.colour = (int)*(void **)arg;
|
priv->picture.colour = 65535*((int)*(void **)arg+100)/200;
|
||||||
control(priv, TVI_CONTROL_VID_SET_PICTURE, 0);
|
control(priv, TVI_CONTROL_VID_SET_PICTURE, 0);
|
||||||
return(TVI_CONTROL_TRUE);
|
return(TVI_CONTROL_TRUE);
|
||||||
case TVI_CONTROL_VID_SET_CONTRAST:
|
case TVI_CONTROL_VID_SET_CONTRAST:
|
||||||
priv->picture.contrast = (int)*(void **)arg;
|
priv->picture.contrast = poly((int)*(void **)arg, 24576);
|
||||||
control(priv, TVI_CONTROL_VID_SET_PICTURE, 0);
|
control(priv, TVI_CONTROL_VID_SET_PICTURE, 0);
|
||||||
return(TVI_CONTROL_TRUE);
|
return(TVI_CONTROL_TRUE);
|
||||||
case TVI_CONTROL_VID_GET_FPS:
|
case TVI_CONTROL_VID_GET_FPS:
|
||||||
|
Loading…
Reference in New Issue
Block a user