OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROMECAST_MEDIA_AUDIO_CAST_AUDIO_MANAGER_H_ |
| 6 #define CHROMECAST_MEDIA_AUDIO_CAST_AUDIO_MANAGER_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/macros.h" |
| 12 #include "base/memory/linked_ptr.h" |
| 13 #include "media/audio/audio_manager_base.h" |
| 14 |
| 15 namespace media { |
| 16 class AudioLogFactory; |
| 17 } |
| 18 |
| 19 namespace chromecast { |
| 20 namespace media { |
| 21 |
| 22 class CastAudioOutputDevice; |
| 23 class ChromecastDeviceAudioOutputStream; |
| 24 |
| 25 // This class acts as a proxy for chromecast::CastAudioOutputDevice, |
| 26 // converting external-facing chromecast interfaces and data structures to |
| 27 // those expected by ::media::AudioManager. |
| 28 class CastAudioManager : public ::media::AudioManagerBase { |
| 29 public: |
| 30 // This class does not take ownership of |audio_output_device|, which must be |
| 31 // non-null and which must outlive this class. All calls to CreateAudioLog() |
| 32 // will be forwarded to |audio_log_factory|, which also must outlive this |
| 33 // class. |
| 34 CastAudioManager(::media::AudioLogFactory* audio_log_factory, |
| 35 CastAudioOutputDevice* audio_output_device); |
| 36 ~CastAudioManager() override; |
| 37 |
| 38 // ::media::AudioManager implementation: |
| 39 bool HasAudioOutputDevices() override; |
| 40 bool HasAudioInputDevices() override; |
| 41 void ShowAudioInputSettings() override; |
| 42 void GetAudioInputDeviceNames( |
| 43 ::media::AudioDeviceNames* device_names) override; |
| 44 ::media::AudioParameters GetInputStreamParameters( |
| 45 const std::string& device_id) override; |
| 46 |
| 47 // ::media::AudioManagerBase implementation: |
| 48 ::media::AudioParameters GetPreferredOutputStreamParameters( |
| 49 const std::string& output_device_id, |
| 50 const ::media::AudioParameters& input_params) override; |
| 51 ::media::AudioOutputStream* MakeLinearOutputStream( |
| 52 const ::media::AudioParameters& params) override; |
| 53 ::media::AudioOutputStream* MakeLowLatencyOutputStream( |
| 54 const ::media::AudioParameters& params, |
| 55 const std::string& device_id) override; |
| 56 ::media::AudioInputStream* MakeLinearInputStream( |
| 57 const ::media::AudioParameters& params, |
| 58 const std::string& device_id) override; |
| 59 ::media::AudioInputStream* MakeLowLatencyInputStream( |
| 60 const ::media::AudioParameters& params, |
| 61 const std::string& device_id) override; |
| 62 |
| 63 // Get the CastAudioOutputDevice for testing. |
| 64 CastAudioOutputDevice* GetAudioOutputDeviceForTesting() const { |
| 65 return audio_output_device_; |
| 66 } |
| 67 |
| 68 private: |
| 69 // Host a ::media::AudioOutputStream interface which wraps a |
| 70 // chromecast::AudioOutputStream. |
| 71 ::media::AudioOutputStream* MakeCastOutputStream( |
| 72 const ::media::AudioParameters& params); |
| 73 |
| 74 // The underlying audio output device. |
| 75 CastAudioOutputDevice* const audio_output_device_; |
| 76 |
| 77 DISALLOW_COPY_AND_ASSIGN(CastAudioManager); |
| 78 }; |
| 79 |
| 80 } // namespace media |
| 81 } // namespace chromecast |
| 82 |
| 83 #endif // CHROMECAST_MEDIA_AUDIO_CAST_AUDIO_MANAGER_H_ |
OLD | NEW |