1 /*
2  *  Copyright (c) 2013 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_IOS_VIDEO_RENDER_IOS_IMPL_H_
12 #define WEBRTC_MODULES_VIDEO_RENDER_IOS_VIDEO_RENDER_IOS_IMPL_H_
13 
14 #include <list>
15 #include <map>
16 
17 #include "webrtc/modules/video_render/i_video_render.h"
18 
19 namespace webrtc {
20 
21 class VideoRenderIosGles20;
22 class CriticalSectionWrapper;
23 
24 class VideoRenderIosImpl : IVideoRender {
25  public:
26   explicit VideoRenderIosImpl(const int32_t id,
27                               void* window,
28                               const bool full_screen);
29 
30   ~VideoRenderIosImpl();
31 
32   // Implementation of IVideoRender.
33   int32_t Init() override;
34   int32_t ChangeWindow(void* window) override;
35 
36   VideoRenderCallback* AddIncomingRenderStream(const uint32_t stream_id,
37                                                const uint32_t z_order,
38                                                const float left,
39                                                const float top,
40                                                const float right,
41                                                const float bottom) override;
42 
43   int32_t DeleteIncomingRenderStream(const uint32_t stream_id) override;
44 
45   int32_t GetIncomingRenderStreamProperties(const uint32_t stream_id,
46                                             uint32_t& z_order,
47                                             float& left,
48                                             float& top,
49                                             float& right,
50                                             float& bottom) const override;
51 
52   int32_t StartRender() override;
53   int32_t StopRender() override;
54 
55   VideoRenderType RenderType() override;
56   RawVideoType PerferedVideoType() override;
57   bool FullScreen() override;
58   int32_t GetGraphicsMemory(
59       uint64_t& total_graphics_memory,
60       uint64_t& available_graphics_memory) const override;  // NOLINT
61   int32_t GetScreenResolution(
62       uint32_t& screen_width,
63       uint32_t& screen_height) const override;  // NOLINT
64   uint32_t RenderFrameRate(const uint32_t stream_id);
65   int32_t SetStreamCropping(const uint32_t stream_id,
66                             const float left,
67                             const float top,
68                             const float right,
69                             const float bottom) override;
70   int32_t ConfigureRenderer(const uint32_t stream_id,
71                             const unsigned int z_order,
72                             const float left,
73                             const float top,
74                             const float right,
75                             const float bottom) override;
76   int32_t SetTransparentBackground(const bool enable) override;
77   int32_t SetText(const uint8_t text_id,
78                   const uint8_t* text,
79                   const int32_t text_length,
80                   const uint32_t text_color_ref,
81                   const uint32_t background_color_ref,
82                   const float left,
83                   const float top,
84                   const float right,
85                   const float bottom) override;
86   int32_t SetBitmap(const void* bit_map,
87                     const uint8_t picture_id,
88                     const void* color_key,
89                     const float left,
90                     const float top,
91                     const float right,
92                     const float bottom);
93   int32_t FullScreenRender(void* window, const bool enable);
94 
95  private:
96   int32_t id_;
97   void* ptr_window_;
98   bool full_screen_;
99 
100   CriticalSectionWrapper* crit_sec_;
101   rtc::scoped_ptr<VideoRenderIosGles20> ptr_ios_render_;
102 };
103 }  // namespace webrtc
104 #endif  // WEBRTC_MODULES_VIDEO_RENDER_IOS_VIDEO_RENDER_IOS_IMPL_H_
105