[vlc-devel] [PATCH 1/2] lib: deprecate the old track API

Thomas Guillem thomas at gllm.fr
Wed Sep 9 14:38:12 CEST 2020


cf. 6f4685bedb03c81b32ac8a49873d704a5983bfab

Note: All libvlc deprecated functions/members will be removed before VLC 4.0
freeze.
---
 include/vlc/deprecated.h          | 180 ++++++++++++++++++++++++++++++
 include/vlc/libvlc_media.h        |  33 ------
 include/vlc/libvlc_media_player.h | 125 ---------------------
 include/vlc/libvlc_media_track.h  |   2 +-
 4 files changed, 181 insertions(+), 159 deletions(-)

diff --git a/include/vlc/deprecated.h b/include/vlc/deprecated.h
index 82ac660f949..017bba79572 100644
--- a/include/vlc/deprecated.h
+++ b/include/vlc/deprecated.h
@@ -88,6 +88,186 @@ libvlc_media_parse_async( libvlc_media_t *p_md );
 LIBVLC_DEPRECATED LIBVLC_API bool
    libvlc_media_is_parsed( libvlc_media_t *p_md );
 
+/**
+ * Get media descriptor's elementary streams description
+ *
+ * Note, you need to call libvlc_media_parse_with_options() or play the media
+ * at least once before calling this function.
+ * Not doing this will result in an empty array.
+ *
+ * \version LibVLC 2.1.0 and later.
+ * \see libvlc_media_parse_with_options
+ *
+ * \param p_md media descriptor object
+ * \param tracks address to store an allocated array of Elementary Streams
+ *        descriptions (must be freed with libvlc_media_tracks_release
+          by the caller) [OUT]
+ *
+ * \return the number of Elementary Streams (zero on error)
+ */
+LIBVLC_DEPRECATED LIBVLC_API
+unsigned libvlc_media_tracks_get( libvlc_media_t *p_md,
+                                  libvlc_media_track_t ***tracks );
+
+/**
+ * Release media descriptor's elementary streams description array
+ *
+ * \version LibVLC 2.1.0 and later.
+ *
+ * \param p_tracks tracks info array to release
+ * \param i_count number of elements in the array
+ */
+LIBVLC_DEPRECATED LIBVLC_API
+void libvlc_media_tracks_release( libvlc_media_track_t **p_tracks,
+                                  unsigned i_count );
+
+/** @}*/
+
+/**
+ * \ingroup libvlc libvlc_media_player
+ * @{
+ */
+
+/**
+ * Description for video, audio tracks and subtitles. It contains
+ * id, name (description string) and pointer to next record.
+ */
+typedef struct libvlc_track_description_t
+{
+    int   i_id;
+    char *psz_name;
+    struct libvlc_track_description_t *p_next;
+
+} libvlc_track_description_t;
+
+/**
+ * Release (free) libvlc_track_description_t
+ *
+ * \param p_track_description the structure to release
+ */
+LIBVLC_DEPRECATED LIBVLC_API void libvlc_track_description_list_release( libvlc_track_description_t *p_track_description );
+
+
+/** @}*/
+
+/**
+ * \ingroup libvlc libvlc_video
+ * @{
+ */
+
+/**
+ * Get number of available video tracks.
+ *
+ * \param p_mi media player
+ * \return the number of available video tracks (int)
+ */
+LIBVLC_DEPRECATED LIBVLC_API int libvlc_video_get_track_count( libvlc_media_player_t *p_mi );
+
+/**
+ * Get the description of available video tracks.
+ *
+ * \param p_mi media player
+ * \return list with description of available video tracks, or NULL on error.
+ * It must be freed with libvlc_track_description_list_release()
+ */
+LIBVLC_DEPRECATED LIBVLC_API libvlc_track_description_t *
+        libvlc_video_get_track_description( libvlc_media_player_t *p_mi );
+
+/**
+ * Get current video track.
+ *
+ * \param p_mi media player
+ * \return the video track ID (int) or -1 if no active input
+ */
+LIBVLC_DEPRECATED LIBVLC_API int libvlc_video_get_track( libvlc_media_player_t *p_mi );
+
+/**
+ * Set video track.
+ *
+ * \param p_mi media player
+ * \param i_track the track ID (i_id field from track description)
+ * \return 0 on success, -1 if out of range
+ */
+LIBVLC_DEPRECATED LIBVLC_API
+int libvlc_video_set_track( libvlc_media_player_t *p_mi, int i_track );
+
+/**
+ * Get current video subtitle.
+ *
+ * \param p_mi the media player
+ * \return the video subtitle selected, or -1 if none
+ */
+LIBVLC_DEPRECATED LIBVLC_API int libvlc_video_get_spu( libvlc_media_player_t *p_mi );
+
+/**
+ * Get the number of available video subtitles.
+ *
+ * \param p_mi the media player
+ * \return the number of available video subtitles
+ */
+LIBVLC_DEPRECATED LIBVLC_API int libvlc_video_get_spu_count( libvlc_media_player_t *p_mi );
+
+/**
+ * Get the description of available video subtitles.
+ *
+ * \param p_mi the media player
+ * \return list containing description of available video subtitles.
+ * It must be freed with libvlc_track_description_list_release()
+ */
+LIBVLC_DEPRECATED LIBVLC_API libvlc_track_description_t *
+        libvlc_video_get_spu_description( libvlc_media_player_t *p_mi );
+
+/**
+ * Set new video subtitle.
+ *
+ * \param p_mi the media player
+ * \param i_spu video subtitle track to select (i_id from track description)
+ * \return 0 on success, -1 if out of range
+ */
+LIBVLC_DEPRECATED LIBVLC_API int libvlc_video_set_spu( libvlc_media_player_t *p_mi, int i_spu );
+
+/** @}*/
+
+/**
+ * \ingroup libvlc libvlc_audio
+ * @{
+ */
+
+/**
+ * Get number of available audio tracks.
+ *
+ * \param p_mi media player
+ * \return the number of available audio tracks (int), or -1 if unavailable
+ */
+LIBVLC_DEPRECATED LIBVLC_API int libvlc_audio_get_track_count( libvlc_media_player_t *p_mi );
+
+/**
+ * Get the description of available audio tracks.
+ *
+ * \param p_mi media player
+ * \return list with description of available audio tracks, or NULL.
+ * It must be freed with libvlc_track_description_list_release()
+ */
+LIBVLC_DEPRECATED LIBVLC_API libvlc_track_description_t *
+        libvlc_audio_get_track_description( libvlc_media_player_t *p_mi );
+
+/**
+ * Get current audio track.
+ *
+ * \param p_mi media player
+ * \return the audio track ID or -1 if no active input.
+ */
+LIBVLC_DEPRECATED LIBVLC_API int libvlc_audio_get_track( libvlc_media_player_t *p_mi );
+
+/**
+ * Set current audio track.
+ *
+ * \param p_mi media player
+ * \param i_track the track ID (i_id field from track description)
+ * \return 0 on success, -1 on error
+ */
+LIBVLC_DEPRECATED LIBVLC_API int libvlc_audio_set_track( libvlc_media_player_t *p_mi, int i_track );
+
 /** @}*/
 
 /**
diff --git a/include/vlc/libvlc_media.h b/include/vlc/libvlc_media.h
index 23946f0b16a..cd203e8edaa 100644
--- a/include/vlc/libvlc_media.h
+++ b/include/vlc/libvlc_media.h
@@ -641,27 +641,6 @@ LIBVLC_API void
  */
 LIBVLC_API void *libvlc_media_get_user_data( libvlc_media_t *p_md );
 
