Changeset 2203:a4fc168618a0 in roaraudio
- Timestamp:
- 07/26/09 23:59:47 (15 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libroardsp/transcode_celt.c
r2202 r2203 145 145 int roar_xcoder_celt_decode (struct roar_xcoder * state, void * buf, size_t len) { 146 146 struct roar_xcoder_celt * self = state->inst; 147 uint16_t * lenp = self->iobuffer; 148 void * cp = self->iobuffer + _SIZE_LEN; 149 uint16_t pkglen; 150 char magic[ROAR_CELT_MAGIC_LEN]; 147 151 148 152 ROAR_DBG("roar_xcoder_celt_decode(*): test if we are in decoding mode..."); … … 151 155 return -1; 152 156 153 return -1; 157 if ( state->stage == ROAR_XCODER_STAGE_INITED ) { 158 if ( roar_vio_read(state->backend, magic, ROAR_CELT_MAGIC_LEN) != ROAR_CELT_MAGIC_LEN ) 159 return -1; 160 161 if ( memcmp(magic, ROAR_CELT_MAGIC, ROAR_CELT_MAGIC_LEN) != 0 ) 162 return -1; 163 164 state->stage = ROAR_XCODER_STAGE_MAGIC; 165 ROAR_DBG("roar_xcoder_celt_decode(*): Found valid Magic"); 166 } 167 168 if ( roar_vio_read(state->backend, lenp, _SIZE_LEN) != _SIZE_LEN ) 169 return -1; 170 171 pkglen = ROAR_NET2HOST16(*lenp); 172 173 if ( pkglen > (self->bufferlen - _SIZE_LEN) ) 174 return -1; 175 176 if ( roar_vio_read(state->backend, cp, pkglen) != pkglen ) 177 return -1; 178 179 if ( celt_decode(self->decoder, cp, pkglen, (celt_int16_t *) buf) < 0 ) 180 return -1; 181 182 return 0; 154 183 } 155 184
Note: See TracChangeset
for help on using the changeset viewer.