Bitrate for some coreaudiofile files
parent
42ff4e5ef1
commit
5877c0b9fa
|
@ -188,6 +188,8 @@
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int sec = (int)(([positionSlider maxValue] - pos)/1000.0);
|
int sec = (int)(([positionSlider maxValue] - pos)/1000.0);
|
||||||
|
if (sec < 0)
|
||||||
|
sec = 0;
|
||||||
text = [NSString stringWithFormat:NSLocalizedString(@"TimeRemaining", @""), sec/60, sec%60];
|
text = [NSString stringWithFormat:NSLocalizedString(@"TimeRemaining", @""), sec/60, sec%60];
|
||||||
}
|
}
|
||||||
[timeField setStringValue:text];
|
[timeField setStringValue:text];
|
||||||
|
|
|
@ -250,10 +250,7 @@
|
||||||
PlaylistEntry* pe;
|
PlaylistEntry* pe;
|
||||||
|
|
||||||
while (pe = [enumerator nextObject]) {
|
while (pe = [enumerator nextObject]) {
|
||||||
NSLog(@"Updating :%i", pe);
|
|
||||||
NSLog(@"Updating :%@", pe);
|
|
||||||
tt += [pe length];
|
tt += [pe length];
|
||||||
NSLog(@"UpdateD");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int sec = (int)(tt/1000.0);
|
int sec = (int)(tt/1000.0);
|
||||||
|
|
|
@ -106,7 +106,7 @@ OSStatus writeFunc(void * inRefCon, SInt64 inPosition, ByteCount requestCount, c
|
||||||
{
|
{
|
||||||
OSStatus err;
|
OSStatus err;
|
||||||
|
|
||||||
#ifdef _USE_WRAPPER_
|
#ifdef _USE_WRAPPER_
|
||||||
// Open the input file
|
// Open the input file
|
||||||
_inFd = fopen(filename, "r");
|
_inFd = fopen(filename, "r");
|
||||||
if (!_inFd)
|
if (!_inFd)
|
||||||
|
@ -177,7 +177,23 @@ OSStatus writeFunc(void * inRefCon, SInt64 inPosition, ByteCount requestCount, c
|
||||||
err = ExtAudioFileDispose(_in);
|
err = ExtAudioFileDispose(_in);
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _USE_WRAPPER_
|
||||||
|
SInt64 totalBytes;
|
||||||
|
|
||||||
|
size = sizeof(totalBytes);
|
||||||
|
err = AudioFileGetProperty(_audioID, kAudioFilePropertyAudioDataByteCount, &size, &totalBytes);
|
||||||
|
if(err != noErr) {
|
||||||
|
[self close];
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
bitRate = ((totalBytes*8)/((totalFrames)/asbd.mSampleRate))/1000.0;
|
||||||
|
#else
|
||||||
|
//Is there a way to get bitrate with extAudioFile?
|
||||||
|
bitRate = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Set our properties
|
// Set our properties
|
||||||
bitsPerSample = asbd.mBitsPerChannel;
|
bitsPerSample = asbd.mBitsPerChannel;
|
||||||
channels = asbd.mChannelsPerFrame;
|
channels = asbd.mChannelsPerFrame;
|
||||||
|
@ -189,7 +205,6 @@ OSStatus writeFunc(void * inRefCon, SInt64 inPosition, ByteCount requestCount, c
|
||||||
}
|
}
|
||||||
|
|
||||||
totalSize = totalFrames * channels * (bitsPerSample / 8);
|
totalSize = totalFrames * channels * (bitsPerSample / 8);
|
||||||
bitRate = 0;
|
|
||||||
|
|
||||||
// Set output format
|
// Set output format
|
||||||
AudioStreamBasicDescription result;
|
AudioStreamBasicDescription result;
|
||||||
|
|
Loading…
Reference in New Issue