1 /*
2  * Copyright (C) 2015-2020 Alibaba Group Holding Limited
3  *
4  */
5 
6 #ifndef __UVOICE_RECORDER_H__
7 #define __UVOICE_RECORDER_H__
8 
9 #include "uvoice_types.h"
10 
11 /** @defgroup uvoice_recoder_api uvoice_recoder
12  *  @ingroup uvoice_aos_api
13  * @{
14  */
15 
16 /** @brief 录音状态 */
17 typedef enum {
18 	RECORDER_STAT_IDLE = 0,
19 	RECORDER_STAT_READY,
20 	RECORDER_STAT_RUNNING,
21 	RECORDER_STAT_STOP,
22 	RECORDER_STAT_ERROR,
23 } recorder_state_t;
24 
25 /** @brief 录音接口 */
26 typedef struct {
27 	/** @brief 设置录音参数 */
28 	int (*set_sink)(media_format_t format, int rate, int channels, int bits, int frames, int bitrate, char *sink);
29 	int (*clr_sink)(void);
30 	int (*start)(void);
31 	int (*stop)(void);
32 	int (*get_stream)(uint8_t *buffer, int nbytes);
33 	int (*get_state)(recorder_state_t *state);
34 	int (*get_position)(int *position);
35 	int (*ns_enable)(int enable);
36 	int (*ec_enable)(int enable);
37 	int (*agc_enable)(int enable);
38 	int (*vad_enable)(int enable);
39 	int (*format_support)(media_format_t format);
40 	void *priv;
41 } uvoice_recorder_t;
42 
43 /**
44  * 创建录音handler
45  *
46  * @retrun 成功返回非NULL指针,失败返回NULL.
47  */
48 uvoice_recorder_t *uvoice_recorder_create(void);
49 
50 /**
51  * 释放录音handler
52  *
53  * @param[in]  mrecorder 创建录音handler时返回的指针.
54  *
55  * @return  0成功,其他失败.
56  */
57 int uvoice_recorder_release(uvoice_recorder_t *mrecorder);
58 
59 /**
60  * @}
61  */
62 
63 #endif /* __UVOICE_RECORDER_H__ */
64 
65