]> git.sesse.net Git - vlc/commitdiff
Real Demuxer: Support for Atrac-3 codecs in Real files. Close #1359.
authorJean-Baptiste Kempf <jb@videolan.org>
Tue, 13 Nov 2007 06:33:10 +0000 (06:33 +0000)
committerJean-Baptiste Kempf <jb@videolan.org>
Tue, 13 Nov 2007 06:33:10 +0000 (06:33 +0000)
Some new comments are in.

modules/demux/real.c

index 885c8da6a3e982e6fd7aa9bce82a0b81137252f4..94421e6cf2ed1083b8f9d81569501dffb224aabd 100644 (file)
@@ -506,6 +506,7 @@ static int Demux( demux_t *p_demux )
         }
         else if( tk->fmt.i_codec == VLC_FOURCC( 'c', 'o', 'o', 'k' ) ||
                  tk->fmt.i_codec == VLC_FOURCC( 'a', 't', 'r', 'c') ||
+                 tk->fmt.i_codec == VLC_FOURCC( 's', 'i', 'p', 'r') ||
                  tk->fmt.i_codec == VLC_FOURCC( '2', '8', '_', '8') )
         {
             uint8_t *p_buf = p_sys->buffer;
@@ -516,7 +517,8 @@ static int Demux( demux_t *p_demux )
             if( i_flags & 2 ) y = tk->i_subpacket = 0;
 
             if( tk->fmt.i_codec == VLC_FOURCC( 'c', 'o', 'o', 'k' ) ||
-                tk->fmt.i_codec == VLC_FOURCC( 'a', 't', 'r', 'c' ) )
+                tk->fmt.i_codec == VLC_FOURCC( 'a', 't', 'r', 'c' ) ||
+                tk->fmt.i_codec == VLC_FOURCC( 's', 'i', 'p', 'r' ) )
             for( i = 0; i < tk->i_frame_size / tk->i_subpacket_size; i++ )
             {
                 block_t *p_block = block_New( p_demux, tk->i_subpacket_size );
@@ -1000,25 +1002,25 @@ static int ReadCodecSpecificData( demux_t *p_demux, int i_len, int i_num )
 
         p_peek += 2; /* 00 00 */
         p_peek += 4; /* .ra4 or .ra5 */
-        p_peek += 4; /* ?? */
+        p_peek += 4; /* data size */
         p_peek += 2; /* version (4 or 5) */
         i_header_size = GetDWBE( p_peek ); p_peek += 4; /* header size */
         i_flavor = GetWBE( p_peek ); p_peek += 2; /* codec flavor */
-        i_coded_frame_size = GetDWBE( p_peek ); p_peek += 4;
+        i_coded_frame_size = GetDWBE( p_peek ); p_peek += 4; /* coded frame size*/
         p_peek += 4; /* ?? */
         p_peek += 4; /* ?? */
         p_peek += 4; /* ?? */
-        i_subpacket_h = GetWBE( p_peek ); p_peek += 2;
-        i_frame_size = GetWBE( p_peek ); p_peek += 2;
-        i_subpacket_size = GetWBE( p_peek ); p_peek += 2;
+        i_subpacket_h = GetWBE( p_peek ); p_peek += 2; /* 1 */
+        i_frame_size = GetWBE( p_peek ); p_peek += 2; /* frame size */
+        i_subpacket_size = GetWBE( p_peek ); p_peek += 2; /* subpacket_size */
         p_peek += 2; /* ?? */
 
         if( i_version == 5 ) p_peek += 6; /* 0, srate, 0 */
 
-        fmt.audio.i_rate = GetWBE( p_peek ); p_peek += 2;
+        fmt.audio.i_rate = GetWBE( p_peek ); p_peek += 2; /* Sample Rate */
         p_peek += 2; /* ?? */
-        fmt.audio.i_bitspersample = GetWBE( p_peek ); p_peek += 2;
-        fmt.audio.i_channels = GetWBE( p_peek ); p_peek += 2;
+        fmt.audio.i_bitspersample = GetWBE( p_peek ); p_peek += 2; /* Sure?*/
+        fmt.audio.i_channels = GetWBE( p_peek ); p_peek += 2; /* Channels */
         fmt.audio.i_blockalign = i_frame_size;
 
         if( i_version == 5 )
@@ -1048,6 +1050,7 @@ static int ReadCodecSpecificData( demux_t *p_demux, int i_len, int i_num )
         case VLC_FOURCC( 'r', 'a', 'a', 'c' ):
         case VLC_FOURCC( 'r', 'a', 'c', 'p' ):
             fmt.i_extra = GetDWBE( p_peek ); p_peek += 4;
+            //version 5 ? 
             if( fmt.i_extra > 0 ) { fmt.i_extra--; p_peek++; }
             if( fmt.i_extra > 0 )
             {
@@ -1060,6 +1063,7 @@ static int ReadCodecSpecificData( demux_t *p_demux, int i_len, int i_num )
 
         case VLC_FOURCC('c','o','o','k'):
         case VLC_FOURCC('a','t','r','c'):
+//        case VLC_FOURCC('s','i','p','r'):
             fmt.audio.i_blockalign = i_subpacket_size;
             if( !(fmt.i_extra = GetDWBE( p_peek )) ) break;
             fmt.p_extra = malloc( fmt.i_extra );
@@ -1067,6 +1071,7 @@ static int ReadCodecSpecificData( demux_t *p_demux, int i_len, int i_num )
             break;
 
         case VLC_FOURCC('2','8','_','8'):
+            fmt.i_extra = 0;
             fmt.audio.i_blockalign = i_coded_frame_size;
             break;
 
@@ -1097,7 +1102,8 @@ static int ReadCodecSpecificData( demux_t *p_demux, int i_len, int i_num )
             tk->i_subpacket = 0;
             tk->i_subpackets = 0;
             tk->p_subpackets = NULL;
-            if( fmt.i_codec == VLC_FOURCC('c','o','o','k') )
+            if( fmt.i_codec == VLC_FOURCC('c','o','o','k')
+             || fmt.i_codec == VLC_FOURCC('a','t','r','c') )
             {
                 tk->i_subpackets =
                     i_subpacket_h * i_frame_size / tk->i_subpacket_size;