|
OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_RENDERER_MEDIA_VIDEO_SOURCE_HANDLER_H_ | |
6 #define CONTENT_RENDERER_MEDIA_VIDEO_SOURCE_HANDLER_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/compiler_specific.h" | |
11 #include "base/memory/ref_counted.h" | |
12 #include "base/memory/scoped_ptr.h" | |
wjia(left Chromium)
2013/05/03 02:00:38
this one is not needed.
Ronghua Wu (Left Chromium)
2013/05/03 05:37:28
Done.
| |
13 #include "base/synchronization/lock.h" | |
wjia(left Chromium)
2013/05/03 02:00:38
no lock is used.
Ronghua Wu (Left Chromium)
2013/05/03 05:37:28
Done.
| |
14 #include "content/common/content_export.h" | |
15 #include "content/renderer/media/media_stream_registry_interface.h" | |
wjia(left Chromium)
2013/05/03 02:00:38
it's already forward declared. do you still need t
Ronghua Wu (Left Chromium)
2013/05/03 05:37:28
Moved to ccl
| |
16 #include "third_party/libjingle/source/talk/app/webrtc/videosourceinterface.h" | |
17 #include "third_party/libjingle/source/talk/media/base/videoframe.h" | |
wjia(left Chromium)
2013/05/03 02:00:38
use forward declaration.
Ronghua Wu (Left Chromium)
2013/05/03 05:37:28
Done.
| |
18 #include "third_party/libjingle/source/talk/media/base/videorenderer.h" | |
wjia(left Chromium)
2013/05/03 02:00:38
not needed.
Ronghua Wu (Left Chromium)
2013/05/03 05:37:28
Moved to cc
| |
19 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStream.h" | |
wjia(left Chromium)
2013/05/03 02:00:38
Is this one needed?
Ronghua Wu (Left Chromium)
2013/05/03 05:37:28
dito
| |
20 | |
21 namespace content { | |
22 | |
23 class MediaStreamDependencyFactory; | |
24 class MediaStreamRegistryInterface; | |
25 | |
26 // Interface used by the effects pepper plugin to get captured frame | |
27 // from the video track. | |
28 class CONTENT_EXPORT FrameReaderInterface { | |
29 public: | |
30 // Got a new captured frame. | |
31 // The ownership of the |frame| transfers to the caller. So the caller must | |
32 // delete |frame| when done with it. | |
33 virtual bool GotFrame(cricket::VideoFrame* frame) = 0; | |
34 | |
35 protected: | |
36 virtual ~FrameReaderInterface() {} | |
37 }; | |
38 | |
39 // VideoSourceHandler is a glue class between the webrtc MediaStream and | |
40 // the effects pepper plugin host. | |
41 class CONTENT_EXPORT VideoSourceHandler { | |
42 public: | |
43 VideoSourceHandler(MediaStreamDependencyFactory* factory, | |
44 MediaStreamRegistryInterface* registry); | |
45 // Connects to the first video track in the MediaStream specified by |url| and | |
46 // the received frames will be delivered via |reader|. | |
47 // Returns true on success and false on failure. | |
48 bool Open(const std::string& url, FrameReaderInterface* reader); | |
49 // Closes |reader|'s connection with the first video track in | |
50 // the MediaStream specified by |url|, i.e. stops receiving frames from the | |
51 // video track. | |
52 // Returns true on success and false on failure. | |
53 bool Close(const std::string& url, FrameReaderInterface* reader); | |
54 | |
55 // Gets the VideoRenderer associated with |reader|. | |
56 // Made it public only for testing purpose. | |
57 cricket::VideoRenderer* GetReceiver(FrameReaderInterface* reader); | |
58 | |
59 private: | |
60 scoped_refptr<webrtc::VideoSourceInterface> GetFirstVideoSource( | |
61 const std::string& url); | |
62 | |
63 MediaStreamDependencyFactory* factory_; | |
64 MediaStreamRegistryInterface* registry_; | |
65 std::map<FrameReaderInterface*, cricket::VideoRenderer*> reader_to_receiver_; | |
66 | |
67 DISALLOW_COPY_AND_ASSIGN(VideoSourceHandler); | |
68 }; | |
69 | |
70 } // namespace content | |
71 | |
72 #endif // CONTENT_RENDERER_MEDIA_VIDEO_SOURCE_HANDLER_H_ | |
73 | |
OLD | NEW |