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_ANDROID_OPENSLES_OUTPUT_H_ | 5 #ifndef MEDIA_AUDIO_ANDROID_OPENSLES_OUTPUT_H_ |
6 #define MEDIA_AUDIO_ANDROID_OPENSLES_OUTPUT_H_ | 6 #define MEDIA_AUDIO_ANDROID_OPENSLES_OUTPUT_H_ |
7 | 7 |
8 #include <SLES/OpenSLES.h> | 8 #include <SLES/OpenSLES.h> |
9 #include <SLES/OpenSLES_Android.h> | 9 #include <SLES/OpenSLES_Android.h> |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 // audio buffers are given to us from an internal OpenSLES audio thread. | 24 // audio buffers are given to us from an internal OpenSLES audio thread. |
25 // All public methods should be called on the Audio Manager thread. | 25 // All public methods should be called on the Audio Manager thread. |
26 class OpenSLESOutputStream : public AudioOutputStream { | 26 class OpenSLESOutputStream : public AudioOutputStream { |
27 public: | 27 public: |
28 static const int kMaxNumOfBuffersInQueue = 2; | 28 static const int kMaxNumOfBuffersInQueue = 2; |
29 | 29 |
30 OpenSLESOutputStream(AudioManagerAndroid* manager, | 30 OpenSLESOutputStream(AudioManagerAndroid* manager, |
31 const AudioParameters& params, | 31 const AudioParameters& params, |
32 SLint32 stream_type); | 32 SLint32 stream_type); |
33 | 33 |
34 virtual ~OpenSLESOutputStream(); | 34 ~OpenSLESOutputStream() override; |
35 | 35 |
36 // Implementation of AudioOutputStream. | 36 // Implementation of AudioOutputStream. |
37 virtual bool Open() override; | 37 bool Open() override; |
38 virtual void Close() override; | 38 void Close() override; |
39 virtual void Start(AudioSourceCallback* callback) override; | 39 void Start(AudioSourceCallback* callback) override; |
40 virtual void Stop() override; | 40 void Stop() override; |
41 virtual void SetVolume(double volume) override; | 41 void SetVolume(double volume) override; |
42 virtual void GetVolume(double* volume) override; | 42 void GetVolume(double* volume) override; |
43 | 43 |
44 // Set the value of |muted_|. It does not affect |volume_| which can be | 44 // Set the value of |muted_|. It does not affect |volume_| which can be |
45 // got by calling GetVolume(). See comments for |muted_| below. | 45 // got by calling GetVolume(). See comments for |muted_| below. |
46 void SetMute(bool muted); | 46 void SetMute(bool muted); |
47 | 47 |
48 private: | 48 private: |
49 bool CreatePlayer(); | 49 bool CreatePlayer(); |
50 | 50 |
51 // Called from OpenSLES specific audio worker thread. | 51 // Called from OpenSLES specific audio worker thread. |
52 static void SimpleBufferQueueCallback( | 52 static void SimpleBufferQueueCallback( |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 | 116 |
117 // Container for retrieving data from AudioSourceCallback::OnMoreData(). | 117 // Container for retrieving data from AudioSourceCallback::OnMoreData(). |
118 scoped_ptr<AudioBus> audio_bus_; | 118 scoped_ptr<AudioBus> audio_bus_; |
119 | 119 |
120 DISALLOW_COPY_AND_ASSIGN(OpenSLESOutputStream); | 120 DISALLOW_COPY_AND_ASSIGN(OpenSLESOutputStream); |
121 }; | 121 }; |
122 | 122 |
123 } // namespace media | 123 } // namespace media |
124 | 124 |
125 #endif // MEDIA_AUDIO_ANDROID_OPENSLES_OUTPUT_H_ | 125 #endif // MEDIA_AUDIO_ANDROID_OPENSLES_OUTPUT_H_ |
OLD | NEW |