Line | |
---|
1 | //codecfilter_speex.c: |
---|
2 | |
---|
3 | #include "roard.h" |
---|
4 | #ifdef ROAR_HAVE_LIBSPEEX |
---|
5 | |
---|
6 | int cf_speex_open(CODECFILTER_USERDATA_T * inst, int codec, |
---|
7 | struct roar_stream_server * info, |
---|
8 | struct roar_codecfilter * filter) { |
---|
9 | struct codecfilter_speex_inst * self = malloc(sizeof(struct codecfilter_speex_inst)); |
---|
10 | |
---|
11 | *inst = NULL; |
---|
12 | |
---|
13 | if (!self) |
---|
14 | return -1; |
---|
15 | |
---|
16 | self->encoder = NULL; |
---|
17 | self->decoder = NULL; |
---|
18 | |
---|
19 | speex_bits_init(&(self->bits)); |
---|
20 | |
---|
21 | *inst = (void*) self; |
---|
22 | |
---|
23 | return 0; |
---|
24 | } |
---|
25 | |
---|
26 | int cf_speex_close(CODECFILTER_USERDATA_T inst) { |
---|
27 | struct codecfilter_speex_inst * self = (struct codecfilter_speex_inst *) inst; |
---|
28 | |
---|
29 | if (!self) |
---|
30 | return -1; |
---|
31 | |
---|
32 | if ( self->encoder ) |
---|
33 | speex_encoder_destroy(self->decoder); |
---|
34 | |
---|
35 | self->encoder = NULL; |
---|
36 | |
---|
37 | if ( self->decoder ) |
---|
38 | speex_decoder_destroy(self->decoder); |
---|
39 | |
---|
40 | self->decoder = NULL; |
---|
41 | |
---|
42 | speex_bits_destroy(&(self->bits)); |
---|
43 | |
---|
44 | free((void*)self); |
---|
45 | |
---|
46 | return 0; |
---|
47 | } |
---|
48 | |
---|
49 | int cf_speex_read(CODECFILTER_USERDATA_T inst, char * buf, int len) { |
---|
50 | struct codecfilter_speex_inst * self = (struct codecfilter_speex_inst *) inst; |
---|
51 | |
---|
52 | return -1; |
---|
53 | } |
---|
54 | int cf_speex_write(CODECFILTER_USERDATA_T inst, char * buf, int len) { |
---|
55 | struct codecfilter_speex_inst * self = (struct codecfilter_speex_inst *) inst; |
---|
56 | |
---|
57 | return -1; |
---|
58 | } |
---|
59 | |
---|
60 | #endif |
---|
61 | |
---|
62 | //ll |
---|
Note: See
TracBrowser
for help on using the repository browser.