-/**
- * Get media descriptor's elementary streams description
- *
- * Note, you need to call libvlc_media_parse_with_options() or play the media
- * at least once before calling this function.
- * Not doing this will result in an empty array.
- *
- * \version LibVLC 2.1.0 and later.
- * \see libvlc_media_parse_with_options
- *
- * \param p_md media descriptor object
- * \param tracks address to store an allocated array of Elementary Streams
- *        descriptions (must be freed with libvlc_media_tracks_release
-          by the caller) [OUT]
- *
- * \return the number of Elementary Streams (zero on error)
- */
-LIBVLC_API
-unsigned libvlc_media_tracks_get( libvlc_media_t *p_md,
-                                  libvlc_media_track_t ***tracks );
-
 /**
  * Get the track list for one type
  *
@@ -705,18 +684,6 @@ LIBVLC_API
 const char *libvlc_media_get_codec_description( libvlc_track_type_t i_type,
                                                 uint32_t i_codec );
 
-/**
- * Release media descriptor's elementary streams description array
- *
- * \version LibVLC 2.1.0 and later.
- *
- * \param p_tracks tracks info array to release
- * \param i_count number of elements in the array
- */
-LIBVLC_API
-void libvlc_media_tracks_release( libvlc_media_track_t **p_tracks,
-                                  unsigned i_count );
-
 /**
  * Get the media type of the media descriptor object
  *
diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h
index 134e4140437..ed5bb933ce3 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -41,18 +41,6 @@ extern "C" {
 
 typedef struct libvlc_media_player_t libvlc_media_player_t;
 
-/**
- * Description for video, audio tracks and subtitles. It contains
- * id, name (description string) and pointer to next record.
- */
-typedef struct libvlc_track_description_t
-{
-    int   i_id;
-    char *psz_name;
-    struct libvlc_track_description_t *p_next;
-
-} libvlc_track_description_t;
-
 /**
  * Description for titles
  */
@@ -1452,13 +1440,6 @@ int libvlc_media_player_add_slave( libvlc_media_player_t *p_mi,
                                    libvlc_media_slave_type_t i_type,
                                    const char *psz_uri, bool b_select );
 
-/**
- * Release (free) libvlc_track_description_t
- *
- * \param p_track_description the structure to release
- */
-LIBVLC_API void libvlc_track_description_list_release( libvlc_track_description_t *p_track_description );
-
 /** \defgroup libvlc_video LibVLC video controls
  * @{
  */
