Index: content/renderer/media/canvas_capture_handler.h |
diff --git a/content/renderer/media/canvas_capture_handler.h b/content/renderer/media/canvas_capture_handler.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..6256e27123dc0424393f6071863ca39d15023b5c |
--- /dev/null |
+++ b/content/renderer/media/canvas_capture_handler.h |
@@ -0,0 +1,75 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CONTENT_RENDERER_MEDIA_CANVAS_CAPTURE_HANDLER_H_ |
+#define CONTENT_RENDERER_MEDIA_CANVAS_CAPTURE_HANDLER_H_ |
+ |
+#include "base/macros.h" |
+#include "base/memory/ref_counted.h" |
+#include "base/memory/scoped_ptr.h" |
+#include "base/threading/thread.h" |
+#include "base/threading/thread_checker.h" |
+#include "content/common/content_export.h" |
+#include "media/base/video_capturer_source.h" |
+#include "media/base/video_frame_pool.h" |
+#include "media/base/video_types.h" |
+#include "third_party/WebKit/public/platform/WebCanvasCaptureHandler.h" |
+#include "third_party/WebKit/public/platform/WebMediaStream.h" |
+#include "third_party/WebKit/public/platform/WebSize.h" |
+#include "third_party/WebKit/public/platform/WebSkImage.h" |
+#include "third_party/skia/include/core/SkImage.h" |
+ |
+namespace content { |
+ |
+class CONTENT_EXPORT CanvasCaptureHandler final |
+ : public NON_EXPORTED_BASE(blink::WebCanvasCaptureHandler), |
+ public base::RefCounted<CanvasCaptureHandler> { |
perkj_chrome
2015/11/26 18:52:14
RefCounted? Does this object really need to be? It
emircan
2015/12/01 00:25:45
Here is my logic. I am not sure if I am doing the
|
+ public: |
+ CanvasCaptureHandler(const blink::WebSize& size, |
+ blink::WebMediaStream* stream); |
+ |
+ // blink::WebCanvasCaptureHandler Implementation. |
+ void sendNewFrame(const blink::WebSkImage& image) override; |
+ bool needsNewFrameCapture() const override; |
+ |
+ // media::VideoCapturerSource Implementation. |
perkj_chrome
2015/11/26 18:52:14
This class does not implement media::VideoCapturer
emircan
2015/12/01 00:25:45
Leftover from earlier. Fixing it.
|
+ void StartVideoCapture( |
+ const media::VideoCaptureParams& params, |
+ const media::VideoCapturerSource::VideoCaptureDeliverFrameCB& |
+ new_frame_callback, |
+ const media::VideoCapturerSource::RunningCallback& running_callback); |
+ void StopVideoCapture(); |
+ blink::WebSize GetSourceSize() { return size_; } |
+ |
+ private: |
+ friend class base::RefCounted<CanvasCaptureHandler>; |
+ virtual ~CanvasCaptureHandler(); |
+ |
+ class VideoCapturerSource; |
+ // An object that does all the work of running |new_frame_callback_|. |
+ // Destroyed on |io_task_runner_| after the class is destroyed. |
+ class CanvasCaptureHandlerDelegate; |
+ scoped_ptr<CanvasCaptureHandlerDelegate> delegate_; |
+ void createNewFrame(const blink::WebSkImage& image); |
+ |
+ media::VideoCaptureFormat capture_format_; |
+ bool ask_for_new_frame_; |
+ |
+ const blink::WebSize size_; |
+ gfx::Size last_size; |
+ std::vector<uint8> temp_data_; |
+ size_t row_bytes_; |
+ SkImageInfo image_info_; |
+ media::VideoFramePool frame_pool_; |
+ |
+ const scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
+ // Bound to the main render thread. |
+ base::ThreadChecker thread_checker_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(CanvasCaptureHandler); |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_RENDERER_MEDIA_CANVAS_CAPTURE_HANDLER_H_ |