blob: c1314cdedccbf31075473f464be1441968abe2a3 [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
mflodman@webrtc.orgcee447a2012-06-28 07:29:46 +00002 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
niklase@google.com470e71d2011-07-07 08:21:25 +00003 *
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.orge06ca3c2012-06-29 13:20:14 +000011#ifndef WEBRTC_VIDEO_ENGINE_VIE_RENDER_MANAGER_H_
12#define WEBRTC_VIDEO_ENGINE_VIE_RENDER_MANAGER_H_
niklase@google.com470e71d2011-07-07 08:21:25 +000013
henrike@webrtc.org79cf3ac2014-01-13 15:21:30 +000014#include <list>
pbos@webrtc.org4ca7d3f2013-08-12 19:51:57 +000015#include <map>
16
pbos@webrtc.orgf5d4cb12013-05-17 13:44:48 +000017#include "webrtc/system_wrappers/interface/scoped_ptr.h"
18#include "webrtc/typedefs.h"
pbos@webrtc.orgf5d4cb12013-05-17 13:44:48 +000019#include "webrtc/video_engine/vie_manager_base.h"
niklase@google.com470e71d2011-07-07 08:21:25 +000020
21namespace webrtc {
22
23class CriticalSectionWrapper;
24class RWLockWrapper;
25class VideoRender;
26class VideoRenderCallback;
mflodman@webrtc.org02afbea2011-12-14 18:50:47 +000027class ViERenderer;
niklase@google.com470e71d2011-07-07 08:21:25 +000028
mflodman@webrtc.org02afbea2011-12-14 18:50:47 +000029class ViERenderManager : private ViEManagerBase {
30 friend class ViERenderManagerScoped;
31 public:
pbos@webrtc.orgb238d122013-04-09 13:41:51 +000032 explicit ViERenderManager(int32_t engine_id);
mflodman@webrtc.org02afbea2011-12-14 18:50:47 +000033 ~ViERenderManager();
niklase@google.com470e71d2011-07-07 08:21:25 +000034
pbos@webrtc.orgb238d122013-04-09 13:41:51 +000035 int32_t RegisterVideoRenderModule(VideoRender* render_module);
36 int32_t DeRegisterVideoRenderModule(VideoRender* render_module);
niklase@google.com470e71d2011-07-07 08:21:25 +000037
pbos@webrtc.orgb238d122013-04-09 13:41:51 +000038 ViERenderer* AddRenderStream(const int32_t render_id,
mflodman@webrtc.org02afbea2011-12-14 18:50:47 +000039 void* window,
pbos@webrtc.orgb238d122013-04-09 13:41:51 +000040 const uint32_t z_order,
mflodman@webrtc.org02afbea2011-12-14 18:50:47 +000041 const float left,
42 const float top,
43 const float right,
44 const float bottom);
niklase@google.com470e71d2011-07-07 08:21:25 +000045
pbos@webrtc.orgb238d122013-04-09 13:41:51 +000046 int32_t RemoveRenderStream(int32_t render_id);
niklase@google.com470e71d2011-07-07 08:21:25 +000047
mflodman@webrtc.org02afbea2011-12-14 18:50:47 +000048 private:
henrike@webrtc.org79cf3ac2014-01-13 15:21:30 +000049 typedef std::list<VideoRender*> RenderList;
mflodman@webrtc.org02afbea2011-12-14 18:50:47 +000050 // Returns a pointer to the render module if it exists in the render list.
51 // Assumed protected.
52 VideoRender* FindRenderModule(void* window);
niklase@google.com470e71d2011-07-07 08:21:25 +000053
mflodman@webrtc.org02afbea2011-12-14 18:50:47 +000054 // Methods used by ViERenderScoped.
pbos@webrtc.orgb238d122013-04-09 13:41:51 +000055 ViERenderer* ViERenderPtr(int32_t render_id) const;
niklase@google.com470e71d2011-07-07 08:21:25 +000056
mflodman@webrtc.orgd32c4472011-12-22 14:17:53 +000057 scoped_ptr<CriticalSectionWrapper> list_cs_;
pbos@webrtc.orgb238d122013-04-09 13:41:51 +000058 int32_t engine_id_;
pbos@webrtc.org4ca7d3f2013-08-12 19:51:57 +000059 // Protected by ViEManagerBase.
60 typedef std::map<int32_t, ViERenderer*> RendererMap;
61 RendererMap stream_to_vie_renderer_;
henrike@webrtc.org79cf3ac2014-01-13 15:21:30 +000062 RenderList render_list_;
mflodman@webrtc.org02afbea2011-12-14 18:50:47 +000063 bool use_external_render_module_;
niklase@google.com470e71d2011-07-07 08:21:25 +000064};
65
mflodman@webrtc.org02afbea2011-12-14 18:50:47 +000066class ViERenderManagerScoped: private ViEManagerScopedBase {
67 public:
68 explicit ViERenderManagerScoped(const ViERenderManager& vie_render_manager);
niklase@google.com470e71d2011-07-07 08:21:25 +000069
mflodman@webrtc.org02afbea2011-12-14 18:50:47 +000070 // Returns a pointer to the ViERender object.
pbos@webrtc.orgb238d122013-04-09 13:41:51 +000071 ViERenderer* Renderer(int32_t render_id) const;
niklase@google.com470e71d2011-07-07 08:21:25 +000072};
73
mflodman@webrtc.org02afbea2011-12-14 18:50:47 +000074} // namespace webrtc
niklase@google.com470e71d2011-07-07 08:21:25 +000075
mflodman@webrtc.orge06ca3c2012-06-29 13:20:14 +000076#endif // WEBRTC_VIDEO_ENGINE_VIE_RENDER_MANAGER_H_