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