-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathAQHandler.h
65 lines (52 loc) · 1.81 KB
/
AQHandler.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//
// AQHandler.h
// FFmpegPlayTest
//
// Created by Jack on 11/2/12.
// Copyright (c) 2012 Jack. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <AudioToolbox/AudioQueue.h>
#import <AudioToolbox/AudioToolbox.h>
#import "Controllable.h"
#import "TimingProtocols.h"
enum {
kAQStateUnknown, //= 0,
kAQStateStopped, //= 1 << 0,
kAQStateRunning, //= 1 << 1,
kAQStatePaused //= 1 << 2,
};
typedef NSInteger AQState;
static const int kNumberBuffers = 3;
typedef struct {
AudioStreamBasicDescription mDataFormat;
AudioQueueRef mQueue;
AudioQueueBufferRef mBuffers[kNumberBuffers];
// AudioFileID mAudioFile;
UInt32 bufferByteSize;
UInt32 mNumPacketsToRead;
SInt64 mCurrentPacket;
AudioStreamPacketDescription *mPacketDescs;
AQState mStatus;
} AQPlayerState;
//----------------------------------------------------------------
@protocol AudioQueueSource <NSObject>
@required
- (BOOL) fillAudioStreamDescription: (AudioStreamBasicDescription*) pASBD;
- (UInt32) maxAudioPacketSize;
- (void) renderAudioBuffer:(AudioQueueBufferRef) aqBuffer
forPts:(NSTimeInterval) pts;
@optional
- (int) sampleRate;
@end
//----------------------------------------------------------------
@protocol AQHandlerDelegate <NSObject>
@end
//----------------------------------------------------------------
@interface AQHandler : NSObject <Controllable, Clock>
//@property (nonatomic, readonly) AQPlayerState* pAQdata;
- (AQPlayerState*) audioQueueData;
@property (nonatomic, assign) id<AudioQueueSource> source;
@property (nonatomic, assign) id<AQHandlerDelegate> delegate;
- (id) initWithSource: (id<AudioQueueSource>) source;
@end