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 ChangeWindow(void* window); 46 47 /************************************************************************** 48 * 49 * Incoming Streams 50 * 51 ***************************************************************************/ 52 53 virtual VideoRenderCallback 54 * AddIncomingRenderStream(const uint32_t streamId, 55 const uint32_t zOrder, 56 const float left, const float top, 57 const float right, const float bottom); 58 59 virtual int32_t 60 DeleteIncomingRenderStream(const uint32_t streamId); 61 62 virtual int32_t 63 GetIncomingRenderStreamProperties(const uint32_t streamId, 64 uint32_t& zOrder, 65 float& left, float& top, 66 float& right, float& bottom) const; 67 68 /************************************************************************** 69 * 70 * Start/Stop 71 * 72 ***************************************************************************/ 73 74 virtual int32_t StartRender(); 75 76 virtual int32_t StopRender(); 77 78 /************************************************************************** 79 * 80 * Properties 81 * 82 ***************************************************************************/ 83 84 virtual VideoRenderType RenderType(); 85 86 virtual RawVideoType PerferedVideoType(); 87 88 virtual bool FullScreen(); 89 90 virtual int32_t 91 GetGraphicsMemory(uint64_t& totalGraphicsMemory, 92 uint64_t& availableGraphicsMemory) const; 93 94 virtual int32_t 95 GetScreenResolution(uint32_t& screenWidth, 96 uint32_t& screenHeight) const; 97 98 virtual uint32_t RenderFrameRate(const uint32_t streamId); 99 100 virtual int32_t SetStreamCropping(const uint32_t streamId, 101 const float left, const float top, 102 const float right, const float bottom); 103 104 virtual int32_t ConfigureRenderer(const uint32_t streamId, 105 const unsigned int zOrder, 106 const float left, const float top, 107 const float right, 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, const float top, 117 const float right, 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, const float top, 123 const float right, const float bottom); 124 125 private: 126 CriticalSectionWrapper& _renderWindowsCritsect; 127 128 void* _prtWindow; 129 bool _fullscreen; 130 131 VideoRenderWinMethod _renderMethod; 132 IVideoRenderWin* _ptrRendererWin; 133 }; 134 135 } // namespace webrtc 136 137 #endif // WEBRTC_MODULES_VIDEO_RENDER_MAIN_SOURCE_WINDOWS_VIDEO_RENDER_WINDOWS_IMPL_H_ 138