OLD | NEW |
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/AudioFormat.h> | 8 #include <AudioToolbox/AudioFormat.h> |
9 #include <AudioToolbox/AudioQueue.h> | 9 #include <AudioToolbox/AudioQueue.h> |
10 | 10 |
11 #include "base/cancelable_callback.h" | 11 #include "base/cancelable_callback.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
14 #include "media/audio/audio_io.h" | 14 #include "media/audio/audio_io.h" |
15 #include "media/audio/audio_parameters.h" | 15 #include "media/audio/audio_parameters.h" |
16 | 16 |
17 namespace media { | 17 namespace media { |
18 | 18 |
19 class AudioBus; | 19 class AudioBus; |
20 class AudioManagerMac; | 20 class AudioManagerMac; |
21 | 21 |
22 // Implementation of AudioInputStream for Mac OS X using the audio queue service | 22 // Implementation of AudioInputStream for Mac OS X using the audio queue service |
23 // present in OS 10.5 and later. Design reflects PCMQueueOutAudioOutputStream. | 23 // present in OS 10.5 and later. Design reflects PCMQueueOutAudioOutputStream. |
24 class PCMQueueInAudioInputStream : public AudioInputStream { | 24 class PCMQueueInAudioInputStream : public AudioInputStream { |
25 public: | 25 public: |
26 // Parameters as per AudioManager::MakeAudioInputStream. | 26 // Parameters as per AudioManager::MakeAudioInputStream. |
27 PCMQueueInAudioInputStream(AudioManagerMac* manager, | 27 PCMQueueInAudioInputStream(AudioManagerMac* manager, |
28 const AudioParameters& params); | 28 const AudioParameters& params); |
29 virtual ~PCMQueueInAudioInputStream(); | 29 ~PCMQueueInAudioInputStream() override; |
30 | 30 |
31 // Implementation of AudioInputStream. | 31 // Implementation of AudioInputStream. |
32 virtual bool Open() override; | 32 bool Open() override; |
33 virtual void Start(AudioInputCallback* callback) override; | 33 void Start(AudioInputCallback* callback) override; |
34 virtual void Stop() override; | 34 void Stop() override; |
35 virtual void Close() override; | 35 void Close() override; |
36 virtual double GetMaxVolume() override; | 36 double GetMaxVolume() override; |
37 virtual void SetVolume(double volume) override; | 37 void SetVolume(double volume) override; |
38 virtual double GetVolume() override; | 38 double GetVolume() override; |
39 virtual void SetAutomaticGainControl(bool enabled) override; | 39 void SetAutomaticGainControl(bool enabled) override; |
40 virtual bool GetAutomaticGainControl() override; | 40 bool GetAutomaticGainControl() override; |
41 virtual bool IsMuted() override; | 41 bool IsMuted() override; |
42 | 42 |
43 private: | 43 private: |
44 // Issue the OnError to |callback_|; | 44 // Issue the OnError to |callback_|; |
45 void HandleError(OSStatus err); | 45 void HandleError(OSStatus err); |
46 | 46 |
47 // Allocates and prepares the memory that will be used for recording. | 47 // Allocates and prepares the memory that will be used for recording. |
48 bool SetupBuffers(); | 48 bool SetupBuffers(); |
49 | 49 |
50 // Sends a buffer to the audio driver for recording. | 50 // Sends a buffer to the audio driver for recording. |
51 OSStatus QueueNextBuffer(AudioQueueBufferRef audio_buffer); | 51 OSStatus QueueNextBuffer(AudioQueueBufferRef audio_buffer); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 base::CancelableClosure deferred_start_cb_; | 86 base::CancelableClosure deferred_start_cb_; |
87 | 87 |
88 scoped_ptr<media::AudioBus> audio_bus_; | 88 scoped_ptr<media::AudioBus> audio_bus_; |
89 | 89 |
90 DISALLOW_COPY_AND_ASSIGN(PCMQueueInAudioInputStream); | 90 DISALLOW_COPY_AND_ASSIGN(PCMQueueInAudioInputStream); |
91 }; | 91 }; |
92 | 92 |
93 } // namespace media | 93 } // namespace media |
94 | 94 |
95 #endif // MEDIA_AUDIO_MAC_AUDIO_INPUT_MAC_H_ | 95 #endif // MEDIA_AUDIO_MAC_AUDIO_INPUT_MAC_H_ |
OLD | NEW |