[vlc-commits] MP4: fix trkn parsing and support totaltrack

Jean-Baptiste Kempf git at videolan.org
Wed Jun 13 00:56:20 CEST 2012


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Wed Jun 13 01:21:28 2012 +0200| [a5cf9514165fc4ad3811cfdee88d2e9715469a47] | committer: Jean-Baptiste Kempf

MP4: fix trkn parsing and support totaltrack

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

 modules/demux/mp4/libmp4.c |    5 +++--
 modules/demux/mp4/mp4.c    |    3 +++
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index 912533f..6ddd8d8 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -1461,13 +1461,14 @@ static int MP4_ReadBox_trkn( stream_t *p_stream, MP4_Box_t *p_box )
     uint32_t i_reserved;
     MP4_GET4BYTES( i_version );
     MP4_GET4BYTES( i_reserved );
-    MP4_GET4BYTES( p_trkn->i_track_number );
+    MP4_GET2BYTES( i_reserved );
+    MP4_GET2BYTES( p_trkn->i_track_number );
 #ifdef MP4_VERBOSE
     msg_Dbg( p_stream, "read box: \"trkn\" number=%i", p_trkn->i_track_number );
 #endif
     if( i_data_len > 15 )
     {
-       MP4_GET4BYTES( p_trkn->i_track_total );
+       MP4_GET2BYTES( p_trkn->i_track_total );
 #ifdef MP4_VERBOSE
        msg_Dbg( p_stream, "read box: \"trkn\" total=%i", p_trkn->i_track_total );
 #endif
diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c
index bef1102..b0cb662 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -843,6 +843,9 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
                     snprintf( psz_trck, sizeof( psz_trck ), "%i",
                               p_0xa9xxx->data.p_trkn->i_track_number );
                     vlc_meta_SetTrackNum( p_meta, psz_trck );
+                    snprintf( psz_trck, sizeof( psz_trck ), "%i",
+                              p_0xa9xxx->data.p_trkn->i_track_total );
+                    vlc_meta_Set( p_meta, vlc_meta_TrackTotal, psz_trck );
                     break;
                 }
                 case ATOM_0xa9cmt: /* Commment */



More information about the vlc-commits mailing list