Index: media/video/capture/video_capture_device.h |
diff --git a/media/video/capture/video_capture_device.h b/media/video/capture/video_capture_device.h |
index 382dad6cdc461d7d6d20bf04ab8e7e91693ae503..614fc08aea8ce680a0a7c71014eaf1105a64b2ae 100644 |
--- a/media/video/capture/video_capture_device.h |
+++ b/media/video/capture/video_capture_device.h |
@@ -216,6 +216,33 @@ class MEDIA_EXPORT VideoCaptureDevice { |
// VideoCaptureDevice requests the |message| to be logged. |
virtual void OnLog(const std::string& message) {} |
+ |
+ // The video stream has been muted. After this callback, no more |
+ // OnIncomingCapturedData() will be called. This may happen when |
+ // CaptureImage() has called. After the still image has been captured, the |
+ // client will get notified by OnUnmute() and the video stream will be |
+ // resumed. |
+ virtual void OnMute() {} |
+ |
+ // The video stream has resumed. |
+ virtual void OnUnmute() {} |
+ }; |
+ |
+ class MEDIA_EXPORT ImageClient { |
+ public: |
+ virtual ~ImageClient() {} |
+ |
+ // Callback function to notify the client the caputred image is available. |
+ virtual void OnIncomingCapturedData(const uint8* data, |
+ int length, |
+ const ImageCaptureFormat& format, |
+ int rotation, |
+ base::TimeTicks timestamp) = 0; |
+ |
+ // Callback function to notify client the failure of the image capturing. |
wuchengli
2014/09/15 06:14:13
s/capturing/capture/
Owen Lin
2014/09/15 09:04:36
Done.
|
+ // The VideoCaptureDevice must be StopAndDeAllocate()-ed. |reason| is a |
+ // text description of the error. |
+ virtual void OnError(const std::string& reason) = 0; |
wuchengli
2014/09/15 06:14:13
We want an integer error to report to the error ca
Owen Lin
2014/09/15 09:04:36
Can we keep it for consistency ? We are still far
Owen Lin
2014/09/16 02:35:15
The current errors are
1. Fail to open the device
|
}; |
// Creates a VideoCaptureDevice object. |
@@ -235,6 +262,12 @@ class MEDIA_EXPORT VideoCaptureDevice { |
static void GetDeviceSupportedFormats(const Name& device, |
VideoCaptureFormats* supported_formats); |
+ // Gets the supported formats for still image of a particular device attached |
+ // to the system. |
+ static void GetDeviceSupportedImageFormats( |
+ const Name& device, |
+ ImageCaptureFormats* supported_formats); |
+ |
// Prepares the camera for use. After this function has been called no other |
// applications can use the camera. StopAndDeAllocate() must be called before |
// the object is deleted. |
@@ -258,6 +291,30 @@ class MEDIA_EXPORT VideoCaptureDevice { |
// defined, otherwise returns 0. |
int GetPowerLineFrequencyForLocation() const; |
+ // Initializes the device for still image capture for the given image format. |
+ // |
+ // This function must be called between AllocateAndStart() and |
+ // StopAndDeAllocate(). |
+ virtual void InitializeImageCapture(const ImageCaptureFormat& image_format, |
+ scoped_ptr<ImageClient> client) {} |
+ |
+ // Releases resources for image capture. |
+ // |
+ // The ImageClient passed from InitializeImageCapture would be freed. This |
+ // method must be called between InitializeImageCapture() and |
+ // StopAndDeAllocate(). |
+ virtual void ReleaseImageCapture() {} |
+ |
+ // Gets one image from the device asynchronously. |
+ // |
+ // It will return the image by the ImageClient::OnIncomingCapturedData() |
+ // callback. If the video stream has to be stopped to capture the still image, |
+ // the Client::OnMute() and Client::OnUnmute() will be called. |
+ // |
+ // This function must be called between InitializeImageCapture() and |
+ // ReleaseImageCapture(). |
+ virtual void CaptureImage() {} |
+ |
protected: |
static const int kPowerLine50Hz = 50; |
static const int kPowerLine60Hz = 60; |