| 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_INPUT_H_ | 5 #ifndef CHROMECAST_MEDIA_CMA_BACKEND_ALSA_STREAM_MIXER_ALSA_INPUT_H_ |
| 6 #define CHROMECAST_MEDIA_CMA_BACKEND_ALSA_STREAM_MIXER_ALSA_INPUT_H_ | 6 #define CHROMECAST_MEDIA_CMA_BACKEND_ALSA_STREAM_MIXER_ALSA_INPUT_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/threading/thread_checker.h" | 12 #include "base/threading/thread_checker.h" |
| 13 #include "chromecast/media/cma/backend/alsa/media_pipeline_backend_alsa.h" | 13 #include "chromecast/media/cma/backend/alsa/media_pipeline_backend_alsa.h" |
| 14 #include "chromecast/public/media/media_pipeline_device_params.h" | 14 #include "chromecast/public/media/media_pipeline_device_params.h" |
| 15 #include "chromecast/public/volume_control.h" |
| 15 | 16 |
| 16 namespace chromecast { | 17 namespace chromecast { |
| 17 namespace media { | 18 namespace media { |
| 18 | 19 |
| 19 class DecoderBufferBase; | 20 class DecoderBufferBase; |
| 20 class StreamMixerAlsaInputImpl; | 21 class StreamMixerAlsaInputImpl; |
| 21 | 22 |
| 22 // Input handle to the mixer. All methods (including constructor and destructor) | 23 // Input handle to the mixer. All methods (including constructor and destructor) |
| 23 // must be called on the same thread. | 24 // must be called on the same thread. |
| 24 class StreamMixerAlsaInput { | 25 class StreamMixerAlsaInput { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 45 | 46 |
| 46 protected: | 47 protected: |
| 47 virtual ~Delegate() {} | 48 virtual ~Delegate() {} |
| 48 }; | 49 }; |
| 49 | 50 |
| 50 // Adds a new input to the mixer, creating the mixer if it does not already | 51 // Adds a new input to the mixer, creating the mixer if it does not already |
| 51 // exist. | 52 // exist. |
| 52 StreamMixerAlsaInput(Delegate* delegate, | 53 StreamMixerAlsaInput(Delegate* delegate, |
| 53 int samples_per_second, | 54 int samples_per_second, |
| 54 bool primary, | 55 bool primary, |
| 55 const std::string& device_id); | 56 const std::string& device_id, |
| 57 AudioContentType content_type); |
| 56 // Removes this input from the mixer, destroying the mixer if there are no | 58 // Removes this input from the mixer, destroying the mixer if there are no |
| 57 // remaining inputs. | 59 // remaining inputs. |
| 58 ~StreamMixerAlsaInput(); | 60 ~StreamMixerAlsaInput(); |
| 59 | 61 |
| 60 // Writes some PCM data to be mixed. |data| must be in planar float format. | 62 // Writes some PCM data to be mixed. |data| must be in planar float format. |
| 61 // Once the data has been written, the delegate's OnWritePcmCompletion() | 63 // Once the data has been written, the delegate's OnWritePcmCompletion() |
| 62 // method will be called on the same thread that the StreamMixerAlsaInput was | 64 // method will be called on the same thread that the StreamMixerAlsaInput was |
| 63 // created on. Note that no further calls to WritePcm() should be made until | 65 // created on. Note that no further calls to WritePcm() should be made until |
| 64 // OnWritePcmCompletion() has been called. | 66 // OnWritePcmCompletion() has been called. |
| 65 void WritePcm(const scoped_refptr<DecoderBufferBase>& data); | 67 void WritePcm(const scoped_refptr<DecoderBufferBase>& data); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 76 StreamMixerAlsaInputImpl* impl_; | 78 StreamMixerAlsaInputImpl* impl_; |
| 77 base::ThreadChecker thread_checker_; | 79 base::ThreadChecker thread_checker_; |
| 78 | 80 |
| 79 DISALLOW_COPY_AND_ASSIGN(StreamMixerAlsaInput); | 81 DISALLOW_COPY_AND_ASSIGN(StreamMixerAlsaInput); |
| 80 }; | 82 }; |
| 81 | 83 |
| 82 } // namespace media | 84 } // namespace media |
| 83 } // namespace chromecast | 85 } // namespace chromecast |
| 84 | 86 |
| 85 #endif // CHROMECAST_MEDIA_CMA_BACKEND_ALSA_STREAM_MIXER_ALSA_INPUT_H_ | 87 #endif // CHROMECAST_MEDIA_CMA_BACKEND_ALSA_STREAM_MIXER_ALSA_INPUT_H_ |
| OLD | NEW |