Index: media/base/mediaplayer_observer.h |
diff --git a/media/base/mediaplayer_observer.h b/media/base/mediaplayer_observer.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e9667df52137ae1f5ff990bfdf773d6328ef18dc |
--- /dev/null |
+++ b/media/base/mediaplayer_observer.h |
@@ -0,0 +1,44 @@ |
+// Copyright 2016 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 MEDIA_BASE_MEDIAPLAYER_OBSERVER_H_ |
+#define MEDIA_BASE_MEDIAPLAYER_OBSERVER_H_ |
+ |
+#include "base/callback.h" |
+#include "media/base/audio_decoder_config.h" |
+#include "media/base/cdm_context.h" |
+#include "media/base/video_decoder_config.h" |
+ |
+namespace media { |
+ |
+// This class is an observer of a media player and can trigger a pipeline |
+// restart (suspend/resume) to switch renderer if the callback is set. |
+class MediaPlayerObserver { |
+ public: |
+ MediaPlayerObserver(); |
+ virtual ~MediaPlayerObserver(); |
+ |
+ // Called when the media element or its ancestor is entered/exited fullscreen. |
+ virtual void OnEnteredFullscreen() = 0; |
+ virtual void OnExitedFullscreen() = 0; |
+ |
+ // Called when CDM is attached to a media element. |
+ virtual void OnSetCdm(CdmContext* cdm_context) = 0; |
+ |
+ // Set video/audio config after demuxer is initialized. |
+ virtual void OnDecoderConfigChanged( |
+ const AudioDecoderConfig& audio_config, |
+ const VideoDecoderConfig& video_config) = 0; |
+ |
+ // Set the callback to schedule restart of pipeline to switch renderer. |
+ using SwitchRendererCallback = base::Callback<void()>; |
+ virtual void SetSwitchRenderCallback(const SwitchRendererCallback& cb) = 0; |
miu
2016/09/30 08:12:10
Hmm...Everything except this looks like an "observ
xjz
2016/10/01 00:28:41
Done.
|
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(MediaPlayerObserver); |
miu
2016/09/30 08:12:10
This doesn't belong in a pure virtual interface, s
xjz
2016/10/01 00:28:41
Removed.
|
+}; |
+ |
+} // namespace media |
+ |
+#endif // MEDIA_BASE_MEDIAPLAYER_OBSERVER_H_ |