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

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
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..fff3243fdfc210775f41ee6ffb363a55f5c69121 100644
--- a/media/video/capture/video_capture_device.h
+++ b/media/video/capture/video_capture_device.h
@@ -216,6 +216,30 @@ class MEDIA_EXPORT VideoCaptureDevice {
// VideoCaptureDevice requests the |message| to be logged.
virtual void OnLog(const std::string& message) {}
+
+ // The video stream is being muted. After this callback, no more
wuchengli 2014/09/09 05:53:22 s/is being/has/
Owen Lin 2014/09/11 06:17:59 Done.
+ // OnIncomingCapturedData() will be called.
wuchengli 2014/09/09 05:53:21 Explain OnMute and OnUnmute are called when image
Owen Lin 2014/09/11 06:17:59 Done.
+ virtual void OnMute() {}
+
+ // The video stream is being resumed.
wuchengli 2014/09/09 05:53:22 s/is being/has/
Owen Lin 2014/09/11 06:18:00 Done.
+ 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.
+ // The VideoCaptureDevice must be StopAndDeAllocate()-ed. |reason| is a
wuchengli 2014/09/09 05:53:22 s/StopAndDeAllocate/CloseImageCapture/
Owen Lin 2014/09/11 06:17:59 I do mean StopAndDeallocate. In the current implem
+ // text description of the error.
+ virtual void OnError(const std::string& reason) = 0;
};
// Creates a VideoCaptureDevice object.
@@ -235,6 +259,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 +288,21 @@ 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 is used to allocate resources.
wuchengli 2014/09/09 05:53:22 Does the caller require to start the video stream
Owen Lin 2014/09/11 06:17:59 Yes. Comment added.
+ virtual void InitializeImageCapture(const ImageCaptureFormat& image_format,
wuchengli 2014/09/09 05:53:22 Using AllocateImageCapture and DeAllocateImageCapt
Owen Lin 2014/09/11 06:17:59 The problem is we may not really allocate resource
+ scoped_ptr<ImageClient> client);
+
+ // Releases used resources for image capture.
wuchengli 2014/09/09 05:53:22 s/used// Does CloseImageCapture have to be called
Owen Lin 2014/09/11 06:18:00 Command added. It has to be called before StopAndD
+ virtual void CloseImageCapture() {}
+
+ // Gets one image from the device. It will returne the picture by the
wuchengli 2014/09/09 05:53:21 s/returne/return/. s/picture/image/.
Owen Lin 2014/09/11 06:18:00 Done.
+ // ImageClient's OnIncomingCapturedData() callback.
wuchengli 2014/09/09 05:53:21 ImageClient::OnIncomingCapturedData(). Also mentio
Owen Lin 2014/09/11 06:17:59 Done.
+ //
+ // This function must be called between InitializeImageCapture() and
+ // CloseImageCapture().
+ 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_device.cc » ('j') | media/video/capture/video_capture_device.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698