1bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org/*
2bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org *  Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org *
4bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org *  Use of this source code is governed by a BSD-style license
5bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org *  that can be found in the LICENSE file in the root of the source
6bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org *  tree. An additional intellectual property rights grant can be found
7bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org *  in the file PATENTS.  All contributing project authors may
8bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org *  be found in the AUTHORS file in the root of the source tree.
9bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org */
10bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org
11bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org#ifndef WEBRTC_MODULES_VIDEO_RENDER_IOS_VIDEO_RENDER_IOS_IMPL_H_
12bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org#define WEBRTC_MODULES_VIDEO_RENDER_IOS_VIDEO_RENDER_IOS_IMPL_H_
13bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org
14bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org#include <list>
15bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org#include <map>
16bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org
17bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org#include "webrtc/modules/video_render/i_video_render.h"
18bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org
19bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.orgnamespace webrtc {
20bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org
21bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.orgclass VideoRenderIosGles20;
22bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.orgclass CriticalSectionWrapper;
23bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org
24bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.orgclass VideoRenderIosImpl : IVideoRender {
25bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org public:
26bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org  explicit VideoRenderIosImpl(const int32_t id,
27bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org                              void* window,
28bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org                              const bool full_screen);
29bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org
30bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org  ~VideoRenderIosImpl();
31bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org
32bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org  // Implementation of IVideoRender.
33bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org  int32_t Init() OVERRIDE;
34bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org  int32_t ChangeUniqueId(const int32_t id) OVERRIDE;
35bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org  int32_t ChangeWindow(void* window) OVERRIDE;
36bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org
37bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org  VideoRenderCallback* AddIncomingRenderStream(const uint32_t stream_id,
38bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org                                               const uint32_t z_order,
39bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org                                               const float left,
40bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org                                               const float top,
41bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org                                               const float right,
42bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org                                               const float bottom) OVERRIDE;
43bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org
44bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org  int32_t DeleteIncomingRenderStream(const uint32_t stream_id) OVERRIDE;
45bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org
46bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org  int32_t GetIncomingRenderStreamProperties(const uint32_t stream_id,
47bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org                                            uint32_t& z_order,
48bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org                                            float& left,
49bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org                                            float& top,
50bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org                                            float& right,
51bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org                                            float& bottom) const OVERRIDE;
52bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org
53bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org  int32_t StartRender() OVERRIDE;
54bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org  int32_t StopRender() OVERRIDE;
55bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org
56bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org  VideoRenderType RenderType() OVERRIDE;
57bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org  RawVideoType PerferedVideoType() OVERRIDE;
58bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org  bool FullScreen() OVERRIDE;
59bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org  int32_t GetGraphicsMemory(
60bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org      uint64_t& total_graphics_memory,
61bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org      uint64_t& available_graphics_memory) const OVERRIDE;  // NOLINT
62bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org  int32_t GetScreenResolution(
63bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org      uint32_t& screen_width,
64bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org      uint32_t& screen_height) const OVERRIDE;  // NOLINT
65bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org  uint32_t RenderFrameRate(const uint32_t stream_id);
66bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org  int32_t SetStreamCropping(const uint32_t stream_id,
67bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org                            const float left,
68bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org                            const float top,
69bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org                            const float right,
70bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org                            const float bottom) OVERRIDE;
71bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org  int32_t ConfigureRenderer(const uint32_t stream_id,
72bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org                            const unsigned int z_order,
73bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org                            const float left,
74bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org                            const float top,
75bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org                            const float right,
76bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org                            const float bottom) OVERRIDE;
77bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org  int32_t SetTransparentBackground(const bool enable) OVERRIDE;
78bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org  int32_t SetText(const uint8_t text_id,
79bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org                  const uint8_t* text,
80bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org                  const int32_t text_length,
81bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org                  const uint32_t text_color_ref,
82bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org                  const uint32_t background_color_ref,
83bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org                  const float left,
84bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org                  const float top,
85bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org                  const float right,
86bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org                  const float bottom) OVERRIDE;
87bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org  int32_t SetBitmap(const void* bit_map,
88bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org                    const uint8_t picture_id,
89bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org                    const void* color_key,
90bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org                    const float left,
91bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org                    const float top,
92bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org                    const float right,
93bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org                    const float bottom);
94bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org  int32_t FullScreenRender(void* window, const bool enable);
95bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org
96bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org private:
97bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org  int32_t id_;
98bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org  void* ptr_window_;
99bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org  bool full_screen_;
100bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org
101bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org  CriticalSectionWrapper* crit_sec_;
10225bbc982baeb7ba97c20b90d27828597dc3dc7cffischman@webrtc.org  webrtc::scoped_ptr<VideoRenderIosGles20> ptr_ios_render_;
103bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org};
104bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org}  // namespace webrtc
105bc375b56d1d38a5b99d5cc726e1da098b5da969dfischman@webrtc.org#endif  // WEBRTC_MODULES_VIDEO_RENDER_IOS_VIDEO_RENDER_IOS_IMPL_H_
106