[vlc-commits] [Git][videolan/vlc][master] lib: remove the deprecated track API

Steve Lhomme (@robUx4) gitlab at videolan.org
Tue Jan 30 08:09:41 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
3f5e46ba by Thomas Guillem at 2024-01-30T07:35:01+00:00
lib: remove the deprecated track API

Use the libvlc_media_tracklist_t API instead.

- - - - -


6 changed files:

- include/vlc/deprecated.h
- lib/audio.c
- lib/libvlc.sym
- lib/media_player.c
- lib/media_player_internal.h
- lib/video.c


Changes:

=====================================
include/vlc/deprecated.h
=====================================
@@ -28,155 +28,6 @@
 extern "C" {
 # endif
 
-typedef struct libvlc_media_player_t libvlc_media_player_t;
-
-/**
- * \ingroup 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_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_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 );
-
-/** @}*/
-
 /**
  * \ingroup libvlc
  * \defgroup libvlc_playlist LibVLC playlist (legacy)


=====================================
lib/audio.c
=====================================
@@ -279,74 +279,6 @@ int libvlc_audio_set_volume( libvlc_media_player_t *mp, int volume )
     return ret;
 }
 
-/*****************************************************************************
- * libvlc_audio_get_track_count : Get the number of available audio tracks
- *****************************************************************************/
-int libvlc_audio_get_track_count( libvlc_media_player_t *p_mi )
-{
-    vlc_player_t *player = p_mi->player;
-    vlc_player_Lock(player);
-
-    int ret = vlc_player_GetTrackCount(p_mi->player, AUDIO_ES);
-
-    vlc_player_Unlock(player);
-    return ret;
-}
-
-/*****************************************************************************
- * libvlc_audio_get_track_description : Get the description of available audio tracks
- *****************************************************************************/
-libvlc_track_description_t *
-        libvlc_audio_get_track_description( libvlc_media_player_t *p_mi )
-{
-    return libvlc_get_track_description( p_mi, AUDIO_ES );
-}
-
-/*****************************************************************************
- * libvlc_audio_get_track : Get the current audio track
- *****************************************************************************/
-int libvlc_audio_get_track( libvlc_media_player_t *p_mi )
-{
-    vlc_player_t *player = p_mi->player;
-    vlc_player_Lock(player);
-
-    const struct vlc_player_track *track =
-        vlc_player_GetSelectedTrack(player, AUDIO_ES);
-    int id = track ? vlc_es_id_GetInputId(track->es_id) : -1;
-
-    vlc_player_Unlock(player);
-    return id;
-}
-
-/*****************************************************************************
- * libvlc_audio_set_track : Set the current audio track
- *****************************************************************************/
-int libvlc_audio_set_track( libvlc_media_player_t *p_mi, int i_track )
-{
-    int i_ret = -1;
-
-    vlc_player_t *player = p_mi->player;
-    vlc_player_Lock(player);
-
-    size_t count = vlc_player_GetAudioTrackCount(player);
-    for( size_t i = 0; i < count; i++ )
-    {
-        const struct vlc_player_track *track =
-            vlc_player_GetAudioTrackAt(player, i);
-        if (i_track == vlc_es_id_GetInputId(track->es_id))
-        {
-            /* found */
-            vlc_player_SelectTrack(player, track, VLC_PLAYER_SELECT_EXCLUSIVE);
-            i_ret = 0;
-            goto end;
-        }
-    }
-    libvlc_printerr( "Track identifier not found" );
-end:
-    vlc_player_Unlock(player);
-    return i_ret;
-}
-
 /*****************************************************************************
  * libvlc_audio_get_stereomode : Get the current audio stereo-mode
  *****************************************************************************/


=====================================
lib/libvlc.sym
=====================================
@@ -23,15 +23,11 @@ libvlc_audio_get_mixmode
 libvlc_audio_get_stereomode
 libvlc_audio_get_delay
 libvlc_audio_get_mute
-libvlc_audio_get_track
-libvlc_audio_get_track_count
-libvlc_audio_get_track_description
 libvlc_audio_get_volume
 libvlc_audio_set_mixmode
 libvlc_audio_set_stereomode
 libvlc_audio_set_delay
 libvlc_audio_set_mute
-libvlc_audio_set_track
 libvlc_audio_set_volume
 libvlc_audio_toggle_mute
 libvlc_audio_set_format
@@ -235,7 +231,6 @@ libvlc_set_user_agent
 libvlc_set_app_id
 libvlc_title_descriptions_release
 libvlc_toggle_fullscreen
-libvlc_track_description_list_release
 libvlc_video_get_adjust_float
 libvlc_video_get_adjust_int
 libvlc_video_get_aspect_ratio
@@ -244,15 +239,9 @@ libvlc_video_get_cursor
 libvlc_video_get_logo_int
 libvlc_video_get_marquee_int
 libvlc_video_get_scale
-libvlc_video_get_spu
-libvlc_video_get_spu_count
 libvlc_video_get_spu_delay
-libvlc_video_get_spu_description
 libvlc_video_get_spu_text_scale
 libvlc_video_get_teletext
-libvlc_video_get_track
-libvlc_video_get_track_count
-libvlc_video_get_track_description
 libvlc_video_set_adjust_float
 libvlc_video_set_adjust_int
 libvlc_video_set_aspect_ratio
@@ -271,11 +260,9 @@ libvlc_video_set_marquee_int
 libvlc_video_set_marquee_string
 libvlc_video_set_mouse_input
 libvlc_video_set_scale
-libvlc_video_set_spu
 libvlc_video_set_spu_delay
 libvlc_video_set_spu_text_scale
 libvlc_video_set_teletext
-libvlc_video_set_track
 libvlc_video_take_snapshot
 libvlc_video_new_viewpoint
 libvlc_video_update_viewpoint


=====================================
lib/media_player.c
=====================================
@@ -1710,60 +1710,6 @@ void libvlc_media_player_navigate( libvlc_media_player_t* p_mi,
     vlc_player_Unlock(player);
 }
 
-/* internal function, used by audio, video */
-libvlc_track_description_t *
-        libvlc_get_track_description( libvlc_media_player_t *p_mi,
-                                      enum es_format_category_e cat )
-{
-    vlc_player_t *player = p_mi->player;
-    vlc_player_Lock(player);
-
-    libvlc_track_description_t *ret, **pp = &ret;
-
-    size_t count = vlc_player_GetTrackCount(player, cat);
-    for (size_t i = 0; i < count; i++)
-    {
-        libvlc_track_description_t *tr = malloc(sizeof (*tr));
-        if (unlikely(tr == NULL))
-        {
-            libvlc_printerr("Not enough memory");
-            continue;
-        }
-
-        const struct vlc_player_track *track =
-            vlc_player_GetTrackAt(player, cat, i);
-
-        *pp = tr;
-        tr->i_id = vlc_es_id_GetInputId(track->es_id);
-        tr->psz_name = strdup(track->name);
-        if (unlikely(!tr->psz_name))
-        {
-            free(tr);
-            continue;
-        }
-        pp = &tr->p_next;
-    }
-
-    *pp = NULL;
-
-    vlc_player_Unlock(player);
-    return ret;
-}
-
-void libvlc_track_description_list_release( libvlc_track_description_t *p_td )
-{
-    libvlc_track_description_t *p_actual, *p_before;
-    p_actual = p_td;
-
-    while ( p_actual )
-    {
-        free( p_actual->psz_name );
-        p_before = p_actual;
-        p_actual = p_before->p_next;
-        free( p_before );
-    }
-}
-
 bool libvlc_media_player_can_pause(libvlc_media_player_t *p_mi)
 {
     vlc_player_t *player = p_mi->player;


=====================================
lib/media_player_internal.h
=====================================
@@ -54,10 +54,6 @@ struct libvlc_media_player_t
     } timer;
 };
 
