123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 |
- #ifndef __IFLY_WINREC_H__
- #define __IFLY_WINREC_H__
- #include "formats.h"
- enum {
- RECORD_ERR_BASE = 0,
- RECORD_ERR_GENERAL,
- RECORD_ERR_MEMFAIL,
- RECORD_ERR_INVAL,
- RECORD_ERR_NOT_READY
- };
- typedef struct {
- union {
- char * name;
- int index;
- void * resv;
- }u;
- }record_dev_id;
- struct recorder {
- void (*on_data_ind)(char *data, unsigned long len, void *user_para);
- void * user_cb_para;
- volatile int state;
- void * wavein_hdl;
-
- pthread_t rec_thread;
-
- void * bufheader;
- unsigned int bufcount;
-
- char *audiobuf;
- int bits_per_frame;
- unsigned int buffer_time;
- unsigned int period_time;
- size_t period_frames;
- size_t buffer_frames;
- };
- #ifdef __cplusplus
- extern "C" {
- #endif
- record_dev_id get_default_input_dev();
- int get_input_dev_num();
- int create_recorder(struct recorder ** out_rec,
- void (*on_data_ind)(char *data, unsigned long len, void *user_para),
- void* user_cb_para);
- void destroy_recorder(struct recorder *rec);
- int open_recorder(struct recorder * rec, record_dev_id dev, WAVEFORMATEX * fmt);
- void close_recorder(struct recorder *rec);
- int start_record(struct recorder * rec);
- int stop_record(struct recorder * rec);
- int is_record_stopped(struct recorder *rec);
- #ifdef __cplusplus
- }
- #endif
- #endif
|