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