-libvlc_track_description_t * libvlc_get_track_description(
-        libvlc_media_player_t *p_mi,
-        enum es_format_category_e cat );
-
 /**
  * Internal equalizer structure.
  */


=====================================
lib/video.c
=====================================
@@ -286,62 +286,6 @@ int libvlc_video_update_viewpoint( libvlc_media_player_t *p_mi,
     return 0;
 }
 
-int libvlc_video_get_spu( libvlc_media_player_t *p_mi )
-{
-    vlc_player_t *player = p_mi->player;
-    vlc_player_Lock(player);
-
-    const struct vlc_player_track *track =
-        vlc_player_GetSelectedTrack(player, SPU_ES);
-    int i_spu = track ? vlc_es_id_GetInputId(track->es_id) : -1;
-
-    vlc_player_Unlock(player);
-    return i_spu;
-}
-
-int libvlc_video_get_spu_count( libvlc_media_player_t *p_mi )
-{
-    vlc_player_t *player = p_mi->player;
-    vlc_player_Lock(player);
-
-    int ret = vlc_player_GetTrackCount(p_mi->player, SPU_ES);
-
-    vlc_player_Unlock(player);
-    return ret;
-}
-
-libvlc_track_description_t *
-        libvlc_video_get_spu_description( libvlc_media_player_t *p_mi )
-{
-    return libvlc_get_track_description( p_mi, SPU_ES );
-}
-
-int libvlc_video_set_spu( libvlc_media_player_t *p_mi, int i_spu )
-{
-    int i_ret = -1;
-
-    vlc_player_t *player = p_mi->player;
-    vlc_player_Lock(player);
-
-    size_t count = vlc_player_GetSubtitleTrackCount(player);
-    for (size_t i = 0; i < count; i++)
-    {
-        const struct vlc_player_track *track =
-            vlc_player_GetSubtitleTrackAt(player, i);
-        if (i_spu == vlc_es_id_GetInputId(track->es_id))
-        {
-            /* found */
-            vlc_player_SelectTrack(player, track, VLC_PLAYER_SELECT_EXCLUSIVE);
-            i_ret = 0;
-            goto end;
-        }
-    }
-    libvlc_printerr( "Track identifier not found" );
-end:
-    vlc_player_Unlock(player);
-    return i_ret;
-}
-
 int64_t libvlc_video_get_spu_delay( libvlc_media_player_t *p_mi )
 {
     vlc_player_t *player = p_mi->player;
@@ -480,62 +424,6 @@ void libvlc_video_set_teletext( libvlc_media_player_t *p_mi, int i_page )
     vlc_player_Unlock(player);
 }
 
