]> git.sesse.net Git - vlc/blobdiff - lib/video.c
Contribs: update dvdread to 5.0.3
[vlc] / lib / video.c
index d0f1f7a6084fd80bccaf4664101f88e4a085c95c..4abe36e4311fd54682a41339eaa9e87e9e47ed35 100644 (file)
@@ -38,6 +38,7 @@
 #include <vlc_vout.h>
 
 #include "media_player_internal.h"
+#include <math.h>
 #include <assert.h>
 
 /*
@@ -229,17 +230,17 @@ unsigned libvlc_media_player_has_vout( libvlc_media_player_t *p_mi )
 
 float libvlc_video_get_scale( libvlc_media_player_t *mp )
 {
-    float f_scale = var_GetFloat (mp, "scale");
+    float f_scale = var_GetFloat (mp, "zoom");
     if (var_GetBool (mp, "autoscale"))
-        f_scale = 0.;
+        f_scale = 0.f;
     return f_scale;
 }
 
 void libvlc_video_set_scale( libvlc_media_player_t *p_mp, float f_scale )
 {
-    if (f_scale != 0.)
-        var_SetFloat (p_mp, "scale", f_scale);
-    var_SetBool (p_mp, "autoscale", f_scale == 0.);
+    if (isfinite(f_scale) && f_scale != 0.f)
+        var_SetFloat (p_mp, "zoom", f_scale);
+    var_SetBool (p_mp, "autoscale", f_scale == 0.f);
 
     /* Apply to current video outputs (if any) */
     size_t n;
@@ -248,9 +249,9 @@ void libvlc_video_set_scale( libvlc_media_player_t *p_mp, float f_scale )
     {
         vout_thread_t *p_vout = pp_vouts[i];
 
-        if (f_scale != 0.)
-            var_SetFloat (p_vout, "scale", f_scale);
-        var_SetBool (p_vout, "autoscale", f_scale == 0.);
+        if (isfinite(f_scale) && f_scale != 0.f)
+            var_SetFloat (p_vout, "zoom", f_scale);
+        var_SetBool (p_vout, "autoscale", f_scale == 0.f);
         vlc_object_release (p_vout);
     }
     free (pp_vouts);
@@ -494,7 +495,7 @@ void libvlc_toggle_teletext( libvlc_media_player_t *p_mi )
     else
     {
         vlc_value_t list;
-        if( !var_Change( p_input_thread, "teletext-es", VLC_VAR_GETLIST, &list, NULL ) )
+        if( !var_Change( p_input_thread, "teletext-es", VLC_VAR_GETCHOICES, &list, NULL ) )
         {
             if( list.p_list->i_count > 0 )
                 var_SetInteger( p_input_thread, "spu-es", list.p_list->p_values[0].i_int );
@@ -642,26 +643,29 @@ set_int( libvlc_media_player_t *p_mi, const char *restrict name,
 {
     if( !opt ) return;
 
-    if( !opt->type ) /* the enabler */
+    switch( opt->type )
     {
-        vout_thread_t *vout = GetVout( p_mi, 0 );
-        if (vout)
+        case 0: /* the enabler */
         {
-            /* Fill sub-source */
-            vout_EnableFilter( vout, opt->name, value, false );
-            var_TriggerCallback( vout, "sub-source" );
-            vlc_object_release( vout );
+            vout_thread_t *vout = GetVout( p_mi, 0 );
+            if (vout != NULL)
+            {   /* Fill sub-source */
+                vout_EnableFilter( vout, opt->name, value, false );
+                var_TriggerCallback( vout, "sub-source" );
+                vlc_object_release( vout );
+            }
+            break;
         }
-        return;
-    }
-
-    if( opt->type != VLC_VAR_INTEGER )
-    {
-        libvlc_printerr( "Invalid argument to %s in %s", name, "set int" );
-        return;
+        case VLC_VAR_INTEGER:
+            var_SetInteger( p_mi, opt->name, value );
+            break;
+        case VLC_VAR_FLOAT:
+            var_SetFloat( p_mi, opt->name, value );
+            break;
+        default:
+            libvlc_printerr( "Invalid argument to %s in %s", name, "set int" );
+            return;
     }
-
-    var_SetInteger( p_mi, opt->name, value );
 }
 
 static int
@@ -679,6 +683,8 @@ get_int( libvlc_media_player_t *p_mi, const char *restrict name,
         }
     case VLC_VAR_INTEGER:
         return var_GetInteger(p_mi, opt->name);
+    case VLC_VAR_FLOAT:
+        return lroundf(var_GetFloat(p_mi, opt->name));
     default:
         libvlc_printerr( "Invalid argument to %s in %s", name, "get int" );
         return 0;
@@ -863,7 +869,7 @@ adjust_option_bynumber( unsigned option )
         { "adjust",     0 },
         { "contrast",   VLC_VAR_FLOAT },
         { "brightness", VLC_VAR_FLOAT },
-        { "hue",        VLC_VAR_INTEGER },
+        { "hue",        VLC_VAR_FLOAT },
         { "saturation", VLC_VAR_FLOAT },
         { "gamma",      VLC_VAR_FLOAT },
     };