PageRenderTime 44ms CodeModel.GetById 23ms RepoModel.GetById 2ms app.codeStats 0ms

/include/camera/ndk/NdkCaptureRequest.h

https://gitlab.com/jhalayashraj/android_frameworks_av4
C Header | 309 lines | 39 code | 24 blank | 246 comment | 0 complexity | 5a0fac93a3a6914ec63d9e5384de9580 MD5 | raw file
  1. /*
  2. * Copyright (C) 2015 The Android Open Source Project
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. /**
  17. * @addtogroup Camera
  18. * @{
  19. */
  20. /**
  21. * @file NdkCaptureRequest.h
  22. */
  23. /*
  24. * This file defines an NDK API.
  25. * Do not remove methods.
  26. * Do not change method signatures.
  27. * Do not change the value of constants.
  28. * Do not change the size of any of the classes defined in here.
  29. * Do not reference types that are not part of the NDK.
  30. * Do not #include files that aren't part of the NDK.
  31. */
  32. #include <android/native_window.h>
  33. #include "NdkCameraError.h"
  34. #include "NdkCameraMetadata.h"
  35. #ifndef _NDK_CAPTURE_REQUEST_H
  36. #define _NDK_CAPTURE_REQUEST_H
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40. // Container for output targets
  41. typedef struct ACameraOutputTargets ACameraOutputTargets;
  42. // Container for a single output target
  43. typedef struct ACameraOutputTarget ACameraOutputTarget;
  44. /**
  45. * ACaptureRequest is an opaque type that contains settings and output targets needed to capture
  46. * a single image from camera device.
  47. *
  48. * <p>ACaptureRequest contains the configuration for the capture hardware (sensor, lens, flash),
  49. * the processing pipeline, the control algorithms, and the output buffers. Also
  50. * contains the list of target {@link ANativeWindow}s to send image data to for this
  51. * capture.</p>
  52. *
  53. * <p>ACaptureRequest is created by {@link ACameraDevice_createCaptureRequest}.
  54. *
  55. * <p>ACaptureRequest is given to {@link ACameraCaptureSession_capture} or
  56. * {@link ACameraCaptureSession_setRepeatingRequest} to capture images from a camera.</p>
  57. *
  58. * <p>Each request can specify a different subset of target {@link ANativeWindow}s for the
  59. * camera to send the captured data to. All the {@link ANativeWindow}s used in a request must
  60. * be part of the {@link ANativeWindow} list given to the last call to
  61. * {@link ACameraDevice_createCaptureSession}, when the request is submitted to the
  62. * session.</p>
  63. *
  64. * <p>For example, a request meant for repeating preview might only include the
  65. * {@link ANativeWindow} for the preview SurfaceView or SurfaceTexture, while a
  66. * high-resolution still capture would also include a {@link ANativeWindow} from a
  67. * {@link AImageReader} configured for high-resolution JPEG images.</p>
  68. *
  69. * @see ACameraDevice_createCaptureRequest
  70. * @see ACameraCaptureSession_capture
  71. * @see ACameraCaptureSession_setRepeatingRequest
  72. */
  73. typedef struct ACaptureRequest ACaptureRequest;
  74. /**
  75. * Create a ACameraOutputTarget object.
  76. *
  77. * <p>The ACameraOutputTarget is used in {@link ACaptureRequest_addTarget} method to add an output
  78. * {@link ANativeWindow} to ACaptureRequest. Use {@link ACameraOutputTarget_free} to free the object
  79. * and its memory after application no longer needs the {@link ACameraOutputTarget}.</p>
  80. *
  81. * @param window the {@link ANativeWindow} to be associated with the {@link ACameraOutputTarget}
  82. * @param output the output {@link ACameraOutputTarget} will be stored here if the
  83. * method call succeeds.
  84. *
  85. * @return <ul>
  86. * <li>{@link ACAMERA_OK} if the method call succeeds. The created ACameraOutputTarget will
  87. * be filled in the output argument.</li>
  88. * <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if window or output is NULL.</li></ul>
  89. *
  90. * @see ACaptureRequest_addTarget
  91. */
  92. camera_status_t ACameraOutputTarget_create(ANativeWindow* window, ACameraOutputTarget** output);
  93. /**
  94. * Free a ACameraOutputTarget object.
  95. *
  96. * @param output the {@link ACameraOutputTarget} to be freed.
  97. *
  98. * @see ACameraOutputTarget_create
  99. */
  100. void ACameraOutputTarget_free(ACameraOutputTarget* output);
  101. /**
  102. * Add an {@link ACameraOutputTarget} object to {@link ACaptureRequest}.
  103. *
  104. * @param request the {@link ACaptureRequest} of interest.
  105. * @param output the output {@link ACameraOutputTarget} to be added to capture request.
  106. *
  107. * @return <ul>
  108. * <li>{@link ACAMERA_OK} if the method call succeeds.</li>
  109. * <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if request or output is NULL.</li></ul>
  110. */
  111. camera_status_t ACaptureRequest_addTarget(ACaptureRequest* request,
  112. const ACameraOutputTarget* output);
  113. /**
  114. * Remove an {@link ACameraOutputTarget} object from {@link ACaptureRequest}.
  115. *
  116. * <p>This method has no effect if the ACameraOutputTarget does not exist in ACaptureRequest.</p>
  117. *
  118. * @param request the {@link ACaptureRequest} of interest.
  119. * @param output the output {@link ACameraOutputTarget} to be removed from capture request.
  120. *
  121. * @return <ul>
  122. * <li>{@link ACAMERA_OK} if the method call succeeds.</li>
  123. * <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if request or output is NULL.</li></ul>
  124. */
  125. camera_status_t ACaptureRequest_removeTarget(ACaptureRequest* request,
  126. const ACameraOutputTarget* output);
  127. /**
  128. * Get a metadata entry from input {@link ACaptureRequest}.
  129. *
  130. * <p>The memory of the data field in returned entry is managed by camera framework. Do not
  131. * attempt to free it.</p>
  132. *
  133. * @param request the {@link ACaptureRequest} of interest.
  134. * @param tag the tag value of the camera metadata entry to be get.
  135. * @param entry the output {@link ACameraMetadata_const_entry} will be filled here if the method
  136. * call succeeeds.
  137. *
  138. * @return <ul>
  139. * <li>{@link ACAMERA_OK} if the method call succeeds.</li>
  140. * <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if metadata or entry is NULL.</li>
  141. * <li>{@link ACAMERA_ERROR_METADATA_NOT_FOUND} if the capture request does not contain an
  142. * entry of input tag value.</li></ul>
  143. */
  144. camera_status_t ACaptureRequest_getConstEntry(
  145. const ACaptureRequest* request, uint32_t tag, ACameraMetadata_const_entry* entry);
  146. /*
  147. * List all the entry tags in input {@link ACaptureRequest}.
  148. *
  149. * @param request the {@link ACaptureRequest} of interest.
  150. * @param numEntries number of metadata entries in input {@link ACaptureRequest}
  151. * @param tags the tag values of the metadata entries. Length of tags is returned in numEntries
  152. * argument. The memory is managed by ACaptureRequest itself and must NOT be free/delete
  153. * by application. Calling ACaptureRequest_setEntry_* methods will invalidate previous
  154. * output of ACaptureRequest_getAllTags. Do not access tags after calling
  155. * ACaptureRequest_setEntry_*. To get new list of tags after updating capture request,
  156. * application must call ACaptureRequest_getAllTags again. Do NOT access tags after
  157. * calling ACaptureRequest_free.
  158. *
  159. * @return <ul>
  160. * <li>{@link ACAMERA_OK} if the method call succeeds.</li>
  161. * <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if request, numEntries or tags is NULL.</li>
  162. * <li>{@link ACAMERA_ERROR_UNKNOWN} if the method fails for some other reasons.</li></ul>
  163. */
  164. camera_status_t ACaptureRequest_getAllTags(
  165. const ACaptureRequest* request, /*out*/int32_t* numTags, /*out*/const uint32_t** tags);
  166. /**
  167. * Set/change a camera capture control entry with unsigned 8 bits data type.
  168. *
  169. * <p>Set count to 0 and data to NULL to remove a tag from the capture request.</p>
  170. *
  171. * @param request the {@link ACaptureRequest} of interest.
  172. * @param tag the tag value of the camera metadata entry to be set.
  173. * @param count number of elements to be set in data argument
  174. * @param data the entries to be set/change in the capture request.
  175. *
  176. * @return <ul>
  177. * <li>{@link ACAMERA_OK} if the method call succeeds.</li>
  178. * <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if request is NULL, count is larger than
  179. * zero while data is NULL, the data type of the tag is not unsigned 8 bits, or
  180. * the tag is not controllable by application.</li></ul>
  181. */
  182. camera_status_t ACaptureRequest_setEntry_u8(
  183. ACaptureRequest* request, uint32_t tag, uint32_t count, const uint8_t* data);
  184. /**
  185. * Set/change a camera capture control entry with signed 32 bits data type.
  186. *
  187. * <p>Set count to 0 and data to NULL to remove a tag from the capture request.</p>
  188. *
  189. * @param request the {@link ACaptureRequest} of interest.
  190. * @param tag the tag value of the camera metadata entry to be set.
  191. * @param count number of elements to be set in data argument
  192. * @param data the entries to be set/change in the capture request.
  193. *
  194. * @return <ul>
  195. * <li>{@link ACAMERA_OK} if the method call succeeds.</li>
  196. * <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if request is NULL, count is larger than
  197. * zero while data is NULL, the data type of the tag is not signed 32 bits, or
  198. * the tag is not controllable by application.</li></ul>
  199. */
  200. camera_status_t ACaptureRequest_setEntry_i32(
  201. ACaptureRequest* request, uint32_t tag, uint32_t count, const int32_t* data);
  202. /**
  203. * Set/change a camera capture control entry with float data type.
  204. *
  205. * <p>Set count to 0 and data to NULL to remove a tag from the capture request.</p>
  206. *
  207. * @param request the {@link ACaptureRequest} of interest.
  208. * @param tag the tag value of the camera metadata entry to be set.
  209. * @param count number of elements to be set in data argument
  210. * @param data the entries to be set/change in the capture request.
  211. *
  212. * @return <ul>
  213. * <li>{@link ACAMERA_OK} if the method call succeeds.</li>
  214. * <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if request is NULL, count is larger than
  215. * zero while data is NULL, the data type of the tag is not float, or
  216. * the tag is not controllable by application.</li></ul>
  217. */
  218. camera_status_t ACaptureRequest_setEntry_float(
  219. ACaptureRequest* request, uint32_t tag, uint32_t count, const float* data);
  220. /**
  221. * Set/change a camera capture control entry with signed 64 bits data type.
  222. *
  223. * <p>Set count to 0 and data to NULL to remove a tag from the capture request.</p>
  224. *
  225. * @param request the {@link ACaptureRequest} of interest.
  226. * @param tag the tag value of the camera metadata entry to be set.
  227. * @param count number of elements to be set in data argument
  228. * @param data the entries to be set/change in the capture request.
  229. *
  230. * @return <ul>
  231. * <li>{@link ACAMERA_OK} if the method call succeeds.</li>
  232. * <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if request is NULL, count is larger than
  233. * zero while data is NULL, the data type of the tag is not signed 64 bits, or
  234. * the tag is not controllable by application.</li></ul>
  235. */
  236. camera_status_t ACaptureRequest_setEntry_i64(
  237. ACaptureRequest* request, uint32_t tag, uint32_t count, const int64_t* data);
  238. /**
  239. * Set/change a camera capture control entry with double data type.
  240. *
  241. * <p>Set count to 0 and data to NULL to remove a tag from the capture request.</p>
  242. *
  243. * @param request the {@link ACaptureRequest} of interest.
  244. * @param tag the tag value of the camera metadata entry to be set.
  245. * @param count number of elements to be set in data argument
  246. * @param data the entries to be set/change in the capture request.
  247. *
  248. * @return <ul>
  249. * <li>{@link ACAMERA_OK} if the method call succeeds.</li>
  250. * <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if request is NULL, count is larger than
  251. * zero while data is NULL, the data type of the tag is not double, or
  252. * the tag is not controllable by application.</li></ul>
  253. */
  254. camera_status_t ACaptureRequest_setEntry_double(
  255. ACaptureRequest* request, uint32_t tag, uint32_t count, const double* data);
  256. /**
  257. * Set/change a camera capture control entry with rational data type.
  258. *
  259. * <p>Set count to 0 and data to NULL to remove a tag from the capture request.</p>
  260. *
  261. * @param request the {@link ACaptureRequest} of interest.
  262. * @param tag the tag value of the camera metadata entry to be set.
  263. * @param count number of elements to be set in data argument
  264. * @param data the entries to be set/change in the capture request.
  265. *
  266. * @return <ul>
  267. * <li>{@link ACAMERA_OK} if the method call succeeds.</li>
  268. * <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if request is NULL, count is larger than
  269. * zero while data is NULL, the data type of the tag is not rational, or
  270. * the tag is not controllable by application.</li></ul>
  271. */
  272. camera_status_t ACaptureRequest_setEntry_rational(
  273. ACaptureRequest* request, uint32_t tag, uint32_t count,
  274. const ACameraMetadata_rational* data);
  275. /**
  276. * Free a {@link ACaptureRequest} structure.
  277. *
  278. * @param request the {@link ACaptureRequest} to be freed.
  279. */
  280. void ACaptureRequest_free(ACaptureRequest* request);
  281. #ifdef __cplusplus
  282. } // extern "C"
  283. #endif
  284. #endif // _NDK_CAPTURE_REQUEST_H
  285. /** @} */