Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Side by Side Diff: webrtc/modules/video_render/mac/video_render_mac_cocoa_impl.mm

Issue 1929223003: Reland of Delete video_render module. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2012 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(COCOA_RENDERING)
13
14 #include "webrtc/modules/video_render/mac/cocoa_render_view.h"
15 #include "webrtc/modules/video_render/mac/video_render_mac_cocoa_impl.h"
16 #include "webrtc/modules/video_render/mac/video_render_nsopengl.h"
17 #include "webrtc/system_wrappers/include/critical_section_wrapper.h"
18 #include "webrtc/system_wrappers/include/trace.h"
19
20 namespace webrtc {
21
22 VideoRenderMacCocoaImpl::VideoRenderMacCocoaImpl(const int32_t id,
23 const VideoRenderType videoRenderType,
24 void* window,
25 const bool fullscreen) :
26 _id(id),
27 _renderMacCocoaCritsect(*CriticalSectionWrapper::CreateCriticalSection()),
28 _fullScreen(fullscreen),
29 _ptrWindow(window)
30 {
31
32 WEBRTC_TRACE(kTraceInfo, kTraceVideoRenderer, _id, "Constructor %s:%d", __FU NCTION__, __LINE__);
33 }
34
35 VideoRenderMacCocoaImpl::~VideoRenderMacCocoaImpl()
36 {
37 WEBRTC_TRACE(kTraceInfo, kTraceVideoRenderer, _id, "Destructor %s:%d", __FUN CTION__, __LINE__);
38 delete &_renderMacCocoaCritsect;
39 if (_ptrCocoaRender)
40 {
41 delete _ptrCocoaRender;
42 _ptrCocoaRender = NULL;
43 }
44 }
45
46 int32_t
47 VideoRenderMacCocoaImpl::Init()
48 {
49
50 CriticalSectionScoped cs(&_renderMacCocoaCritsect);
51 WEBRTC_TRACE(kTraceInfo, kTraceVideoRenderer, _id, "%s:%d", __FUNCTION__, __ LINE__);
52
53 // cast ptrWindow from void* to CocoaRenderer. Void* was once NSOpenGLView, and CocoaRenderer is NSOpenGLView.
54 _ptrCocoaRender = new VideoRenderNSOpenGL((CocoaRenderView*)_ptrWindow, _ful lScreen, _id);
55 if (!_ptrWindow)
56 {
57 WEBRTC_TRACE(kTraceWarning, kTraceVideoRenderer, _id, "Constructor %s:%d ", __FUNCTION__, __LINE__);
58 return -1;
59 }
60 int retVal = _ptrCocoaRender->Init();
61 if (retVal == -1)
62 {
63 WEBRTC_TRACE(kTraceInfo, kTraceVideoRenderer, _id, "Failed to init %s:%d ", __FUNCTION__, __LINE__);
64 return -1;
65 }
66
67 return 0;
68 }
69
70 int32_t
71 VideoRenderMacCocoaImpl::ChangeWindow(void* window)
72 {
73
74 CriticalSectionScoped cs(&_renderMacCocoaCritsect);
75 WEBRTC_TRACE(kTraceInfo, kTraceVideoRenderer, _id, "%s changing ID to ", __F UNCTION__, window);
76
77 if (window == NULL)
78 {
79 return -1;
80 }
81 _ptrWindow = window;
82
83
84 _ptrWindow = window;
85 _ptrCocoaRender->ChangeWindow((CocoaRenderView*)_ptrWindow);
86
87 return 0;
88 }
89
90 VideoRenderCallback*
91 VideoRenderMacCocoaImpl::AddIncomingRenderStream(const uint32_t streamId,
92 const uint32_t zOrder,
93 const float left,
94 const float top,
95 const float right,
96 const float bottom)
97 {
98 CriticalSectionScoped cs(&_renderMacCocoaCritsect);
99 WEBRTC_TRACE(kTraceDebug, kTraceVideoRenderer, _id, "%s", __FUNCTION__);
100 VideoChannelNSOpenGL* nsOpenGLChannel = NULL;
101
102 if(!_ptrWindow)
103 {
104 }
105
106 if(!nsOpenGLChannel)
107 {
108 nsOpenGLChannel = _ptrCocoaRender->CreateNSGLChannel(streamId, zOrder, l eft, top, right, bottom);
109 }
110
111 return nsOpenGLChannel;
112
113 }
114
115 int32_t
116 VideoRenderMacCocoaImpl::DeleteIncomingRenderStream(const uint32_t streamId)
117 {
118 WEBRTC_TRACE(kTraceDebug, kTraceVideoRenderer, _id, "Constructor %s:%d", __F UNCTION__, __LINE__);
119 CriticalSectionScoped cs(&_renderMacCocoaCritsect);
120 _ptrCocoaRender->DeleteNSGLChannel(streamId);
121
122 return 0;
123 }
124
125 int32_t
126 VideoRenderMacCocoaImpl::GetIncomingRenderStreamProperties(const uint32_t stream Id,
127 uint32_t& zOrder,
128 float& left,
129 float& top,
130 float& right,
131 float& bottom) const
132 {
133 return _ptrCocoaRender->GetChannelProperties(streamId, zOrder, left, top, ri ght, bottom);
134 }
135
136 int32_t
137 VideoRenderMacCocoaImpl::StartRender()
138 {
139 return _ptrCocoaRender->StartRender();
140 }
141
142 int32_t
143 VideoRenderMacCocoaImpl::StopRender()
144 {
145 return _ptrCocoaRender->StopRender();
146 }
147
148 VideoRenderType
149 VideoRenderMacCocoaImpl::RenderType()
150 {
151 return kRenderCocoa;
152 }
153
154 RawVideoType
155 VideoRenderMacCocoaImpl::PerferedVideoType()
156 {
157 return kVideoI420;
158 }
159
160 bool
161 VideoRenderMacCocoaImpl::FullScreen()
162 {
163 return false;
164 }
165
166 int32_t
167 VideoRenderMacCocoaImpl::GetGraphicsMemory(uint64_t& totalGraphicsMemory,
168 uint64_t& availableGraphicsMemory) const
169 {
170 totalGraphicsMemory = 0;
171 availableGraphicsMemory = 0;
172 return 0;
173 }
174
175 int32_t
176 VideoRenderMacCocoaImpl::GetScreenResolution(uint32_t& screenWidth,
177 uint32_t& screenHeight) const
178 {
179 CriticalSectionScoped cs(&_renderMacCocoaCritsect);
180 NSScreen* mainScreen = [NSScreen mainScreen];
181
182 NSRect frame = [mainScreen frame];
183
184 screenWidth = frame.size.width;
185 screenHeight = frame.size.height;
186 return 0;
187 }
188
189 uint32_t
190 VideoRenderMacCocoaImpl::RenderFrameRate(const uint32_t streamId)
191 {
192 CriticalSectionScoped cs(&_renderMacCocoaCritsect);
193 return 0;
194 }
195
196 int32_t
197 VideoRenderMacCocoaImpl::SetStreamCropping(const uint32_t streamId,
198 const float left,
199 const float top,
200 const float right,
201 const float bottom)
202 {
203 return 0;
204 }
205
206 int32_t VideoRenderMacCocoaImpl::ConfigureRenderer(const uint32_t streamId,
207 const unsigned int zOrder,
208 const float left,
209 const float top,
210 const float right,
211 const float bottom)
212 {
213 return 0;
214 }
215
216 int32_t
217 VideoRenderMacCocoaImpl::SetTransparentBackground(const bool enable)
218 {
219 return 0;
220 }
221
222 int32_t VideoRenderMacCocoaImpl::SetText(const uint8_t textId,
223 const uint8_t* text,
224 const int32_t textLength,
225 const uint32_t textColorRef,
226 const uint32_t backgroundColorRef,
227 const float left,
228 const float top,
229 const float right,
230 const float bottom)
231 {
232 return _ptrCocoaRender->SetText(textId, text, textLength, textColorRef, back groundColorRef, left, top, right, bottom);
233 }
234
235 int32_t VideoRenderMacCocoaImpl::SetBitmap(const void* bitMap,
236 const uint8_t pictureId,
237 const void* colorKey,
238 const float left,
239 const float top,
240 const float right,
241 const float bottom)
242 {
243 return 0;
244 }
245
246 int32_t VideoRenderMacCocoaImpl::FullScreenRender(void* window, const bool enabl e)
247 {
248 return -1;
249 }
250
251 } // namespace webrtc
252
253 #endif // COCOA_RENDERING
OLDNEW
« no previous file with comments | « webrtc/modules/video_render/mac/video_render_mac_cocoa_impl.h ('k') | webrtc/modules/video_render/mac/video_render_nsopengl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698