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 #include "webrtc/engine_configurations.h"
12 #if defined(CARBON_RENDERING)
13 
14 #ifndef WEBRTC_MODULES_VIDEO_RENDER_MAIN_SOURCE_MAC_VIDEO_RENDER_MAC_CARBON_IMPL_H_
15 #define WEBRTC_MODULES_VIDEO_RENDER_MAIN_SOURCE_MAC_VIDEO_RENDER_MAC_CARBON_IMPL_H_
16 
17 #include "webrtc/modules/video_render/i_video_render.h"
18 
19 namespace webrtc {
20 
21 class CriticalSectionWrapper;
22 class VideoRenderAGL;
23 
24 // Class definitions
25 class VideoRenderMacCarbonImpl : IVideoRender
26 {
27 public:
28     /*
29      *   Constructor/destructor
30      */
31 
32     VideoRenderMacCarbonImpl(const int32_t id,
33             const VideoRenderType videoRenderType,
34             void* window,
35             const bool fullscreen);
36 
37     virtual ~VideoRenderMacCarbonImpl();
38 
39     virtual int32_t Init();
40 
41     virtual int32_t ChangeWindow(void* window);
42 
43     /**************************************************************************
44      *
45      *   Incoming Streams
46      *
47      ***************************************************************************/
48     virtual VideoRenderCallback* AddIncomingRenderStream(const uint32_t streamId,
49             const uint32_t zOrder,
50             const float left,
51             const float top,
52             const float right,
53             const float bottom);
54 
55     virtual int32_t DeleteIncomingRenderStream(const uint32_t streamId);
56 
57     virtual int32_t GetIncomingRenderStreamProperties(const uint32_t streamId,
58                                                       uint32_t& zOrder,
59                                                       float& left,
60                                                       float& top,
61                                                       float& right,
62                                                       float& bottom) const;
63 
64     /**************************************************************************
65      *
66      *   Start/Stop
67      *
68      ***************************************************************************/
69 
70     virtual int32_t StartRender();
71 
72     virtual int32_t StopRender();
73 
74     /**************************************************************************
75      *
76      *   Properties
77      *
78      ***************************************************************************/
79 
80     virtual VideoRenderType RenderType();
81 
82     virtual RawVideoType PerferedVideoType();
83 
84     virtual bool FullScreen();
85 
86     virtual int32_t GetGraphicsMemory(uint64_t& totalGraphicsMemory,
87             uint64_t& availableGraphicsMemory) const;
88 
89     virtual int32_t GetScreenResolution(uint32_t& screenWidth,
90             uint32_t& screenHeight) const;
91 
92     virtual uint32_t RenderFrameRate(const uint32_t streamId);
93 
94     virtual int32_t SetStreamCropping(const uint32_t streamId,
95             const float left,
96             const float top,
97             const float right,
98             const float bottom);
99 
100     virtual int32_t ConfigureRenderer(const uint32_t streamId,
101             const unsigned int zOrder,
102             const float left,
103             const float top,
104             const float right,
105             const float bottom);
106 
107     virtual int32_t SetTransparentBackground(const bool enable);
108 
109     virtual int32_t SetText(const uint8_t textId,
110             const uint8_t* text,
111             const int32_t textLength,
112             const uint32_t textColorRef,
113             const uint32_t backgroundColorRef,
114             const float left,
115             const float top,
116             const float right,
117             const float bottom);
118 
119     virtual int32_t SetBitmap(const void* bitMap,
120             const uint8_t pictureId,
121             const void* colorKey,
122             const float left,
123             const float top,
124             const float right,
125             const float bottom);
126 
FullScreenRender(void * window,const bool enable)127     virtual int32_t FullScreenRender(void* window, const bool enable)
128     {
129         // not supported in Carbon at this time
130         return -1;
131     }
132 
133 private:
134     int32_t _id;
135     CriticalSectionWrapper& _renderMacCarbonCritsect;
136     bool _fullScreen;
137     void* _ptrWindow;
138     VideoRenderAGL* _ptrCarbonRender;
139 
140 };
141 
142 
143 }  // namespace webrtc
144 
145 #endif  // WEBRTC_MODULES_VIDEO_RENDER_MAIN_SOURCE_MAC_VIDEO_RENDER_MAC_CARBON_IMPL_H_
146 #endif // CARBON_RENDERING
147