[vlc-commits] lib: add libvlc_media_track_delete

Thomas Guillem git at videolan.org
Thu Jun 11 14:45:38 CEST 2020


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Jun  4 19:57:47 2020 +0200| [737818383018a5ad1295450fe7317792698d988d] | committer: Thomas Guillem

lib: add libvlc_media_track_delete

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=737818383018a5ad1295450fe7317792698d988d
---

 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 d34d5a251d..4b075a8dee 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_delete( 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_delete()
+ *
+ * \param track valid track
+ */
+LIBVLC_API void
+libvlc_media_track_delete( libvlc_media_track_t *track );
 /** @}*/
 
 # ifdef __cplusplus
diff --git a/lib/libvlc.sym b/lib/libvlc.sym
index 58f9e94062..6251d5d230 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_delete
 libvlc_media_tracklist_at
 libvlc_media_tracklist_count
 libvlc_media_tracklist_delete
diff --git a/lib/media_track.c b/lib/media_track.c
index bab8537c04..ff6c932f69 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_delete( 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 )
 {



More information about the vlc-commits mailing list