1 /* 2 * Copyright (C) 2021-2023 Alibaba Group Holding Limited 3 */ 4 5 #ifndef _CAMERA_SERVICE_H_ 6 #define _CAMERA_SERVICE_H_ 7 #include <stdint.h> 8 #include "ucamera_device.h" 9 #include "ucamera_common.h" 10 11 #define UCAMERA_PIX_FMT_YYUV 0 12 #define UCAMERA_PIX_FMT_AYUV32 1 13 #define UCAMERA_PIX_FMT_ARGB32 2 14 #define UCAMERA_PIX_FMT_BGRA32 3 15 #define UCAMERA_PIX_FMT_RGB24 4 16 #define UCAMERA_PIX_FMT_BGR24 5 17 #define UCAMERA_PIX_FMT_YUV420 6 18 #define UCAMERA_PIX_FMT_YUV420SP 7 19 #define UCAMERA_PIX_FMT_PNG 8 20 #define UCAMERA_PIX_FMT_JPEG 9 21 22 23 typedef struct _ucamera_context_t { 24 const char *name; 25 const char *desc; 26 int (*available) (void); 27 ucamera_device_t *(*create) (int devindex); 28 } ucamera_context_t; 29 30 extern ucamera_context_t wifi_camera; 31 32 33 /** @defgroup ucamera_aos_api ucamera 34 * @{ 35 */ 36 37 /** 38 * Init the ucamera module. 39 * 40 * @param[in] dev_name device name. 41 * @param[in] dev_name device name. 42 * 43 * @return 0 on success, negative error on failure. 44 */ 45 int32_t ucamera_service_init(const char *dev_name); 46 47 /** 48 * Uninit the ucamera module. 49 * 50 * @return 0 on success, negative error on failure. 51 */ 52 int32_t ucamera_service_uninit(void); 53 54 /** 55 * Get one frame of camera device. 56 57 * @return frame buffer content. 58 */ 59 frame_buffer_t *ucamera_service_get_frame(void); 60 61 /** 62 * Init the ucamera module. 63 * @param[in] frame frame buffer content. 64 * @param[in] path path of saving image. 65 66 * @return 0 on success, negative error on failure. 67 */ 68 int ucamera_service_save_frame(frame_buffer_t *frame, const char *path); 69 70 /** 71 * @} 72 */ 73 74 #endif // _WIFI_CAMERA_H_ 75