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..50af12e260c4348e8d424c133fa7f60b2b446a43 100644 |
--- a/chromecast/media/base/cast_media_default.cc |
+++ b/chromecast/media/base/cast_media_default.cc |
@@ -4,6 +4,7 @@ |
#include "chromecast/public/cast_media_shlib.h" |
#include "chromecast/public/graphics_types.h" |
+#include "chromecast/public/media/cast_audio_output_device.h" |
#include "chromecast/public/video_plane.h" |
namespace chromecast { |
@@ -25,7 +26,45 @@ class DefaultVideoPlane : public VideoPlane { |
void OnScreenResolutionChanged(const Size& screen_res) override {} |
}; |
+class DefaultCastAudioOutputDevice : public CastAudioOutputDevice { |
+ public: |
+ DefaultCastAudioOutputDevice() {} |
+ ~DefaultCastAudioOutputDevice() override {} |
+ |
+ int GetMaximumOutputStreamsAllowed() override { return 0; } |
+ |
+ AudioParameters GetPreferredOutputStreamParameters( |
+ const AudioParameters& suggested) override { |
+ return AudioParameters(); |
+ } |
+ |
+ CastAudioOutputStream* MakeOutputStream(const AudioParameters& params, |
+ 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: |
+ AudioParameters GetParameters() 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 +75,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 |