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