vlc | branch: master | Filip Roséen <fi...@atch.se> | Wed Oct 12 19:39:33 2016 
+0200| [897d37e4a15c4290fd0f59f1ade5f1788e48f60b] | committer: Thomas Guillem

vlc_variables: add VLC_VAR_SETMINMAX

Most of the time when you wanna limit the range of possible values for
a variable you do so my specifying both the lower and upper bound.

As such it certainly make sense to have a var_Change specifier to set
both, instead of doing one at a time.

Signed-off-by: Thomas Guillem <tho...@gllm.fr>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=897d37e4a15c4290fd0f59f1ade5f1788e48f60b
---

 include/vlc_variables.h |  1 +
 src/misc/variables.c    | 19 +++++++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/include/vlc_variables.h b/include/vlc_variables.h
index 77b4682..072f537 100644
--- a/include/vlc_variables.h
+++ b/include/vlc_variables.h
@@ -115,6 +115,7 @@
 #define VLC_VAR_GETCHOICES          0x0024
 
 #define VLC_VAR_CHOICESCOUNT        0x0026
+#define VLC_VAR_SETMINMAX           0x0027
 
 /**@}*/
 
diff --git a/src/misc/variables.c b/src/misc/variables.c
index c2ed69a..66c94f6 100644
--- a/src/misc/variables.c
+++ b/src/misc/variables.c
@@ -529,6 +529,25 @@ int var_Change( vlc_object_t *p_this, const char *psz_name,
             else
                 ret = VLC_EGENERIC;
             break;
+        case VLC_VAR_SETMINMAX:
+            if( p_var->i_type & VLC_VAR_HASMIN )
+            {
+                p_var->ops->pf_free( &p_var->min );
+            }
+            p_var->i_type |= VLC_VAR_HASMIN;
+            p_var->min = *p_val;
+            p_var->ops->pf_dup( &p_var->min );
+
+            if( p_var->i_type & VLC_VAR_HASMAX )
+            {
+                p_var->ops->pf_free( &p_var->max );
+            }
+            p_var->i_type |= VLC_VAR_HASMAX;
+            p_var->max = *p_val2;
+            p_var->ops->pf_dup( &p_var->max );
+
+            break;
+
         case VLC_VAR_SETSTEP:
             if( p_var->i_type & VLC_VAR_HASSTEP )
             {

_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to