Index: chromecast/media/audio/cast_audio_output_stream.h |
diff --git a/chromecast/media/audio/cast_audio_output_stream.h b/chromecast/media/audio/cast_audio_output_stream.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..7fbe793026f38c8dec381c62a203e39501cb832c |
--- /dev/null |
+++ b/chromecast/media/audio/cast_audio_output_stream.h |
@@ -0,0 +1,55 @@ |
+// 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_OUTPUT_STREAM_H_ |
+#define CHROMECAST_MEDIA_AUDIO_CAST_AUDIO_OUTPUT_STREAM_H_ |
+ |
+#include "chromecast/public/cast_audio_stream.h" |
+#include "media/audio/audio_io.h" |
+#include "media/audio/audio_manager.h" |
+#include "media/base/media_export.h" |
+ |
+namespace chromecast { |
+struct AudioParameters; |
+} |
+ |
+namespace media { |
+ |
+// This class translates between media:: and chromecast:: interfaces. |
+class CastAudioOutputStream |
+ : public media::AudioOutputStream, |
+ public chromecast::AudioOutputStream::AudioSourceCallback { |
+ public: |
+ CastAudioOutputStream(chromecast::AudioOutputStream* output_stream, |
+ const chromecast::AudioParameters& params); |
+ ~CastAudioOutputStream() override; |
+ |
+ // media::AudioOutputStream overrides. |
+ 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 overrides. |
+ int OnMoreData(void* dest, |
+ uint32_t len, |
+ int32_t frames, |
+ uint32_t total_bytes_delay) override; |
+ void OnError(chromecast::AudioOutputStream* stream) override; |
+ void OnClose() override; |
+ |
+ private: |
+ // Calls to media::AudioOutputStream overrides will be forwarded here. |
+ chromecast::AudioOutputStream* output_stream_; |
+ chromecast::AudioParameters params_; |
+ |
+ // Calls to chromecast::AudioSourceCallback overrides will be forwarded here. |
+ media::AudioOutputStream::AudioSourceCallback* callback_; |
+}; |
+ |
+} // namespace media |
+ |
+#endif // CHROMECAST_MEDIA_AUDIO_CAST_AUDIO_OUTPUT_STREAM_H_ |