Commit b985328e authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Real Demuxer: Support for Atrac-3 codecs in Real files. Close #1359.

Some new comments are in.
parent c0f040ea
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment