blob: 7c7376efa7818f83e6cf46a379dc9beaf3ec9f0d
1 | |
2 | #ifndef __ADEC_WRITE_H__ |
3 | #define __ADEC_WRITE_H__ |
4 | |
5 | #include <pthread.h> |
6 | #include <stdlib.h> |
7 | #include<stdio.h> |
8 | #include <string.h> |
9 | |
10 | #define DEFAULT_BUFFER_SIZE 1024*1024 |
11 | #define MIN(a,b) (a>b)?b:a |
12 | |
13 | typedef struct buffer_stream_st { |
14 | int buf_length; |
15 | int buf_level; |
16 | unsigned char * data; |
17 | unsigned char * rd_ptr; |
18 | unsigned char * wr_ptr; |
19 | int bInited; |
20 | int nMutex; |
21 | int data_width; |
22 | int channels; |
23 | int samplerate; |
24 | int format; |
25 | pthread_mutex_t nMutex1; |
26 | |
27 | } buffer_stream_t; |
28 | |
29 | int init_buff(buffer_stream_t *bs, int length); |
30 | int reset_buffer(buffer_stream_t *bs); |
31 | int release_buffer(buffer_stream_t *bs); |
32 | |
33 | int is_buffer_empty(buffer_stream_t *bs); |
34 | |
35 | int is_buffer_full(buffer_stream_t *bs); |
36 | int get_buffer_length(buffer_stream_t *bs); |
37 | int read_pcm_buffer(char * out, buffer_stream_t *bs, int size); |
38 | int write_pcm_buffer(char * in, buffer_stream_t *bs, int size); |
39 | int get_pcmbuf_level(); |
40 | |
41 | |
42 | #endif |
43 |