• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright (c) 2012 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_VIDEO_ENGINE_VIE_RENDER_MANAGER_H_
12 #define WEBRTC_VIDEO_ENGINE_VIE_RENDER_MANAGER_H_
13 
14 #include <list>
15 #include <map>
16 
17 #include "webrtc/system_wrappers/interface/scoped_ptr.h"
18 #include "webrtc/typedefs.h"
19 #include "webrtc/video_engine/vie_manager_base.h"
20 
21 namespace webrtc {
22 
23 class CriticalSectionWrapper;
24 class RWLockWrapper;
25 class VideoRender;
26 class VideoRenderCallback;
27 class ViERenderer;
28 
29 class ViERenderManager : private ViEManagerBase {
30   friend class ViERenderManagerScoped;
31  public:
32   explicit ViERenderManager(int32_t engine_id);
33   ~ViERenderManager();
34 
35   int32_t RegisterVideoRenderModule(VideoRender* render_module);
36   int32_t DeRegisterVideoRenderModule(VideoRender* render_module);
37 
38   ViERenderer* AddRenderStream(const int32_t render_id,
39                                void* window,
40                                const uint32_t z_order,
41                                const float left,
42                                const float top,
43                                const float right,
44                                const float bottom);
45 
46   int32_t RemoveRenderStream(int32_t render_id);
47 
48  private:
49   typedef std::list<VideoRender*> RenderList;
50   // Returns a pointer to the render module if it exists in the render list.
51   // Assumed protected.
52   VideoRender* FindRenderModule(void* window);
53 
54   // Methods used by ViERenderScoped.
55   ViERenderer* ViERenderPtr(int32_t render_id) const;
56 
57   scoped_ptr<CriticalSectionWrapper> list_cs_;
58   int32_t engine_id_;
59   // Protected by ViEManagerBase.
60   typedef std::map<int32_t, ViERenderer*> RendererMap;
61   RendererMap stream_to_vie_renderer_;
62   RenderList render_list_;
63   bool use_external_render_module_;
64 };
65 
66 class ViERenderManagerScoped: private ViEManagerScopedBase {
67  public:
68   explicit ViERenderManagerScoped(const ViERenderManager& vie_render_manager);
69 
70   // Returns a pointer to the ViERender object.
71   ViERenderer* Renderer(int32_t render_id) const;
72 };
73 
74 }  // namespace webrtc
75 
76 #endif  // WEBRTC_VIDEO_ENGINE_VIE_RENDER_MANAGER_H_
77