Skip to content

Commit

Permalink
libvlc: add SPU scale getter
Browse files Browse the repository at this point in the history
This fixes the compilation broken in 632c0c7 that used non-existing API
  • Loading branch information
fkuehne committed Oct 27, 2020
1 parent dfd51ed commit 5d45207
Showing 1 changed file with 72 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
From a85164a9d9322211ccd9b273dda0866740357e83 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Felix=20Paul=20K=C3=BChne?= <felix@feepk.net>
Date: Tue, 27 Oct 2020 10:27:06 +0100
Subject: [PATCH 18/18] lib: add libvlc_video_get_spu_text_scale API

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)

0 comments on commit 5d45207

Please sign in to comment.