12024
|
1 /*
|
|
2 The mediastreamer library aims at providing modular media processing and I/O
|
|
3 for linphone, but also for any telephony application.
|
|
4 Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
|
|
5
|
|
6 This library is free software; you can redistribute it and/or
|
|
7 modify it under the terms of the GNU Lesser General Public
|
|
8 License as published by the Free Software Foundation; either
|
|
9 version 2.1 of the License, or (at your option) any later version.
|
|
10
|
|
11 This library is distributed in the hope that it will be useful,
|
|
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
14 Lesser General Public License for more details.
|
|
15
|
|
16 You should have received a copy of the GNU Lesser General Public
|
|
17 License along with this library; if not, write to the Free Software
|
|
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
19 */
|
|
20
|
|
21
|
|
22 #ifndef MSILBCENCODER_H
|
|
23 #define MSILBCENCODER_H
|
|
24
|
|
25 #include "mscodec.h"
|
|
26 #include <iLBC_encode.h>
|
|
27
|
|
28 #define ILBC_BITS_IN_COMPRESSED_FRAME 400
|
|
29
|
|
30 int
|
|
31 ilbc_read_16bit_samples(gint16 int16samples[], float speech[], int n);
|
|
32
|
|
33 int
|
|
34 ilbc_write_16bit_samples(gint16 int16samples[], float speech[], int n);
|
|
35
|
|
36 void
|
|
37 ilbc_write_bits(unsigned char *data, unsigned char *bits, int nbytes);
|
|
38
|
|
39 int
|
|
40 ilbc_read_bits(unsigned char *data, unsigned char *bits, int nbytes);
|
|
41
|
|
42
|
|
43 /*this is the class that implements a ILBCencoder filter*/
|
|
44
|
|
45 #define MSILBCENCODER_MAX_INPUTS 1 /* max output per filter*/
|
|
46
|
|
47
|
|
48 typedef struct _MSILBCEncoder
|
|
49 {
|
|
50 /* the MSILBCEncoder derivates from MSFilter, so the MSFilter object MUST be the first of the MSILBCEncoder object
|
|
51 in order to the object mechanism to work*/
|
|
52 MSFilter filter;
|
|
53 MSFifo *f_inputs[MSILBCENCODER_MAX_INPUTS];
|
|
54 MSQueue *q_outputs[MSILBCENCODER_MAX_INPUTS];
|
|
55 iLBC_Enc_Inst_t ilbc_enc;
|
|
56 int ilbc_encoded_bytes;
|
|
57 int bitrate;
|
|
58 int ms_per_frame;
|
|
59 int samples_per_frame;
|
|
60 int bytes_per_compressed_frame;
|
|
61 } MSILBCEncoder;
|
|
62
|
|
63 typedef struct _MSILBCEncoderClass
|
|
64 {
|
|
65 /* the MSILBCEncoder derivates from MSFilter, so the MSFilter class MUST be the first of the MSILBCEncoder class
|
|
66 in order to the class mechanism to work*/
|
|
67 MSFilterClass parent_class;
|
|
68 } MSILBCEncoderClass;
|
|
69
|
|
70 /* PUBLIC */
|
|
71 #define MS_ILBCENCODER(filter) ((MSILBCEncoder*)(filter))
|
|
72 #define MS_ILBCENCODER_CLASS(klass) ((MSILBCEncoderClass*)(klass))
|
|
73 MSFilter * ms_ilbc_encoder_new(void);
|
|
74
|
|
75 /* FOR INTERNAL USE*/
|
|
76 void ms_ilbc_encoder_init(MSILBCEncoder *r);
|
|
77 void ms_ilbc_encoder_class_init(MSILBCEncoderClass *klass);
|
|
78 void ms_ilbc_encoder_destroy( MSILBCEncoder *obj);
|
|
79 void ms_ilbc_encoder_process(MSILBCEncoder *r);
|
|
80
|
|
81 #define ILBC_MAX_BYTES_PER_COMPRESSED_FRAME NO_OF_BYTES_30MS
|
|
82 #define ILBC_MAX_SAMPLES_PER_FRAME BLOCKL_30MS
|
|
83
|
|
84 #endif
|