[vlc-devel] [PATCHv3 06/17] lib: media_track: add new members

Thomas Guillem thomas at gllm.fr
Wed Jun 10 14:57:45 CEST 2020


That will be used by player tracks.
---
 include/vlc/libvlc_media_track.h | 15 +++++++++++++++
 lib/media_track.c                |  4 ++++
 2 files changed, 19 insertions(+)

diff --git a/include/vlc/libvlc_media_track.h b/include/vlc/libvlc_media_track.h
index cad3822a4f5..634fe17b8b5 100644
--- a/include/vlc/libvlc_media_track.h
+++ b/include/vlc/libvlc_media_track.h
@@ -139,6 +139,21 @@ typedef struct libvlc_media_track_t
     char *psz_language;
     char *psz_description;
 
+    /** String identifier of track, can be used to save the track preference
+     * from an other LibVLC run, only valid when the track is fetch from a
+     * media_player */
+    const char *psz_id;
+    /** A string identifier is stable when it is certified to be the same
+     * across different playback instances for the same track, only valid when
+     * the track is fetch from a media_player */
+    bool id_stable;
+    /** Name of the track, only valid when the track is fetch from a
+     * media_player */
+    char *psz_name;
+    /** true if the track is selected, only valid when the track is fetch from
+     * a media_player */
+    bool selected;
+
 } libvlc_media_track_t;
 
 /**
diff --git a/lib/media_track.c b/lib/media_track.c
index d2c835c5fc0..2e6885bf7d9 100644
--- a/lib/media_track.c
+++ b/lib/media_track.c
@@ -55,6 +55,9 @@ libvlc_media_trackpriv_from_es( libvlc_media_trackpriv_t *trackpriv,
     track->i_bitrate = es->i_bitrate;
     track->psz_language = es->psz_language != NULL ? strdup(es->psz_language) : NULL;
     track->psz_description = es->psz_description != NULL ? strdup(es->psz_description) : NULL;
+    track->psz_id = NULL;
+    track->psz_name = NULL;
+    track->selected = false;
 
     switch( es->i_cat )
     {
@@ -110,6 +113,7 @@ libvlc_media_track_clean( libvlc_media_track_t *track )
 {
     free( track->psz_language );
     free( track->psz_description );
+    free( track->psz_name );
     switch( track->i_type )
     {
     case libvlc_track_audio:
-- 
2.20.1



More information about the vlc-devel mailing list