[vlc-commits] lib: use libvlc_media_tracks_get()

Rémi Denis-Courmont git at videolan.org
Sun Jul 15 14:16:35 CEST 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Jul 12 19:43:52 2018 +0300| [4d1fe3415ca771e4c9f93ee8013c3f1ba61d9559] | committer: Rémi Denis-Courmont

lib: use libvlc_media_tracks_get()

...instead of deprecated libvlc_media_get_tracks_info().

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

 lib/video.c | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/lib/video.c b/lib/video.c
index 8a3657cc18..e5796ec2c8 100644
--- a/lib/video.c
+++ b/lib/video.c
@@ -172,23 +172,22 @@ libvlc_video_take_snapshot( libvlc_media_player_t *p_mi, unsigned num,
 int libvlc_video_get_size( libvlc_media_player_t *p_mi, unsigned num,
                            unsigned *restrict px, unsigned *restrict py )
 {
-    libvlc_media_track_info_t *info;
+    if (p_mi->p_md == NULL)
+        return -1;
+
+    libvlc_media_track_t **tracks;
+    unsigned count = libvlc_media_tracks_get(p_mi->p_md, &tracks);
     int ret = -1;
-    if (!p_mi->p_md)
-        return ret;
-    int infos = libvlc_media_get_tracks_info(p_mi->p_md, &info);
-    if (infos <= 0)
-        return ret;
-
-    for (int i = 0; i < infos; i++)
-        if (info[i].i_type == libvlc_track_video && num-- == 0) {
-            *px = info[i].u.video.i_width;
-            *py = info[i].u.video.i_height;
+
+    for (unsigned i = 0; i < count; i++)
+        if (tracks[i]->i_type == libvlc_track_video && num-- == 0) {
+            *px = tracks[i]->video->i_width;
+            *py = tracks[i]->video->i_height;
             ret = 0;
             break;
         }
 
-    free(info);
+    libvlc_media_tracks_release(tracks, count);
     return ret;
 }
 



More information about the vlc-commits mailing list