0003-libvlc-add-language-and-frame-rate-to-libvlc_media_t.patch 2.9 KB
Newer Older
1
From 796397ae813096cb86e3effd9b6709e2039be8d4 Mon Sep 17 00:00:00 2001
2
From: =?UTF-8?q?S=C3=A9bastien=20Toque?= <xilasz@gmail.com>
3
Date: Sun, 22 Apr 2012 09:35:52 +0200
4 5 6 7
Subject: [PATCH 3/3] libvlc: add language and frame rate to
 libvlc_media_track_info_t

---
8 9
 include/vlc/libvlc_media.h |   14 ++++++++++++++
 lib/media.c                |   15 +++++++++++++++
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
10
 2 files changed, 29 insertions(+)
11 12

diff --git a/include/vlc/libvlc_media.h b/include/vlc/libvlc_media.h
13
index 279a29c..d4b1524 100644
14 15
--- a/include/vlc/libvlc_media.h
+++ b/include/vlc/libvlc_media.h
16
@@ -164,9 +164,12 @@ typedef struct libvlc_media_track_info_t
17 18 19 20 21 22 23
             /* Video specific */
             unsigned    i_height;
             unsigned    i_width;
+            float       f_frame_rate;
         } video;
     } u;
 
24 25 26 27 28
+    char *psz_language;
+
 } libvlc_media_track_info_t;
 
 
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
@@ -504,6 +507,17 @@ LIBVLC_API
 int libvlc_media_get_tracks_info( libvlc_media_t *p_md,
                                   libvlc_media_track_info_t **tracks );
 
+/**
+ * Release media descriptor's elementary streams description array
+ *
+ * \param p_tracks tracks info array to release
+ * \param i_count number of elements in the array
+ */
+LIBVLC_API
+void libvlc_media_tracks_info_release( libvlc_media_track_info_t *p_tracks,
+                                       int i_count );
+
+
 /** @}*/
 
 # ifdef __cplusplus
47
diff --git a/lib/media.c b/lib/media.c
48
index 2c01c80..b3f5a9a 100644
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
--- a/lib/media.c
+++ b/lib/media.c
@@ -707,6 +707,8 @@ libvlc_media_get_tracks_info( libvlc_media_t *p_md, libvlc_media_track_info_t **
         p_mes->i_codec = p_es->i_codec;
         p_mes->i_id = p_es->i_id;
 
+        p_mes->psz_language = p_es->psz_language != NULL ? strdup(p_es->psz_language) : NULL;
+
         p_mes->i_profile = p_es->i_profile;
         p_mes->i_level = p_es->i_level;
 
@@ -720,6 +722,7 @@ libvlc_media_get_tracks_info( libvlc_media_t *p_md, libvlc_media_track_info_t **
             p_mes->i_type = libvlc_track_video;
             p_mes->u.video.i_height = p_es->video.i_height;
             p_mes->u.video.i_width = p_es->video.i_width;
+            p_mes->u.video.f_frame_rate = p_es->video.i_frame_rate / (float) p_es->video.i_frame_rate_base;
             break;
         case AUDIO_ES:
             p_mes->i_type = libvlc_track_audio;
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
@@ -735,3 +738,15 @@ libvlc_media_get_tracks_info( libvlc_media_t *p_md, libvlc_media_track_info_t **
     vlc_mutex_unlock( &p_input_item->lock );
     return i_es;
 }
+
+/**************************************************************************
+ * Release media descriptor's elementary streams description array
+ **************************************************************************/
+void libvlc_media_tracks_info_release( libvlc_media_track_info_t *p_tracks, int i_count )
+{
+    if (!p_tracks)
+        return;
+    for (int i = 0; i < i_count; ++i)
+        free( p_tracks[i].psz_language );
+    free( p_tracks );
+}
84
-- 
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
85
1.7.10.2
86