summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrofafor <rofafor>2009-01-09 08:39:08 +0000
committerrofafor <rofafor>2009-01-09 08:39:08 +0000
commit78b7711154bd694450c1f7969e47c42d01d474da (patch)
tree8cbbf43216fd6948900c68c061ce3fee0604bd8e
parente78d23e9490e2c099c890dc2a98dbea9744d1e9a (diff)
downloadxineliboutput-78b7711154bd694450c1f7969e47c42d01d474da.tar.gz
xineliboutput-78b7711154bd694450c1f7969e47c42d01d474da.tar.bz2
Changed video output properties to utilize min and max values from video drivers.
-rw-r--r--setup_menu.c13
-rw-r--r--xine_input_vdr.c116
2 files changed, 92 insertions, 37 deletions
diff --git a/setup_menu.c b/setup_menu.c
index 4269fd05..6e9ec2f6 100644
--- a/setup_menu.c
+++ b/setup_menu.c
@@ -4,7 +4,7 @@
* See the main source file 'xineliboutput.c' for copyright information and
* how to reach the author.
*
- * $Id: setup_menu.c,v 1.66 2009-01-08 11:58:33 rofafor Exp $
+ * $Id: setup_menu.c,v 1.67 2009-01-09 08:39:08 rofafor Exp $
*
*/
@@ -26,6 +26,7 @@ namespace XinelibOutputSetupMenu {
//#define INTEGER_CONFIG_VIDEO_CONTROLS
//#define LINEAR_VIDEO_CONTROLS
+//#define LOGARITHM_SCALING
#define ISNUMBERKEY(k) (RAWKEY(k) >= k0 && RAWKEY(k) <= k9)
@@ -65,12 +66,22 @@ const char *controls[] =
# define CONTROL_TO_INDEX(val) ((val)>=0 ? ((val)>>11)+1 : 0)
# define INDEX_TO_CONTROL(ind) ((ind)==0 ? -1 : ((ind)-1)<<11)
#else
+#ifdef LOGARITHM_SCALING
const int ind2ctrl_tbl[33] = {
-1, 0, 0x0001, 0x0002, 0x0003, 0x0004, 0x0007, 0x000a,
0x000f, 0x0014, 0x001f, 42, 0x003f, 80, 0x007f, 170,
0x00ff, 336, 0x01ff, 682, 0x03ff, 1630, 0x07ff, 2730,
0x0fff, 5726, 0x1fff, 10858, 0x3fff, 22110, 0x7fff, 43224,
0xffff };
+#else
+const int ind2ctrl_tbl[33] = {
+ -1,
+ 0x0000, 0x0843, 0x1085, 0x18c7, 0x2109, 0x294b, 0x318d, 0x39cf,
+ 0x4211, 0x4a53, 0x5295, 0x5ad7, 0x6319, 0x6b5b, 0x739d, 0x7bdf,
+ 0x8421, 0x8c63, 0x94a5, 0x9ce7, 0xa529, 0xad6b, 0xb5ad, 0xbdef,
+ 0xc631, 0xce73, 0xd6b5, 0xdef7, 0xe739, 0xef7b, 0xf7bd, 0xffff
+};
+#endif
static int CONTROL_TO_INDEX(int val)
{
for(int i=0; i<33;i++)
diff --git a/xine_input_vdr.c b/xine_input_vdr.c
index 5e644b03..24c06ee2 100644
--- a/xine_input_vdr.c
+++ b/xine_input_vdr.c
@@ -4,7 +4,7 @@
* See the main source file 'xineliboutput.c' for copyright information and
* how to reach the author.
*
- * $Id: xine_input_vdr.c,v 1.208 2009-01-08 11:58:33 rofafor Exp $
+ * $Id: xine_input_vdr.c,v 1.209 2009-01-09 08:39:08 rofafor Exp $
*
*/
@@ -1723,61 +1723,105 @@ static int set_video_properties(vdr_input_plugin_t *this,
int noise_reduction, int contrast,
int vo_aspect_ratio)
{
+ int min, max;
pthread_mutex_lock(&this->lock);
/* when changed first time, save original/default values */
if(!this->video_properties_saved &&
(hue>=0 || saturation>=0 || contrast>=0 || brightness>=0 ||
- vo_aspect_ratio>=0)) {
+ sharpness>=0 || noise_reduction>=0 || vo_aspect_ratio>=0)) {
this->video_properties_saved = 1;
- this->orig_hue = xine_get_param(this->stream,
- XINE_PARAM_VO_HUE );
- this->orig_saturation = xine_get_param(this->stream,
- XINE_PARAM_VO_SATURATION );
- this->orig_brightness = xine_get_param(this->stream,
- XINE_PARAM_VO_BRIGHTNESS );
+ this->orig_hue = xine_get_param(this->stream,
+ XINE_PARAM_VO_HUE);
+ this->orig_saturation = xine_get_param(this->stream,
+ XINE_PARAM_VO_SATURATION);
+ this->orig_brightness = xine_get_param(this->stream,
+ XINE_PARAM_VO_BRIGHTNESS);
#ifdef XINE_PARAM_VO_SHARPNESS
- this->orig_sharpness = xine_get_param(this->stream,
- XINE_PARAM_VO_SHARPNESS );
+ this->orig_sharpness = xine_get_param(this->stream,
+ XINE_PARAM_VO_SHARPNESS);
#endif
#ifdef XINE_PARAM_VO_NOISE_REDUCTION
- this->orig_noise_reduction = xine_get_param(this->stream,
- XINE_PARAM_VO_NOISE_REDUCTION );
+ this->orig_noise_reduction = xine_get_param(this->stream,
+ XINE_PARAM_VO_NOISE_REDUCTION);
#endif
- this->orig_contrast = xine_get_param(this->stream,
- XINE_PARAM_VO_CONTRAST );
- this->orig_vo_aspect_ratio = xine_get_param(this->stream,
- XINE_PARAM_VO_ASPECT_RATIO );
+ this->orig_contrast = xine_get_param(this->stream,
+ XINE_PARAM_VO_CONTRAST);
+ this->orig_vo_aspect_ratio = xine_get_param(this->stream,
+ XINE_PARAM_VO_ASPECT_RATIO);
}
/* set new values, or restore default/original values */
- if(hue>=0 || this->video_properties_saved)
- xine_set_param(this->stream, XINE_PARAM_VO_HUE,
- hue>=0 ? hue : this->orig_hue );
- if(saturation>=0 || this->video_properties_saved)
- xine_set_param(this->stream, XINE_PARAM_VO_SATURATION,
- saturation>0 ? saturation : this->orig_saturation );
- if(brightness>=0 || this->video_properties_saved)
- xine_set_param(this->stream, XINE_PARAM_VO_BRIGHTNESS,
- brightness>=0 ? brightness : this->orig_brightness );
+ if(hue>=0 || this->video_properties_saved) {
+ this->stream->video_out->driver->get_property_min_max(this->stream->video_out->driver,
+ VO_PROP_HUE, &min, &max);
+ int scaled_hue = min + (float)(max - min + 1) * hue / 0xffff;
+ if (scaled_hue < min) scaled_hue = min;
+ else if (scaled_hue > max) scaled_hue = max;
+ TRACE("Hue=%d Scaled=%d Min=%d Max=%d\n", hue, scaled_hue, min, max);
+ xine_set_param(this->stream, XINE_PARAM_VO_HUE,
+ hue>=0 ? scaled_hue : this->orig_hue);
+ }
+ if(saturation>=0 || this->video_properties_saved) {
+ this->stream->video_out->driver->get_property_min_max(this->stream->video_out->driver,
+ VO_PROP_SATURATION, &min, &max);
+ int scaled_saturation = min + (float)(max - min + 1) * saturation / 0xffff;
+ if (scaled_saturation < min) scaled_saturation = min;
+ else if (scaled_saturation > max) scaled_saturation = max;
+ TRACE("Saturation=%d Scaled=%d Min=%d Max=%d\n", saturation, scaled_saturation, min, max);
+ xine_set_param(this->stream, XINE_PARAM_VO_SATURATION,
+ saturation>0 ? scaled_saturation : this->orig_saturation);
+ }
+ if(brightness>=0 || this->video_properties_saved) {
+ this->stream->video_out->driver->get_property_min_max(this->stream->video_out->driver,
+ VO_PROP_BRIGHTNESS, &min, &max);
+ int scaled_brightness = min + (float)(max - min + 1) * brightness / 0xffff;
+ if (scaled_brightness < min) scaled_brightness = min;
+ else if (scaled_brightness > max) scaled_brightness = max;
+ TRACE("Brightness=%d Scaled=%d Min=%d Max=%d\n", brightness, scaled_brightness, min, max);
+ xine_set_param(this->stream, XINE_PARAM_VO_BRIGHTNESS,
+ brightness>=0 ? scaled_brightness : this->orig_brightness);
+ }
#ifdef XINE_PARAM_VO_SHARPNESS
- if(sharpness>=0 || this->video_properties_saved)
- xine_set_param(this->stream, XINE_PARAM_VO_SHARPNESS,
- sharpness>=0 ? sharpness : this->orig_sharpness );
+ if(sharpness>=0 || this->video_properties_saved) {
+ this->stream->video_out->driver->get_property_min_max(this->stream->video_out->driver,
+ VO_PROP_SHARPNESS, &min, &max);
+ int scaled_sharpness = min + (float)(max - min + 1) * sharpness / 0xffff;
+ if (scaled_sharpness < min) scaled_sharpness = min;
+ else if (scaled_sharpness > max) scaled_sharpness = max;
+ TRACE("Sharpness=%d Scaled=%d Min=%d Max=%d\n", sharpness, scaled_sharpness, min, max);
+ xine_set_param(this->stream, XINE_PARAM_VO_SHARPNESS,
+ sharpness>=0 ? scaled_sharpness : this->orig_sharpness);
+ }
#endif
#ifdef XINE_PARAM_VO_NOISE_REDUCTION
- if(noise_reduction>=0 || this->video_properties_saved)
- xine_set_param(this->stream, XINE_PARAM_VO_NOISE_REDUCTION,
- noise_reduction>=0 ? noise_reduction : this->orig_noise_reduction );
+ if(noise_reduction>=0 || this->video_properties_saved) {
+ this->stream->video_out->driver->get_property_min_max(this->stream->video_out->driver,
+ VO_PROP_NOISE_REDUCTION, &min, &max);
+ int scaled_noise_reduction = min + (float)(max - min + 1) * noise_reduction / 0xffff;
+ if (scaled_noise_reduction < min) scaled_noise_reduction = min;
+ else if (scaled_noise_reduction > max) scaled_noise_reduction = max;
+ TRACE("Noise=%d Scaled=%d Min=%d Max=%d\n", noise_reduction, scaled_noise_reduction, min, max);
+ xine_set_param(this->stream, XINE_PARAM_VO_NOISE_REDUCTION,
+ noise_reduction>=0 ? scaled_noise_reduction : this->orig_noise_reduction);
+ }
#endif
- if(contrast>=0 || this->video_properties_saved)
- xine_set_param(this->stream, XINE_PARAM_VO_CONTRAST,
- contrast>=0 ? contrast : this->orig_contrast );
- if(vo_aspect_ratio>=0 || this->video_properties_saved)
+ if(contrast>=0 || this->video_properties_saved) {
+ this->stream->video_out->driver->get_property_min_max(this->stream->video_out->driver,
+ VO_PROP_CONTRAST, &min, &max);
+ int scaled_contrast = min + (float)(max - min + 1) * contrast / 0xffff;
+ if (scaled_contrast < min) scaled_contrast = min;
+ else if (scaled_contrast > max) scaled_contrast = max;
+ TRACE("Contrast=%d Scaled=%d Min=%d Max=%d\n", contrast, scaled_contrast, min, max);
+ xine_set_param(this->stream, XINE_PARAM_VO_CONTRAST,
+ contrast>=0 ? scaled_contrast : this->orig_contrast);
+ }
+ if(vo_aspect_ratio>=0 || this->video_properties_saved) {
xine_set_param(this->stream, XINE_PARAM_VO_ASPECT_RATIO,
vo_aspect_ratio>=0 ? vo_aspect_ratio : this->orig_vo_aspect_ratio );
+ }
- if(hue<0 && saturation<0 && contrast<0 && brightness<0 && vo_aspect_ratio<0)
+ if(hue<0 && saturation<0 && contrast<0 && brightness<0 && sharpness<0 && noise_reduction<0 && vo_aspect_ratio<0)
this->video_properties_saved = 0;
pthread_mutex_unlock(&this->lock);