Changeset 2894:70f3e75119e6 in roaraudio
- Timestamp:
- 10/10/09 03:07:04 (15 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
include/libroardsp/transcode_speex.h
r2304 r2894 50 50 int frame_size; 51 51 char cc[ROAR_SPEEX_MAX_CC]; /* buffer for read() and write() */ 52 struct roar_libroar_config_codec * codec_config; 53 int max_cc; 52 54 }; 53 55 -
libroardsp/transcode_speex.c
r2315 r2894 29 29 #define _16BIT (16/8) 30 30 #define _SIZE_LEN 2 31 32 #define _HAVE_CCFG(x) (self->codec_config != NULL && (self->codec_config->para_set & (x))) 31 33 32 34 int roar_xcoder_speex_init (struct roar_xcoder * state) { … … 62 64 63 65 if (state->encode) { 66 self->codec_config = roar_libroar_config_codec_get(ROAR_CODEC_ROAR_SPEEX, 0); 67 self->max_cc = ROAR_SPEEX_MAX_CC; 68 69 if ( _HAVE_CCFG(ROAR_LIBROAR_CONFIG_PSET_MAX_CC) ) { 70 self->max_cc = self->codec_config->max_cc; 71 } 72 64 73 switch (self->mode) { 65 74 case ROAR_SPEEX_MODE_NB: self->xcoder = speex_encoder_init(&speex_nb_mode); break; … … 67 76 case ROAR_SPEEX_MODE_UWB: self->xcoder = speex_encoder_init(&speex_uwb_mode); break; 68 77 } 69 tmp = 8; 78 79 if ( _HAVE_CCFG(ROAR_LIBROAR_CONFIG_PSET_COMPLEXITY) ) { 80 tmp = self->codec_config->complexity / 256; 81 } else { 82 tmp = 8; 83 } 70 84 speex_encoder_ctl(self->xcoder, SPEEX_SET_QUALITY, &tmp); 85 86 if ( _HAVE_CCFG(ROAR_LIBROAR_CONFIG_PSET_Q) ) { 87 tmp = self->codec_config->q / 256; 88 speex_encoder_ctl(self->xcoder, SPEEX_SET_QUALITY, &tmp); 89 } 90 91 if ( _HAVE_CCFG(ROAR_LIBROAR_CONFIG_PSET_DTX) ) { 92 tmp = self->codec_config->dtx ? 1 : 0; 93 speex_encoder_ctl(self->xcoder, SPEEX_SET_DTX, &tmp); 94 } 95 71 96 tmp = info->rate; 72 97 speex_encoder_ctl(self->xcoder, SPEEX_SET_SAMPLING_RATE, &tmp); … … 141 166 speex_encode_int(self->xcoder, (spx_int16_t *) buf, &(self->bits)); 142 167 143 pkg_len = speex_bits_write(&(self->bits), self->cc, ROAR_SPEEX_MAX_CC);168 pkg_len = speex_bits_write(&(self->bits), self->cc, self->max_cc); 144 169 145 170 tmp_net = ROAR_HOST2NET16(pkg_len);
Note: See TracChangeset
for help on using the changeset viewer.