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_BASE_AUDIO_CAPTURER_SOURCE_H_ | 5 #ifndef MEDIA_BASE_AUDIO_CAPTURER_SOURCE_H_ |
6 #define MEDIA_BASE_AUDIO_CAPTURER_SOURCE_H_ | 6 #define MEDIA_BASE_AUDIO_CAPTURER_SOURCE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 int audio_delay_milliseconds, | 28 int audio_delay_milliseconds, |
29 double volume) = 0; | 29 double volume) = 0; |
30 | 30 |
31 // Signals an error has occurred. | 31 // Signals an error has occurred. |
32 virtual void OnCaptureError() = 0; | 32 virtual void OnCaptureError() = 0; |
33 | 33 |
34 protected: | 34 protected: |
35 virtual ~CaptureCallback() {} | 35 virtual ~CaptureCallback() {} |
36 }; | 36 }; |
37 | 37 |
38 class CaptureEventHandler { | |
39 public: | |
40 // Notification to the client that the device with the specific |device_id| | |
41 // has been started. | |
42 virtual void OnDeviceStarted(const std::string& device_id) = 0; | |
43 | |
44 // Notification to the client that the device has been stopped. | |
45 virtual void OnDeviceStopped() = 0; | |
46 | |
47 protected: | |
48 virtual ~CaptureEventHandler() {} | |
49 }; | |
50 | |
51 // Sets information about the audio stream format and the device | 38 // Sets information about the audio stream format and the device |
52 // to be used. It must be called before any of the other methods. | 39 // to be used. It must be called before any of the other methods. |
53 // TODO(xians): Add |device_id| to this Initialize() function. | 40 // The |session_id| is used by the browser to identify which input device to |
| 41 // be used. For clients who do not care about device permission and device |
| 42 // selection, pass |session_id| using |
| 43 // AudioInputDeviceManager::kFakeOpenSessionId. |
54 virtual void Initialize(const AudioParameters& params, | 44 virtual void Initialize(const AudioParameters& params, |
55 CaptureCallback* callback, | 45 CaptureCallback* callback, |
56 CaptureEventHandler* event_handler) = 0; | 46 int session_id) = 0; |
57 | 47 |
58 // Starts the audio recording. | 48 // Starts the audio recording. |
59 virtual void Start() = 0; | 49 virtual void Start() = 0; |
60 | 50 |
61 // Stops the audio recording. This API is synchronous, and no more data | 51 // Stops the audio recording. This API is synchronous, and no more data |
62 // callback will be passed to the client after it is being called. | 52 // callback will be passed to the client after it is being called. |
63 virtual void Stop() = 0; | 53 virtual void Stop() = 0; |
64 | 54 |
65 // Sets the capture volume, with range [0.0, 1.0] inclusive. | 55 // Sets the capture volume, with range [0.0, 1.0] inclusive. |
66 virtual void SetVolume(double volume) = 0; | 56 virtual void SetVolume(double volume) = 0; |
67 | 57 |
68 // Specifies the |session_id| to query which device to use. | |
69 // TODO(xians): Change the interface to SetDevice(const std::string&). | |
70 virtual void SetDevice(int session_id) = 0; | |
71 | |
72 // Enables or disables the WebRtc AGC control. | 58 // Enables or disables the WebRtc AGC control. |
73 virtual void SetAutomaticGainControl(bool enable) = 0; | 59 virtual void SetAutomaticGainControl(bool enable) = 0; |
74 | 60 |
75 protected: | 61 protected: |
76 friend class base::RefCountedThreadSafe<AudioCapturerSource>; | 62 friend class base::RefCountedThreadSafe<AudioCapturerSource>; |
77 virtual ~AudioCapturerSource() {} | 63 virtual ~AudioCapturerSource() {} |
78 }; | 64 }; |
79 | 65 |
80 } // namespace media | 66 } // namespace media |
81 | 67 |
82 #endif // MEDIA_BASE_AUDIO_CAPTURER_SOURCE_H_ | 68 #endif // MEDIA_BASE_AUDIO_CAPTURER_SOURCE_H_ |
OLD | NEW |