Permalink
Browse files

Update the AudioStreamer classes back to their original state, no ARC

  • Loading branch information...
1 parent e3f529b commit 723358ce4238cdbbe7efb18a25eb70ec3d88f587 @alexcrichton alexcrichton committed Jan 6, 2012
Showing with 162 additions and 614 deletions.
  1. +18 −37 AudioStreamer/AudioStreamer.h
  2. +144 −577 AudioStreamer/AudioStreamer.m
@@ -5,23 +5,28 @@
// Created by Matt Gallagher on 27/09/08.
// Copyright 2008 Matt Gallagher. All rights reserved.
//
-// Permission is given to use this source code file, free of charge, in any
-// project, commercial or otherwise, entirely at your risk, with the condition
-// that any redistribution (in part or whole) of source code must retain
-// this copyright and permission notice. Attribution in compiled projects is
-// appreciated but not required.
+// This software is provided 'as-is', without any express or implied
+// warranty. In no event will the authors be held liable for any damages
+// arising from the use of this software. Permission is granted to anyone to
+// use this software for any purpose, including commercial applications, and to
+// alter it and redistribute it freely, subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented; you must not
+// claim that you wrote the original software. If you use this software
+// in a product, an acknowledgment in the product documentation would be
+// appreciated but is not required.
+// 2. Altered source versions must be plainly marked as such, and must not be
+// misrepresented as being the original software.
+// 3. This notice may not be removed or altered from any source
+// distribution.
//
#if TARGET_OS_IPHONE
#import <UIKit/UIKit.h>
-#ifndef kCFCoreFoundationVersionNumber_iPhoneOS_4_0
-#define kCFCoreFoundationVersionNumber_iPhoneOS_4_0 550.32
-#endif
#else
#import <Cocoa/Cocoa.h>
#endif //TARGET_OS_IPHONE
-#import <Foundation/Foundation.h>
#include <pthread.h>
#include <AudioToolbox/AudioToolbox.h>
@@ -101,16 +106,9 @@ typedef enum
} AudioStreamerErrorCode;
extern NSString * const ASStatusChangedNotification;
-extern NSString * const ASPresentAlertWithTitleNotification;
-#ifdef SHOUTCAST_METADATA
-extern NSString * const ASUpdateMetadataNotification;
-#endif
@interface AudioStreamer : NSObject
{
-#if TARGET_OS_IPHONE
- UIBackgroundTaskIdentifier bgTaskId;
-#endif
NSURL *url;
//
@@ -166,30 +164,17 @@ extern NSString * const ASUpdateMetadataNotification;
// time)
double packetDuration; // sample rate times frames per packet
double lastProgress; // last calculated progress point
- UInt32 numberOfChannels; // Number of audio channels in the stream (1 = mono, 2 = stereo)
-
-#ifdef SHOUTCAST_METADATA
- BOOL foundIcyStart;
- BOOL foundIcyEnd;
- BOOL parsedHeaders;
- unsigned int metaDataInterval; // how many data bytes between meta data
- unsigned int metaDataBytesRemaining; // how many bytes of metadata remain to be read
- unsigned int dataBytesRead; // how many bytes of data have been read
- NSMutableString *metaDataString; // the metaDataString
+#if TARGET_OS_IPHONE
+ BOOL pausedByInterruption;
#endif
- BOOL vbr; // indicates VBR (or not) stream
}
@property AudioStreamerErrorCode errorCode;
-@property (readonly) AudioStreamerStopReason stopReason;
+@property (readonly) AudioStreamerState state;
@property (readonly) double progress;
-@property (readonly) double bufferFillPercentage;
@property (readonly) double duration;
@property (readwrite) UInt32 bitRate;
@property (readonly) NSDictionary *httpHeaders;
-@property (readonly) UInt32 numberOfChannels;
-@property (assign, getter=isMeteringEnabled) BOOL meteringEnabled;
-@property (readonly) BOOL vbr;
- (id)initWithURL:(NSURL *)aURL;
- (void)start;
@@ -201,10 +186,6 @@ extern NSString * const ASUpdateMetadataNotification;
- (BOOL)isIdle;
- (void)seekToTime:(double)newSeekTime;
- (double)calculatedBitRate;
-- (BOOL) setVolume: (double) volume;
-
-// level metering
-- (float)peakPowerForChannel:(NSUInteger)channelNumber;
-- (float)averagePowerForChannel:(NSUInteger)channelNumber;
+- (BOOL)setVolume: (double) volume;
@end
Oops, something went wrong. Retry.

0 comments on commit 723358c

Please sign in to comment.