| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // Creates a unified stream based on the cras (ChromeOS audio server) interface. | 5 // Creates a unified stream based on the cras (ChromeOS audio server) interface. |
| 6 // | 6 // |
| 7 // CrasUnifiedStream object is *not* thread-safe and should only be used | 7 // CrasUnifiedStream object is *not* thread-safe and should only be used |
| 8 // from the audio thread. | 8 // from the audio thread. |
| 9 | 9 |
| 10 #ifndef MEDIA_AUDIO_LINUX_CRAS_UNIFIED_H_ | 10 #ifndef MEDIA_AUDIO_LINUX_CRAS_UNIFIED_H_ |
| 11 #define MEDIA_AUDIO_LINUX_CRAS_UNIFIED_H_ | 11 #define MEDIA_AUDIO_LINUX_CRAS_UNIFIED_H_ |
| 12 | 12 |
| 13 #include <cras_client.h> | 13 #include <cras_client.h> |
| 14 | 14 |
| 15 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
| 16 #include "media/audio/audio_io.h" | 16 #include "media/audio/audio_io.h" |
| 17 #include "media/audio/audio_parameters.h" | 17 #include "media/audio/audio_parameters.h" |
| 18 | 18 |
| 19 namespace media { | 19 namespace media { |
| 20 | 20 |
| 21 class AudioManagerCras; | 21 class AudioManagerCras; |
| 22 | 22 |
| 23 // Implementation of AudioOuputStream for Chrome OS using the Chrome OS audio | 23 // Implementation of AudioOuputStream for Chrome OS using the Chrome OS audio |
| 24 // server. | 24 // server. |
| 25 // TODO(dgreid): This class is used for only output, remove all the relevant |
| 26 // input code and change the class to CrasOutputStream. |
| 25 class MEDIA_EXPORT CrasUnifiedStream : public AudioOutputStream { | 27 class MEDIA_EXPORT CrasUnifiedStream : public AudioOutputStream { |
| 26 public: | 28 public: |
| 27 // The ctor takes all the usual parameters, plus |manager| which is the | 29 // The ctor takes all the usual parameters, plus |manager| which is the |
| 28 // audio manager who is creating this object. | 30 // audio manager who is creating this object. |
| 29 CrasUnifiedStream(const AudioParameters& params, AudioManagerCras* manager); | 31 CrasUnifiedStream(const AudioParameters& params, AudioManagerCras* manager); |
| 30 | 32 |
| 31 // The dtor is typically called by the AudioManager only and it is usually | 33 // The dtor is typically called by the AudioManager only and it is usually |
| 32 // triggered by calling AudioUnifiedStream::Close(). | 34 // triggered by calling AudioUnifiedStream::Close(). |
| 33 virtual ~CrasUnifiedStream(); | 35 virtual ~CrasUnifiedStream(); |
| 34 | 36 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 | 99 |
| 98 // Volume level from 0.0 to 1.0. | 100 // Volume level from 0.0 to 1.0. |
| 99 float volume_; | 101 float volume_; |
| 100 | 102 |
| 101 // Audio manager that created us. Used to report that we've been closed. | 103 // Audio manager that created us. Used to report that we've been closed. |
| 102 AudioManagerCras* manager_; | 104 AudioManagerCras* manager_; |
| 103 | 105 |
| 104 // Callback to get audio samples. | 106 // Callback to get audio samples. |
| 105 AudioSourceCallback* source_callback_; | 107 AudioSourceCallback* source_callback_; |
| 106 | 108 |
| 107 // Container for exchanging data with AudioSourceCallback::OnMoreIOData(). | 109 // Container for exchanging data with AudioSourceCallback::OnMoreData(). |
| 108 scoped_ptr<AudioBus> input_bus_; | 110 scoped_ptr<AudioBus> input_bus_; |
| 109 scoped_ptr<AudioBus> output_bus_; | 111 scoped_ptr<AudioBus> output_bus_; |
| 110 | 112 |
| 111 // Direciton of the stream. | 113 // Direciton of the stream. |
| 112 CRAS_STREAM_DIRECTION stream_direction_; | 114 CRAS_STREAM_DIRECTION stream_direction_; |
| 113 | 115 |
| 114 DISALLOW_COPY_AND_ASSIGN(CrasUnifiedStream); | 116 DISALLOW_COPY_AND_ASSIGN(CrasUnifiedStream); |
| 115 }; | 117 }; |
| 116 | 118 |
| 117 } // namespace media | 119 } // namespace media |
| 118 | 120 |
| 119 #endif // MEDIA_AUDIO_LINUX_CRAS_UNIFIED_H_ | 121 #endif // MEDIA_AUDIO_LINUX_CRAS_UNIFIED_H_ |
| OLD | NEW |