| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_OUTPUT_MAC_H_ | 5 #ifndef MEDIA_AUDIO_MAC_OUTPUT_MAC_H_ |
| 6 #define MEDIA_AUDIO_MAC_OUTPUT_MAC_H_ | 6 #define MEDIA_AUDIO_MAC_OUTPUT_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 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 // triggered by calling AudioOutputStream::Close(). | 28 // triggered by calling AudioOutputStream::Close(). |
| 29 virtual ~PCMQueueOutAudioOutputStream(); | 29 virtual ~PCMQueueOutAudioOutputStream(); |
| 30 | 30 |
| 31 // Implementation of AudioOutputStream. | 31 // Implementation of AudioOutputStream. |
| 32 virtual bool Open(size_t packet_size); | 32 virtual bool Open(size_t packet_size); |
| 33 virtual void Close(); | 33 virtual void Close(); |
| 34 virtual void Start(AudioSourceCallback* callback); | 34 virtual void Start(AudioSourceCallback* callback); |
| 35 virtual void Stop(); | 35 virtual void Stop(); |
| 36 virtual void SetVolume(double left_level, double right_level); | 36 virtual void SetVolume(double left_level, double right_level); |
| 37 virtual void GetVolume(double* left_level, double* right_level); | 37 virtual void GetVolume(double* left_level, double* right_level); |
| 38 virtual size_t GetNumBuffers(); | |
| 39 | 38 |
| 40 private: | 39 private: |
| 41 // The audio is double buffered. | 40 // The audio is double buffered. |
| 42 static const size_t kNumBuffers = 2; | 41 static const size_t kNumBuffers = 2; |
| 43 | 42 |
| 44 // The OS calls back here when an audio buffer has been processed. | 43 // The OS calls back here when an audio buffer has been processed. |
| 45 static void RenderCallback(void* p_this, AudioQueueRef queue, | 44 static void RenderCallback(void* p_this, AudioQueueRef queue, |
| 46 AudioQueueBufferRef buffer); | 45 AudioQueueBufferRef buffer); |
| 47 // Called when an error occurs. | 46 // Called when an error occurs. |
| 48 void HandleError(OSStatus err); | 47 void HandleError(OSStatus err); |
| 49 | 48 |
| 50 // Structure that holds the stream format details such as bitrate. | 49 // Structure that holds the stream format details such as bitrate. |
| 51 AudioStreamBasicDescription format_; | 50 AudioStreamBasicDescription format_; |
| 52 // Handle to the OS audio queue object. | 51 // Handle to the OS audio queue object. |
| 53 AudioQueueRef audio_queue_; | 52 AudioQueueRef audio_queue_; |
| 54 // Array of pointers to the OS managed audio buffers. | 53 // Array of pointers to the OS managed audio buffers. |
| 55 AudioQueueBufferRef buffer_[kNumBuffers]; | 54 AudioQueueBufferRef buffer_[kNumBuffers]; |
| 56 // Pointer to the object that will provide the audio samples. | 55 // Pointer to the object that will provide the audio samples. |
| 57 AudioSourceCallback* source_; | 56 AudioSourceCallback* source_; |
| 58 // Our creator, the audio manager needs to be notified when we close. | 57 // Our creator, the audio manager needs to be notified when we close. |
| 59 AudioManagerMac* manager_; | 58 AudioManagerMac* manager_; |
| 60 | 59 |
| 61 DISALLOW_COPY_AND_ASSIGN(PCMQueueOutAudioOutputStream); | 60 DISALLOW_COPY_AND_ASSIGN(PCMQueueOutAudioOutputStream); |
| 62 }; | 61 }; |
| 63 | 62 |
| 64 #endif // MEDIA_AUDIO_MAC_OUTPUT_MAC_H_ | 63 #endif // MEDIA_AUDIO_MAC_OUTPUT_MAC_H_ |
| OLD | NEW |