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

Unified Diff: media/video/capture/video_capture_device.h

Issue 545053002: Add still image capture interface for VideoCaptureDevice. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « no previous file | media/video/capture/video_capture_types.h » ('j') | media/video/capture/video_capture_types.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..105087ee41f60425362afe84f5de4b2e27751c6e 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
perkj_chrome 2014/09/17 11:25:58 s has been
Pawel Osciak 2014/09/17 11:29:42 s/has called/was called/ Is there any other case t
Owen Lin 2014/09/18 06:04:15 Hi, Pawel, I was thinking if the implementation do
+ // 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 {
Pawel Osciak 2014/09/17 11:29:42 StillImageClient here and everywhere?
wuchengli 2014/09/18 01:26:39 Image is symmetric to video. For example, ImageCap
+ public:
+ virtual ~ImageClient() {}
+
+ // Callback function to notify the client the caputred image is available.
Pawel Osciak 2014/09/17 11:29:42 s/caputred/captured
Owen Lin 2014/09/18 06:04:15 Done.
+ virtual void OnIncomingCapturedData(const uint8* data,
Pawel Osciak 2014/09/17 11:29:42 Let's call this differently, in case one class wan
Owen Lin 2014/09/18 06:04:15 It is unlikely to happen. Both function "AllocateA
+ int length,
+ const ImageCaptureFormat& format,
+ int rotation,
Pawel Osciak 2014/09/17 11:29:42 Please specify the parameters in the doc above.
Owen Lin 2014/09/18 06:04:15 Done.
+ base::TimeTicks timestamp) = 0;
+
+ // Callback function to notify client the failure of the image capture.
+ // 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/17 06:54:29 OK. Let's keep this for now. PPAPI uses the error
Pawel Osciak 2014/09/17 11:29:42 I'm wondering if we need to have a separate OnErro
wuchengli 2014/09/18 01:26:39 One thing to consider is we'll soon add doAutoFocu
Owen Lin 2014/09/18 06:04:15 Good point. I was thinking that. The main reason I
wuchengli 2014/09/18 08:55:08 I think having ImageClient interface is more consi
};
// 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(
Pawel Osciak 2014/09/17 11:29:42 StillImageFormats?
Owen Lin 2014/09/18 06:04:15 Let's keep using Image for consistency.
+ const Name& device,
+ ImageCaptureFormats* supported_formats);
Pawel Osciak 2014/09/17 11:29:42 What is the expectation for lifetime/ownership of
Owen Lin 2014/09/18 06:04:15 ImageCaputreFormats is actullay a vector<ImageCapt
+
// 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;
« no previous file with comments | « no previous file | media/video/capture/video_capture_types.h » ('j') | media/video/capture/video_capture_types.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698