2006-06-19 00:39:41 +00:00
|
|
|
//
|
|
|
|
// MADFile.h
|
|
|
|
// Cog
|
|
|
|
//
|
2006-09-04 18:46:18 +00:00
|
|
|
// Created by Vincent Spader on 6/17/06.
|
|
|
|
// Copyright 2006 Vincent Spader. All rights reserved.
|
2006-06-19 00:39:41 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
#import <Cocoa/Cocoa.h>
|
2007-02-24 20:36:27 +00:00
|
|
|
|
2006-06-19 00:39:41 +00:00
|
|
|
#import "MAD/mad.h"
|
|
|
|
|
2007-02-24 20:36:27 +00:00
|
|
|
#import "Plugin.h"
|
|
|
|
|
2006-06-19 00:39:41 +00:00
|
|
|
#define INPUT_BUFFER_SIZE 5*8192
|
|
|
|
|
2007-02-24 20:36:27 +00:00
|
|
|
@interface MADDecoder : NSObject <CogDecoder>
|
|
|
|
{
|
2006-06-19 00:39:41 +00:00
|
|
|
struct mad_stream _stream;
|
|
|
|
struct mad_frame _frame;
|
|
|
|
struct mad_synth _synth;
|
2007-10-18 02:33:12 +00:00
|
|
|
|
2006-06-19 00:39:41 +00:00
|
|
|
unsigned char _inputBuffer[INPUT_BUFFER_SIZE+MAD_BUFFER_GUARD];
|
|
|
|
unsigned char *_outputBuffer;
|
2007-11-24 20:16:27 +00:00
|
|
|
int _outputFrames;
|
2008-02-17 19:59:01 +00:00
|
|
|
long _fileSize;
|
2006-06-19 00:39:41 +00:00
|
|
|
|
2007-03-03 00:33:36 +00:00
|
|
|
id<CogSource> _source;
|
2006-06-19 00:39:41 +00:00
|
|
|
|
2007-03-04 00:17:05 +00:00
|
|
|
BOOL _firstFrame;
|
|
|
|
|
2006-09-02 16:09:20 +00:00
|
|
|
//For gapless playback of mp3s
|
2007-10-18 02:33:12 +00:00
|
|
|
BOOL _foundXingHeader;
|
|
|
|
BOOL _foundLAMEHeader;
|
|
|
|
|
2007-11-24 20:16:27 +00:00
|
|
|
long _framesDecoded;
|
2007-10-18 02:33:12 +00:00
|
|
|
uint16_t _startPadding;
|
|
|
|
uint16_t _endPadding;
|
2007-02-24 20:36:27 +00:00
|
|
|
|
2007-11-24 20:16:27 +00:00
|
|
|
|
|
|
|
BOOL inputEOF;
|
|
|
|
|
|
|
|
int bytesPerFrame;
|
|
|
|
|
2007-02-24 20:36:27 +00:00
|
|
|
int channels;
|
|
|
|
int bitsPerSample;
|
2007-11-24 20:16:27 +00:00
|
|
|
float sampleRate;
|
2007-02-24 20:36:27 +00:00
|
|
|
int bitrate;
|
2007-11-24 20:16:27 +00:00
|
|
|
long totalFrames;
|
2006-06-19 00:39:41 +00:00
|
|
|
}
|
|
|
|
|
2007-11-24 20:16:27 +00:00
|
|
|
- (int)decodeMPEGFrame;
|
|
|
|
|
2006-06-19 00:39:41 +00:00
|
|
|
@end
|