niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | /* |
mflodman@webrtc.org | 8baed51 | 2012-06-21 12:11:50 +0000 | [diff] [blame] | 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 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 | |
mflodman@webrtc.org | e06ca3c | 2012-06-29 13:20:14 +0000 | [diff] [blame] | 11 | #ifndef WEBRTC_VIDEO_ENGINE_VIE_RENDERER_H_ |
| 12 | #define WEBRTC_VIDEO_ENGINE_VIE_RENDERER_H_ |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 13 | |
mflodman@webrtc.org | 5885a41 | 2011-12-09 05:52:32 +0000 | [diff] [blame] | 14 | #include "modules/video_render/main/interface/video_render_defines.h" |
| 15 | #include "system_wrappers/interface/map_wrapper.h" |
mflodman@webrtc.org | 7b3f3b1 | 2012-01-17 12:12:42 +0000 | [diff] [blame] | 16 | #include "system_wrappers/interface/scoped_ptr.h" |
mflodman@webrtc.org | a4863db | 2011-12-22 08:51:52 +0000 | [diff] [blame] | 17 | #include "video_engine/include/vie_render.h" |
mflodman@webrtc.org | 5885a41 | 2011-12-09 05:52:32 +0000 | [diff] [blame] | 18 | #include "video_engine/vie_frame_provider_base.h" |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 19 | |
| 20 | namespace webrtc { |
| 21 | |
| 22 | class VideoRender; |
| 23 | class VideoRenderCallback; |
| 24 | class ViERenderManager; |
| 25 | |
mflodman@webrtc.org | 5885a41 | 2011-12-09 05:52:32 +0000 | [diff] [blame] | 26 | class ViEExternalRendererImpl : public VideoRenderCallback { |
| 27 | public: |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 28 | ViEExternalRendererImpl(); |
mflodman@webrtc.org | 5885a41 | 2011-12-09 05:52:32 +0000 | [diff] [blame] | 29 | virtual ~ViEExternalRendererImpl() {} |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 30 | |
mflodman@webrtc.org | 5885a41 | 2011-12-09 05:52:32 +0000 | [diff] [blame] | 31 | int SetViEExternalRenderer(ExternalRenderer* external_renderer, |
| 32 | RawVideoType video_input_format); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 33 | |
mflodman@webrtc.org | 5885a41 | 2011-12-09 05:52:32 +0000 | [diff] [blame] | 34 | // Implements VideoRenderCallback. |
| 35 | virtual WebRtc_Word32 RenderFrame(const WebRtc_UWord32 stream_id, |
| 36 | VideoFrame& video_frame); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 37 | |
mflodman@webrtc.org | 5885a41 | 2011-12-09 05:52:32 +0000 | [diff] [blame] | 38 | private: |
| 39 | ExternalRenderer* external_renderer_; |
| 40 | RawVideoType external_renderer_format_; |
| 41 | WebRtc_UWord32 external_renderer_width_; |
| 42 | WebRtc_UWord32 external_renderer_height_; |
mflodman@webrtc.org | 7b3f3b1 | 2012-01-17 12:12:42 +0000 | [diff] [blame] | 43 | scoped_ptr<VideoFrame> converted_frame_; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 44 | }; |
| 45 | |
mflodman@webrtc.org | 5885a41 | 2011-12-09 05:52:32 +0000 | [diff] [blame] | 46 | class ViERenderer: public ViEFrameCallback { |
| 47 | public: |
| 48 | static ViERenderer* CreateViERenderer(const WebRtc_Word32 render_id, |
| 49 | const WebRtc_Word32 engine_id, |
| 50 | VideoRender& render_module, |
| 51 | ViERenderManager& render_manager, |
| 52 | const WebRtc_UWord32 z_order, |
| 53 | const float left, |
| 54 | const float top, |
| 55 | const float right, |
| 56 | const float bottom); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 57 | ~ViERenderer(void); |
| 58 | |
| 59 | WebRtc_Word32 StartRender(); |
| 60 | WebRtc_Word32 StopRender(); |
| 61 | |
mflodman@webrtc.org | 5885a41 | 2011-12-09 05:52:32 +0000 | [diff] [blame] | 62 | WebRtc_Word32 GetLastRenderedFrame(const WebRtc_Word32 renderID, |
| 63 | VideoFrame& video_frame); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 64 | |
mflodman@webrtc.org | f4f2145 | 2012-09-28 11:27:35 +0000 | [diff] [blame] | 65 | int SetExpectedRenderDelay(int render_delay); |
| 66 | |
mflodman@webrtc.org | 5885a41 | 2011-12-09 05:52:32 +0000 | [diff] [blame] | 67 | WebRtc_Word32 ConfigureRenderer(const unsigned int z_order, |
| 68 | const float left, |
| 69 | const float top, |
| 70 | const float right, |
| 71 | const float bottom); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 72 | |
| 73 | VideoRender& RenderModule(); |
| 74 | |
mflodman@webrtc.org | 5885a41 | 2011-12-09 05:52:32 +0000 | [diff] [blame] | 75 | WebRtc_Word32 EnableMirroring(const WebRtc_Word32 render_id, |
| 76 | const bool enable, |
| 77 | const bool mirror_xaxis, |
| 78 | const bool mirror_yaxis); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 79 | |
mflodman@webrtc.org | 5885a41 | 2011-12-09 05:52:32 +0000 | [diff] [blame] | 80 | WebRtc_Word32 SetTimeoutImage(const VideoFrame& timeout_image, |
| 81 | const WebRtc_Word32 timeout_value); |
| 82 | WebRtc_Word32 SetRenderStartImage(const VideoFrame& start_image); |
| 83 | WebRtc_Word32 SetExternalRenderer(const WebRtc_Word32 render_id, |
| 84 | RawVideoType video_input_format, |
| 85 | ExternalRenderer* external_renderer); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 86 | |
mflodman@webrtc.org | 5885a41 | 2011-12-09 05:52:32 +0000 | [diff] [blame] | 87 | private: |
| 88 | ViERenderer(const WebRtc_Word32 render_id, const WebRtc_Word32 engine_id, |
| 89 | VideoRender& render_module, |
| 90 | ViERenderManager& render_manager); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 91 | |
mflodman@webrtc.org | 5885a41 | 2011-12-09 05:52:32 +0000 | [diff] [blame] | 92 | WebRtc_Word32 Init(const WebRtc_UWord32 z_order, |
| 93 | const float left, |
| 94 | const float top, |
| 95 | const float right, |
| 96 | const float bottom); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 97 | |
| 98 | // Implement ViEFrameCallback |
mflodman@webrtc.org | 5885a41 | 2011-12-09 05:52:32 +0000 | [diff] [blame] | 99 | virtual void DeliverFrame(int id, |
mflodman@webrtc.org | 8baed51 | 2012-06-21 12:11:50 +0000 | [diff] [blame] | 100 | VideoFrame* video_frame, |
mflodman@webrtc.org | 5885a41 | 2011-12-09 05:52:32 +0000 | [diff] [blame] | 101 | int num_csrcs = 0, |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 102 | const WebRtc_UWord32 CSRC[kRtpCsrcSize] = NULL); |
mflodman@webrtc.org | 5885a41 | 2011-12-09 05:52:32 +0000 | [diff] [blame] | 103 | virtual void DelayChanged(int id, int frame_delay); |
mflodman@webrtc.org | 8baed51 | 2012-06-21 12:11:50 +0000 | [diff] [blame] | 104 | virtual int GetPreferedFrameSettings(int* width, |
| 105 | int* height, |
| 106 | int* frame_rate); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 107 | virtual void ProviderDestroyed(int id); |
| 108 | |
mflodman@webrtc.org | 5885a41 | 2011-12-09 05:52:32 +0000 | [diff] [blame] | 109 | WebRtc_UWord32 render_id_; |
mflodman@webrtc.org | 5885a41 | 2011-12-09 05:52:32 +0000 | [diff] [blame] | 110 | VideoRender& render_module_; |
| 111 | ViERenderManager& render_manager_; |
| 112 | VideoRenderCallback* render_callback_; |
| 113 | ViEExternalRendererImpl* incoming_external_callback_; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 114 | }; |
| 115 | |
mflodman@webrtc.org | 5885a41 | 2011-12-09 05:52:32 +0000 | [diff] [blame] | 116 | } // namespace webrtc |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 117 | |
mflodman@webrtc.org | e06ca3c | 2012-06-29 13:20:14 +0000 | [diff] [blame] | 118 | #endif // WEBRTC_VIDEO_ENGINE_VIE_RENDERER_H_ |