| 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 <vector> | 8 #include <jni.h> |
| 9 | 9 |
| 10 #include "base/android/jni_android.h" |
| 10 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 11 #include "media/audio/android/opensles_util.h" | 12 #include "media/audio/android/opensles_util.h" |
| 12 #include "media/audio/audio_io.h" | 13 #include "media/audio/audio_io.h" |
| 13 #include "media/audio/audio_parameters.h" | 14 #include "media/audio/audio_parameters.h" |
| 15 |
| 14 #include <SLES/OpenSLES_Android.h> | 16 #include <SLES/OpenSLES_Android.h> |
| 17 #include <SLES/OpenSLES_AndroidConfiguration.h> |
| 15 | 18 |
| 16 namespace media { | 19 namespace media { |
| 17 | 20 |
| 18 class AudioManagerAndroid; | 21 class AudioManagerAndroid; |
| 19 | 22 |
| 20 // Implements PCM audio output support for Android using the OpenSLES API. | 23 // Implements PCM audio output support for Android using the OpenSLES API. |
| 21 class OpenSLESOutputStream : public AudioOutputStream { | 24 class OpenSLESOutputStream : public AudioOutputStream { |
| 22 public: | 25 public: |
| 23 static const int kNumOfQueuesInBuffer = 2; | 26 static const int kNumOfQueuesInBuffer = 2; |
| 24 | 27 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 45 | 48 |
| 46 // Called in Open(); | 49 // Called in Open(); |
| 47 void SetupAudioBuffer(); | 50 void SetupAudioBuffer(); |
| 48 | 51 |
| 49 // Called in Close(); | 52 // Called in Close(); |
| 50 void ReleaseAudioBuffer(); | 53 void ReleaseAudioBuffer(); |
| 51 | 54 |
| 52 // If OpenSLES reports an error this function handles it and passes it to | 55 // If OpenSLES reports an error this function handles it and passes it to |
| 53 // the attached AudioOutputCallback::OnError(). | 56 // the attached AudioOutputCallback::OnError(). |
| 54 void HandleError(SLresult error); | 57 void HandleError(SLresult error); |
| 58 void SetAudioMode(); |
| 55 | 59 |
| 56 AudioManagerAndroid* audio_manager_; | 60 AudioManagerAndroid* audio_manager_; |
| 57 | 61 |
| 58 AudioSourceCallback* callback_; | 62 AudioSourceCallback* callback_; |
| 59 | 63 |
| 60 // Shared engine interfaces for the app. | 64 // Shared engine interfaces for the app. |
| 61 media::ScopedSLObjectItf engine_object_; | 65 media::ScopedSLObjectItf engine_object_; |
| 62 media::ScopedSLObjectItf player_object_; | 66 media::ScopedSLObjectItf player_object_; |
| 63 media::ScopedSLObjectItf output_mixer_; | 67 media::ScopedSLObjectItf output_mixer_; |
| 64 | 68 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 82 | 86 |
| 83 // Container for retrieving data from AudioSourceCallback::OnMoreData(). | 87 // Container for retrieving data from AudioSourceCallback::OnMoreData(). |
| 84 scoped_ptr<AudioBus> audio_bus_; | 88 scoped_ptr<AudioBus> audio_bus_; |
| 85 | 89 |
| 86 DISALLOW_COPY_AND_ASSIGN(OpenSLESOutputStream); | 90 DISALLOW_COPY_AND_ASSIGN(OpenSLESOutputStream); |
| 87 }; | 91 }; |
| 88 | 92 |
| 89 } // namespace media | 93 } // namespace media |
| 90 | 94 |
| 91 #endif // MEDIA_AUDIO_ANDROID_OPENSLES_INPUT_H_ | 95 #endif // MEDIA_AUDIO_ANDROID_OPENSLES_INPUT_H_ |
| OLD | NEW |