[vlc-commits] demux: mp4: add support for XiphQt vorbis

Francois Cartegnie git at videolan.org
Thu May 19 20:23:18 CEST 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed May 18 14:04:14 2016 +0200| [e085cdceb4f6c30de67f30a4ef314331311decae] | committer: Francois Cartegnie

demux: mp4: add support for XiphQt vorbis

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

 modules/demux/mp4/essetup.c |   31 +++++++++++++++++++++++++++++++
 modules/demux/mp4/libmp4.c  |    6 ++++++
 modules/demux/mp4/libmp4.h  |    6 ++++++
 3 files changed, 43 insertions(+)

diff --git a/modules/demux/mp4/essetup.c b/modules/demux/mp4/essetup.c
index c8f8c23..408ad5d 100644
--- a/modules/demux/mp4/essetup.c
+++ b/modules/demux/mp4/essetup.c
@@ -26,6 +26,7 @@
 
 #include "mp4.h"
 #include "avci.h"
+#include "../xiph.h"
 
 #include <vlc_demux.h>
 #include <vlc_aout.h>
@@ -753,6 +754,36 @@ int SetupAudioES( demux_t *p_demux, mp4_track_t *p_track, MP4_Box_t *p_sample )
             p_track->fmt.i_codec = VLC_CODEC_MPGA;
             break;
         }
+        case VLC_FOURCC( 'X', 'i', 'V', 's' ):
+        {
+            const MP4_Box_t *p_vCtH = MP4_BoxGet( p_sample, "wave/vCtH" ); /* kCookieTypeVorbisHeader */
+            const MP4_Box_t *p_vCtd = MP4_BoxGet( p_sample, "wave/vCt#" ); /* kCookieTypeVorbisComments */
+            const MP4_Box_t *p_vCtC = MP4_BoxGet( p_sample, "wave/vCtC" ); /* kCookieTypeVorbisCodebooks */
+            if( p_vCtH && p_vCtH->data.p_binary &&
+                p_vCtd && p_vCtd->data.p_binary &&
+                p_vCtC && p_vCtC->data.p_binary )
+            {
+                unsigned headers_sizes[3] = {
+                    p_vCtH->data.p_binary->i_blob,
+                    p_vCtd->data.p_binary->i_blob,
+                    p_vCtC->data.p_binary->i_blob
+                };
+
+                const void * headers[3] = {
+                    p_vCtH->data.p_binary->p_blob,
+                    p_vCtd->data.p_binary->p_blob,
+                    p_vCtC->data.p_binary->p_blob
+                };
+
+                if( xiph_PackHeaders( &p_track->fmt.i_extra, &p_track->fmt.p_extra,
+                                      headers_sizes, headers, 3 ) == VLC_SUCCESS )
+                {
+                    p_track->fmt.i_codec = VLC_CODEC_VORBIS;
+                    p_track->fmt.b_packetized = false;
+                }
+            }
+            break;
+        }
         case( ATOM_eac3 ):
         {
             const MP4_Box_t *p_dec3 = MP4_BoxGet(  p_sample, "dec3", 0 );
diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index 1015422..017712c8 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -3919,6 +3919,7 @@ static const struct
     { ATOM_wave,    MP4_ReadBoxContainer,     ATOM_fl64 },
     { ATOM_wave,    MP4_ReadBoxContainer,     ATOM_QDMC },
     { ATOM_wave,    MP4_ReadBoxContainer,     ATOM_QDM2 },
+    { ATOM_wave,    MP4_ReadBoxContainer,     ATOM_XiVs }, /* XiphQT */
     { ATOM_ilst,    MP4_ReadBox_ilst,         ATOM_meta },
     { ATOM_mvex,    MP4_ReadBoxContainer,     ATOM_moov },
     { ATOM_mvex,    MP4_ReadBoxContainer,     ATOM_ftyp },
@@ -3976,6 +3977,11 @@ static const struct
     { ATOM_keys,    MP4_ReadBox_keys,         ATOM_meta },
     { ATOM_colr,    MP4_ReadBox_colr,         0 },
 
+    /* XiphQT */
+    { ATOM_vCtH,    MP4_ReadBox_Binary,       ATOM_wave },
+    { ATOM_vCtC,    MP4_ReadBox_Binary,       ATOM_wave },
+    { ATOM_vCtd,    MP4_ReadBox_Binary,       ATOM_wave },
+
     /* Samples groups specific information */
     { ATOM_sbgp,    MP4_ReadBox_sbgp,         ATOM_stbl },
     { ATOM_sbgp,    MP4_ReadBox_sbgp,         ATOM_traf },
diff --git a/modules/demux/mp4/libmp4.h b/modules/demux/mp4/libmp4.h
index 3c3a37a..d1e987b 100644
--- a/modules/demux/mp4/libmp4.h
+++ b/modules/demux/mp4/libmp4.h
@@ -155,6 +155,7 @@ typedef int64_t stime_t;
 #define ATOM_sowt VLC_FOURCC( 's', 'o', 'w', 't' )
 #define ATOM_QDMC VLC_FOURCC( 'Q', 'D', 'M', 'C' )
 #define ATOM_QDM2 VLC_FOURCC( 'Q', 'D', 'M', '2' )
+#define ATOM_XiVs VLC_FOURCC( 'X', 'i', 'V', 's' )
 #define ATOM_ima4 VLC_FOURCC( 'i', 'm', 'a', '4' )
 #define ATOM_IMA4 VLC_FOURCC( 'I', 'M', 'A', '4' )
 #define ATOM_dvi  VLC_FOURCC( 'd', 'v', 'i', ' ' )
@@ -186,6 +187,11 @@ typedef int64_t stime_t;
 #define ATOM_fl64 VLC_FOURCC( 'f', 'l', '6', '4' )
 #define ATOM_Opus VLC_FOURCC( 'O', 'p', 'u', 's' )
 
+/* XiphQT */
+#define ATOM_vCtH VLC_FOURCC( 'v', 'C', 't', 'H' )
+#define ATOM_vCtC VLC_FOURCC( 'v', 'C', 't', 'C' )
+#define ATOM_vCtd VLC_FOURCC( 'v', 'C', 't', '#' )
+
 #define ATOM_zlib VLC_FOURCC( 'z', 'l', 'i', 'b' )
 #define ATOM_SVQ1 VLC_FOURCC( 'S', 'V', 'Q', '1' )
 #define ATOM_SVQ3 VLC_FOURCC( 'S', 'V', 'Q', '3' )



More information about the vlc-commits mailing list