[Speex-dev] Some question about speexcodex 1.2 beta2 on linux
r96128
r96128 at csie.ntu.edu.tw
Tue Dec 4 21:59:19 PST 2007
Hi,
I am an user of speex codec.Can I ask some question about the speexcodec 1.2beta2
on installed to linux(fedora 6) thanks!
After I downloaded the latest version of codec
then I type the commands to install :
configure -prefix=/home/...../test -enable-shared -enable-static
make
make install
then I try to compile my encode.c
here is the encode.c of mine:
=====================================
#include <speex/speex.h>
#include <speex/speex_preprocess.h>
#include <stdio.h>
#define MAX_FRAME_SIZE 320
int main() {
FILE *fin, *fout;
short in[MAX_FRAME_SIZE];
char cbits[200];
int nbBytes = 0;
void *state;
SpeexBits bits;
int m_frame_size;
int m_channels = 1;
// SpeeX encode options
int m_bitrate = (8 << 10);
int m_complexity = 3;
int m_quality = 8;
int m_encMode = 6;
int m_iAGC = 0;
int m_iDenoise = 0;
SpeexPreprocessState *m_preProcesser;
int nOff = 0, nOn = 1;
int modex=30;
speex_bits_init(&bits);
state = speex_encoder_init(&speex_nb_mode);
speex_encoder_ctl(state,SPEEX_RESET_STATE,NULL);
speex_encoder_ctl(state,SPEEX_RESET_STATE,NULL);
speex_encoder_ctl(state,SPEEX_GET_FRAME_SIZE,&m_frame_size);
speex_encoder_ctl(state,SPEEX_SET_VAD, &nOff);
speex_encoder_ctl(state,SPEEX_SET_DTX, &nOn);
speex_encoder_ctl(state,SPEEX_SET_MODE,&m_encMode);
speex_encoder_ctl(state,SPEEX_SET_BITRATE,&m_bitrate);
// speex_encoder_ctl(state, SPEEX_SET_QUALITY, &tmp);
m_preProcesser = speex_preprocess_state_init(m_frame_size, 8000);
speex_preprocess_ctl(m_preProcesser, SPEEX_PREPROCESS_SET_DENOISE,
&m_iDenoise);
speex_preprocess_ctl(m_preProcesser, SPEEX_PREPROCESS_SET_AGC, &m_iAGC);
fin = fopen("test.pcm", "r+b");
fout = fopen("out.spx", "w+b");
if (fin == NULL || fout == NULL){
printf("FILE open error!!\n");
return 1;
}
while(1){
fread(in, sizeof(short), m_frame_size, fin);
if(feof(fin))
break;
speex_bits_reset(&bits);
if (m_preProcesser)
speex_preprocess(m_preProcesser, in, NULL);
speex_encode_int(state, in, &bits);
nbBytes = speex_bits_write(&bits, cbits, 200);
fwrite(&nbBytes, sizeof(int), 1, fout);
#ifdef _DEBUG
printf("Encode nbBytes: %d\n", nbBytes);
#endif
fwrite(cbits, 1, nbBytes, fout);
//fflush(fout);
}
speex_encoder_destroy(state);
speex_bits_destroy(&bits);
fclose(fin);
fclose(fout);
return 0;
}
=============================
then I used gcc or g++ to compile this file with the static libery
command:
gcc encode.c ../test/lib/libspeex.so
the result of compiling is ok
then when I run the program it shows
'./a.out: symbol lookup error: ./a.out: undefined symbol:
speex_preprocess_state_init
how can I compile the file?
thanks for the viewing for this mail
--
Open WebMail Project (http://openwebmail.org)
More information about the Speex-dev
mailing list