changeset 18172:90b62d7c0fca

Implement tv_get_color_options() and make tv_set_color_options() return mainfull values.
author albeu
date Fri, 21 Apr 2006 12:45:18 +0000
parents 6019c54e3b11
children 1acdeb017c9c
files libmpdemux/tv.c libmpdemux/tv.h
diffstat 2 files changed, 27 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/tv.c	Fri Apr 21 10:54:00 2006 +0000
+++ b/libmpdemux/tv.c	Fri Apr 21 12:45:18 2006 +0000
@@ -679,22 +679,39 @@
     switch(opt)
     {
 	case TV_COLOR_BRIGHTNESS:
-	    funcs->control(tvh->priv, TVI_CONTROL_VID_SET_BRIGHTNESS, &value);
-	    break;
+	    return funcs->control(tvh->priv, TVI_CONTROL_VID_SET_BRIGHTNESS, &value);
 	case TV_COLOR_HUE:
-	    funcs->control(tvh->priv, TVI_CONTROL_VID_SET_HUE, &value);
-	    break;
+	    return funcs->control(tvh->priv, TVI_CONTROL_VID_SET_HUE, &value);
 	case TV_COLOR_SATURATION:
-	    funcs->control(tvh->priv, TVI_CONTROL_VID_SET_SATURATION, &value);
-	    break;
+	    return funcs->control(tvh->priv, TVI_CONTROL_VID_SET_SATURATION, &value);
 	case TV_COLOR_CONTRAST:
-	    funcs->control(tvh->priv, TVI_CONTROL_VID_SET_CONTRAST, &value);
-	    break;
+	    return funcs->control(tvh->priv, TVI_CONTROL_VID_SET_CONTRAST, &value);
 	default:
 	    mp_msg(MSGT_TV, MSGL_WARN, "Unknown color option (%d) specified!\n", opt);
     }
     
-    return(1);
+    return(TVI_CONTROL_UNKNOWN);
+}
+
+int tv_get_color_options(tvi_handle_t *tvh, int opt, int* value)
+{
+    tvi_functions_t *funcs = tvh->functions;
+
+    switch(opt)
+    {
+	case TV_COLOR_BRIGHTNESS:
+	    return funcs->control(tvh->priv, TVI_CONTROL_VID_GET_BRIGHTNESS, value);
+	case TV_COLOR_HUE:
+	    return funcs->control(tvh->priv, TVI_CONTROL_VID_GET_HUE, value);
+	case TV_COLOR_SATURATION:
+	    return funcs->control(tvh->priv, TVI_CONTROL_VID_GET_SATURATION, value);
+	case TV_COLOR_CONTRAST:
+	    return funcs->control(tvh->priv, TVI_CONTROL_VID_GET_CONTRAST, value);
+	default:
+	    mp_msg(MSGT_TV, MSGL_WARN, "Unknown color option (%d) specified!\n", opt);
+    }
+    
+    return(TVI_CONTROL_UNKNOWN);
 }
 
 int tv_get_freq(tvi_handle_t *tvh, unsigned long *freq)
--- a/libmpdemux/tv.h	Fri Apr 21 10:54:00 2006 +0000
+++ b/libmpdemux/tv.h	Fri Apr 21 12:45:18 2006 +0000
@@ -163,6 +163,7 @@
 extern int tv_uninit(tvi_handle_t *tvh);
 
 int tv_set_color_options(tvi_handle_t *tvh, int opt, int val);
+int tv_get_color_options(tvi_handle_t *tvh, int opt, int* val);
 #define TV_COLOR_BRIGHTNESS	1
 #define TV_COLOR_HUE		2
 #define TV_COLOR_SATURATION	3