| 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..c4417b1420f3dd3fa12c046d3e556d05c5a963ed
|
| --- /dev/null
|
| +++ b/content/renderer/media/canvas_capture_handler.h
|
| @@ -0,0 +1,73 @@
|
| +// 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:
|
| + 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.
|
| + 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:
|
| + 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_
|
|
|