Index: media/filters/remoting_controller.h |
diff --git a/media/filters/remoting_controller.h b/media/filters/remoting_controller.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..1972b8e441fd32aecad161910d2dd32358eb167a |
--- /dev/null |
+++ b/media/filters/remoting_controller.h |
@@ -0,0 +1,70 @@ |
+// 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_FILTERS_REMOTING_CONTROLLER_H_ |
+#define MEDIA_FILTERS_REMOTING_CONTROLLER_H_ |
+ |
+// This class does the following: |
+// 1) Receive notification from Remoter; |
+// 3) Make decision and notify the WebMediaPlayerImpl when to switch the |
+// media renderer. |
+// |
+// It is own by media::PipelineController, and may be created in two places: |
+// 1) In CdmSessionAdapter::CreateCdm(). Its ownership is passed to |
+// media::PopelineController later. |
+// TODO(xjz): The implementation for encrypted content case will be added in a |
+// soon-upcoming change. |
+// 2) In media::PipelineController if is not created before. |
+// |
+// TODO(xjz): Mojo service bindings will be added in a soon-upcoming change. |
+namespace media { |
+ |
+class PipelineController; |
+ |
+class RemotingController { |
+ public: |
+ RemotingController(); |
+ // |pipeline_controller| outlives this class. |
+ explicit RemotingController(PipelineController* pipeline_controller); |
+ ~RemotingController(); |
+ |
+ // Notification of the remoting sink availability from Remoter. |
+ void OnSinkAvailable(); |
+ void OnSinkGone(); |
+ |
+ // Setters. |
+ void SetFullscreenMode(bool is_fullscreen); |
+ void SetIsEncryptedContent(); |
+ void SetPipelineController(PipelineController* pipeline_controller); |
+ |
+ // Starts/Stops remoting according to |use_remoting_renderer_|, and returns |
+ // whether to use remoting renderer. This is used to tell PipelineController |
+ // which renderer should be used. |
+ bool ShouldUseRemotingRenderer(); |
+ |
+ private: |
+ bool isVideoDecoderSupported(); |
+ bool isAudioDecoderSupported(); |
+ |
+ // Makes decision on which renderer should be used. |
+ void Update(); |
+ |
+ // Indicates whether this media element or its ancestor enters full screen. |
+ bool is_fullscreen_; |
+ |
+ // Indicates whether WebMediaPlayerImpl encounters encrypted content. |
+ bool is_encrypted_content_; |
+ |
+ // Indicates the remoting sink availablity. |
+ bool is_sink_available_; |
+ |
+ // Indicates whether we should use remoting renderer. |
+ bool use_remoting_renderer_; |
+ |
+ PipelineController* pipeline_controller_; |
+}; |
+ |
+} // namespace media |
+ |
+#endif // MEDIA_FILTERS_REMOTING_CONTROLLER_H_ |