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

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

Issue 884483007: Image Capture PPAPI: remove unused APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/resource.h" 10 #include "ppapi/cpp/resource.h"
11 #include "ppapi/cpp/var.h" 11 #include "ppapi/cpp/var.h"
12 12
13 /// @file 13 /// @file
14 /// Defines the <code>ImageCapture_Private</code> interface. Used for 14 /// Defines the <code>ImageCapture_Private</code> interface. Used for
15 /// acquiring a single still image from a camera source. 15 /// acquiring a single still image from a camera source.
16 namespace pp { 16 namespace pp {
17 17
18 class CameraCapabilities_Private; 18 class CameraCapabilities_Private;
19 class CompletionCallback; 19 class CompletionCallback;
20 class ImageCaptureConfig_Private;
21 class InstanceHandle; 20 class InstanceHandle;
22 21
23 template <typename T> 22 template <typename T>
24 class CompletionCallbackWithOutput; 23 class CompletionCallbackWithOutput;
25 24
26 /// To capture a still image with this class, use the following steps. 25 /// To capture a still image with this class, use the following steps.
27 /// 1. Create an ImageCapture_Private object by the constructor. 26 /// 1. Create an ImageCapture_Private object by the constructor.
28 /// 2. Call GetCameraCapabilities to get the supported preview sizes. 27 /// 2. Call GetCameraCapabilities to get the supported preview sizes.
29 /// 3. For optimal performance, set one of the supported preview size as the 28 /// 3. For optimal performance, set one of the supported preview size as the
30 /// constraints of getUserMedia. Use the created MediaStreamVideoTrack for 29 /// constraints of getUserMedia. Use the created MediaStreamVideoTrack for
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 /// @return An int32_t containing a result code from <code>pp_errors.h</code>. 77 /// @return An int32_t containing a result code from <code>pp_errors.h</code>.
79 int32_t Open(const Var& camera_source_id, const CompletionCallback& callback); 78 int32_t Open(const Var& camera_source_id, const CompletionCallback& callback);
80 79
81 /// Disconnects from the camera and cancels all pending capture requests. 80 /// Disconnects from the camera and cancels all pending capture requests.
82 /// After this returns, no callbacks will be called. If <code> 81 /// After this returns, no callbacks will be called. If <code>
83 /// ImageCapture_Private</code> is destroyed and is not closed yet, this 82 /// ImageCapture_Private</code> is destroyed and is not closed yet, this
84 /// function will be automatically called. Calling this more than once has no 83 /// function will be automatically called. Calling this more than once has no
85 /// effect. 84 /// effect.
86 void Close(); 85 void Close();
87 86
88 /// Sets the configuration of the image capture.
89 /// If <code>SetConfig()</code> is not called, default settings will be used.
90 ///
91 /// @param[in] config A <code>ImageCaptureConfig_Private</code> object.
92 /// @param[in] callback <code>CompletionCallback</code> to be called upon
93 /// completion of <code>SetConfig()</code>.
94 ///
95 /// @return An int32_t containing a result code from <code>pp_errors.h</code>.
96 /// Returns <code>PP_ERROR_INPROGRESS</code> if there is a pending call of
97 /// <code>SetConfig()</code> or <code>CaptureStillImage()</code>.
98 /// If an error is returned, the configuration will not be changed.
99 int32_t SetConfig(const ImageCaptureConfig_Private& config,
100 const CompletionCallback& callback);
101
102 /// Gets the configuration of the image capture.
103 ///
104 /// @param[in] callback A <code>CompletionCallbackWithOutput</code>
105 /// to be called upon completion.
106 ///
107 /// @return An int32_t containing a result code from <code>pp_errors.h</code>.
108 int32_t GetConfig(
109 const CompletionCallbackWithOutput<ImageCaptureConfig_Private>& callback);
110
111 /// Gets the camera capabilities. 87 /// Gets the camera capabilities.
112 /// 88 ///
113 /// The camera capabilities do not change for a given camera source. 89 /// The camera capabilities do not change for a given camera source.
114 /// 90 ///
115 /// @param[in] callback A <code>CompletionCallbackWithOutput</code> 91 /// @param[in] callback A <code>CompletionCallbackWithOutput</code>
116 /// to be called upon completion. 92 /// to be called upon completion.
117 /// 93 ///
118 /// @return An int32_t containing a result code from <code>pp_errors.h</code>. 94 /// @return An int32_t containing a result code from <code>pp_errors.h</code>.
119 int32_t GetCameraCapabilities( 95 int32_t GetCameraCapabilities(
120 const CompletionCallbackWithOutput<CameraCapabilities_Private>& callback); 96 const CompletionCallbackWithOutput<CameraCapabilities_Private>& callback);
121 97
122 /// Captures a still JPEG image from the camera.
123 ///
124 /// Triggers an asynchronous image capture. The camera will initiate a series
125 /// of callbacks to the application as the image capture progresses. The
126 /// callbacks will be invoked in the order of shutter callback, preview
127 /// callback, and JPEG callback. The shutter callback occurs after the image
128 /// is captured. This can be used to trigger a sound to let the user know that
129 /// image has been captured. The preview callback occurs when a scaled, fully
130 /// processed preview image is available. The JPEG callback occurs when the
131 /// compressed image is available. If there is an error after the capture is
132 /// in progress, the error callback passed to <code>
133 /// ImageCapture_Private.Create()</code> will be invoked. All the callbacks
134 /// are invoked by the thread that calls this function.
135 ///
136 /// The size of the preview image in preview callback is determined by
137 /// <code>ImageCaptureConfig_Private.SetPreviewSize</code>. The format is
138 /// decided by the camera and can be got from <code>VideoFrame.GetFormat
139 /// </code>. The size of the JPEG image is determined by <code>
140 /// ImageCaptureConfig_Private.SetJpegSize</code>.
141 ///
142 /// The camera may need to stop and re-start streaming during image capture.
143 /// If some MediaStreamVideoTrack are associated with the camera source, they
144 /// will receive mute and unmute events. The mute event will be received
145 /// before all the callbacks. The unmute event will be received after all the
146 /// callbacks. The preview image will not be sent to the video tracks
147 /// associated with the camera.
148 ///
149 /// @param[in] shutter_callback A <code>
150 /// ImageCapture_Private_ShutterCallback</code> callback to indicate the
151 /// image has been taken.
152 /// @param[in] preview_callback A <code>
153 /// ImageCapture_Private_PreviewCallback</code> callback to return a
154 /// preview of the captured image.
155 /// @param[in] jpeg_callback A <code>
156 /// ImageCapture_Private_JpegCallback</code> callback to return captured
157 /// JPEG image.
158 /// @param[in] error_callback A <code>PPB_ImageCapture_Private_ErrorCallback
159 /// </code> callback to indicate <code>CaptureStillImage()</code> has failed.
160 /// @param[out] sequence_id The sequence ID is a unique monotonically
161 /// increasing value starting from 0, incremented every time a new request
162 /// like image capture is submitted.
163 ///
164 /// @return An int32_t containing a result code from <code>pp_errors.h</code>.
165 /// PP_OK means the callbacks will be triggered. Other values mean the
166 /// callbacks will not be triggered.
167 int32_t CaptureStillImage(
168 PPB_ImageCapture_Private_ShutterCallback shutter_callback,
169 PPB_ImageCapture_Private_PreviewCallback preview_callback,
170 PPB_ImageCapture_Private_JpegCallback jpeg_callback,
171 int64_t* sequence_id);
172
173 /// Determines if a resource is an image capture resource. 98 /// Determines if a resource is an image capture resource.
174 /// 99 ///
175 /// @param[in] resource The <code>Resource</code> to test. 100 /// @param[in] resource The <code>Resource</code> to test.
176 /// 101 ///
177 /// @return true if the given resource is an image capture resource or false 102 /// @return true if the given resource is an image capture resource or false
178 /// otherwise. 103 /// otherwise.
179 static bool IsImageCapture(const Resource& resource); 104 static bool IsImageCapture(const Resource& resource);
180 }; 105 };
181 106
182 } // namespace pp 107 } // namespace pp
183 108
184 #endif /* PPAPI_CPP_PRIVATE_IMAGE_CAPTURE_PRIVATE_H_ */ 109 #endif /* PPAPI_CPP_PRIVATE_IMAGE_CAPTURE_PRIVATE_H_ */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698