[vlc-commits] lib: add libvlc_video_get_spu_text_scale API

Felix Paul Kühne git at videolan.org
Wed Jan 27 05:00:09 UTC 2021


vlc | branch: master | Felix Paul Kühne <felix at feepk.net> | Tue Oct 27 10:27:06 2020 +0100| [f86b34707976b963270c781267378d0693abcd90] | committer: Felix Paul Kühne

lib: add libvlc_video_get_spu_text_scale API

This complements 67c4ffd5.

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

 include/vlc/libvlc_media_player.h | 11 +++++++++++
 lib/libvlc.sym                    |  1 +
 lib/video.c                       | 12 ++++++++++++
 3 files changed, 24 insertions(+)

diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h
index 8dd85d1604..77cebe6d57 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -1788,6 +1788,17 @@ LIBVLC_API int libvlc_video_update_viewpoint( libvlc_media_player_t *p_mi,
  */
 LIBVLC_API int64_t libvlc_video_get_spu_delay( libvlc_media_player_t *p_mi );
 
+/**
+ * Get the current subtitle text scale
+ *
+ * The scale factor is expressed as a percentage of the default size, where
+ * 1.0 represents 100 percent.
+ *
+ * \param p_mi media player
+ * \version LibVLC 4.0.0 or later
+ */
+LIBVLC_API float libvlc_video_get_spu_text_scale( libvlc_media_player_t *p_mi );
+
 /**
  * Set the subtitle text scale.
  *
diff --git a/lib/libvlc.sym b/lib/libvlc.sym
index f30d67f3a9..2c145c59d3 100644
--- a/lib/libvlc.sym
+++ b/lib/libvlc.sym
@@ -245,6 +245,7 @@ libvlc_video_get_spu
 libvlc_video_get_spu_count
 libvlc_video_get_spu_delay
 libvlc_video_get_spu_description
+libvlc_video_get_spu_text_scale
 libvlc_video_get_teletext
 libvlc_video_get_track
 libvlc_video_get_track_count
diff --git a/lib/video.c b/lib/video.c
index e06adf143b..d3cba035d8 100644
--- a/lib/video.c
+++ b/lib/video.c
@@ -368,6 +368,18 @@ int libvlc_video_set_spu_delay( libvlc_media_player_t *p_mi,
     return 0;
 }
 
+float libvlc_video_get_spu_text_scale( libvlc_media_player_t *p_mi )
+{
+    vlc_player_t *player = p_mi->player;
+    vlc_player_Lock(player);
+
+    unsigned scale = vlc_player_GetSubtitleTextScale(player);
+
+    vlc_player_Unlock(player);
+
+    return scale / 100.f;
+}
+
 void libvlc_video_set_spu_text_scale( libvlc_media_player_t *p_mi,
                                       float f_scale )
 {



More information about the vlc-commits mailing list