Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(960)

Unified Diff: media/capture/video/mac/video_capture_device_mac.h

Issue 2146973002: RELAND: ImageCapture: Implement takePhoto() for Mac AVFoundation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add a [captureSession_ canAddOutput:stillImageOutput_] guard Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..7eff128ab1e0b50ee05c893364027f5625fb78af 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,
+ size_t image_length,
+ 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.
« no previous file with comments | « media/capture/video/mac/video_capture_device_avfoundation_mac.mm ('k') | media/capture/video/mac/video_capture_device_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698