[vlc-commits] demux: mkv: add ALAC atom size, tag and tag version to private data

Tristan Matthews git at videolan.org
Mon Feb 29 20:14:21 CET 2016


vlc/vlc-2.2 | branch: master | Tristan Matthews <tmatth at videolan.org> | Mon Feb 29 09:20:38 2016 -0500| [9c404f4735777527cd8c2a9be6db5c87c554aac0] | committer: Tristan Matthews

demux: mkv: add ALAC atom size, tag and tag version to private data

Fixes #16620

(cherry picked from commit 529444308bf7525bf94b9fb2bd2e5d59120aa89f)

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

 modules/demux/mkv/matroska_segment_parse.cpp |   17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/modules/demux/mkv/matroska_segment_parse.cpp b/modules/demux/mkv/matroska_segment_parse.cpp
index 0aa5924..ff911a1 100644
--- a/modules/demux/mkv/matroska_segment_parse.cpp
+++ b/modules/demux/mkv/matroska_segment_parse.cpp
@@ -43,6 +43,21 @@ static vlc_fourcc_t __GetFOURCC( uint8_t *p )
     return VLC_FOURCC( p[0], p[1], p[2], p[3] );
 }
 
+static inline void fill_extra_data_alac( mkv_track_t *p_tk )
+{
+    if( p_tk->i_extra_data <= 0 ) return;
+    p_tk->fmt.p_extra = malloc( p_tk->i_extra_data + 12 );
+    if( unlikely( !p_tk->fmt.p_extra ) ) return;
+    p_tk->fmt.i_extra = p_tk->i_extra_data + 12;
+    uint8_t *p_extra = (uint8_t *)p_tk->fmt.p_extra;
+    /* See "ALAC Specific Info (36 bytes) (required)" from
+       alac.macosforge.org/trac/browser/trunk/ALACMagicCookieDescription.txt */
+    SetDWBE( p_extra, p_tk->fmt.i_extra );
+    memcpy( p_extra + 4, "alac", 4 );
+    SetDWBE( p_extra + 8, 0 );
+    memcpy( p_extra + 12, p_tk->p_extra_data, p_tk->fmt.i_extra - 12 );
+}
+
 static inline void fill_extra_data( mkv_track_t *p_tk, unsigned int offset )
 {
     if(p_tk->i_extra_data <= offset) return;
@@ -1622,7 +1637,7 @@ int32_t matroska_segment_c::TrackInit( mkv_track_t * p_tk )
     else if( !strcmp( p_tk->psz_codec, "A_ALAC" ) )
     {
         p_tk->fmt.i_codec =  VLC_CODEC_ALAC;
-        fill_extra_data( p_tk, 0 );
+        fill_extra_data_alac( p_tk );
     }
     else if( !strcmp( p_tk->psz_codec, "A_WAVPACK4" ) )
     {



More information about the vlc-commits mailing list