Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions Classes/AudioStreamer.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// this copyright and permission notice. Attribution in compiled projects is
// appreciated but not required.
//
#define SHOUTCAST_METADATA
//#define SHOUTCAST_METADATA

#if TARGET_OS_IPHONE
#import <UIKit/UIKit.h>
Expand All @@ -20,12 +20,16 @@
#endif
#else
#import <Cocoa/Cocoa.h>
#endif TARGET_OS_IPHONE
#endif// TARGET_OS_IPHONE

#import <Foundation/Foundation.h>
#include <pthread.h>
#include <AudioToolbox/AudioToolbox.h>


#define USE_PREBUFFER 1


#define LOG_QUEUED_BUFFERS 0

#define kNumAQBufs 16 // Number of audio queue buffers we allocate.
Expand Down Expand Up @@ -98,7 +102,8 @@ typedef enum
AS_AUDIO_QUEUE_FLUSH_FAILED,
AS_AUDIO_STREAMER_FAILED,
AS_GET_AUDIO_TIME_FAILED,
AS_AUDIO_BUFFER_TOO_SMALL
AS_AUDIO_BUFFER_TOO_SMALL,
AS_AUDIO_MEMORY_ALLOC_FAILED,
} AudioStreamerErrorCode;

extern NSString * const ASStatusChangedNotification;
Expand Down Expand Up @@ -179,6 +184,16 @@ extern NSString * const ASUpdateMetadataNotification;
NSMutableString *metaDataString; // the metaDataString
#endif
BOOL vbr; // indicates VBR (or not) stream


#if defined (USE_PREBUFFER) && USE_PREBUFFER
NSLock * _bufferLock;
NSLock * _audioStreamLock;
NSMutableArray * _buffers;
NSThread * _bufferPushingThread;
BOOL _allBufferPushed;
BOOL _finishedBuffer;
#endif
}

@property AudioStreamerErrorCode errorCode;
Expand All @@ -194,6 +209,7 @@ extern NSString * const ASUpdateMetadataNotification;
@property (readonly) BOOL vbr;

- (id)initWithURL:(NSURL *)aURL;
//- (id)initWithURL:(NSURL *)aURL encryption:(EncryptionMethod)method crc32:(uLong)crc32;
- (void)start;
- (void)stop;
- (void)pause;
Expand All @@ -209,6 +225,7 @@ extern NSString * const ASUpdateMetadataNotification;
- (float)averagePowerForChannel:(NSUInteger)channelNumber;


- (void)setVolume:(float)vol;
@end


Expand Down
Loading