Index: chromecast/media/audio/chromecast_device_audio_output_stream.h |
diff --git a/chromecast/media/audio/chromecast_device_audio_output_stream.h b/chromecast/media/audio/chromecast_device_audio_output_stream.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..2986f256788702949ee45a592b93a543fdc46e7b |
--- /dev/null |
+++ b/chromecast/media/audio/chromecast_device_audio_output_stream.h |
@@ -0,0 +1,71 @@ |
+// 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_CHROMECAST_DEVICE_AUDIO_OUTPUT_STREAM_H_ |
+#define CHROMECAST_MEDIA_AUDIO_CHROMECAST_DEVICE_AUDIO_OUTPUT_STREAM_H_ |
+ |
+#include "base/macros.h" |
+#include "chromecast/media/audio/cast_audio_manager.h" |
+#include "chromecast/public/media/cast_audio_output_stream.h" |
+#include "media/audio/audio_io.h" |
+#include "media/base/media_export.h" |
+ |
+namespace chromecast { |
+namespace media { |
+ |
+struct AudioParameters; |
+ |
+// An implementation of ::media::AudioOutputStream for any Chromecast device. |
+// This passes control requests and data to an instance of the platform- |
+// independent chromecast::CastAudioOutputStream interface. |
+class ChromecastDeviceAudioOutputStream |
+ : private CastAudioOutputStream::AudioSourceCallback, |
+ public ::media::AudioOutputStream { |
+ public: |
+ // |output_stream| is provided and owned by the global instance of |
+ // CastAudioOutputDevice. This class does not take ownership. This |
+ // implementation currently supports the following types for audio samples: |
+ // uint8_t, int16_t, int32_t |
+ // |params|.bits_per_sample must hold 8, 16, or 32, respectively. |
+ ChromecastDeviceAudioOutputStream(CastAudioOutputStream* output_stream, |
+ const AudioParameters& params, |
+ CastAudioManager* manager); |
+ ~ChromecastDeviceAudioOutputStream() override; |
+ |
+ // ::media::AudioOutputStream implementation: |
+ bool Open() override; |
+ void Start( |
+ ::media::AudioOutputStream::AudioSourceCallback* callback) override; |
+ void Stop() override; |
+ void SetVolume(double volume) override; |
+ void GetVolume(double* volume) override; |
+ void Close() override; |
+ |
+ // chromecast::AudioSourceCallback implementation: |
+ int GetMoreData(void* dest, |
+ uint32_t len, |
+ int32_t frames, |
+ uint32_t total_bytes_delay) override; |
+ void OnError(CastAudioOutputStream* stream) override; |
+ |
+ private: |
+ // Calls to ::media::AudioOutputStream interface will be forwarded here. |
+ CastAudioOutputStream* output_stream_; |
+ |
+ // Calls to chromecast::AudioSourceCallback interface will be forwarded here. |
+ ::media::AudioOutputStream::AudioSourceCallback* callback_; |
+ |
+ // The parameters describing the stream. |
+ const AudioParameters params_; |
+ |
+ // The manager that owns this stream. Alert |manager_| when |this| closes. |
+ CastAudioManager* audio_manager_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ChromecastDeviceAudioOutputStream); |
+}; |
+ |
+} // namespace media |
+} // namespace chromecast |
+ |
+#endif // CHROMECAST_MEDIA_AUDIO_CHROMECAST_DEVICE_AUDIO_OUTPUT_STREAM_H_ |