| OLD | NEW |
| (Empty) |
| 1 // Copyright 2016 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 SERVICES_VIDEO_CAPTURE_DEVICE_CLIENT_MOJO_TO_MEDIA_ADAPTER_H_ | |
| 6 #define SERVICES_VIDEO_CAPTURE_DEVICE_CLIENT_MOJO_TO_MEDIA_ADAPTER_H_ | |
| 7 | |
| 8 #include "media/capture/video/video_capture_device.h" | |
| 9 #include "services/video_capture/public/interfaces/video_capture_device_client.m
ojom.h" | |
| 10 | |
| 11 namespace media { | |
| 12 class MojoSharedBufferVideoFrame; | |
| 13 } | |
| 14 | |
| 15 namespace video_capture { | |
| 16 | |
| 17 // Adapter that allows a mojom::VideoCaptureDeviceClient to be used in place of | |
| 18 // a media::VideoCaptureDevice::Client. | |
| 19 class DeviceClientMojoToMediaAdapter | |
| 20 : public media::VideoCaptureDevice::Client { | |
| 21 public: | |
| 22 using VideoCaptureFormat = media::VideoCaptureFormat; | |
| 23 using VideoPixelFormat = media::VideoPixelFormat; | |
| 24 using VideoPixelStorage = media::VideoPixelStorage; | |
| 25 using VideoFrame = media::VideoFrame; | |
| 26 | |
| 27 DeviceClientMojoToMediaAdapter(mojom::VideoCaptureDeviceClientPtr client); | |
| 28 ~DeviceClientMojoToMediaAdapter() override; | |
| 29 | |
| 30 // media::VideoCaptureDevice::Client: | |
| 31 void OnIncomingCapturedData(const uint8_t* data, | |
| 32 int length, | |
| 33 const VideoCaptureFormat& frame_format, | |
| 34 int clockwise_rotation, | |
| 35 base::TimeTicks reference_time, | |
| 36 base::TimeDelta timestamp) override; | |
| 37 std::unique_ptr<Buffer> ReserveOutputBuffer( | |
| 38 const gfx::Size& dimensions, | |
| 39 VideoPixelFormat format, | |
| 40 VideoPixelStorage storage) override; | |
| 41 void OnIncomingCapturedBuffer(std::unique_ptr<Buffer> buffer, | |
| 42 const VideoCaptureFormat& frame_format, | |
| 43 base::TimeTicks reference_time, | |
| 44 base::TimeDelta timestamp) override; | |
| 45 void OnIncomingCapturedVideoFrame( | |
| 46 std::unique_ptr<Buffer> buffer, | |
| 47 const scoped_refptr<VideoFrame>& frame) override; | |
| 48 std::unique_ptr<Buffer> ResurrectLastOutputBuffer( | |
| 49 const gfx::Size& dimensions, | |
| 50 VideoPixelFormat format, | |
| 51 VideoPixelStorage storage) override; | |
| 52 void OnError(const tracked_objects::Location& from_here, | |
| 53 const std::string& reason) override; | |
| 54 double GetBufferPoolUtilization() const override; | |
| 55 | |
| 56 private: | |
| 57 mojom::VideoCaptureDeviceClientPtr client_; | |
| 58 // TODO(chfremer): Remove when actual implementation is finished. | |
| 59 // https://crbug.com/584797 | |
| 60 scoped_refptr<media::MojoSharedBufferVideoFrame> dummy_frame_; | |
| 61 }; | |
| 62 | |
| 63 } // namespace video_capture | |
| 64 | |
| 65 #endif // SERVICES_VIDEO_CAPTURE_DEVICE_CLIENT_MOJO_TO_MEDIA_ADAPTER_H_ | |
| OLD | NEW |