| 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 REMOTING_HOST_AUDIO_CAPTURER_H_ | 5 #ifndef REMOTING_HOST_AUDIO_CAPTURER_H_ |
| 6 #define REMOTING_HOST_AUDIO_CAPTURER_H_ | 6 #define REMOTING_HOST_AUDIO_CAPTURER_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 | 10 |
| 11 namespace remoting { | 11 namespace remoting { |
| 12 | 12 |
| 13 class AudioPacket; | 13 class AudioPacket; |
| 14 class ChromotingHostContext; |
| 14 | 15 |
| 15 class AudioCapturer { | 16 class AudioCapturer { |
| 16 public: | 17 public: |
| 17 typedef base::Callback<void(scoped_ptr<AudioPacket> packet)> | 18 typedef base::Callback<void(scoped_ptr<AudioPacket> packet)> |
| 18 PacketCapturedCallback; | 19 PacketCapturedCallback; |
| 19 | 20 |
| 20 virtual ~AudioCapturer() {} | 21 virtual ~AudioCapturer() {} |
| 21 | 22 |
| 22 // Returns true if audio capturing is supported on this platform. If this | 23 // Returns true if audio capturing is supported on this platform. If this |
| 23 // returns true, then Create() must not return NULL. | 24 // returns true, then Create() must not return NULL. |
| 24 static bool IsSupported(); | 25 static bool IsSupported(ChromotingHostContext* context); |
| 25 static scoped_ptr<AudioCapturer> Create(); | 26 static scoped_ptr<AudioCapturer> Create(ChromotingHostContext* context); |
| 26 | 27 |
| 27 // Capturers should sample at a 44.1 or 48 kHz sampling rate, in uncompressed | 28 // Capturers should sample at a 44.1 or 48 kHz sampling rate, in uncompressed |
| 28 // PCM stereo format. Capturers may choose the number of frames per packet. | 29 // PCM stereo format. Capturers may choose the number of frames per packet. |
| 29 // Returns true on success. | 30 // Returns true on success. |
| 30 virtual bool Start(const PacketCapturedCallback& callback) = 0; | 31 virtual bool Start(const PacketCapturedCallback& callback) = 0; |
| 31 // Stops the audio capturer, and frees the OS-specific audio capture | 32 // Stops the audio capturer, and frees the OS-specific audio capture |
| 32 // resources. | 33 // resources. |
| 33 virtual void Stop() = 0; | 34 virtual void Stop() = 0; |
| 34 // Returns true if the audio capturer is running. | 35 // Returns true if the audio capturer is running. |
| 35 virtual bool IsStarted() = 0; | 36 virtual bool IsStarted() = 0; |
| 36 | 37 |
| 37 static bool IsValidSampleRate(int sample_rate); | 38 static bool IsValidSampleRate(int sample_rate); |
| 38 }; | 39 }; |
| 39 | 40 |
| 40 } // namespace remoting | 41 } // namespace remoting |
| 41 | 42 |
| 42 #endif // REMOTING_HOST_AUDIO_CAPTURER_H_ | 43 #endif // REMOTING_HOST_AUDIO_CAPTURER_H_ |
| OLD | NEW |