[vlc-commits] libvlc: add libvlc_media_get_codec_description

Thomas Guillem git at videolan.org
Tue Jan 13 23:32:46 CET 2015


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Jan 12 09:39:14 2015 +0000| [7458af47e6db6134a8cd96098cbe542a5511e95c] | committer: Jean-Baptiste Kempf

libvlc: add libvlc_media_get_codec_description

Get codec description from media elementary stream.

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

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

 include/vlc/libvlc_media.h |   15 +++++++++++++++
 lib/libvlc.sym             |    1 +
 lib/media.c                |   20 ++++++++++++++++++++
 3 files changed, 36 insertions(+)

diff --git a/include/vlc/libvlc_media.h b/include/vlc/libvlc_media.h
index c93d87b..d3fb9f5 100644
--- a/include/vlc/libvlc_media.h
+++ b/include/vlc/libvlc_media.h
@@ -589,6 +589,21 @@ LIBVLC_API
 unsigned libvlc_media_tracks_get( libvlc_media_t *p_md,
                                   libvlc_media_track_t ***tracks );
 
+/**
+ * Get codec description from media elementary stream
+ *
+ * \version LibVLC 3.0.0 and later.
+ *
+ * \see libvlc_media_track_t
+ *
+ * \param i_type i_type from libvlc_media_track_t
+ * \param i_codec i_codec or i_original_fourcc from libvlc_media_track_t
+ *
+ * \return codec description
+ */
+LIBVLC_API
+const char *libvlc_media_get_codec_description( libvlc_track_type_t i_type,
+                                                uint32_t i_codec );
 
 /**
  * Release media descriptor's elementary streams description array
diff --git a/lib/libvlc.sym b/lib/libvlc.sym
index f0512c6..494097e 100644
--- a/lib/libvlc.sym
+++ b/lib/libvlc.sym
@@ -83,6 +83,7 @@ libvlc_media_discoverer_start
 libvlc_media_discoverer_stop
 libvlc_media_duplicate
 libvlc_media_event_manager
+libvlc_media_get_codec_description
 libvlc_media_get_duration
 libvlc_media_get_meta
 libvlc_media_get_mrl
diff --git a/lib/media.c b/lib/media.c
index 7d4bbb9..7e455f7 100644
--- a/lib/media.c
+++ b/lib/media.c
@@ -868,6 +868,26 @@ libvlc_media_tracks_get( libvlc_media_t *p_md, libvlc_media_track_t *** pp_es )
     return i_es;
 }
 
+/**************************************************************************
+ * Get codec description from media elementary stream
+ **************************************************************************/
+const char *
+libvlc_media_get_codec_description( libvlc_track_type_t i_type,
+                                    uint32_t i_codec )
+{
+    switch( i_type )
+    {
+        case libvlc_track_audio:
+            return vlc_fourcc_GetDescription( AUDIO_ES, i_codec );
+        case libvlc_track_video:
+            return vlc_fourcc_GetDescription( VIDEO_ES, i_codec );
+        case libvlc_track_text:
+            return vlc_fourcc_GetDescription( SPU_ES, i_codec );
+        case libvlc_track_unknown:
+        default:
+            return vlc_fourcc_GetDescription( UNKNOWN_ES, i_codec );
+    }
+}
 
 /**************************************************************************
  * Release media descriptor's elementary streams description array



More information about the vlc-commits mailing list