[vlc-devel] commit: Forged a TTA1 header in matroska if not present. (Laurent Aimar )

git version control git at videolan.org
Mon Jun 29 11:39:59 CEST 2009


vlc | branch: 1.0-bugfix | Laurent Aimar <fenrir at videolan.org> | Sun Jun 28 23:07:03 2009 +0200| [60d193b047c0f0979cfcf3e5360fa798fd39b7e5] | committer: Derk-Jan Hartman 

Forged a TTA1 header in matroska if not present.

(cherry picked from commit 9139b342903d9cc4b508ef2b5e49286ae2c07c98)
Signed-off-by: Derk-Jan Hartman <hartman at videolan.org>

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

 modules/demux/mkv/matroska_segment.cpp |   28 ++++++++++++++++++++++++----
 1 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/modules/demux/mkv/matroska_segment.cpp b/modules/demux/mkv/matroska_segment.cpp
index 26d43b4..e510188 100644
--- a/modules/demux/mkv/matroska_segment.cpp
+++ b/modules/demux/mkv/matroska_segment.cpp
@@ -985,10 +985,30 @@ bool matroska_segment_c::Select( mtime_t i_start_time )
         }
         else if( !strcmp( tracks[i_track]->psz_codec, "A_TTA1" ) )
         {
-            tracks[i_track]->fmt.i_codec = VLC_FOURCC( 'T', 'T', 'A', '1' );
-            tracks[i_track]->fmt.i_extra = tracks[i_track]->i_extra_data;
-            tracks[i_track]->fmt.p_extra = malloc( tracks[i_track]->i_extra_data );
-            memcpy( tracks[i_track]->fmt.p_extra, tracks[i_track]->p_extra_data, tracks[i_track]->i_extra_data );
+            p_fmt->i_codec = VLC_FOURCC( 'T', 'T', 'A', '1' );
+            p_fmt->i_extra = p_tk->i_extra_data;
+            if( p_fmt->i_extra > 0 )
+            {
+                p_fmt->p_extra = malloc( p_tk->i_extra_data );
+                if( !p_fmt->p_extra )
+                    abort();
+                memcpy( p_fmt->p_extra, p_tk->p_extra_data, p_tk->i_extra_data );
+            }
+            else
+            {
+                p_fmt->i_extra = 30;
+                p_fmt->p_extra = malloc( p_fmt->i_extra );
+                if( !p_fmt->p_extra )
+                    abort();
+                uint8_t *p_extra = (uint8_t*)p_fmt->p_extra;
+                memcpy( &p_extra[ 0], "TTA1", 4 );
+                SetWLE( &p_extra[ 4], 1 );
+                SetWLE( &p_extra[ 6], p_fmt->audio.i_channels );
+                SetWLE( &p_extra[ 8], p_fmt->audio.i_bitspersample );
+                SetDWLE( &p_extra[10], p_fmt->audio.i_rate );
+                SetDWLE( &p_extra[14], 0xffffffff );
+                memset( &p_extra[18], 0, 30  - 18 );
+            }
         }
         else if( !strcmp( tracks[i_track]->psz_codec, "A_PCM/INT/BIG" ) ||
                  !strcmp( tracks[i_track]->psz_codec, "A_PCM/INT/LIT" ) ||




More information about the vlc-devel mailing list