GetLength optimization
This commit is contained in:
@@ -348,13 +348,20 @@ void fill_frame_index_cache( madlib_t *mad )
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Handle first-stage decoding: extracting the MP3 frame data. */
|
/* Handle first-stage decoding: extracting the MP3 frame data. */
|
||||||
int RageSoundReader_MP3::do_mad_frame_decode()
|
int RageSoundReader_MP3::do_mad_frame_decode( bool headers_only )
|
||||||
{
|
{
|
||||||
int bytes_read = 0;
|
int bytes_read = 0;
|
||||||
|
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
if( !mad_frame_decode(&mad->Frame,&mad->Stream) )
|
int ret;
|
||||||
|
|
||||||
|
/* Always actually decode the first packet, so we cleanly pass Xing tags. */
|
||||||
|
if( headers_only && !mad->first_frame )
|
||||||
|
ret=mad_header_decode( &mad->Frame.header,&mad->Stream );
|
||||||
|
else
|
||||||
|
ret=mad_frame_decode( &mad->Frame,&mad->Stream );
|
||||||
|
if( !ret )
|
||||||
{
|
{
|
||||||
/* OK. */
|
/* OK. */
|
||||||
if( mad->first_frame )
|
if( mad->first_frame )
|
||||||
@@ -1069,10 +1076,9 @@ int RageSoundReader_MP3::GetLengthInternal( bool fast )
|
|||||||
}
|
}
|
||||||
|
|
||||||
MADLIB_rewind();
|
MADLIB_rewind();
|
||||||
/* XXX use mad_header_decode (do_mad_frame_decode(true)?) */
|
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
int ret = do_mad_frame_decode();
|
int ret = do_mad_frame_decode( true );
|
||||||
if( ret == -1 )
|
if( ret == -1 )
|
||||||
return -1; /* it set the error */
|
return -1; /* it set the error */
|
||||||
if( ret == 0 ) /* EOF */
|
if( ret == 0 ) /* EOF */
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public:
|
|||||||
int FindOffsetFix();
|
int FindOffsetFix();
|
||||||
|
|
||||||
int fill_buffer();
|
int fill_buffer();
|
||||||
int do_mad_frame_decode();
|
int do_mad_frame_decode( bool headers_only=false );
|
||||||
int resync();
|
int resync();
|
||||||
void synth_output();
|
void synth_output();
|
||||||
int seek_stream_to_byte( int byte );
|
int seek_stream_to_byte( int byte );
|
||||||
|
|||||||
Reference in New Issue
Block a user