[vlc-devel] [PATCH] lib: add libvlc_video_get_spu_text_scale API

Felix Paul Kühne fkuehne at videolan.org
Tue Oct 27 12:08:10 CET 2020


From: Felix Paul Kühne <felix at feepk.net>

This complements 67c4ffd5.
---
 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 fea7034644..a017d6c1cf 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -1648,6 +1648,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 2bb67eccf8..5d9713cdb3 100644
--- a/lib/libvlc.sym
+++ b/lib/libvlc.sym
@@ -239,6 +239,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 )
 {
-- 
2.24.3 (Apple Git-128)



More information about the vlc-devel mailing list