Index: chromecast/media/base/cast_media_default.cc |
diff --git a/chromecast/media/base/cast_media_default.cc b/chromecast/media/base/cast_media_default.cc |
index 0c177126ad6b3c9679001e20d3692bac941821b8..6614395082a79fc17e712457a6a1b9948e9c48b0 100644 |
--- a/chromecast/media/base/cast_media_default.cc |
+++ b/chromecast/media/base/cast_media_default.cc |
@@ -2,6 +2,7 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
+#include "chromecast/public/cast_audio_output_device.h" |
#include "chromecast/public/cast_media_shlib.h" |
#include "chromecast/public/graphics_types.h" |
#include "chromecast/public/video_plane.h" |
@@ -25,7 +26,46 @@ class DefaultVideoPlane : public VideoPlane { |
void OnScreenResolutionChanged(const Size& screen_res) override {} |
}; |
+class DefaultCastAudioOutputDevice : public CastAudioOutputDevice { |
+ public: |
+ DefaultCastAudioOutputDevice() {} |
+ ~DefaultCastAudioOutputDevice() override {} |
+ |
+ int GetMaximumOutputStreamsAllowed() const override { return 0; } |
+ |
+ AudioParameters GetPreferredOutputStreamParameters( |
+ const AudioParameters& suggested) const override { |
+ return AudioParameters(); |
+ } |
+ |
+ CastAudioOutputStream* MakeOutputStream( |
+ const AudioParameters& params, |
+ chromecast::TaskRunner* task_runner) override { |
+ return nullptr; // No streams allowed, always return nullptr |
+ } |
+}; |
+ |
+class DefaultCastAudioOutputStream : public CastAudioOutputStream { |
+ public: |
+ explicit DefaultCastAudioOutputStream(const AudioParameters& params) |
+ : params_(params) {} |
+ ~DefaultCastAudioOutputStream() override {} |
+ |
+ // CastAudioOutputStream implementation: |
+ const AudioParameters GetParameters() const override { return params_; } |
+ bool Open() override { return false; } |
+ void Start(AudioSourceCallback* callback) override {} |
+ void Stop() override {} |
+ void SetVolume(double volume) override {} |
+ double GetVolume() override { return 0.0; } |
+ void Close() override {} |
+ |
+ private: |
+ AudioParameters params_; |
+}; |
+ |
DefaultVideoPlane* g_video_plane = nullptr; |
+DefaultCastAudioOutputDevice* g_audio_output_device = nullptr; |
} // namespace |
@@ -36,11 +76,22 @@ void CastMediaShlib::Initialize(const std::vector<std::string>& argv) { |
void CastMediaShlib::Finalize() { |
delete g_video_plane; |
g_video_plane = nullptr; |
+ |
+ if (g_audio_output_device) { |
+ delete g_audio_output_device; |
+ g_audio_output_device = nullptr; |
+ } |
} |
VideoPlane* CastMediaShlib::GetVideoPlane() { |
return g_video_plane; |
} |
+CastAudioOutputDevice* CastMediaShlib::GetAudioOutputDevice() { |
+ if (!g_audio_output_device) |
+ g_audio_output_device = new DefaultCastAudioOutputDevice(); |
+ return g_audio_output_device; |
+} |
+ |
} // namespace media |
} // namespace chromecast |