[vlc-devel] [PATCH] lib: player: add unset tracks API
Thomas Guillem
thomas at gllm.fr
Fri Jan 24 17:20:48 CET 2020
The libvlc_media_player is no longer exposing the "disable" tracks. LibVLC
users should now explicitly call these 3 new unset functions to disable a
track category.
These new functions don't support disabling a specific track of a category.
This can be done in a separate commit by adding the following calls:
libvlc_video_add_spu()
libvlc_video_remove_spu()
Since VLC support multi tracks for SPU only (for now).
---
include/vlc/libvlc_media_player.h | 25 +++++++++++++++++++++++++
lib/audio.c | 8 ++++++++
lib/libvlc.sym | 3 +++
lib/video.c | 16 ++++++++++++++++
4 files changed, 52 insertions(+)
diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h
index 7c72c9774b2..6648ba6a5ad 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -1575,6 +1575,14 @@ LIBVLC_API libvlc_track_description_t *
*/
LIBVLC_API int libvlc_video_set_spu( libvlc_media_player_t *p_mi, int i_spu );
+/**
+ * Unset the current subtitle
+ *
+ * \param p_mi the media player
+ * \version LibVLC 4.0.0 and later
+ */
+LIBVLC_API void libvlc_video_unset_spu( libvlc_media_player_t *p_mi );
+
/**
* Get the current subtitle delay. Positive values means subtitles are being
* displayed later, negative values earlier.
@@ -1792,6 +1800,15 @@ LIBVLC_API int libvlc_video_get_track( libvlc_media_player_t *p_mi );
LIBVLC_API
int libvlc_video_set_track( libvlc_media_player_t *p_mi, int i_track );
+/**
+ * Unset the current video track.
+ *
+ * \param p_mi media player
+ * \version LibVLC 4.0.0 and later
+ */
+LIBVLC_API
+void libvlc_video_unset_track( libvlc_media_player_t *p_mi );
+
/**
* Take a snapshot of the current video window.
*
@@ -2213,6 +2230,14 @@ LIBVLC_API int libvlc_audio_get_track( libvlc_media_player_t *p_mi );
*/
LIBVLC_API int libvlc_audio_set_track( libvlc_media_player_t *p_mi, int i_track );
+/**
+ * Unset the current audio track.
+ *
+ * \param p_mi media player
+ * \version LibVLC 4.0.0 and later
+ */
+LIBVLC_API void libvlc_audio_unset_track( libvlc_media_player_t *p_mi );
+
/**
* Get current audio channel.
*
diff --git a/lib/audio.c b/lib/audio.c
index aab84cd47a9..36695fe06da 100644
--- a/lib/audio.c
+++ b/lib/audio.c
@@ -394,6 +394,14 @@ end:
return i_ret;
}
+void libvlc_audio_unset_track(libvlc_media_player_t *p_mi)
+{
+ vlc_player_t *player = p_mi->player;
+ vlc_player_Lock(player);
+ vlc_player_UnselectTrackCategory(player, AUDIO_ES);
+ vlc_player_Unlock(player);
+}
+
/*****************************************************************************
* libvlc_audio_get_channel : Get the current audio channel
*****************************************************************************/
diff --git a/lib/libvlc.sym b/lib/libvlc.sym
index d8fb0806bca..cc0535b868b 100644
--- a/lib/libvlc.sym
+++ b/lib/libvlc.sym
@@ -39,6 +39,7 @@ libvlc_audio_set_format
libvlc_audio_set_format_callbacks
libvlc_audio_set_callbacks
libvlc_audio_set_volume_callback
+libvlc_audio_unset_track
libvlc_chapter_descriptions_release
libvlc_clock
libvlc_dialog_dismiss
@@ -253,6 +254,8 @@ libvlc_video_set_teletext
libvlc_video_set_track
libvlc_video_take_snapshot
libvlc_video_new_viewpoint
+libvlc_video_unset_track
+libvlc_video_unset_spu
libvlc_video_update_viewpoint
libvlc_set_exit_handler
libvlc_audio_filter_list_get
diff --git a/lib/video.c b/lib/video.c
index 6f8e6d7f59a..c667a0d07ac 100644
--- a/lib/video.c
+++ b/lib/video.c
@@ -336,6 +336,14 @@ end:
return i_ret;
}
+void libvlc_video_unset_spu(libvlc_media_player_t *p_mi)
+{
+ vlc_player_t *player = p_mi->player;
+ vlc_player_Lock(player);
+ vlc_player_UnselectTrackCategory(player, SPU_ES);
+ vlc_player_Unlock(player);
+}
+
int64_t libvlc_video_get_spu_delay( libvlc_media_player_t *p_mi )
{
vlc_player_t *player = p_mi->player;
@@ -507,6 +515,14 @@ end:
return i_ret;
}
+void libvlc_video_unset_track(libvlc_media_player_t *p_mi)
+{
+ vlc_player_t *player = p_mi->player;
+ vlc_player_Lock(player);
+ vlc_player_UnselectTrackCategory(player, VIDEO_ES);
+ vlc_player_Unlock(player);
+}
+
/******************************************************************************
* libvlc_video_set_deinterlace : enable/disable/auto deinterlace and filter
*****************************************************************************/
--
2.20.1
More information about the vlc-devel
mailing list