OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MEDIA_REMOTING_REMOTING_INTERSTITIAL_UI_H_ | 5 #ifndef MEDIA_REMOTING_REMOTING_INTERSTITIAL_UI_H_ |
6 #define MEDIA_REMOTING_REMOTING_INTERSTITIAL_UI_H_ | 6 #define MEDIA_REMOTING_REMOTING_INTERSTITIAL_UI_H_ |
7 | 7 |
8 #include "base/callback.h" | |
9 #include "base/memory/ref_counted.h" | |
10 #include "media/base/pipeline_metadata.h" | |
11 #include "third_party/skia/include/core/SkBitmap.h" | 8 #include "third_party/skia/include/core/SkBitmap.h" |
12 | 9 |
| 10 namespace gfx { |
| 11 class Size; |
| 12 } |
| 13 |
13 namespace media { | 14 namespace media { |
14 | 15 |
15 class VideoFrame; | |
16 class VideoRendererSink; | 16 class VideoRendererSink; |
17 | 17 |
18 class RemotingInterstitialUI { | 18 enum RemotingInterstitialType { |
19 public: | 19 BETWEEN_SESSIONS, // Show background image only. |
20 RemotingInterstitialUI(VideoRendererSink* video_renderer_sink, | 20 IN_SESSION, // Show MEDIA_REMOTING_CASTING_VIDEO_TEXT. |
21 const PipelineMetadata& pipeline_metadata); | 21 ENCRYPTED_MEDIA_FATAL_ERROR, // Show MEDIA_REMOTING_CAST_ERROR_TEXT. |
22 ~RemotingInterstitialUI(); | 22 }; |
23 | 23 |
24 void ShowInterstitial(bool is_remoting_successful); | 24 // Paint an interstitial frame and send it to the given VideoRendererSink. |
25 | 25 // |background_image| will be scaled to fit in |canvas_size|, but keep its |
26 private: | 26 // aspect ratio. When has different aspect ratio with |canvas_size|, scaled |
27 // Gets an 'interstitial' VideoFrame to paint on the media player when the | 27 // |background_image| will be centered in the canvas. When |background_image| |
28 // video is being played remotely. | 28 // is empty, interstitial will be drawn on a blank and black background. When |
29 scoped_refptr<VideoFrame> GetInterstitial(const SkBitmap& background_image, | 29 // |interstial_type| is BETWEEN_SESSIONS, show background image only. |
30 bool is_remoting_successful); | 30 void PaintRemotingInterstitial(const SkBitmap& background_image, |
31 | 31 const gfx::Size& canvas_size, |
32 VideoRendererSink* const video_renderer_sink_; // Outlives this class. | 32 RemotingInterstitialType interstitial_type, |
33 PipelineMetadata pipeline_metadata_; | 33 VideoRendererSink* video_renderer_sink); |
34 | |
35 DISALLOW_COPY_AND_ASSIGN(RemotingInterstitialUI); | |
36 }; | |
37 | 34 |
38 } // namespace media | 35 } // namespace media |
39 | 36 |
40 #endif // MEDIA_REMOTING_REMOTING_INTERSTITIAL_UI_H_ | 37 #endif // MEDIA_REMOTING_REMOTING_INTERSTITIAL_UI_H_ |
OLD | NEW |