Skip to content

Commit

Permalink
Updates to the API to express failure
Browse files Browse the repository at this point in the history
Also deal with proxies.
  • Loading branch information
alexcrichton committed Jun 15, 2012
1 parent 293267b commit 3a072f7
Show file tree
Hide file tree
Showing 2 changed files with 187 additions and 96 deletions.
42 changes: 26 additions & 16 deletions AudioStreamer/AudioStreamer.h
Expand Up @@ -83,6 +83,9 @@ struct queued_packet;
@interface AudioStreamer : NSObject {
/* Properties specified at creation */
NSURL *url;
int proxyType;
NSString *proxyHost;
int proxyPort;

/* Creates as part of the [start] method */
CFReadStreamRef stream;
Expand Down Expand Up @@ -147,21 +150,28 @@ struct queued_packet;
@property (readonly) NSDictionary *httpHeaders;
@property (readonly) NSError *networkError;

+ (NSString *)stringForErrorCode:(AudioStreamerErrorCode)anErrorCode;

- (id)initWithURL:(NSURL *)aURL;
- (void)start;
- (void)stop;
- (void)pause;
- (void)play;
- (BOOL)isPlaying;
- (BOOL)isPaused;
- (BOOL)isWaiting;
- (BOOL)isDone;
- (BOOL)seekToTime:(double)newSeekTime;
- (double)calculatedBitRate;
- (BOOL)setVolume:(double)volume;
- (double)duration;
- (double)progress;
+ (NSString*) stringForErrorCode:(AudioStreamerErrorCode)anErrorCode;

/* Creating an audio stream and managing properties before starting */
- (AudioStreamer*) initWithURL:(NSURL*)url;
- (void) setHTTPProxy:(NSString*)host port:(int)port;
- (void) setSOCKSProxy:(NSString*)host port:(int)port;

/* Management of the stream and testing state */
- (BOOL) start;
- (void) stop;
- (BOOL) pause;
- (BOOL) play;
- (BOOL) isPlaying;
- (BOOL) isPaused;
- (BOOL) isWaiting;
- (BOOL) isDone;

/* Calculated properties and modifying the stream (all can fail) */
- (BOOL) seekToTime:(double)newSeekTime;
- (BOOL) calculatedBitRate:(double*)ret;
- (BOOL) setVolume:(double)volume;
- (BOOL) duration:(double*)ret;
- (BOOL) progress:(double*)ret;

@end

0 comments on commit 3a072f7

Please sign in to comment.