OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 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_CANVAS_CAPTURE_HANDLER_H_ | |
6 #define CONTENT_RENDERER_MEDIA_CANVAS_CAPTURE_HANDLER_H_ | |
7 | |
8 #include "base/macros.h" | |
9 #include "base/memory/ref_counted.h" | |
10 #include "base/memory/scoped_ptr.h" | |
11 #include "base/threading/thread.h" | |
perkj_chrome
2015/12/03 13:40:20
thread.h not used?
emircan
2015/12/03 18:43:51
Done.
| |
12 #include "base/threading/thread_checker.h" | |
13 #include "content/common/content_export.h" | |
14 #include "media/base/video_capturer_source.h" | |
15 #include "media/base/video_frame_pool.h" | |
16 #include "media/base/video_types.h" | |
perkj_chrome
2015/12/03 13:40:21
not used or used in cc only?
emircan
2015/12/03 18:43:51
Done.
| |
17 #include "third_party/WebKit/public/platform/WebCanvasCaptureHandler.h" | |
18 #include "third_party/WebKit/public/platform/WebMediaStream.h" | |
19 #include "third_party/WebKit/public/platform/WebSize.h" | |
20 #include "third_party/WebKit/public/platform/WebSkImage.h" | |
21 #include "third_party/skia/include/core/SkImage.h" | |
22 | |
23 namespace content { | |
24 | |
25 class CONTENT_EXPORT CanvasCaptureHandler final | |
26 : public NON_EXPORTED_BASE(blink::WebCanvasCaptureHandler) { | |
27 public: | |
28 CanvasCaptureHandler(const blink::WebSize& size, | |
29 blink::WebMediaStream* stream); | |
30 | |
31 // blink::WebCanvasCaptureHandler Implementation. | |
32 void sendNewFrame(const blink::WebSkImage& image) override; | |
33 bool needsNewFrameCapture() const override; | |
34 | |
35 // Functions called by media::VideoCapturerSource implementation. | |
36 void StartVideoCapture( | |
37 const media::VideoCaptureParams& params, | |
38 const media::VideoCapturerSource::VideoCaptureDeliverFrameCB& | |
39 new_frame_callback, | |
40 const media::VideoCapturerSource::RunningCallback& running_callback); | |
41 void StopVideoCapture(); | |
42 blink::WebSize GetSourceSize() const { return size_; } | |
43 | |
44 private: | |
45 virtual ~CanvasCaptureHandler(); | |
46 | |
47 void CreateNewFrame(const blink::WebSkImage& image); | |
48 | |
49 // Implementation VideoCapturerSource that is owned by blink and delegates | |
50 // the Start/Stop calls to CanvasCaptureHandler. | |
51 class VideoCapturerSource; | |
52 // Object that does all the work of running |new_frame_callback_|. | |
53 // Destroyed on |io_task_runner_| after the class is destroyed. | |
54 class CanvasCaptureHandlerDelegate; | |
55 | |
56 media::VideoCaptureFormat capture_format_; | |
57 bool ask_for_new_frame_; | |
58 | |
59 const blink::WebSize size_; | |
60 gfx::Size last_size; | |
61 std::vector<uint8> temp_data_; | |
62 size_t row_bytes_; | |
63 SkImageInfo image_info_; | |
64 media::VideoFramePool frame_pool_; | |
65 | |
66 const scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; | |
67 scoped_ptr<CanvasCaptureHandlerDelegate> delegate_; | |
68 // Bound to the main render thread. | |
69 base::ThreadChecker thread_checker_; | |
70 | |
71 DISALLOW_COPY_AND_ASSIGN(CanvasCaptureHandler); | |
72 }; | |
73 | |
74 } // namespace content | |
75 | |
76 #endif // CONTENT_RENDERER_MEDIA_CANVAS_CAPTURE_HANDLER_H_ | |
OLD | NEW |