8 #ifndef META_OCEAN_MEDIA_ANDROID_NATIVE_CAMERA_LIBRARY_H
9 #define META_OCEAN_MEDIA_ANDROID_NATIVE_CAMERA_LIBRARY_H
17 #if defined(__ANDROID_API__) && __ANDROID_API__ >= 24
19 #ifndef OCEAN_MEDIA_ANDROID_NATIVECAMERALIBRARY_AVAILABLE
20 #define OCEAN_MEDIA_ANDROID_NATIVECAMERALIBRARY_AVAILABLE
23 #include <camera/NdkCaptureRequest.h>
25 #include <camera/NdkCameraCaptureSession.h>
26 #include <camera/NdkCameraDevice.h>
27 #include <camera/NdkCameraManager.h>
143 using Function_ACameraDevice_createCaptureSession = camera_status_t (ACameraDevice* device,
const ACaptureSessionOutputContainer* outputs,
const ACameraCaptureSession_stateCallbacks* callbacks, ACameraCaptureSession** session);
187 using Function_ACameraCaptureSession_capture = camera_status_t (ACameraCaptureSession* session, ACameraCaptureSession_captureCallbacks* callbacks,
int numRequests, ACaptureRequest** requests,
int* captureSequenceId);
205 inline bool isInitialized()
const;
210 inline camera_status_t ACameraDevice_close(ACameraDevice* device);
211 inline const char* ACameraDevice_getId(
const ACameraDevice* device);
212 inline camera_status_t ACameraDevice_createCaptureRequest(
const ACameraDevice* device, ACameraDevice_request_template templateId, ACaptureRequest** request);
213 inline camera_status_t ACaptureSessionOutputContainer_create(ACaptureSessionOutputContainer** container);
214 inline void ACaptureSessionOutputContainer_free(ACaptureSessionOutputContainer* container);
215 inline camera_status_t ACaptureSessionOutput_create(ANativeWindow* anw, ACaptureSessionOutput** output);
216 inline void ACaptureSessionOutput_free(ACaptureSessionOutput* output);
217 inline camera_status_t ACaptureSessionOutputContainer_add(ACaptureSessionOutputContainer* container,
const ACaptureSessionOutput* output);
218 inline camera_status_t ACaptureSessionOutputContainer_remove(ACaptureSessionOutputContainer* container,
const ACaptureSessionOutput* output);
219 inline camera_status_t ACameraDevice_createCaptureSession(ACameraDevice* device,
const ACaptureSessionOutputContainer* outputs,
const ACameraCaptureSession_stateCallbacks* callbacks, ACameraCaptureSession** session);
224 inline ACameraManager* ACameraManager_create();
225 inline void ACameraManager_delete(ACameraManager* manager);
226 inline camera_status_t ACameraManager_getCameraIdList(ACameraManager* manager, ACameraIdList** cameraIdList);
227 inline void ACameraManager_deleteCameraIdList(ACameraIdList* cameraIdList);
228 inline camera_status_t ACameraManager_registerAvailabilityCallback(ACameraManager* manager,
const ACameraManager_AvailabilityCallbacks* callback);
229 inline camera_status_t ACameraManager_unregisterAvailabilityCallback(ACameraManager* manager,
const ACameraManager_AvailabilityCallbacks* callback);
230 inline camera_status_t ACameraManager_getCameraCharacteristics(ACameraManager* manager,
const char* cameraId, ACameraMetadata** characteristics);
231 inline camera_status_t ACameraManager_openCamera(ACameraManager* manager,
const char* cameraId, ACameraDevice_StateCallbacks* callback, ACameraDevice** device);
236 inline camera_status_t ACameraMetadata_getConstEntry(
const ACameraMetadata* metadata, uint32_t tag, ACameraMetadata_const_entry* entry);
237 inline camera_status_t ACameraMetadata_getAllTags(
const ACameraMetadata* metadata, int32_t* numEntries,
const uint32_t** tags);
238 inline ACameraMetadata* ACameraMetadata_copy(
const ACameraMetadata* src);
239 inline void ACameraMetadata_free(ACameraMetadata* metadata);
244 inline camera_status_t ACameraOutputTarget_create(ANativeWindow* window, ACameraOutputTarget** output);
245 inline void ACameraOutputTarget_free(ACameraOutputTarget* output);
246 inline camera_status_t ACaptureRequest_addTarget(ACaptureRequest* request,
const ACameraOutputTarget* output);
247 inline camera_status_t ACaptureRequest_removeTarget(ACaptureRequest* request,
const ACameraOutputTarget* output);
248 inline camera_status_t ACaptureRequest_getConstEntry(
const ACaptureRequest* request, uint32_t tag, ACameraMetadata_const_entry* entry);
249 inline camera_status_t ACaptureRequest_getAllTags(
const ACaptureRequest* request, int32_t* numTags,
const uint32_t** tags);
250 inline camera_status_t ACaptureRequest_setEntry_u8(ACaptureRequest* request, uint32_t tag, uint32_t count,
const uint8_t* data);
251 inline camera_status_t ACaptureRequest_setEntry_i32(ACaptureRequest* request, uint32_t tag, uint32_t count,
const int32_t* data);
252 inline camera_status_t ACaptureRequest_setEntry_float(ACaptureRequest* request, uint32_t tag, uint32_t count,
const float* data);
253 inline camera_status_t ACaptureRequest_setEntry_i64(ACaptureRequest* request, uint32_t tag, uint32_t count,
const int64_t* data);
254 inline camera_status_t ACaptureRequest_setEntry_double(ACaptureRequest* request, uint32_t tag, uint32_t count,
const double* data);
255 inline camera_status_t ACaptureRequest_setEntry_rational(ACaptureRequest* request, uint32_t tag, uint32_t count,
const ACameraMetadata_rational* data);
256 inline void ACaptureRequest_free(ACaptureRequest* request);
261 inline void ACameraCaptureSession_close(ACameraCaptureSession* session);
262 inline camera_status_t ACameraCaptureSession_getDevice(ACameraCaptureSession* session, ACameraDevice** device);
263 inline camera_status_t ACameraCaptureSession_capture(ACameraCaptureSession* session, ACameraCaptureSession_captureCallbacks* callbacks,
int numRequests, ACaptureRequest** requests,
int* captureSequenceId);
264 inline camera_status_t ACameraCaptureSession_setRepeatingRequest(ACameraCaptureSession* session, ACameraCaptureSession_captureCallbacks* callbacks,
int numRequests, ACaptureRequest** requests,
int* captureSequenceId);
265 inline camera_status_t ACameraCaptureSession_stopRepeating(ACameraCaptureSession* session);
266 inline camera_status_t ACameraCaptureSession_abortCaptures(ACameraCaptureSession* session);
294 void* libraryHandle_ =
nullptr;
348 unsigned int initializationCounter_ = 0u;
381 ocean_assert(ACameraDevice_close_ !=
nullptr);
383 return ACameraDevice_close_(device);
389 ocean_assert(ACameraDevice_getId_ !=
nullptr);
391 return ACameraDevice_getId_(device);
397 ocean_assert(ACameraDevice_createCaptureRequest_ !=
nullptr);
399 return ACameraDevice_createCaptureRequest_(device, templateId, request);
405 ocean_assert(ACaptureSessionOutputContainer_create_ !=
nullptr);
407 return ACaptureSessionOutputContainer_create_(container);
413 ocean_assert(ACaptureSessionOutputContainer_free_ !=
nullptr);
415 ACaptureSessionOutputContainer_free_(container);
421 ocean_assert(ACaptureSessionOutput_create_ !=
nullptr);
423 return ACaptureSessionOutput_create_(anw, output);
429 ocean_assert(ACaptureSessionOutput_free_ !=
nullptr);
431 ACaptureSessionOutput_free_(output);
437 ocean_assert(ACaptureSessionOutputContainer_add_ !=
nullptr);
439 return ACaptureSessionOutputContainer_add_(container, output);
445 ocean_assert(ACaptureSessionOutputContainer_remove_ !=
nullptr);
447 return ACaptureSessionOutputContainer_remove_(container, output);
453 ocean_assert(ACameraDevice_createCaptureSession_ !=
nullptr);
455 return ACameraDevice_createCaptureSession_(device, outputs, callbacks, session);
461 ocean_assert(ACameraManager_create_ !=
nullptr);
463 return ACameraManager_create_();
469 ocean_assert(ACameraManager_delete_ !=
nullptr);
471 ACameraManager_delete_(manager);
477 ocean_assert(ACameraManager_getCameraIdList_ !=
nullptr);
479 return ACameraManager_getCameraIdList_(manager, cameraIdList);
485 ocean_assert(ACameraManager_deleteCameraIdList_ !=
nullptr);
487 ACameraManager_deleteCameraIdList_(cameraIdList);
493 ocean_assert(ACameraManager_registerAvailabilityCallback_ !=
nullptr);
495 return ACameraManager_registerAvailabilityCallback_(manager, callback);
501 ocean_assert(ACameraManager_unregisterAvailabilityCallback_ !=
nullptr);
503 return ACameraManager_unregisterAvailabilityCallback_(manager, callback);
509 ocean_assert(ACameraManager_getCameraCharacteristics_ !=
nullptr);
511 return ACameraManager_getCameraCharacteristics_(manager, cameraId, characteristics);
517 ocean_assert(ACameraManager_openCamera_ !=
nullptr);
519 return ACameraManager_openCamera_(manager, cameraId, callback, device);
525 ocean_assert(ACameraMetadata_getConstEntry_ !=
nullptr);
527 return ACameraMetadata_getConstEntry_(metadata, tag, entry);
533 ocean_assert(ACameraMetadata_getAllTags_ !=
nullptr);
535 return ACameraMetadata_getAllTags_(metadata, numEntries, tags);
541 ocean_assert(ACameraMetadata_copy_ !=
nullptr);
543 return ACameraMetadata_copy_(src);
549 ocean_assert(ACameraMetadata_free_ !=
nullptr);
551 ACameraMetadata_free_(metadata);
557 ocean_assert(ACameraOutputTarget_create_ !=
nullptr);
559 return ACameraOutputTarget_create_(window, output);
565 ocean_assert(ACameraOutputTarget_free_ !=
nullptr);
567 return ACameraOutputTarget_free_(output);
573 ocean_assert(ACaptureRequest_addTarget_ !=
nullptr);
575 return ACaptureRequest_addTarget_(request, output);
581 ocean_assert(ACaptureRequest_removeTarget_ !=
nullptr);
583 return ACaptureRequest_removeTarget_(request, output);
589 ocean_assert(ACaptureRequest_getConstEntry_ !=
nullptr);
591 return ACaptureRequest_getConstEntry_(request, tag, entry);
597 ocean_assert(ACaptureRequest_getAllTags_ !=
nullptr);
599 return ACaptureRequest_getAllTags_(request, numTags, tags);
605 ocean_assert(ACaptureRequest_setEntry_u8_ !=
nullptr);
607 return ACaptureRequest_setEntry_u8_(request, tag, count, data);
613 ocean_assert(ACaptureRequest_setEntry_i32_ !=
nullptr);
615 return ACaptureRequest_setEntry_i32_(request, tag, count, data);
621 ocean_assert(ACaptureRequest_setEntry_float_ !=
nullptr);
623 return ACaptureRequest_setEntry_float_(request, tag, count, data);
629 ocean_assert(ACaptureRequest_setEntry_i64_ !=
nullptr);
631 return ACaptureRequest_setEntry_i64_(request, tag, count, data);
637 ocean_assert(ACaptureRequest_setEntry_double_ !=
nullptr);
639 return ACaptureRequest_setEntry_double_(request, tag, count, data);
645 ocean_assert(ACaptureRequest_setEntry_rational_ !=
nullptr);
647 return ACaptureRequest_setEntry_rational_(request, tag, count, data);
653 ocean_assert(ACaptureRequest_free_ !=
nullptr);
655 ACaptureRequest_free_(request);
661 ocean_assert(ACameraCaptureSession_close_ !=
nullptr);
663 ACameraCaptureSession_close_(session);
669 ocean_assert(ACameraCaptureSession_getDevice_ !=
nullptr);
671 return ACameraCaptureSession_getDevice_(session, device);
677 ocean_assert(ACameraCaptureSession_capture_ !=
nullptr);
679 return ACameraCaptureSession_capture_(session, callbacks, numRequests, requests, captureSequenceId);
685 ocean_assert(ACameraCaptureSession_setRepeatingRequest_ !=
nullptr);
687 return ACameraCaptureSession_setRepeatingRequest_(session, callbacks, numRequests, requests, captureSequenceId);
693 ocean_assert(ACameraCaptureSession_stopRepeating_ !=
nullptr);
695 return ACameraCaptureSession_stopRepeating_(session);
701 ocean_assert(ACameraCaptureSession_abortCaptures_ !=
nullptr);
703 return ACameraCaptureSession_abortCaptures_(session);
This class implements a recursive lock object.
Definition: Lock.h:31
This class implements a scoped lock object for recursive lock objects.
Definition: Lock.h:135
This class wraps an unmanaged object (or reference) which needs to be released after usage.
Definition: ScopedObject.h:28
This template class is the base class for all singleton objects.
Definition: Singleton.h:71
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15