Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(601)

Unified Diff: chromecast/media/audio/cast_audio_manager.h

Issue 1105803002: Exposes a shlib interface for media/audio path. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chromecast/media/audio/cast_audio_manager.h
diff --git a/chromecast/media/audio/cast_audio_manager.h b/chromecast/media/audio/cast_audio_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..d44f89be92d2045e61deeff374c9e31883be4306
--- /dev/null
+++ b/chromecast/media/audio/cast_audio_manager.h
@@ -0,0 +1,73 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROMECAST_MEDIA_AUDIO_CAST_AUDIO_MANAGER_H_
+#define CHROMECAST_MEDIA_AUDIO_CAST_AUDIO_MANAGER_H_
+
+#include <string>
+#include <vector>
+#include "base/macros.h"
lcwu1 2015/04/24 02:18:24 Keep a vertical space between C++ system headers a
slan 2015/04/24 05:34:26 Done.
+#include "base/memory/linked_ptr.h"
+#include "media/audio/audio_manager_base.h"
+
+namespace chromecast {
+class CastAudioStreamProvider;
+}
+
+namespace media {
lcwu1 2015/04/24 02:18:24 Any reason why you want this to be outside of chro
slan 2015/04/24 05:34:26 I did this to add readability and avoid name colli
+
+class AudioLogFactory;
+class CastAudioOutputStream;
+
+class MEDIA_EXPORT CastAudioManager : public AudioManagerBase {
+ public:
+ // This class acts as a proxy for chromecast::CastAudioStreamProvider,
+ // converting external-facing chromecast interfces and data structures to
+ // those expected by media::AudioManager. It does not take ownership of
+ // |audio_stream_provider|, which must be non-null and which must outlive
+ // this class. All calls to CreateAudioLog() will be forwarded to
+ // |audio_log_factory|, which also must outlive this class.
+ CastAudioManager(AudioLogFactory* audio_log_factory,
+ chromecast::CastAudioStreamProvider* audio_stream_provider);
+ ~CastAudioManager() override;
+
+ // AudioManager overrides.
lcwu1 2015/04/24 02:18:24 Our convention is to use // AudioManager implemen
slan 2015/04/24 05:34:26 Done.
+ bool HasAudioOutputDevices() override;
+ bool HasAudioInputDevices() override;
+ void ShowAudioInputSettings() override;
+ void GetAudioInputDeviceNames(AudioDeviceNames* device_names) override;
+ AudioParameters GetInputStreamParameters(
+ const std::string& device_id) override;
+
+ // AudioManagerBase overrides.
+ AudioParameters GetPreferredOutputStreamParameters(
+ const std::string& output_device_id,
+ const AudioParameters& input_params) override;
+ AudioOutputStream* MakeLinearOutputStream(
+ const AudioParameters& params) override;
+ AudioOutputStream* MakeLowLatencyOutputStream(
+ const AudioParameters& params,
+ const std::string& device_id) override;
+ AudioInputStream* MakeLinearInputStream(
+ const AudioParameters& params,
+ const std::string& device_id) override;
+ AudioInputStream* MakeLowLatencyInputStream(
+ const AudioParameters& params,
+ const std::string& device_id) override;
+
+ private:
+ // Host a media::AudioOutputStream interface which wraps a
+ // chromecast::AudioOutputStream.
+ AudioOutputStream* MakeCastOutputStream(const AudioParameters& params);
+
+ // Bindings between media and chromecast audio streams.
+ std::vector<linked_ptr<CastAudioOutputStream>> streams_;
+ chromecast::CastAudioStreamProvider* audio_stream_provider_;
+
+ DISALLOW_COPY_AND_ASSIGN(CastAudioManager);
+};
+
+} // namespace media
+
+#endif // CHROMECAST_MEDIA_AUDIO_CAST_AUDIO_MANAGER_H_

Powered by Google App Engine
This is Rietveld 408576698