Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(910)

Side by Side Diff: media/audio/mac/audio_input_mac.h

Issue 10907110: Create iOS Audio Manager implementation. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Response to reviews Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MEDIA_AUDIO_MAC_AUDIO_INPUT_MAC_H_ 5 #ifndef MEDIA_AUDIO_MAC_AUDIO_INPUT_MAC_H_
6 #define MEDIA_AUDIO_MAC_AUDIO_INPUT_MAC_H_ 6 #define MEDIA_AUDIO_MAC_AUDIO_INPUT_MAC_H_
7 7
8 #include <AudioToolbox/AudioQueue.h> 8 #include <AudioToolbox/AudioQueue.h>
9 #include <AudioToolbox/AudioFormat.h> 9 #include <AudioToolbox/AudioFormat.h>
10 10
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "media/audio/audio_io.h" 12 #include "media/audio/audio_io.h"
13 #include "media/audio/audio_parameters.h" 13 #include "media/audio/audio_parameters.h"
14 14
15 namespace media { 15 namespace media {
16 16
17 class AudioManagerMac; 17 class AudioManagerBase;
18 18
19 // Implementation of AudioInputStream for Mac OS X using the audio queue service 19 // Implementation of AudioInputStream for Mac OS X using the audio queue service
20 // present in OS 10.5 and later. Design reflects PCMQueueOutAudioOutputStream. 20 // present in OS 10.5 and later. Design reflects PCMQueueOutAudioOutputStream.
21 class PCMQueueInAudioInputStream : public AudioInputStream { 21 class PCMQueueInAudioInputStream : public AudioInputStream {
22 public: 22 public:
23 // Parameters as per AudioManager::MakeAudioInputStream. 23 // Parameters as per AudioManager::MakeAudioInputStream.
24 PCMQueueInAudioInputStream(AudioManagerMac* manager, 24 PCMQueueInAudioInputStream(AudioManagerBase* manager,
25 const AudioParameters& params); 25 const AudioParameters& params);
26 virtual ~PCMQueueInAudioInputStream(); 26 virtual ~PCMQueueInAudioInputStream();
27 27
28 // Implementation of AudioInputStream. 28 // Implementation of AudioInputStream.
29 virtual bool Open() OVERRIDE; 29 virtual bool Open() OVERRIDE;
30 virtual void Start(AudioInputCallback* callback) OVERRIDE; 30 virtual void Start(AudioInputCallback* callback) OVERRIDE;
31 virtual void Stop() OVERRIDE; 31 virtual void Stop() OVERRIDE;
32 virtual void Close() OVERRIDE; 32 virtual void Close() OVERRIDE;
33 virtual double GetMaxVolume() OVERRIDE; 33 virtual double GetMaxVolume() OVERRIDE;
34 virtual void SetVolume(double volume) OVERRIDE; 34 virtual void SetVolume(double volume) OVERRIDE;
(...skipping 23 matching lines...) Expand all
58 // Handles callback from OS. Will be called on OS internal thread. 58 // Handles callback from OS. Will be called on OS internal thread.
59 void HandleInputBuffer(AudioQueueRef audio_queue, 59 void HandleInputBuffer(AudioQueueRef audio_queue,
60 AudioQueueBufferRef audio_buffer, 60 AudioQueueBufferRef audio_buffer,
61 const AudioTimeStamp* start_time, 61 const AudioTimeStamp* start_time,
62 UInt32 num_packets, 62 UInt32 num_packets,
63 const AudioStreamPacketDescription* packet_desc); 63 const AudioStreamPacketDescription* packet_desc);
64 64
65 static const int kNumberBuffers = 3; 65 static const int kNumberBuffers = 3;
66 66
67 // Manager that owns this stream, used for closing down. 67 // Manager that owns this stream, used for closing down.
68 AudioManagerMac* manager_; 68 AudioManagerBase* manager_;
69 // We use the callback mostly to periodically supply the recorded audio data. 69 // We use the callback mostly to periodically supply the recorded audio data.
70 AudioInputCallback* callback_; 70 AudioInputCallback* callback_;
71 // Structure that holds the stream format details such as bitrate. 71 // Structure that holds the stream format details such as bitrate.
72 AudioStreamBasicDescription format_; 72 AudioStreamBasicDescription format_;
73 // Handle to the OS audio queue object. 73 // Handle to the OS audio queue object.
74 AudioQueueRef audio_queue_; 74 AudioQueueRef audio_queue_;
75 // Size of each of the buffers in |audio_buffers_| 75 // Size of each of the buffers in |audio_buffers_|
76 uint32 buffer_size_bytes_; 76 uint32 buffer_size_bytes_;
77 // True iff Start() has been called successfully. 77 // True iff Start() has been called successfully.
78 bool started_; 78 bool started_;
79 79
80 DISALLOW_COPY_AND_ASSIGN(PCMQueueInAudioInputStream); 80 DISALLOW_COPY_AND_ASSIGN(PCMQueueInAudioInputStream);
81 }; 81 };
82 82
83 } // namespace media 83 } // namespace media
84 84
85 #endif // MEDIA_AUDIO_MAC_AUDIO_INPUT_MAC_H_ 85 #endif // MEDIA_AUDIO_MAC_AUDIO_INPUT_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698