2019-07-16 22:09:04 +02:00
|
|
|
#ifndef LIBCEF_BROWSER_OSR_VIDEO_CONSUMER_OSR_H_
|
|
|
|
#define LIBCEF_BROWSER_OSR_VIDEO_CONSUMER_OSR_H_
|
|
|
|
|
2023-01-30 18:43:54 +01:00
|
|
|
#include "base/functional/callback.h"
|
2019-07-16 22:09:04 +02:00
|
|
|
#include "components/viz/host/client_frame_sink_video_capturer.h"
|
2020-02-10 18:10:17 +01:00
|
|
|
#include "media/capture/mojom/video_capture_types.mojom.h"
|
2021-06-04 03:34:56 +02:00
|
|
|
#include "third_party/abseil-cpp/absl/types/optional.h"
|
2019-07-16 22:09:04 +02:00
|
|
|
|
|
|
|
class CefRenderWidgetHostViewOSR;
|
|
|
|
|
|
|
|
class CefVideoConsumerOSR : public viz::mojom::FrameSinkVideoConsumer {
|
|
|
|
public:
|
|
|
|
explicit CefVideoConsumerOSR(CefRenderWidgetHostViewOSR* view);
|
2021-12-06 21:40:25 +01:00
|
|
|
|
|
|
|
CefVideoConsumerOSR(const CefVideoConsumerOSR&) = delete;
|
|
|
|
CefVideoConsumerOSR& operator=(const CefVideoConsumerOSR&) = delete;
|
|
|
|
|
2019-07-16 22:09:04 +02:00
|
|
|
~CefVideoConsumerOSR() override;
|
|
|
|
|
|
|
|
void SetActive(bool active);
|
|
|
|
void SetFrameRate(base::TimeDelta frame_rate);
|
2020-01-31 23:54:26 +01:00
|
|
|
void SizeChanged(const gfx::Size& size_in_pixels);
|
2021-06-04 03:34:56 +02:00
|
|
|
void RequestRefreshFrame(const absl::optional<gfx::Rect>& bounds_in_pixels);
|
2019-07-16 22:09:04 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
// viz::mojom::FrameSinkVideoConsumer implementation.
|
|
|
|
void OnFrameCaptured(
|
2021-12-16 23:35:54 +01:00
|
|
|
media::mojom::VideoBufferHandlePtr data,
|
|
|
|
media::mojom::VideoFrameInfoPtr info,
|
2019-07-16 22:09:04 +02:00
|
|
|
const gfx::Rect& content_rect,
|
2020-02-10 18:10:17 +01:00
|
|
|
mojo::PendingRemote<viz::mojom::FrameSinkVideoConsumerFrameCallbacks>
|
|
|
|
callbacks) override;
|
2022-07-21 19:26:10 +02:00
|
|
|
void OnNewCropVersion(uint32_t crop_version) override {}
|
2022-02-21 23:23:40 +01:00
|
|
|
void OnFrameWithEmptyRegionCapture() override {}
|
|
|
|
void OnStopped() override {}
|
|
|
|
void OnLog(const std::string& message) override {}
|
2019-07-16 22:09:04 +02:00
|
|
|
|
|
|
|
CefRenderWidgetHostViewOSR* const view_;
|
|
|
|
std::unique_ptr<viz::ClientFrameSinkVideoCapturer> video_capturer_;
|
|
|
|
|
2020-01-31 23:54:26 +01:00
|
|
|
gfx::Size size_in_pixels_;
|
2021-06-04 03:34:56 +02:00
|
|
|
absl::optional<gfx::Rect> bounds_in_pixels_;
|
2019-07-16 22:09:04 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // LIBCEF_BROWSER_OSR_VIDEO_CONSUMER_OSR_H_
|