[vlc-commits] lib: video: use libvlc_media_player_get_selected_track()

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


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Jun  5 11:00:29 2020 +0200| [aaff92bc754642d92a60e467142086525e6ae96a] | committer: Thomas Guillem

lib: video: use libvlc_media_player_get_selected_track()

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

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

diff --git a/lib/video.c b/lib/video.c
index a31db38524..2786108b88 100644
--- a/lib/video.c
+++ b/lib/video.c
@@ -155,25 +155,25 @@ libvlc_video_take_snapshot( libvlc_media_player_t *p_mi, unsigned num,
     return 0;
 }
 
-int libvlc_video_get_size( libvlc_media_player_t *p_mi, unsigned num,
+int libvlc_video_get_size( libvlc_media_player_t *p_mi, unsigned ignored,
                            unsigned *restrict px, unsigned *restrict py )
 {
+    (void) ignored;
     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;
+    libvlc_media_track_t *track =
+        libvlc_media_player_get_selected_track( p_mi, libvlc_track_video );
 
-    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;
-        }
+    if (track)
+    {
+        *px = track->video->i_width;
+        *py = track->video->i_height;
+        ret = 0;
+    }
 
-    libvlc_media_tracks_release(tracks, count);
+    libvlc_media_track_delete(track);
     return ret;
 }
 



More information about the vlc-commits mailing list