Chromium Code Reviews| Index: chromecast/media/cma/backend/alsa/stream_mixer_alsa.h |
| diff --git a/chromecast/media/cma/backend/alsa/stream_mixer_alsa.h b/chromecast/media/cma/backend/alsa/stream_mixer_alsa.h |
| index b522f09024cb274daf1aea6adfe5a1775ded5788..4b7f35b48d15ea24fbc080d188c63f9db1718935 100644 |
| --- a/chromecast/media/cma/backend/alsa/stream_mixer_alsa.h |
| +++ b/chromecast/media/cma/backend/alsa/stream_mixer_alsa.h |
| @@ -8,6 +8,7 @@ |
| #include <alsa/asoundlib.h> |
| #include <stdint.h> |
| +#include <map> |
| #include <memory> |
| #include <string> |
| #include <vector> |
| @@ -20,6 +21,7 @@ |
| #include "chromecast/media/cma/backend/alsa/media_pipeline_backend_alsa.h" |
| #include "chromecast/media/cma/backend/alsa/stream_mixer_alsa_input.h" |
| #include "chromecast/public/cast_media_shlib.h" |
| +#include "chromecast/public/volume_control.h" |
| namespace media { |
| class AudioBus; |
| @@ -73,6 +75,9 @@ class StreamMixerAlsa { |
| // or media/audio/audio_device_description.h |
| virtual std::string device_id() const = 0; |
| + // Returns the content type for volume control. |
| + virtual AudioContentType content_type() const = 0; |
| + |
| // Returns true if PrepareToDelete() has been called. |
| virtual bool IsDeleting() const = 0; |
| @@ -129,6 +134,14 @@ class StreamMixerAlsa { |
| // Once the input is ready to be removed, it should call the supplied |
| // |delete_cb|; this should only happen once per input. |
| virtual void PrepareToDelete(const OnReadyToDeleteCb& delete_cb) = 0; |
| + |
| + // Sets the multiplier based on this stream's content type. The resulting |
| + // output volume should be the content type volume * the per-stream volume |
| + // multiplier. |
| + virtual void SetContentTypeVolume(float volume) = 0; |
| + |
| + // Sets whether or not this stream should be muted. |
| + virtual void SetMuted(bool muted) = 0; |
| }; |
| enum State { |
| @@ -169,6 +182,15 @@ class StreamMixerAlsa { |
| void RemoveLoopbackAudioObserver( |
| CastMediaShlib::LoopbackAudioObserver* observer); |
| + // Sets the volume multiplier for the given content |type|. |
| + void SetVolume(AudioContentType type, float level); |
| + |
| + // Sets the mute state for the given content |type|. |
| + void SetMuted(AudioContentType type, bool muted); |
| + |
| + // Sets the volume multiplier limit for the given content |type|. |
| + void SetOutputLimit(AudioContentType type, float limit); |
| + |
| protected: |
| StreamMixerAlsa(); |
| virtual ~StreamMixerAlsa(); |
| @@ -232,7 +254,6 @@ class StreamMixerAlsa { |
| // only has to interact with the command line parameters once. |
| std::string alsa_device_name_; |
| snd_pcm_uframes_t alsa_buffer_size_; |
| - bool alsa_period_explicitly_set; |
| snd_pcm_uframes_t alsa_period_size_; |
| snd_pcm_uframes_t alsa_start_threshold_; |
| snd_pcm_uframes_t alsa_avail_min_; |
| @@ -251,6 +272,10 @@ class StreamMixerAlsa { |
| std::vector<std::unique_ptr<FilterGroup>> filter_groups_; |
| std::vector<CastMediaShlib::LoopbackAudioObserver*> loopback_observers_; |
| + std::map<AudioContentType, float> volume_; |
|
slan
2017/03/13 22:09:51
Why not std::unordered_map?
I think that Chrome a
kmackay
2017/03/14 00:21:00
The comment in https://cs.chromium.org/chromium/sr
slan
2017/03/14 17:21:28
Acknowledged.
|
| + std::map<AudioContentType, float> volume_limit_; |
| + std::map<AudioContentType, bool> muted_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(StreamMixerAlsa); |
| }; |