1 /*
2  *  Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 #ifndef WEBRTC_MODULES_VIDEO_RENDER_MAIN_SOURCE_I_VIDEO_RENDER_H_
12 #define WEBRTC_MODULES_VIDEO_RENDER_MAIN_SOURCE_I_VIDEO_RENDER_H_
13 
14 #include "webrtc/modules/video_render/video_render.h"
15 
16 namespace webrtc {
17 
18 // Class definitions
19 class IVideoRender
20 {
21 public:
22     /*
23      *   Constructor/destructor
24      */
25 
~IVideoRender()26     virtual ~IVideoRender() {}
27 
28     virtual int32_t Init() = 0;
29 
30     virtual int32_t ChangeWindow(void* window) = 0;
31 
32     /**************************************************************************
33      *
34      *   Incoming Streams
35      *
36      ***************************************************************************/
37 
38     virtual VideoRenderCallback
39             * AddIncomingRenderStream(const uint32_t streamId,
40                                       const uint32_t zOrder,
41                                       const float left,
42                                       const float top,
43                                       const float right,
44                                       const float bottom) = 0;
45 
46     virtual int32_t
47             DeleteIncomingRenderStream(const uint32_t streamId) = 0;
48 
49     virtual int32_t
50             GetIncomingRenderStreamProperties(const uint32_t streamId,
51                                               uint32_t& zOrder,
52                                               float& left,
53                                               float& top,
54                                               float& right,
55                                               float& bottom) const = 0;
56     // Implemented in common code?
57     //virtual uint32_t GetNumIncomingRenderStreams() const = 0;
58     //virtual bool HasIncomingRenderStream(const uint16_t stramId) const = 0;
59 
60 
61     /**************************************************************************
62      *
63      *   Start/Stop
64      *
65      ***************************************************************************/
66 
67     virtual int32_t StartRender() = 0;
68 
69     virtual int32_t StopRender() = 0;
70 
71     /**************************************************************************
72      *
73      *   Properties
74      *
75      ***************************************************************************/
76     virtual VideoRenderType RenderType() = 0;
77 
78     virtual RawVideoType PerferedVideoType() = 0;
79 
80     virtual bool FullScreen() = 0;
81 
82     // TODO: This should be treated in platform specific code only
83     virtual int32_t
84             GetGraphicsMemory(uint64_t& totalGraphicsMemory,
85                               uint64_t& availableGraphicsMemory) const = 0;
86 
87     virtual int32_t
88             GetScreenResolution(uint32_t& screenWidth,
89                                 uint32_t& screenHeight) const = 0;
90 
91     virtual uint32_t RenderFrameRate(const uint32_t streamId) = 0;
92 
93     virtual int32_t SetStreamCropping(const uint32_t streamId,
94                                       const float left,
95                                       const float top,
96                                       const float right,
97                                       const float bottom) = 0;
98 
99     virtual int32_t ConfigureRenderer(const uint32_t streamId,
100                                       const unsigned int zOrder,
101                                       const float left,
102                                       const float top,
103                                       const float right,
104                                       const float bottom) = 0;
105 
106     virtual int32_t SetTransparentBackground(const bool enable) = 0;
107 
108     virtual int32_t SetText(const uint8_t textId,
109                             const uint8_t* text,
110                             const int32_t textLength,
111                             const uint32_t textColorRef,
112                             const uint32_t backgroundColorRef,
113                             const float left,
114                             const float top,
115                             const float rigth,
116                             const float bottom) = 0;
117 
118     virtual int32_t SetBitmap(const void* bitMap,
119                               const uint8_t pictureId,
120                               const void* colorKey,
121                               const float left,
122                               const float top,
123                               const float right,
124                               const float bottom) = 0;
125 
126 };
127 }  // namespace webrtc
128 
129 #endif  // WEBRTC_MODULES_VIDEO_RENDER_MAIN_SOURCE_I_VIDEO_RENDER_H_
130