@@ -1645,41 +1626,6 @@ LIBVLC_API int libvlc_video_update_viewpoint( libvlc_media_player_t *p_mi,
                                               const libvlc_video_viewpoint_t *p_viewpoint,
                                               bool b_absolute);
 
-/**
- * Get current video subtitle.
- *
- * \param p_mi the media player
- * \return the video subtitle selected, or -1 if none
- */
-LIBVLC_API int libvlc_video_get_spu( libvlc_media_player_t *p_mi );
-
-/**
- * Get the number of available video subtitles.
- *
- * \param p_mi the media player
- * \return the number of available video subtitles
- */
-LIBVLC_API int libvlc_video_get_spu_count( libvlc_media_player_t *p_mi );
-
-/**
- * Get the description of available video subtitles.
- *
- * \param p_mi the media player
- * \return list containing description of available video subtitles.
- * It must be freed with libvlc_track_description_list_release()
- */
-LIBVLC_API libvlc_track_description_t *
-        libvlc_video_get_spu_description( libvlc_media_player_t *p_mi );
-
-/**
- * Set new video subtitle.
- *
- * \param p_mi the media player
- * \param i_spu video subtitle track to select (i_id from track description)
- * \return 0 on success, -1 if out of range
- */
-LIBVLC_API int libvlc_video_set_spu( libvlc_media_player_t *p_mi, int i_spu );
-
 /**
  * Get the current subtitle delay. Positive values means subtitles are being
  * displayed later, negative values earlier.
@@ -1880,42 +1826,6 @@ LIBVLC_API int libvlc_video_get_teletext( libvlc_media_player_t *p_mi );
  */
 LIBVLC_API void libvlc_video_set_teletext( libvlc_media_player_t *p_mi, int i_page );
 
-/**
- * Get number of available video tracks.
- *
- * \param p_mi media player
- * \return the number of available video tracks (int)
- */
-LIBVLC_API int libvlc_video_get_track_count( libvlc_media_player_t *p_mi );
-
-/**
- * Get the description of available video tracks.
- *
- * \param p_mi media player
- * \return list with description of available video tracks, or NULL on error.
- * It must be freed with libvlc_track_description_list_release()
- */
-LIBVLC_API libvlc_track_description_t *
-        libvlc_video_get_track_description( libvlc_media_player_t *p_mi );
-
-/**
- * Get current video track.
- *
- * \param p_mi media player
- * \return the video track ID (int) or -1 if no active input
- */
-LIBVLC_API int libvlc_video_get_track( libvlc_media_player_t *p_mi );
-
-/**
- * Set video track.
- *
- * \param p_mi media player
- * \param i_track the track ID (i_id field from track description)
- * \return 0 on success, -1 if out of range
- */
-LIBVLC_API
-int libvlc_video_set_track( libvlc_media_player_t *p_mi, int i_track );
-
 /**
  * Take a snapshot of the current video window.
  *
@@ -2302,41 +2212,6 @@ LIBVLC_API int libvlc_audio_get_volume( libvlc_media_player_t *p_mi );
  */
 LIBVLC_API int libvlc_audio_set_volume( libvlc_media_player_t *p_mi, int i_volume );
 
-/**
- * Get number of available audio tracks.
- *
- * \param p_mi media player
- * \return the number of available audio tracks (int), or -1 if unavailable
- */
-LIBVLC_API int libvlc_audio_get_track_count( libvlc_media_player_t *p_mi );
-
-/**
- * Get the description of available audio tracks.
- *
- * \param p_mi media player
- * \return list with description of available audio tracks, or NULL.
- * It must be freed with libvlc_track_description_list_release()
- */
-LIBVLC_API libvlc_track_description_t *
-        libvlc_audio_get_track_description( libvlc_media_player_t *p_mi );
-
-/**
- * Get current audio track.
- *
- * \param p_mi media player
- * \return the audio track ID or -1 if no active input.
- */
-LIBVLC_API int libvlc_audio_get_track( libvlc_media_player_t *p_mi );
-
-/**
- * Set current audio track.
- *
- * \param p_mi media player
- * \param i_track the track ID (i_id field from track description)
- * \return 0 on success, -1 on error
- */
-LIBVLC_API int libvlc_audio_set_track( libvlc_media_player_t *p_mi, int i_track );
-
 /**
  * Get current audio channel.
  *
diff --git a/include/vlc/libvlc_media_track.h b/include/vlc/libvlc_media_track.h
index f1da2478714..f8afc01c808 100644
--- a/include/vlc/libvlc_media_track.h
+++ b/include/vlc/libvlc_media_track.h
@@ -122,7 +122,7 @@ typedef struct libvlc_media_track_t
     /* Codec fourcc */
     uint32_t    i_codec;
     uint32_t    i_original_fourcc;
-    int         i_id;
+    int         i_id; /* DEPRECATED: use psz_id */
     libvlc_track_type_t i_type;
 
     /* Codec specific */
-- 
2.28.0



More information about the vlc-devel mailing list