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 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 127 virtual int32_t FullScreenRender(void* window, const bool enable); 128 129 private: 130 int32_t _id; 131 CriticalSectionWrapper& _renderMacCocoaCritsect; 132 bool _fullScreen; 133 void* _ptrWindow; 134 VideoRenderNSOpenGL* _ptrCocoaRender; 135 136 }; 137 138 } // namespace webrtc 139 140 #endif // WEBRTC_MODULES_VIDEO_RENDER_MAIN_SOURCE_MAC_VIDEO_RENDER_MAC_COCOA_IMPL_H_ 141 #endif // COCOA_RENDERING 142