[vlc-devel] [PATCHv3 07/17] lib: add libvlc_media_track_release

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


---
 include/vlc/libvlc_media_track.h | 12 ++++++++++++
 lib/libvlc.sym                   |  1 +
 lib/media_track.c                |  9 +++++++++
 3 files changed, 22 insertions(+)

diff --git a/include/vlc/libvlc_media_track.h b/include/vlc/libvlc_media_track.h
index 634fe17b8b5..ceb01ea37e1 100644
--- a/include/vlc/libvlc_media_track.h
+++ b/include/vlc/libvlc_media_track.h
@@ -199,6 +199,18 @@ libvlc_media_tracklist_at( libvlc_media_tracklist_t *list, size_t index );
 LIBVLC_API void
 libvlc_media_tracklist_release( libvlc_media_tracklist_t *list );
 
+/**
+ * Release a single track
+ *
+ * \version LibVLC 4.0.0 and later.
+ * \warning Don't release tracks from a tracklist with this function. Tracks
+ * from a tracklist are released alongside the list with
+ * libvlc_media_tracklist_release()
+ *
+ * \param track valid track
+ */
+LIBVLC_API void
+libvlc_media_track_release( libvlc_media_track_t *track );
 /** @}*/
 
 # ifdef __cplusplus
diff --git a/lib/libvlc.sym b/lib/libvlc.sym
index a3217c5750f..4b886da7532 100644
--- a/lib/libvlc.sym
+++ b/lib/libvlc.sym
@@ -86,6 +86,7 @@ libvlc_media_thumbnail_request_by_time
 libvlc_media_thumbnail_request_by_pos
 libvlc_media_thumbnail_request_cancel
 libvlc_media_thumbnail_request_destroy
+libvlc_media_track_release
 libvlc_media_tracklist_at
 libvlc_media_tracklist_count
 libvlc_media_tracklist_release
diff --git a/lib/media_track.c b/lib/media_track.c
index 2e6885bf7d9..6046bb0025c 100644
--- a/lib/media_track.c
+++ b/lib/media_track.c
@@ -129,6 +129,15 @@ libvlc_media_track_clean( libvlc_media_track_t *track )
     }
 }
 
+void
+libvlc_media_track_release( libvlc_media_track_t *track )
+{
+    libvlc_media_trackpriv_t *trackpriv =
+        container_of( track, libvlc_media_trackpriv_t, t );
+    libvlc_media_track_clean( track );
+    free( trackpriv );
+}
+
 static libvlc_media_tracklist_t *
 libvlc_media_tracklist_alloc( size_t count )
 {
-- 
2.20.1



More information about the vlc-devel mailing list