<!DOCTYPE html><html><head><title></title><style type="text/css">p.MsoNormal,p.MsoNoSpacing{margin:0}</style></head><body><div>It was done like that in VLC 3.0.<br></div><div><br></div><div>Adding specific functions to disable tracks will require all LibVLC users to update their code accordingly.<br></div><div><br></div><div>For now, the transition between LibVLC 3.0 and 4.0 is quite smooth and doesn't require a lot of rewrite.<br></div><div><br></div><div>I'm fine with both ways, I just proposed the simplest one first.<br></div><div><br></div><div>Waiting for everyone's feedback.<br></div><div><br></div><div>On Thu, Jan 16, 2020, at 15:55, Rémi Denis-Courmont wrote:<br></div><blockquote type="cite" id="qt"><div>Hi,<br></div><div><br></div><div>It's certainly useful to be able to disable tracks but I don't think that choice should be listed as a track per se.<br></div><div><br></div><div class="qt-gmail_quote"><div>Le 16 janvier 2020 16:02:48 GMT+02:00, Thomas Guillem <thomas@gllm.fr> a écrit :<br></div><blockquote style="margin-top:0pt;margin-right:0pt;margin-bottom:0pt;margin-left:0.8ex;border-left-color:rgb(204, 204, 204);border-left-style:solid;border-left-width:1px;padding-left:1ex;" class="qt-gmail_quote"><pre class="qt-k9mail"><div>Regression from vlc_player.h port. libvlc_media_player expose the "disable"<br></div><div>track. A -1 id is still a good choice to disable a track, cf<br></div><div>src/input/es_out.c, a valid i_id can't be negative.<hr> lib/audio.c | 7 +++++++<br></div><div> lib/media_player.c | 18 ++++++++++++++++--<br></div><div> lib/video.c | 14 ++++++++++++++<br></div><div> 3 files changed, 37 insertions(+), 2 deletions(-)<br></div><div><br></div><div>diff --git a/lib/audio.c b/lib/audio.c<br></div><div>index aab84cd47a9..8222300707d 100644<br></div><div>--- a/lib/audio.c<br></div><div>+++ b/lib/audio.c<br></div><div>@@ -375,6 +375,13 @@ int libvlc_audio_set_track( libvlc_media_player_t *p_mi, int i_track )<br></div><div> vlc_player_t *player = p_mi->player;<br></div><div> vlc_player_Lock(player);<br></div><div> <br></div><div>+ if (i_track < 0)<br></div><div>+ {<br></div><div>+ vlc_player_UnselectTrackCategory(player, AUDIO_ES);<br></div><div>+ i_ret = 0;<br></div><div>+ goto end;<br></div><div>+ }<br></div><div>+<br></div><div> size_t count = vlc_player_GetAudioTrackCount(player);<br></div><div> for( size_t i = 0; i < count; i++ )<br></div><div> {<br></div><div>diff --git a/lib/media_player.c b/lib/media_player.c<br></div><div>index cdb6ba0b8c5..e21ab5c1998 100644<br></div><div>--- a/lib/media_player.c<br></div><div>+++ b/lib/media_player.c<br></div><div>@@ -1671,14 +1671,28 @@ libvlc_track_description_t *<br></div><div> enum es_format_category_e cat )<br></div><div> {<br></div><div> vlc_player_t *player = p_mi->player;<br></div><div>- vlc_player_Lock(player);<br></div><div> <br></div><div> libvlc_track_description_t *ret, **pp = &ret;<br></div><div> <br></div><div>+ /* Add the "Disable" track */<br></div><div>+ libvlc_track_description_t *tr = malloc(sizeof (*tr));<br></div><div>+ if (unlikely(tr == NULL))<br></div><div>+ return NULL;<br></div><div>+ tr->i_id = -1;<br></div><div>+ tr->psz_name = strdup(_("Disable"));<br></div><div>+ if (unlikely(!tr->psz_name))<br></div><div>+ {<br></div><div>+ free(tr);<br></div><div>+ return NULL;<br></div><div>+ }<br></div><div>+ *pp = tr;<br></div><div>+ pp = &tr->p_next;<br></div><div>+<br></div><div>+ vlc_player_Lock(player);<br></div><div> size_t count = vlc_player_GetTrackCount(player, cat);<br></div><div> for (size_t i = 0; i < count; i++)<br></div><div> {<br></div><div>- libvlc_track_description_t *tr = malloc(sizeof (*tr));<br></div><div>+ tr = malloc(sizeof (*tr));<br></div><div> if (unlikely(tr == NULL))<br></div><div> {<br></div><div> libvlc_printerr("Not enough memory");<br></div><div>diff --git a/lib/video.c b/lib/video.c<br></div><div>index 6f8e6d7f59a..9772945a958 100644<br></div><div>--- a/lib/video.c<br></div><div>+++ b/lib/video.c<br></div><div>@@ -317,6 +317,13 @@ int libvlc_video_set_spu( libvlc_media_player_t *p_mi, int i_spu )<br></div><div> vlc_player_t *player = p_mi->player;<br></div><div> vlc_player_Lock(player);<br></div><div> <br></div><div>+ if (i_spu < 0)<br></div><div>+ {<br></div><div>+ vlc_player_UnselectTrackCategory(player, SPU_ES);<br></div><div>+ i_ret = 0;<br></div><div>+ goto end;<br></div><div>+ }<br></div><div>+<br></div><div> size_t count = vlc_player_GetSubtitleTrackCount(player);<br></div><div> for (size_t i = 0; i < count; i++)<br></div><div> {<br></div><div>@@ -488,6 +495,13 @@ int libvlc_video_set_track( libvlc_media_player_t *p_mi, int i_track )<br></div><div> vlc_player_t *player = p_mi->player;<br></div><div> vlc_player_Lock(player);<br></div><div> <br></div><div>+ if (i_track < 0)<br></div><div>+ {<br></div><div>+ vlc_player_UnselectTrackCategory(player, VIDEO_ES);<br></div><div>+ i_ret = 0;<br></div><div>+ goto end;<br></div><div>+ }<br></div><div>+<br></div><div> size_t count = vlc_player_GetVideoTrackCount(player);<br></div><div> for( size_t i = 0; i < count; i++ )<br></div><div> {<br></div></pre></blockquote></div><div><br></div><div>-- <br></div><div>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté. <br></div><div>_______________________________________________<br></div><div>vlc-devel mailing list<br></div><div>To unsubscribe or modify your subscription options:<br></div><div>https://mailman.videolan.org/listinfo/vlc-devel<br></div></blockquote><div><br></div></body></html>