summaryrefslogtreecommitdiff
path: root/chromium/media/remoting/interstitial.h
blob: 0703480d58a236392768ccf263630ee228f7dbd4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// 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_REMOTING_INTERSTITIAL_H_
#define MEDIA_REMOTING_INTERSTITIAL_H_

#include "base/memory/ref_counted.h"

class SkBitmap;

namespace gfx {
class Size;
}

namespace media {

class VideoFrame;

namespace remoting {

enum InterstitialType {
  BETWEEN_SESSIONS,             // Show background image only.
  IN_SESSION,                   // Show MEDIA_REMOTING_CASTING_VIDEO_TEXT.
  ENCRYPTED_MEDIA_FATAL_ERROR,  // Show MEDIA_REMOTING_CAST_ERROR_TEXT.
};

// Render an interstitial frame--a combination of |image| in the background
// along with a text message describing what is going on--and return it in a
// VideoFrame. |image| may be scaled accordingly without changing its aspect
// ratio. When it has a different aspect ratio than |natural_size|, a scaled
// |background_image| will be centered in the frame. When |image| is empty, a
// blank black background will be used.
//
// Threading note: This *must* be called on the main thread, because it uses
// Skia's font rendering facility, which loads/caches fonts on the main thread.
// http://crbug.com/687473.
scoped_refptr<VideoFrame> RenderInterstitialFrame(const SkBitmap& image,
                                                  const gfx::Size& natural_size,
                                                  InterstitialType type);

}  // namespace remoting
}  // namespace media

#endif  // MEDIA_REMOTING_INTERSTITIAL_H_