OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CHROMECAST_MEDIA_CMA_BACKEND_ALSA_STREAM_MIXER_ALSA_H_ | 5 #ifndef CHROMECAST_MEDIA_CMA_BACKEND_ALSA_STREAM_MIXER_ALSA_H_ |
6 #define CHROMECAST_MEDIA_CMA_BACKEND_ALSA_STREAM_MIXER_ALSA_H_ | 6 #define CHROMECAST_MEDIA_CMA_BACKEND_ALSA_STREAM_MIXER_ALSA_H_ |
7 | 7 |
8 #include <alsa/asoundlib.h> | 8 #include <alsa/asoundlib.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 virtual int MaxReadSize() = 0; | 86 virtual int MaxReadSize() = 0; |
87 | 87 |
88 // Pulls data from the input stream. The input stream should populate |dest| | 88 // Pulls data from the input stream. The input stream should populate |dest| |
89 // with |frames| frames of data to be mixed. The mixer expects data to be | 89 // with |frames| frames of data to be mixed. The mixer expects data to be |
90 // at a sample rate of |output_samples_per_second()|, so each input stream | 90 // at a sample rate of |output_samples_per_second()|, so each input stream |
91 // should resample as necessary before returning. |frames| is guaranteed to | 91 // should resample as necessary before returning. |frames| is guaranteed to |
92 // be no larger than the value returned by the most recent call to | 92 // be no larger than the value returned by the most recent call to |
93 // MaxReadSize(), and |dest->frames()| shall be >= |frames|. | 93 // MaxReadSize(), and |dest->frames()| shall be >= |frames|. |
94 virtual void GetResampledData(::media::AudioBus* dest, int frames) = 0; | 94 virtual void GetResampledData(::media::AudioBus* dest, int frames) = 0; |
95 | 95 |
| 96 // Scale |frames| frames at |src| by the current volume (smoothing as |
| 97 // needed). Add the scaled result to |dest|. |
| 98 virtual bool VolumeScaleAccumulate(const float* src, |
| 99 int frames, |
| 100 float* dest) = 0; |
| 101 |
96 // This is called for every InputQueue when the mixer writes data to ALSA | 102 // This is called for every InputQueue when the mixer writes data to ALSA |
97 // for any of its input streams. | 103 // for any of its input streams. |
98 virtual void AfterWriteFrames( | 104 virtual void AfterWriteFrames( |
99 const MediaPipelineBackendAlsa::RenderingDelay& | 105 const MediaPipelineBackendAlsa::RenderingDelay& |
100 mixer_rendering_delay) = 0; | 106 mixer_rendering_delay) = 0; |
101 | 107 |
102 // This will be called when a fatal error occurs in the mixer. | 108 // This will be called when a fatal error occurs in the mixer. |
103 virtual void SignalError(StreamMixerAlsaInput::MixerError error) = 0; | 109 virtual void SignalError(StreamMixerAlsaInput::MixerError error) = 0; |
104 | 110 |
105 // Notifies the input that it is being removed by the upper layers, and | 111 // Notifies the input that it is being removed by the upper layers, and |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 std::unique_ptr<AudioFilterInterface> pre_loopback_filter_; | 244 std::unique_ptr<AudioFilterInterface> pre_loopback_filter_; |
239 std::unique_ptr<AudioFilterInterface> post_loopback_filter_; | 245 std::unique_ptr<AudioFilterInterface> post_loopback_filter_; |
240 | 246 |
241 DISALLOW_COPY_AND_ASSIGN(StreamMixerAlsa); | 247 DISALLOW_COPY_AND_ASSIGN(StreamMixerAlsa); |
242 }; | 248 }; |
243 | 249 |
244 } // namespace media | 250 } // namespace media |
245 } // namespace chromecast | 251 } // namespace chromecast |
246 | 252 |
247 #endif // CHROMECAST_MEDIA_CMA_BACKEND_ALSA_STREAM_MIXER_ALSA_H_ | 253 #endif // CHROMECAST_MEDIA_CMA_BACKEND_ALSA_STREAM_MIXER_ALSA_H_ |
OLD | NEW |