[MPlayer-cvslog] CVS: main mplayer.c,1.931,1.932
Alban Bedel CVS
syncmail at mplayerhq.hu
Sat Apr 22 16:30:25 CEST 2006
CVS change done by Alban Bedel CVS
Update of /cvsroot/mplayer/main
In directory mail:/var2/tmp/cvs-serv32533
Modified Files:
mplayer.c
Log Message:
Add properties for the tv input color controls.
Make the "normal" color controls fallback on the tv ones
if not available from vf/vo.
Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.931
retrieving revision 1.932
diff -u -r1.931 -r1.932
--- mplayer.c 19 Apr 2006 21:06:11 -0000 1.931
+++ mplayer.c 22 Apr 2006 14:30:20 -0000 1.932
@@ -1622,7 +1622,7 @@
}
static int mp_property_gamma(m_option_t* prop,int action,void* arg) {
- int* gamma = prop->priv;
+ int* gamma = prop->priv, r;
if(!sh_video) return M_PROPERTY_UNAVAILABLE;
@@ -1636,19 +1636,36 @@
if(!arg) return 0;
M_PROPERTY_CLAMP(prop,*(int*)arg);
*gamma = *(int*)arg;
- set_video_colors(sh_video, prop->name, *gamma);
- return 1;
+ r = set_video_colors(sh_video, prop->name, *gamma);
+ if(r <= 0) break;
+ return r;
case M_PROPERTY_GET:
if(!arg) return 0;
- return get_video_colors (sh_video, prop->name, arg);
+ r = get_video_colors (sh_video, prop->name, arg);
+ if(r <= 0) break;
+ return r;
case M_PROPERTY_STEP_UP:
case M_PROPERTY_STEP_DOWN:
*gamma += (arg ? *(int*)arg : 1) *
(action == M_PROPERTY_STEP_DOWN ? -1 : 1);
M_PROPERTY_CLAMP(prop,*gamma);
- return set_video_colors(sh_video, prop->name, *gamma);
+ r = set_video_colors(sh_video, prop->name, *gamma);
+ if(r <= 0) break;
+ return r;
+ default:
+ return M_PROPERTY_NOT_IMPLEMENTED;
}
- return M_PROPERTY_NOT_IMPLEMENTED;
+
+#ifdef USE_TV
+ if(demuxer->type == DEMUXER_TYPE_TV) {
+ int l = strlen(prop->name);
+ char tv_prop[3+l+1];
+ sprintf(tv_prop,"tv_%s",prop->name);
+ return mp_property_do(tv_prop,action,arg);
+ }
+#endif
+
+ return M_PROPERTY_UNAVAILABLE;
}
static int mp_property_vsync(m_option_t* prop,int action,void* arg) {
@@ -1948,6 +1965,38 @@
}
+// TV properties
+
+#ifdef USE_TV
+
+static int mp_property_tv_color(m_option_t* prop,int action,void* arg) {
+ int r,val;
+ tvi_handle_t* tvh = demuxer->priv;
+ if(demuxer->type != DEMUXER_TYPE_TV || !tvh) return M_PROPERTY_UNAVAILABLE;
+
+ switch(action) {
+ case M_PROPERTY_SET:
+ if(!arg) return 0;
+ M_PROPERTY_CLAMP(prop,*(int*)arg);
+ return tv_set_color_options(tvh,(int)prop->priv,*(int*)arg);
+ case M_PROPERTY_GET:
+ return tv_get_color_options(tvh,(int)prop->priv,arg);
+ case M_PROPERTY_STEP_UP:
+ case M_PROPERTY_STEP_DOWN:
+ if((r = tv_get_color_options(tvh,(int)prop->priv,&val)) >= 0) {
+ if(!r) return 0;
+ val += (arg ? *(int*)arg : 1) *
+ (action == M_PROPERTY_STEP_DOWN ? -1 : 1);
+ M_PROPERTY_CLAMP(prop,val);
+ return tv_set_color_options(tvh,(int)prop->priv,val);
+ }
+ return 0;
+ }
+ return M_PROPERTY_NOT_IMPLEMENTED;
+}
+
+#endif
+
static m_option_t mp_properties[] = {
// General
{ "osdlevel", mp_property_osdlevel, CONF_TYPE_INT,
@@ -2030,6 +2079,17 @@
M_OPT_RANGE, 0, 1, NULL },
{ "sub_forced_only", mp_property_sub_forced_only, CONF_TYPE_FLAG,
M_OPT_RANGE, 0, 1, NULL },
+
+#ifdef USE_TV
+ { "tv_brightness", mp_property_tv_color, CONF_TYPE_INT,
+ M_OPT_RANGE, -100, 100, (void*)TV_COLOR_BRIGHTNESS },
+ { "tv_contrast", mp_property_tv_color, CONF_TYPE_INT,
+ M_OPT_RANGE, -100, 100, (void*)TV_COLOR_CONTRAST },
+ { "tv_saturation", mp_property_tv_color, CONF_TYPE_INT,
+ M_OPT_RANGE, -100, 100, (void*)TV_COLOR_SATURATION },
+ { "tv_hue", mp_property_tv_color, CONF_TYPE_INT,
+ M_OPT_RANGE, -100, 100, (void*)TV_COLOR_HUE },
+#endif
{ NULL, NULL, NULL, 0, 0, 0, NULL }
};
More information about the MPlayer-cvslog
mailing list