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

Mark Lee mark.lee at capricasoftware.co.uk
Sun Apr 19 10:14:32 CEST 2020


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

diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h
index 5e0255a10a..8ebe37d4fa 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -1544,6 +1544,15 @@ LIBVLC_API int libvlc_video_set_spu( libvlc_media_player_t *p_mi, int i_spu );
  */
 LIBVLC_API int64_t libvlc_video_get_spu_delay( libvlc_media_player_t *p_mi );
 
+/**
+ * Set the subtitle text scale.
+ *
+ * \param p_mi media player
+ * \param scale scale factor in the range [10;500] (default: 100)
+ * \version LibVLC 4.0.0 or later
+ */
+LIBVLC_API void libvlc_video_set_spu_text_scale( libvlc_media_player_t *p_mi, unsigned scale );
+
 /**
  * Set the subtitle delay. This affects the timing of when the subtitle will
  * be displayed. Positive values result in subtitles being displayed later,
diff --git a/lib/libvlc.sym b/lib/libvlc.sym
index 67e4dcf748..5623ec87d5 100644
--- a/lib/libvlc.sym
+++ b/lib/libvlc.sym
@@ -248,6 +248,7 @@ libvlc_video_set_mouse_input
 libvlc_video_set_scale
 libvlc_video_set_spu
 libvlc_video_set_spu_delay
+libvlc_video_set_spu_text_scale
 libvlc_video_set_teletext
 libvlc_video_set_track
 libvlc_video_take_snapshot
diff --git a/lib/video.c b/lib/video.c
index 6f8e6d7f59..8a020c3dd7 100644
--- a/lib/video.c
+++ b/lib/video.c
@@ -362,6 +362,17 @@ int libvlc_video_set_spu_delay( libvlc_media_player_t *p_mi,
     return 0;
 }
 
+void libvlc_video_set_spu_text_scale( libvlc_media_player_t *p_mi,
+                                      unsigned scale)
+{
+    vlc_player_t *player = p_mi->player;
+    vlc_player_Lock(player);
+
+    vlc_player_SetSubtitleTextScale(player, scale);
+
+    vlc_player_Unlock(player);
+}
+
 static void libvlc_video_set_crop(libvlc_media_player_t *mp,
                                   const char *geometry)
 {
-- 
2.17.1



More information about the vlc-devel mailing list