blob: 2e31222e7095e01b7a2d7808173e39e8f7f1d2c8 [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
mflodman@webrtc.org02afbea2011-12-14 18:50:47 +000014#include "system_wrappers/interface/list_wrapper.h"
15#include "system_wrappers/interface/map_wrapper.h"
mflodman@webrtc.orgd32c4472011-12-22 14:17:53 +000016#include "system_wrappers/interface/scoped_ptr.h"
mflodman@webrtc.orgcee447a2012-06-28 07:29:46 +000017#include "typedefs.h" // NOLINT
18
mflodman@webrtc.org02afbea2011-12-14 18:50:47 +000019#include "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:
49 // Returns a pointer to the render module if it exists in the render list.
50 // Assumed protected.
51 VideoRender* FindRenderModule(void* window);
niklase@google.com470e71d2011-07-07 08:21:25 +000052
mflodman@webrtc.org02afbea2011-12-14 18:50:47 +000053 // Methods used by ViERenderScoped.
pbos@webrtc.orgb238d122013-04-09 13:41:51 +000054 ViERenderer* ViERenderPtr(int32_t render_id) const;
niklase@google.com470e71d2011-07-07 08:21:25 +000055
mflodman@webrtc.orgd32c4472011-12-22 14:17:53 +000056 scoped_ptr<CriticalSectionWrapper> list_cs_;
pbos@webrtc.orgb238d122013-04-09 13:41:51 +000057 int32_t engine_id_;
mflodman@webrtc.org02afbea2011-12-14 18:50:47 +000058 MapWrapper stream_to_vie_renderer_; // Protected by ViEManagerBase.
59 ListWrapper render_list_;
60 bool use_external_render_module_;
niklase@google.com470e71d2011-07-07 08:21:25 +000061};
62
mflodman@webrtc.org02afbea2011-12-14 18:50:47 +000063class ViERenderManagerScoped: private ViEManagerScopedBase {
64 public:
65 explicit ViERenderManagerScoped(const ViERenderManager& vie_render_manager);
niklase@google.com470e71d2011-07-07 08:21:25 +000066
mflodman@webrtc.org02afbea2011-12-14 18:50:47 +000067 // Returns a pointer to the ViERender object.
pbos@webrtc.orgb238d122013-04-09 13:41:51 +000068 ViERenderer* Renderer(int32_t render_id) const;
niklase@google.com470e71d2011-07-07 08:21:25 +000069};
70
mflodman@webrtc.org02afbea2011-12-14 18:50:47 +000071} // namespace webrtc
niklase@google.com470e71d2011-07-07 08:21:25 +000072
mflodman@webrtc.orge06ca3c2012-06-29 13:20:14 +000073#endif // WEBRTC_VIDEO_ENGINE_VIE_RENDER_MANAGER_H_