|
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_DESTINATION_HANDLER_H_ | |
6 #define CONTENT_RENDERER_MEDIA_VIDEO_DESTINATION_HANDLER_H_ | |
7 | |
8 #include <string> | |
9 #include <vector> | |
wjia(left Chromium)
2013/05/03 02:00:38
not needed since vector is used as part of API in
Ronghua Wu (Left Chromium)
2013/05/03 05:37:28
True. But somehow lint is not happy if I don't inc
| |
10 | |
11 #include "base/compiler_specific.h" | |
12 #include "content/common/content_export.h" | |
13 #include "third_party/libjingle/source/talk/media/base/videocapturer.h" | |
14 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStream.h" | |
wjia(left Chromium)
2013/05/03 02:00:38
not used?
Ronghua Wu (Left Chromium)
2013/05/03 05:37:28
Done.
| |
15 | |
16 namespace webkit { | |
17 namespace ppapi { | |
18 class PPB_ImageData_Impl; | |
19 } | |
20 } | |
21 | |
22 namespace content { | |
23 | |
24 class MediaStreamDependencyFactory; | |
25 class MediaStreamRegistryInterface; | |
26 | |
27 // Interface used by the effects pepper plugin to output the processed frame | |
28 // to the video track. | |
29 class CONTENT_EXPORT FrameWriterInterface { | |
30 public: | |
31 // The ownership of the |image_data| deosn't transfer. So the implementation | |
32 // of this interface should make a copy of the |image_data| before return. | |
33 virtual void PutFrame(webkit::ppapi::PPB_ImageData_Impl* image_data, | |
34 int64 time_stamp_ns) = 0; | |
35 | |
36 protected: | |
37 virtual ~FrameWriterInterface() {} | |
38 }; | |
39 | |
40 // PpFrameWriter implements cricket::VideoCapturer so that it can be used in | |
41 // the native video track's video source. It also implements | |
42 // FrameWriterInterface, which will be used by the effects pepper plugin to | |
43 // inject the processed frame. | |
44 class CONTENT_EXPORT PpFrameWriter | |
wjia(left Chromium)
2013/05/03 02:00:38
How is lifetime of PpFrameWriter managed? It will
Ronghua Wu (Left Chromium)
2013/05/03 05:37:28
Good question. The PpFrameWriter is owned by the m
| |
45 : public NON_EXPORTED_BASE(cricket::VideoCapturer), | |
46 public FrameWriterInterface { | |
47 public: | |
48 PpFrameWriter(); | |
49 virtual ~PpFrameWriter(); | |
50 | |
51 // cricket::VideoCapturer implementation. | |
52 // These methods are accessed from a libJingle worker thread. | |
53 virtual cricket::CaptureState Start( | |
54 const cricket::VideoFormat& capture_format) OVERRIDE; | |
55 virtual void Stop() OVERRIDE; | |
56 virtual bool IsRunning() OVERRIDE; | |
57 virtual bool GetPreferredFourccs(std::vector<uint32>* fourccs) OVERRIDE; | |
58 virtual bool GetBestCaptureFormat(const cricket::VideoFormat& desired, | |
59 cricket::VideoFormat* best_format) OVERRIDE; | |
60 virtual bool IsScreencast() const OVERRIDE; | |
61 | |
62 // FrameWriterInterface implementation. | |
63 virtual void PutFrame(webkit::ppapi::PPB_ImageData_Impl* image_data, | |
64 int64 time_stamp_ns) OVERRIDE; | |
65 | |
66 private: | |
67 bool started_; | |
68 | |
69 DISALLOW_COPY_AND_ASSIGN(PpFrameWriter); | |
70 }; | |
71 | |
72 // VideoDestinationHandler is a glue class between the webrtc MediaStream and | |
73 // the effects pepper plugin host. | |
74 class CONTENT_EXPORT VideoDestinationHandler { | |
wjia(left Chromium)
2013/05/03 02:00:38
Will this class be expanded in the future? If not,
Ronghua Wu (Left Chromium)
2013/05/03 05:37:28
Didn't seem will be expanded from what I can tell.
| |
75 public: | |
76 VideoDestinationHandler(MediaStreamDependencyFactory* factory, | |
77 MediaStreamRegistryInterface* registry); | |
78 // Instantiates and adds a new video track to the MediaStream specified by | |
79 // |url|. Returns a handler for delivering frames to the new video track as | |
80 // |frame_writer|. | |
81 // Returns true on success and false on failure. | |
82 bool Open(const std::string& url, FrameWriterInterface** frame_writer); | |
83 virtual ~VideoDestinationHandler(); | |
84 | |
85 private: | |
86 MediaStreamDependencyFactory* factory_; | |
87 MediaStreamRegistryInterface* registry_; | |
88 | |
89 DISALLOW_COPY_AND_ASSIGN(VideoDestinationHandler); | |
90 }; | |
91 | |
92 } // namespace content | |
93 | |
94 #endif // CONTENT_RENDERER_MEDIA_VIDEO_DESTINATION_HANDLER_H_ | |
95 | |
OLD | NEW |