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

Side by Side Diff: ppapi/cpp/private/image_capture_private.h

Issue 848863002: PPAPI: implement GetSupportedPreviewSizes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address WuCheng's comments in Patch Set 9/10 Created 5 years, 10 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 unified diff | Download patch
OLDNEW
1 /* Copyright 2014 The Chromium Authors. All rights reserved. 1 /* Copyright 2014 The Chromium Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be 2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file. 3 * found in the LICENSE file.
4 */ 4 */
5 5
6 #ifndef PPAPI_CPP_PRIVATE_IMAGE_CAPTURE_PRIVATE_H_ 6 #ifndef PPAPI_CPP_PRIVATE_IMAGE_CAPTURE_PRIVATE_H_
7 #define PPAPI_CPP_PRIVATE_IMAGE_CAPTURE_PRIVATE_H_ 7 #define PPAPI_CPP_PRIVATE_IMAGE_CAPTURE_PRIVATE_H_
8 8
9 #include "ppapi/c/private/ppb_image_capture_private.h" 9 #include "ppapi/c/private/ppb_image_capture_private.h"
10 #include "ppapi/cpp/completion_callback.h"
11 #include "ppapi/cpp/private/camera_capabilities_private.h"
12 #include "ppapi/cpp/private/image_capture_config_private.h"
13 #include "ppapi/cpp/resource.h" 10 #include "ppapi/cpp/resource.h"
14 #include "ppapi/cpp/var.h" 11 #include "ppapi/cpp/var.h"
15 12
16 /// @file 13 /// @file
17 /// Defines the <code>ImageCapture_Private</code> interface. Used for 14 /// Defines the <code>ImageCapture_Private</code> interface. Used for
18 /// acquiring a single still image from a camera source. 15 /// acquiring a single still image from a camera source.
19 namespace pp { 16 namespace pp {
20 17
18 class CameraCapabilities_Private;
19 class CompletionCallback;
20 class ImageCaptureConfig_Private;
21 class InstanceHandle;
22
23 template <typename T>
24 class CompletionCallbackWithOutput;
25
21 /// To capture a still image with this class, use the following steps. 26 /// To capture a still image with this class, use the following steps.
22 /// 1. Create an ImageCapture_Private object by the constructor. 27 /// 1. Create an ImageCapture_Private object by the constructor.
23 /// 2. Call GetCameraCapabilities to get the supported preview sizes. 28 /// 2. Call GetCameraCapabilities to get the supported preview sizes.
24 /// 3. For optimal performance, set one of the supported preview size as the 29 /// 3. For optimal performance, set one of the supported preview size as the
25 /// constraints of getUserMedia. Use the created MediaStreamVideoTrack for 30 /// constraints of getUserMedia. Use the created MediaStreamVideoTrack for
26 /// camera previews. 31 /// camera previews.
27 /// 4. Set the same preview size and other settings by SetConfig. 32 /// 4. Set the same preview size and other settings by SetConfig.
28 /// 5. Call CaptureStillImage to capture a still image. Play the shutter sound 33 /// 5. Call CaptureStillImage to capture a still image. Play the shutter sound
29 /// in the shutter callback. The image from the preview callback can be used 34 /// in the shutter callback. The image from the preview callback can be used
30 /// for display. JPEG image will be returned to the JPEG callback. 35 /// for display. JPEG image will be returned to the JPEG callback.
31 class ImageCapture_Private { 36 class ImageCapture_Private : public Resource {
32 public: 37 public:
33 /// Default constructor for creating an is_null() 38 /// Default constructor for creating an is_null()
34 /// <code>ImageCapture_Private</code> object. 39 /// <code>ImageCapture_Private</code> object.
35 ImageCapture_Private(); 40 ImageCapture_Private();
36 41
37 /// Creates an ImageCapture_Private resource. 42 /// The copy constructor for <code>ImageCapture_Private</code>.
43 ///
44 /// @param[in] other A reference to a <code>ImageCapture_Private</code>.
45 ImageCapture_Private(const ImageCapture_Private& other);
46
47 /// Constructs an <code>ImageCapture_Private</code> from
48 /// a <code>Resource</code>.
49 ///
50 /// @param[in] resource A <code>PPB_ImageCapture_Private</code> resource.
51 explicit ImageCapture_Private(const Resource& resource);
52
53 /// Constructs an ImageCapture_Private resource.
38 /// 54 ///
39 /// @param[in] instance A <code>PP_Instance</code> identifying one instance 55 /// @param[in] instance A <code>PP_Instance</code> identifying one instance
40 /// of a module. 56 /// of a module.
57 ImageCapture_Private(const InstanceHandle& instance);
58
59 /// A constructor used when you have received a <code>PP_Resource</code> as a
60 /// return value that has had 1 ref added for you.
61 ///
62 /// @param[in] resource A <code>PPB_ImageCapture_Private</code> resource.
63 ImageCapture_Private(PassRef, PP_Resource resource);
64
65 // Destructor.
66 ~ImageCapture_Private();
67
68 /// Opens a video capture device.
69 ///
41 /// @param[in] camera_source_id A <code>Var</code> identifying a camera 70 /// @param[in] camera_source_id A <code>Var</code> identifying a camera
42 /// source. The type is string. The ID can be obtained from 71 /// source. The type is string. The ID can be obtained from
43 /// MediaStreamTrack.getSources() or MediaStreamVideoTrack.id. If a 72 /// MediaStreamTrack.getSources() or MediaStreamVideoTrack.id. If a
44 /// MediaStreamVideoTrack is associated with the same source and the track 73 /// MediaStreamVideoTrack is associated with the same source and the track
45 /// is closed, this ImageCapture_Private object can still do image capture. 74 /// is closed, this ImageCapture_Private object can still do image capture.
46 /// @param[in] error_callback A <code>ImageCapture_Private_ErrorCallback 75 /// @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
47 /// </code> callback to indicate the image capture has failed. 76 /// completion of <code>Open()</code>.
48 /// @param[inout] user_data An opaque pointer that will be passed to the
49 /// callbacks of ImageCapture_Private.
50 ImageCapture_Private(const InstanceHandle& instance,
51 const Var& camera_source_id,
52 PPB_ImageCapture_Private_ErrorCallback error_callback,
53 void* user_data);
54
55 /// Constructs a <code>ImageCapture_Private</code> from a <code>
56 /// Resource</code>.
57 /// 77 ///
58 /// @param[in] resource A <code>ImageCapture_Private</code> 78 /// @return An int32_t containing a result code from <code>pp_errors.h</code>.
59 /// resource. 79 int32_t Open(const Var& camera_source_id, const CompletionCallback& callback);
60 explicit ImageCapture_Private(const Resource& resource);
61
62 /// A constructor used when you have received a <code>PP_Resource</code> as a
63 /// return value that has had 1 ref added for you.
64 ///
65 /// @param[in] resource A <code>ImageCapture_Private</code>
66 /// resource.
67 ImageCapture_Private(PassRef, PP_Resource resource);
68
69 // Destructor.
70 ~ImageCapture_Private();
71 80
72 /// Disconnects from the camera and cancels all pending capture requests. 81 /// Disconnects from the camera and cancels all pending capture requests.
73 /// After this returns, no callbacks will be called. If <code> 82 /// After this returns, no callbacks will be called. If <code>
74 /// ImageCapture_Private</code> is destroyed and is not closed yet, this 83 /// ImageCapture_Private</code> is destroyed and is not closed yet, this
75 /// function will be automatically called. Calling this more than once has no 84 /// function will be automatically called. Calling this more than once has no
76 /// effect. 85 /// effect.
77 /// 86 void Close();
78 /// @param[in] callback <code>CompletionCallback</code> to be called upon
79 /// completion of <code>Close()</code>.
80 ///
81 /// @return An int32_t containing a result code from <code>pp_errors.h</code>.
82 int32_t Close(const CompletionCallback& callback);
83 87
84 /// Sets the configuration of the image capture. 88 /// Sets the configuration of the image capture.
85 /// If <code>SetConfig()</code> is not called, default settings will be used. 89 /// If <code>SetConfig()</code> is not called, default settings will be used.
86 /// 90 ///
87 /// @param[in] config A <code>ImageCaptureConfig_Private</code> object. 91 /// @param[in] config A <code>ImageCaptureConfig_Private</code> object.
88 /// @param[in] callback <code>CompletionCallback</code> to be called upon 92 /// @param[in] callback <code>CompletionCallback</code> to be called upon
89 /// completion of <code>SetConfig()</code>. 93 /// completion of <code>SetConfig()</code>.
90 /// 94 ///
91 /// @return An int32_t containing a result code from <code>pp_errors.h</code>. 95 /// @return An int32_t containing a result code from <code>pp_errors.h</code>.
92 /// Returns <code>PP_ERROR_INPROGRESS</code> if there is a pending call of 96 /// Returns <code>PP_ERROR_INPROGRESS</code> if there is a pending call of
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 /// 148 ///
145 /// @param[in] shutter_callback A <code> 149 /// @param[in] shutter_callback A <code>
146 /// ImageCapture_Private_ShutterCallback</code> callback to indicate the 150 /// ImageCapture_Private_ShutterCallback</code> callback to indicate the
147 /// image has been taken. 151 /// image has been taken.
148 /// @param[in] preview_callback A <code> 152 /// @param[in] preview_callback A <code>
149 /// ImageCapture_Private_PreviewCallback</code> callback to return a 153 /// ImageCapture_Private_PreviewCallback</code> callback to return a
150 /// preview of the captured image. 154 /// preview of the captured image.
151 /// @param[in] jpeg_callback A <code> 155 /// @param[in] jpeg_callback A <code>
152 /// ImageCapture_Private_JpegCallback</code> callback to return captured 156 /// ImageCapture_Private_JpegCallback</code> callback to return captured
153 /// JPEG image. 157 /// JPEG image.
158 /// @param[in] error_callback A <code>PPB_ImageCapture_Private_ErrorCallback
159 /// </code> callback to indicate <code>CaptureStillImage()</code> has failed.
wuchengli 2015/02/03 14:34:45 Forgot to remove.
Justin Chuang 2015/02/04 17:44:24 Done.
154 /// @param[out] sequence_id The sequence ID is a unique monotonically 160 /// @param[out] sequence_id The sequence ID is a unique monotonically
155 /// increasing value starting from 0, incremented every time a new request 161 /// increasing value starting from 0, incremented every time a new request
156 /// like image capture is submitted. 162 /// like image capture is submitted.
157 /// 163 ///
158 /// @return An int32_t containing a result code from <code>pp_errors.h</code>. 164 /// @return An int32_t containing a result code from <code>pp_errors.h</code>.
159 /// PP_OK means the callbacks will be triggered. Other values mean the 165 /// PP_OK means the callbacks will be triggered. Other values mean the
160 /// callbacks will not be triggered. 166 /// callbacks will not be triggered.
161 int32_t CaptureStillImage( 167 int32_t CaptureStillImage(
162 PPB_ImageCapture_Private_ShutterCallback shutter_callback, 168 PPB_ImageCapture_Private_ShutterCallback shutter_callback,
163 PPB_ImageCapture_Private_PreviewCallback preview_callback, 169 PPB_ImageCapture_Private_PreviewCallback preview_callback,
164 PPB_ImageCapture_Private_JpegCallback jpeg_callback, 170 PPB_ImageCapture_Private_JpegCallback jpeg_callback,
165 int64_t* sequence_id); 171 int64_t* sequence_id);
166 172
167 /// Determines if a resource is an image capture resource. 173 /// Determines if a resource is an image capture resource.
168 /// 174 ///
169 /// @param[in] resource The <code>Resource</code> to test. 175 /// @param[in] resource The <code>Resource</code> to test.
170 /// 176 ///
171 /// @return true if the given resource is an image capture resource or false 177 /// @return true if the given resource is an image capture resource or false
172 /// otherwise. 178 /// otherwise.
173 static bool IsImageCapture(const Resource& resource); 179 static bool IsImageCapture(const Resource& resource);
174 }; 180 };
175 181
176 } // namespace pp 182 } // namespace pp
177 183
178 #endif /* PPAPI_CPP_PRIVATE_IMAGE_CAPTURE_PRIVATE_H_ */ 184 #endif /* PPAPI_CPP_PRIVATE_IMAGE_CAPTURE_PRIVATE_H_ */
179
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698