[vlc-devel] [PATCH 2/4] player :add vlc_player_GetCategoryLanguage
Thomas Guillem
thomas at gllm.fr
Mon Jun 3 10:28:12 CEST 2019
Will be needed by vlc_strfinput.
---
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
@@ -1852,6 +1852,23 @@ vlc_player_SelectCategoryLanguage(vlc_player_t *player,
enum es_format_category_e cat,
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
*/
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 a723feab48..0bf75a36fc 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -783,6 +783,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
--
2.20.1
More information about the vlc-devel
mailing list