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
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.
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.
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
22
#include "msAlawenc.h"
23
#include "g711common.h"
25
extern MSCodecInfo ALAWinfo;
29
void ms_ALAWencoder_init(MSALAWEncoder *r);
30
void ms_ALAWencoder_process(MSALAWEncoder *r);
32
/* tuning parameters :*/
33
#define ALAW_ENCODER_WMAXGRAN 160
34
#define ALAW_ENCODER_RMAXGRAN 320
36
MSFilter * ms_ALAWencoder_new(void)
39
r=g_new(MSALAWEncoder,1);
40
ms_ALAWencoder_init(r);
44
declare_simple_static_fifo_setup(alaw_encoder,ALAW_ENCODER_RMAXGRAN,ALAW_ENCODER_WMAXGRAN)
46
MSFilterVTable ms_ALAWencoder_vtable={
47
process: ms_ALAWencoder_process,
48
setup_link: simple_static_fifo_setup_ref(alaw_encoder)
52
void ms_ALAWencoder_init(MSALAWEncoder *r)
54
ms_filter_init(MS_FILTER(r),&ms_ALAWencoder_vtable,"MSALAWEncoder",1,0,1,0);
58
void ms_ALAWencoder_process(MSALAWEncoder *r)
64
fi=r->base.infifos[0];
65
fo=r->base.outfifos[0];
67
s=ms_fifo_get_read_ptr(fi,ALAW_ENCODER_RMAXGRAN);
68
d=ms_fifo_get_write_ptr(fo,ALAW_ENCODER_WMAXGRAN);
69
for(i=0;i<ALAW_ENCODER_WMAXGRAN;i++)
71
d[i]=s16_to_alaw( *((gint16*)s) );