[vlc-devel] [PATCH] libvlc: add libvlc_media_get_codec_description

Thomas Guillem thomas at gllm.fr
Mon Jan 12 11:39:14 CET 2015


Get codec description from media elementary stream.
---
 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 087f5ad..98a53d6 100644
--- a/include/vlc/libvlc_media.h
+++ b/include/vlc/libvlc_media.h
@@ -630,6 +630,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 1c49081..bd9bd6e 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 cec3b92..3770d7a 100644
--- a/lib/media.c
+++ b/lib/media.c
@@ -898,6 +898,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
-- 
2.1.3




More information about the vlc-devel mailing list