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

Tristan Matthews git at videolan.org
Mon Feb 29 16:09:48 CET 2016


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

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

Fixes #16620

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

 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 c0ab042..652b549 100644
--- a/modules/demux/mkv/matroska_segment_parse.cpp
+++ b/modules/demux/mkv/matroska_segment_parse.cpp
@@ -44,6 +44,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;
@@ -1628,7 +1643,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