]> git.sesse.net Git - vlc/blobdiff - src/control/video.c
Merge branch 1.0-bugfix
[vlc] / src / control / video.c
index d07a69284b6ff4ce53212ecfccb65859ae4cb612..fd62e005a72deb7e165116d887fa2994e2d7b3f9 100644 (file)
 static vout_thread_t *GetVout( libvlc_media_player_t *p_mi,
                                libvlc_exception_t *p_exception )
 {
-    input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi, p_exception );
+    input_thread_t *p_input = libvlc_get_input_thread( p_mi, p_exception );
     vout_thread_t *p_vout = NULL;
 
-    if( p_input_thread )
+    if( p_input )
     {
-        p_vout = input_GetVout( p_input_thread );
+        p_vout = input_GetVout( p_input );
         if( !p_vout )
         {
             libvlc_exception_raise( p_exception, "No active video output" );
         }
-        vlc_object_release( p_input_thread );
+        vlc_object_release( p_input );
     }
     return p_vout;
 }
@@ -187,6 +187,33 @@ int libvlc_media_player_has_vout( libvlc_media_player_t *p_mi,
     return has_vout;
 }
 
+float libvlc_video_get_scale( libvlc_media_player_t *p_mp,
+                              libvlc_exception_t *p_e )
+{
+    vout_thread_t *p_vout = GetVout( p_mp, p_e );
+    if( !p_vout )
+        return 0.;
+
+    float f_scale = var_GetFloat( p_vout, "scale" );
+    if( var_GetBool( p_vout, "autoscale" ) )
+        f_scale = 0.;
+    vlc_object_release( p_vout );
+    return f_scale;
+}
+
+void libvlc_video_set_scale( libvlc_media_player_t *p_mp, float f_scale,
+                             libvlc_exception_t *p_e )
+{
+    vout_thread_t *p_vout = GetVout( p_mp, p_e );
+    if( !p_vout )
+        return;
+
+    if( f_scale != 0. )
+        var_SetFloat( p_vout, "scale", f_scale );
+    var_SetBool( p_vout, "autoscale", f_scale != 0. );
+    vlc_object_release( p_vout );
+}
+
 char *libvlc_video_get_aspect_ratio( libvlc_media_player_t *p_mi,
                                      libvlc_exception_t *p_e )
 {