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