[vlc-devel] [PATCH] d3d11_adjust: cleaner fix for unknown variable config reading
Steve Lhomme
robux4 at videolabs.io
Mon Jul 3 09:34:59 CEST 2017
We still want to apply the value
---
modules/video_output/win32/d3d11_adjust.c | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/modules/video_output/win32/d3d11_adjust.c b/modules/video_output/win32/d3d11_adjust.c
index e0fd4c5c10..fe401c97fb 100644
--- a/modules/video_output/win32/d3d11_adjust.c
+++ b/modules/video_output/win32/d3d11_adjust.c
@@ -178,9 +178,9 @@ static void SetLevel(struct filter_level *range, float val)
static void InitLevel(filter_t *filter, struct filter_level *range, const char *p_name, float def)
{
- int level = 0;
+ int level;
- module_config_t *cfg = config_FindConfig( VLC_OBJECT(filter), p_name);
+ module_config_t *cfg = config_FindConfig( VLC_OBJECT(filter), p_name );
if (unlikely(cfg == NULL))
{
range->min = 0.;
@@ -192,16 +192,18 @@ static void InitLevel(filter_t *filter, struct filter_level *range, const char *
range->min = cfg->min.f;
range->max = cfg->max.f;
range->default_val = def;
+ }
- float val = var_CreateGetFloatCommand( filter, p_name );
+ float val = var_CreateGetFloatCommand( filter, p_name );
- if (val > range->default_val)
- level = (range->Range.Maximum - range->Range.Default) * (val - range->default_val) /
- (range->max - range->default_val);
- else if (val < range->default_val)
- level = (range->Range.Minimum - range->Range.Default) * (val - range->default_val) /
- (range->min - range->default_val);
- }
+ if (val > range->default_val)
+ level = (range->Range.Maximum - range->Range.Default) * (val - range->default_val) /
+ (range->max - range->default_val);
+ else if (val < range->default_val)
+ level = (range->Range.Minimum - range->Range.Default) * (val - range->default_val) /
+ (range->min - range->default_val);
+ else
+ level = 0;
atomic_init( &range->level, range->Range.Default + level );
}
--
2.12.1
More information about the vlc-devel
mailing list