-int libvlc_video_get_track_count( libvlc_media_player_t *p_mi )
-{
-    vlc_player_t *player = p_mi->player;
-    vlc_player_Lock(player);
-
-    int ret = vlc_player_GetTrackCount(p_mi->player, VIDEO_ES);
-
-    vlc_player_Unlock(player);
-    return ret;
-}
-
-libvlc_track_description_t *
-        libvlc_video_get_track_description( libvlc_media_player_t *p_mi )
-{
-    return libvlc_get_track_description( p_mi, VIDEO_ES );
-}
-
-int libvlc_video_get_track( libvlc_media_player_t *p_mi )
-{
-    vlc_player_t *player = p_mi->player;
-    vlc_player_Lock(player);
-
-    const struct vlc_player_track * track =
-        vlc_player_GetSelectedTrack(player, VIDEO_ES);
-    int id = track ? vlc_es_id_GetInputId(track->es_id) : -1;
-
-    vlc_player_Unlock(player);
-    return id;
-}
-
-int libvlc_video_set_track( libvlc_media_player_t *p_mi, int i_track )
-{
-    int i_ret = -1;
-
-    vlc_player_t *player = p_mi->player;
-    vlc_player_Lock(player);
-
-    size_t count = vlc_player_GetVideoTrackCount(player);
-    for( size_t i = 0; i < count; i++ )
-    {
-        const struct vlc_player_track *track =
-            vlc_player_GetVideoTrackAt(player, i);
-        if (i_track == vlc_es_id_GetInputId(track->es_id))
-        {
-            /* found */
-            vlc_player_SelectTrack(player, track, VLC_PLAYER_SELECT_EXCLUSIVE);
-            i_ret = 0;
-            goto end;
-        }
-    }
-    libvlc_printerr( "Track identifier not found" );
-end:
-    vlc_player_Unlock(player);
-    return i_ret;
-}
-
 /******************************************************************************
  * libvlc_video_set_deinterlace : enable/disable/auto deinterlace and filter
  *****************************************************************************/



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/3f5e46ba4e942063374ddd9e158f7852ce902daa

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/3f5e46ba4e942063374ddd9e158f7852ce902daa
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list