4G_module/include/cmiot/cm_camera.h

151 lines
3.5 KiB
C
Raw Normal View History

2024-09-02 17:54:29 +08:00
/**
* @file cm_camera.h
* @brief
* @copyright Copyright @2023 China Mobile IOT. All rights reserved.
* @author By chenxy
* @date 2023/03/13
*
* @defgroup camera
* @ingroup camera
* @{
*/
#ifndef __CM_CAMERA_H__
#define __CM_CAMERA_H__
/****************************************************************************
* Included Files
****************************************************************************/
#include <stdint.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Public Types
****************************************************************************/
/**
* @brief camera数据输出类型
*/
typedef enum
{
CAM_OUT_FMT_YUV422_YUYV = 0,
CAM_OUT_FMT_YUV422_YVYU,
CAM_OUT_FMT_YUV422_UYVY,
CAM_OUT_FMT_YUV422_VYUY,
CAM_OUT_FMT_YUV420_NV12 = 6,
CAM_OUT_FMT_RAW8 = 10,
}cm_camera_out_fmt_e;
/**
* @brief camera预览接口配置参数
*/
typedef struct {
cm_camera_out_fmt_e recordFormat; /*!< 输出数据类型 */
void (*enqueueCamRecordBuffer)(void *pBuf, uint32_t len); /*!< 输出数据回调函数 */
void (*flushCamRecordBuffers)(void); /*!< 输出关闭回调 */
}cm_camera_preview_cfg_t;
/**
* @brief camera拍照接口配置参数
*/
typedef struct {
cm_camera_out_fmt_e recordFormat; /*!< 输出数据类型 */
uint8_t *file_name; /*!< 输出文件名 */
}cm_camera_capture_cfg_t;
/****************************************************************************
* Public Data
****************************************************************************/
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
#ifdef __cplusplus
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
/**
* @brief
*
* @param [out] width
* @param [out] height
*
* @return 0 -1
*
* @details
*/
int32_t cm_camera_get_info(uint32_t *width, uint32_t *height);
/**
* @brief
*
* @return 0 -1
*
* @details
*/
int32_t cm_camera_open(void);
/**
* @brief
*
* @return 0 -1
*
* @details
*/
int32_t cm_camera_close(void);
/**
* @brief
*
* @param [in] cfg
*
* @return 0 -1
*
* @details cfg中设置的回调函数返回
* cm_camera_preview_stop关闭预览cm_camera_close
*/
int32_t cm_camera_preview_start(cm_camera_preview_cfg_t *cfg);
/**
* @brief
*
* @return 0 -1
*
* @details
*/
int32_t cm_camera_preview_stop(void);
/**
* @brief
*
* @param [in] cfg
*
* @return 0 -1
*
* @details
*/
int32_t cm_camera_capture_take(cm_camera_capture_cfg_t *cfg);
#undef EXTERN
#ifdef __cplusplus
}
#endif
#endif /* __CM_CAMERA_H__ */
/** @}*/