Chromium Code Reviews| 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..e896485aee39a7546756d8e77034a4faed4e8c76 |
| --- /dev/null |
| +++ b/content/renderer/media/canvas_capture_handler.h |
| @@ -0,0 +1,76 @@ |
| +// 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" |
|
perkj_chrome
2015/12/03 13:40:20
thread.h not used?
emircan
2015/12/03 18:43:51
Done.
|
| +#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" |
|
perkj_chrome
2015/12/03 13:40:21
not used or used in cc only?
emircan
2015/12/03 18:43:51
Done.
|
| +#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: |
| + CanvasCaptureHandler(const blink::WebSize& size, |
| + blink::WebMediaStream* stream); |
| + |
| + // blink::WebCanvasCaptureHandler Implementation. |
| + void sendNewFrame(const blink::WebSkImage& image) override; |
| + bool needsNewFrameCapture() const override; |
| + |
| + // Functions called by media::VideoCapturerSource implementation. |
| + void StartVideoCapture( |
| + const media::VideoCaptureParams& params, |
| + const media::VideoCapturerSource::VideoCaptureDeliverFrameCB& |
| + new_frame_callback, |
| + const media::VideoCapturerSource::RunningCallback& running_callback); |
| + void StopVideoCapture(); |
| + blink::WebSize GetSourceSize() const { return size_; } |
| + |
| + private: |
| + virtual ~CanvasCaptureHandler(); |
| + |
| + void CreateNewFrame(const blink::WebSkImage& image); |
| + |
| + // Implementation VideoCapturerSource that is owned by blink and delegates |
| + // the Start/Stop calls to CanvasCaptureHandler. |
| + class VideoCapturerSource; |
| + // Object that does all the work of running |new_frame_callback_|. |
| + // Destroyed on |io_task_runner_| after the class is destroyed. |
| + class CanvasCaptureHandlerDelegate; |
| + |
| + 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_; |
| + scoped_ptr<CanvasCaptureHandlerDelegate> delegate_; |
| + // 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_ |