[vlc-commits] Implement libvlc_video_get_size(), close #3679

Rafaël Carré git at videolan.org
Tue Jan 17 23:30:13 CET 2012


vlc/vlc-1.2 | branch: master | Rafaël Carré <funman at videolan.org> | Sun Jan 15 15:50:05 2012 -0500| [a24c61664bf57316fcdf6b97fbc5368af121acfe] | committer: Jean-Baptiste Kempf

Implement libvlc_video_get_size(), close #3679
(cherry picked from commit 8cf355785e002ade33af056c68123b395ff4e46f)
(cherry picked from commit e64c71e8ea08ecbd678d4b652531a3ae151308f2)

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 lib/video.c |   28 +++++++++++++++++-----------
 1 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/lib/video.c b/lib/video.c
index 163bca3..0c7bb2d 100644
--- a/lib/video.c
+++ b/lib/video.c
@@ -161,18 +161,24 @@ 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 )
 {
-#if 0
-    vout_thread_t *p_vout = GetVout (p_mi, num);
-    if (p_vout == NULL)
-        return -1;
+    libvlc_media_track_info_t *info;
+    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;
+            ret = 0;
+            break;
+        }
 
-    *px = p_vout->i_window_height;
-    *py = p_vout->i_window_width;
-    vlc_object_release (p_vout);
-    return 0;
-#else
-    return -1;
-#endif
+    free(info);
+    return ret;
 }
 
 int libvlc_video_get_height( libvlc_media_player_t *p_mi )



More information about the vlc-commits mailing list