[vlc-devel] commit: libvlc: add support for setting/getting the video scale ( Rémi Denis-Courmont )

git version control git at videolan.org
Wed May 13 20:58:28 CEST 2009


vlc | branch: 1.0-bugfix | Rémi Denis-Courmont <remi at remlab.net> | Wed May 13 21:43:25 2009 +0300| [44b0effdc6c30c7da29a7ee5a97bd69a05430e21] | committer: Rémi Denis-Courmont 

libvlc: add support for setting/getting the video scale

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

 include/vlc/libvlc.h |   25 +++++++++++++++++++++++++
 src/control/video.c  |   27 +++++++++++++++++++++++++++
 src/libvlc.sym       |    2 ++
 3 files changed, 54 insertions(+), 0 deletions(-)

diff --git a/include/vlc/libvlc.h b/include/vlc/libvlc.h
index 5794c0a..0e14b5f 100644
--- a/include/vlc/libvlc.h
+++ b/include/vlc/libvlc.h
@@ -887,6 +887,31 @@ VLC_PUBLIC_API int libvlc_video_get_height( libvlc_media_player_t *, libvlc_exce
 VLC_PUBLIC_API int libvlc_video_get_width( libvlc_media_player_t *, libvlc_exception_t * );
 
 /**
+ * Get the current video scaling factor.
+ * See also libvlc_video_set_scale().
+ *
+ * \param p_mediaplayer the media player
+ * \return the currently configured zoom factor, or 0. if the video is set
+ * to fit to the output window/drawable automatically.
+ */
+VLC_PUBLIC_API float libvlc_video_get_scale( libvlc_media_player_t *,
+                                             libvlc_exception_t *p_e );
+
+/**
+ * Set the video scaling factor. That is the ratio of the number of pixels on
+ * screen to the number of pixels in the original decoded video in each
+ * dimension. Zero is a special value; it will adjust the video to the output
+ * window/drawable (in windowed mode) or the entire screen.
+ *
+ * Note that not all video outputs support scaling.
+ *
+ * \param p_mediaplayer the media player
+ * \param i_factor the scaling factor, or zero
+ */
+VLC_PUBLIC_API void libvlc_video_set_scale( libvlc_media_player_t *, float,
+                                            libvlc_exception_t *p_e );
+
+/**
  * Get current video aspect ratio.
  *
  * \param p_mediaplayer the media player
diff --git a/src/control/video.c b/src/control/video.c
index dc7c922..7904aa2 100644
--- a/src/control/video.c
+++ b/src/control/video.c
@@ -338,6 +338,33 @@ void libvlc_video_set_viewport( libvlc_instance_t *p_instance, libvlc_media_play
 #endif
 }
 
+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 )
 {
diff --git a/src/libvlc.sym b/src/libvlc.sym
index 2dbffcf..8da4a03 100644
--- a/src/libvlc.sym
+++ b/src/libvlc.sym
@@ -199,6 +199,7 @@ libvlc_video_get_chapter_description
 libvlc_video_get_crop_geometry
 libvlc_video_get_height
 libvlc_video_get_parent
+libvlc_video_get_scale
 libvlc_video_get_spu
 libvlc_video_get_spu_count
 libvlc_video_get_spu_description
@@ -214,6 +215,7 @@ libvlc_video_resize
 libvlc_video_set_aspect_ratio
 libvlc_video_set_crop_geometry
 libvlc_video_set_parent
+libvlc_video_set_scale
 libvlc_video_set_size
 libvlc_video_set_spu
 libvlc_video_set_subtitle_file




More information about the vlc-devel mailing list