Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(349)

Unified Diff: media/base/mediaplayer_observer.h

Issue 2204673004: WIP - WebMediaPlayer switch media renderer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_

Powered by Google App Engine
This is Rietveld 408576698