[vlc-commits] player: add vlc_player_GetCategoryLanguage

Thomas Guillem git at videolan.org
Mon Jun 3 16:16:42 CEST 2019


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Jun  3 10:02:42 2019 +0200| [90b33a59d1e378ffa892c77e74d1b9d4099507b0] | committer: Thomas Guillem

player: add vlc_player_GetCategoryLanguage

Will be needed by vlc_strfinput.

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

 include/vlc_player.h | 17 +++++++++++++++++
 src/input/player.c   | 17 +++++++++++++++++
 src/libvlccore.sym   |  1 +
 3 files changed, 35 insertions(+)

diff --git a/include/vlc_player.h b/include/vlc_player.h
index dbb905fe71..4058146005 100644
--- a/include/vlc_player.h
+++ b/include/vlc_player.h
@@ -1853,6 +1853,23 @@ vlc_player_SelectCategoryLanguage(vlc_player_t *player,
                                   const char *lang);
 
 /**
+ * Get the language of an ES category
+ *
+ * @warning This only reflects the change made by
+ * vlc_player_SelectCategoryLanguage(). The current playing track doesn't
+ * necessarily correspond to the returned language.
+ *
+ * @see vlc_player_SelectCategoryLanguage
+ *
+ * @param player locked player instance
+ * @param cat AUDIO_ES or SPU_ES
+ * @return valid language or NULL, need to be freed
+ */
+VLC_API char *
+vlc_player_GetCategoryLanguage(vlc_player_t *player,
+                               enum es_format_category_e cat);
+
+/**
  * Helper to select the audio language
  */
 static inline void
diff --git a/src/input/player.c b/src/input/player.c
index da67e65ecc..7ae7d8ca95 100644
--- a/src/input/player.c
+++ b/src/input/player.c
@@ -1477,6 +1477,23 @@ vlc_player_SelectCategoryLanguage(vlc_player_t *player,
     }
 }
 
+char *
+vlc_player_GetCategoryLanguage(vlc_player_t *player,
+                               enum es_format_category_e cat)
+{
+    vlc_player_assert_locked(player);
+    switch (cat)
+    {
+        case AUDIO_ES:
+            return var_GetString(player, "audio-language");
+            break;
+        case SPU_ES:
+            return var_GetString(player, "sub-language");
+        default:
+            vlc_assert_unreachable();
+    }
+}
+
 static void
 vlc_player_input_HandleTeletextMenu(struct vlc_player_input *input,
                                     const struct vlc_input_event_es *ev)
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index baae814a1f..006ba6bb4c 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -795,6 +795,7 @@ vlc_player_DecrementRate
 vlc_player_Delete
 vlc_player_GetAudioDelay
 vlc_player_GetCapabilities
+vlc_player_GetCategoryLanguage
 vlc_player_GetCurrentMedia
 vlc_player_GetError
 vlc_player_GetEsIdFromVout



More information about the vlc-commits mailing list