Fix for XING parsing
This commit is contained in:
parent
31eac8cb06
commit
e7c4b92b76
1 changed files with 9 additions and 7 deletions
|
@ -168,19 +168,23 @@ fail:
|
||||||
bitrate = header.bitrate;
|
bitrate = header.bitrate;
|
||||||
frequency = header.samplerate;
|
frequency = header.samplerate;
|
||||||
channels = MAD_NCHANNELS(&header);
|
channels = MAD_NCHANNELS(&header);
|
||||||
|
|
||||||
if (use_xing)
|
if (use_xing)
|
||||||
{
|
{
|
||||||
frame.header = header;
|
frame.header = header;
|
||||||
if (mad_frame_decode(&frame, &stream) == -1)
|
if (mad_frame_decode(&frame, &stream) == -1)
|
||||||
break;
|
continue;
|
||||||
|
|
||||||
if (xing_parse (&xing, stream.anc_ptr, stream.anc_bitlen) == 0)
|
if (xing_parse (&xing, stream.anc_ptr, stream.anc_bitlen) == 0)
|
||||||
{
|
{
|
||||||
has_xing = YES;
|
has_xing = YES;
|
||||||
vbr = YES;
|
vbr = YES;
|
||||||
|
|
||||||
frames = xing.frames;
|
frames = xing.frames;
|
||||||
mad_timer_multiply (&_duration, frames);
|
mad_timer_multiply (&_duration, frames);
|
||||||
|
|
||||||
bitrate = 8.0 * xing.bytes / mad_timer_count(_duration, MAD_UNITS_SECONDS);
|
bitrate = 8.0 * xing.bytes / mad_timer_count(_duration, MAD_UNITS_SECONDS);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -247,9 +251,8 @@ fail:
|
||||||
bitsPerSample = 16;
|
bitsPerSample = 16;
|
||||||
isBigEndian=YES;
|
isBigEndian=YES;
|
||||||
isUnsigned=NO;
|
isUnsigned=NO;
|
||||||
[self scanFileFast:YES useXing:YES];
|
|
||||||
channels = 2;
|
return [self scanFileFast:YES useXing:YES];
|
||||||
return YES;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)readInfo:(const char *)filename
|
- (BOOL)readInfo:(const char *)filename
|
||||||
|
@ -498,7 +501,6 @@ static inline signed int scale (mad_fixed_t sample)
|
||||||
|
|
||||||
- (double)seekToTime:(double)milliseconds
|
- (double)seekToTime:(double)milliseconds
|
||||||
{
|
{
|
||||||
NSLog(@"Seeking");
|
|
||||||
int new_position;
|
int new_position;
|
||||||
int seconds = milliseconds/1000.0;
|
int seconds = milliseconds/1000.0;
|
||||||
int total_seconds = mad_timer_count(_duration, MAD_UNITS_SECONDS);
|
int total_seconds = mad_timer_count(_duration, MAD_UNITS_SECONDS);
|
||||||
|
|
Loading…
Reference in a new issue