Chromium Code Reviews| Index: media/capture/video/mac/video_capture_device_mac.h |
| diff --git a/media/capture/video/mac/video_capture_device_mac.h b/media/capture/video/mac/video_capture_device_mac.h |
| index 88b986b6fa0a5dcc66e848a8d0c97101d8a358d6..0af8929c00ad3455d97911715ea16c1c21f4dab8 100644 |
| --- a/media/capture/video/mac/video_capture_device_mac.h |
| +++ b/media/capture/video/mac/video_capture_device_mac.h |
| @@ -62,10 +62,12 @@ class VideoCaptureDeviceMac : public VideoCaptureDevice { |
| const VideoCaptureParams& params, |
| std::unique_ptr<VideoCaptureDevice::Client> client) override; |
| void StopAndDeAllocate() override; |
| + void TakePhoto(TakePhotoCallback callback) override; |
| bool Init(VideoCaptureDevice::Name::CaptureApiType capture_api_type); |
| - // Called to deliver captured video frames. |
| + // Called to deliver captured video frames. It's safe to call this method |
| + // from any thread, including those controlled by AVFoundation. |
| void ReceiveFrame(const uint8_t* video_frame, |
| int video_frame_length, |
| const VideoCaptureFormat& frame_format, |
| @@ -73,6 +75,13 @@ class VideoCaptureDeviceMac : public VideoCaptureDevice { |
| int aspect_denominator, |
| base::TimeDelta timestamp); |
| + // Callbacks with the result of a still image capture, or in case of error, |
| + // respectively. It's safe to call these methods from any thread. |
| + void OnPhotoTaken(const uint8_t* image_data, |
| + int image_length, |
|
Robert Sesek
2016/07/08 19:31:04
Lengths should generally be size_t.
mcasas
2016/07/08 21:39:28
Done.
|
| + const std::string& mime_type); |
| + void OnPhotoError(); |
| + |
| // Forwarder to VideoCaptureDevice::Client::OnError(). |
| void ReceiveError(const tracked_objects::Location& from_here, |
| const std::string& reason); |
| @@ -99,6 +108,9 @@ class VideoCaptureDeviceMac : public VideoCaptureDevice { |
| base::scoped_nsobject<VideoCaptureDeviceAVFoundation> capture_device_; |
| + // To hold on to the TakePhotoCallback while the picture is being taken. |
| + std::unique_ptr<TakePhotoCallback> photo_callback_; |
| + |
| // Used with Bind and PostTask to ensure that methods aren't called after the |
| // VideoCaptureDeviceMac is destroyed. |
| // NOTE: Weak pointers must be invalidated before all other member variables. |