speex.h | speex.h | |||
---|---|---|---|---|
skipping to change at line 22 | skipping to change at line 22 | |||
but WITHOUT ANY WARRANTY; without even the implied warranty of | but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
Lesser General Public License for more details. | Lesser General Public License for more details. | |||
You should have received a copy of the GNU Lesser General Public | You should have received a copy of the GNU Lesser General Public | |||
License along with this library; if not, write to the Free Software | License along with this library; if not, write to the Free Software | |||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A | |||
*/ | */ | |||
#ifndef SPEEX_MODES_H | #ifndef SPEEX_H | |||
#define SPEEX_MODES_H | #define SPEEX_H | |||
#include "speex_bits.h" | #include "speex_bits.h" | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
#define SPEEX_SET_PF 0 | #define SPEEX_SET_PF 0 | |||
#define SPEEX_GET_PF 1 | #define SPEEX_GET_PF 1 | |||
#define SPEEX_GET_FRAME_SIZE 3 | #define SPEEX_GET_FRAME_SIZE 3 | |||
skipping to change at line 51 | skipping to change at line 51 | |||
typedef void (*decoder_destroy_func)(void *st); | typedef void (*decoder_destroy_func)(void *st); | |||
typedef void (*decode_func)(void *state, SpeexBits *bits, float *out, int l ost); | typedef void (*decode_func)(void *state, SpeexBits *bits, float *out, int l ost); | |||
typedef void (*encoder_ctl_func)(void *state, int request, void *ptr); | typedef void (*encoder_ctl_func)(void *state, int request, void *ptr); | |||
typedef void (*decoder_ctl_func)(void *state, int request, void *ptr); | typedef void (*decoder_ctl_func)(void *state, int request, void *ptr); | |||
/** Struct defining a Speex mode */ | /** Struct defining a Speex mode */ | |||
typedef struct SpeexMode { | typedef struct SpeexMode { | |||
/** Pointer to the low-level mode data */ | /** Pointer to the low-level mode data */ | |||
void *mode; | void *mode; | |||
/** The name of the mode (you should not rely on this to identify the mo | ||||
de)*/ | ||||
char *modeName; | ||||
/**ID of the mode*/ | ||||
int modeID; | ||||
/**Version number of the bitstream (incremented every time we break | ||||
bitstream compatibility*/ | ||||
int bitstream_version; | ||||
/** Pointer to encoder initialization function */ | /** Pointer to encoder initialization function */ | |||
encoder_init_func enc_init; | encoder_init_func enc_init; | |||
/** Pointer to encoder destruction function */ | /** Pointer to encoder destruction function */ | |||
encoder_destroy_func enc_destroy; | encoder_destroy_func enc_destroy; | |||
/** Pointer to frame encoding function */ | /** Pointer to frame encoding function */ | |||
encode_func enc; | encode_func enc; | |||
/** Pointer to decoder initialization function */ | /** Pointer to decoder initialization function */ | |||
skipping to change at line 75 | skipping to change at line 85 | |||
/** Pointer to frame decoding function */ | /** Pointer to frame decoding function */ | |||
decode_func dec; | decode_func dec; | |||
/** ioctl-like requests for encoder */ | /** ioctl-like requests for encoder */ | |||
encoder_ctl_func enc_ctl; | encoder_ctl_func enc_ctl; | |||
/** ioctl-like requests for decoder */ | /** ioctl-like requests for decoder */ | |||
decoder_ctl_func dec_ctl; | decoder_ctl_func dec_ctl; | |||
/** Frame size used for the mode*/ | ||||
int frame_size; | ||||
/** Bit-rate for the mode (highest in case of VBR) */ | ||||
int bitrate; | ||||
/** VBR info (currently 0 for constant bit-rate and 1 for VBR) */ | ||||
int vbr; | ||||
} SpeexMode; | } SpeexMode; | |||
/**Returns a handle to a newly created Speex encoder state structure. For n ow, the | /**Returns a handle to a newly created Speex encoder state structure. For n ow, the | |||
"mode" arguent can be &nb_mode or &wb_mode . In the future, more modes m ay be | "mode" arguent can be &nb_mode or &wb_mode . In the future, more modes m ay be | |||
added. Note that for now if you have more than one channels to encode, y ou need | added. Note that for now if you have more than one channels to encode, y ou need | |||
one state per channel.*/ | one state per channel.*/ | |||
void *speex_encoder_init(SpeexMode *mode); | void *speex_encoder_init(SpeexMode *mode); | |||
/** Frees all resources associated to an existing Speex encoder state. */ | /** Frees all resources associated to an existing Speex encoder state. */ | |||
void speex_encoder_destroy(void *state); | void speex_encoder_destroy(void *state); | |||
skipping to change at line 110 | skipping to change at line 129 | |||
/** Uses an existing decoder state to decode one frame of speech from bit-s tream | /** Uses an existing decoder state to decode one frame of speech from bit-s tream | |||
bits. The output speech is saved written to out. */ | bits. The output speech is saved written to out. */ | |||
void speex_decode(void *state, SpeexBits *bits, float *out, int lost); | void speex_decode(void *state, SpeexBits *bits, float *out, int lost); | |||
void speex_decoder_ctl(void *state, int request, void *ptr); | void speex_decoder_ctl(void *state, int request, void *ptr); | |||
/** Default narrowband mode */ | /** Default narrowband mode */ | |||
extern SpeexMode speex_nb_mode; | extern SpeexMode speex_nb_mode; | |||
/** Low bit-rate narrowband mode */ | ||||
extern SpeexMode speex_nb_lbr_mode; | ||||
/** Default wideband mode */ | /** Default wideband mode */ | |||
extern SpeexMode speex_wb_mode; | extern SpeexMode speex_wb_mode; | |||
extern SpeexMode *speex_mode_list[]; | ||||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif | #endif | |||
End of changes. 5 change blocks. | ||||
2 lines changed or deleted | 27 lines changed or added | |||
speex_header.h | speex_header.h | |||
---|---|---|---|---|
/* Copyright (C) 2002 Jean-Marc Valin | /* Copyright (C) 2002 Jean-Marc Valin | |||
File: speex_header.h | File: speex_header.h | |||
Describes the Speex header | ||||
Describes the different modes of the codec | ||||
This library is free software; you can redistribute it and/or | This library is free software; you can redistribute it and/or | |||
modify it under the terms of the GNU Lesser General Public | modify it under the terms of the GNU Lesser General Public | |||
License as published by the Free Software Foundation; either | License as published by the Free Software Foundation; either | |||
version 2.1 of the License, or (at your option) any later version. | version 2.1 of the License, or (at your option) any later version. | |||
This library is distributed in the hope that it will be useful, | This library is distributed in the hope that it will be useful, | |||
but WITHOUT ANY WARRANTY; without even the implied warranty of | but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
Lesser General Public License for more details. | Lesser General Public License for more details. | |||
You should have received a copy of the GNU Lesser General Public | You should have received a copy of the GNU Lesser General Public | |||
License along with this library; if not, write to the Free Software | License along with this library; if not, write to the Free Software | |||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A | |||
*/ | */ | |||
#ifndef SPEEX_HEADER_H | #ifndef SPEEX_HEADER_H | |||
#define SPEEX_HEADER_H | #define SPEEX_HEADER_H | |||
struct SpeexMode; | ||||
#define SPEEX_HEADER_VERSION_LENGTH 20 | ||||
#define SPEEX_HEADER_VERSION -1 | ||||
typedef struct SpeexHeader { | typedef struct SpeexHeader { | |||
char speex_string[8]; | ||||
char speex_version[SPEEX_HEADER_VERSION_LENGTH]; | ||||
int speex_header_version; | ||||
int header_size; | ||||
int rate; | int rate; | |||
int mode; | int mode; | |||
int mode_bitstream_version; | ||||
int nb_channels; | int nb_channels; | |||
int bitrate; | ||||
int frame_size; | ||||
int vbr; | ||||
int reserved1; | ||||
int reserved2; | ||||
int reserved3; | ||||
int reserved4; | ||||
} SpeexHeader; | } SpeexHeader; | |||
void speex_init_header(SpeexHeader *header, int rate, int nb_channels, stru | ||||
ct SpeexMode *m); | ||||
char *speex_header_to_packet(SpeexHeader *header, int *size); | ||||
SpeexHeader *speex_packet_to_header(char *packet, int size); | ||||
#endif | #endif | |||
End of changes. 6 change blocks. | ||||
2 lines changed or deleted | 25 lines changed or added | |||