Diffstat (limited to 'core/multimedia/opieplayer/vorbis/tremor/block.c') (more/less context) (show whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/vorbis/tremor/block.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/core/multimedia/opieplayer/vorbis/tremor/block.c b/core/multimedia/opieplayer/vorbis/tremor/block.c index 8949253..7b5531b 100644 --- a/core/multimedia/opieplayer/vorbis/tremor/block.c +++ b/core/multimedia/opieplayer/vorbis/tremor/block.c | |||
@@ -181,98 +181,100 @@ static int _vds_init(vorbis_dsp_state *v,vorbis_info *vi){ | |||
181 | v->W=0; /* current window size */ | 181 | v->W=0; /* current window size */ |
182 | 182 | ||
183 | /* initialize all the mapping/backend lookups */ | 183 | /* initialize all the mapping/backend lookups */ |
184 | b->mode=(vorbis_look_mapping **)_ogg_calloc(ci->modes,sizeof(*b->mode)); | 184 | b->mode=(vorbis_look_mapping **)_ogg_calloc(ci->modes,sizeof(*b->mode)); |
185 | for(i=0;i<ci->modes;i++){ | 185 | for(i=0;i<ci->modes;i++){ |
186 | int mapnum=ci->mode_param[i]->mapping; | 186 | int mapnum=ci->mode_param[i]->mapping; |
187 | int maptype=ci->map_type[mapnum]; | 187 | int maptype=ci->map_type[mapnum]; |
188 | b->mode[i]=_mapping_P[maptype]->look(v,ci->mode_param[i], | 188 | b->mode[i]=_mapping_P[maptype]->look(v,ci->mode_param[i], |
189 | ci->map_param[mapnum]); | 189 | ci->map_param[mapnum]); |
190 | } | 190 | } |
191 | return(0); | 191 | return(0); |
192 | } | 192 | } |
193 | 193 | ||
194 | int vorbis_synthesis_restart(vorbis_dsp_state *v){ | 194 | int vorbis_synthesis_restart(vorbis_dsp_state *v){ |
195 | vorbis_info *vi=v->vi; | 195 | vorbis_info *vi=v->vi; |
196 | codec_setup_info *ci; | 196 | codec_setup_info *ci; |
197 | 197 | ||
198 | if(!v->backend_state)return -1; | 198 | if(!v->backend_state)return -1; |
199 | if(!vi)return -1; | 199 | if(!vi)return -1; |
200 | ci=vi->codec_setup; | 200 | ci=vi->codec_setup; |
201 | if(!ci)return -1; | 201 | if(!ci)return -1; |
202 | 202 | ||
203 | v->centerW=ci->blocksizes[1]/2; | 203 | v->centerW=ci->blocksizes[1]/2; |
204 | v->pcm_current=v->centerW; | 204 | v->pcm_current=v->centerW; |
205 | 205 | ||
206 | v->pcm_returned=-1; | 206 | v->pcm_returned=-1; |
207 | v->granulepos=-1; | 207 | v->granulepos=-1; |
208 | v->sequence=-1; | 208 | v->sequence=-1; |
209 | ((private_state *)(v->backend_state))->sample_count=-1; | 209 | ((private_state *)(v->backend_state))->sample_count=-1; |
210 | 210 | ||
211 | return(0); | 211 | return(0); |
212 | } | 212 | } |
213 | 213 | ||
214 | int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi){ | 214 | int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi){ |
215 | _vds_init(v,vi); | 215 | _vds_init(v,vi); |
216 | vorbis_synthesis_restart(v); | 216 | vorbis_synthesis_restart(v); |
217 | 217 | ||
218 | return(0); | 218 | return(0); |
219 | } | 219 | } |
220 | 220 | ||
221 | void vorbis_dsp_clear(vorbis_dsp_state *v){ | 221 | void vorbis_dsp_clear(vorbis_dsp_state *v){ |
222 | int i; | 222 | int i; |
223 | if(v){ | 223 | if(v){ |
224 | vorbis_info *vi=v->vi; | 224 | vorbis_info *vi=v->vi; |
225 | codec_setup_info *ci=(codec_setup_info *)(vi?vi->codec_setup:NULL); | 225 | codec_setup_info *ci=(codec_setup_info *)(vi?vi->codec_setup:NULL); |
226 | private_state *b=(private_state *)v->backend_state; | 226 | private_state *b=(private_state *)v->backend_state; |
227 | 227 | ||
228 | if(v->pcm){ | 228 | if(v->pcm){ |
229 | if (vi) { | ||
229 | for(i=0;i<vi->channels;i++) | 230 | for(i=0;i<vi->channels;i++) |
230 | if(v->pcm[i])_ogg_free(v->pcm[i]); | 231 | if(v->pcm[i])_ogg_free(v->pcm[i]); |
232 | } | ||
231 | _ogg_free(v->pcm); | 233 | _ogg_free(v->pcm); |
232 | if(v->pcmret)_ogg_free(v->pcmret); | 234 | if(v->pcmret)_ogg_free(v->pcmret); |
233 | } | 235 | } |
234 | 236 | ||
235 | /* free mode lookups; these are actually vorbis_look_mapping structs */ | 237 | /* free mode lookups; these are actually vorbis_look_mapping structs */ |
236 | if(ci){ | 238 | if(ci){ |
237 | for(i=0;i<ci->modes;i++){ | 239 | for(i=0;i<ci->modes;i++){ |
238 | int mapnum=ci->mode_param[i]->mapping; | 240 | int mapnum=ci->mode_param[i]->mapping; |
239 | int maptype=ci->map_type[mapnum]; | 241 | int maptype=ci->map_type[mapnum]; |
240 | if(b && b->mode)_mapping_P[maptype]->free_look(b->mode[i]); | 242 | if(b && b->mode)_mapping_P[maptype]->free_look(b->mode[i]); |
241 | } | 243 | } |
242 | } | 244 | } |
243 | 245 | ||
244 | if(b){ | 246 | if(b){ |
245 | if(b->mode)_ogg_free(b->mode); | 247 | if(b->mode)_ogg_free(b->mode); |
246 | _ogg_free(b); | 248 | _ogg_free(b); |
247 | } | 249 | } |
248 | 250 | ||
249 | memset(v,0,sizeof(*v)); | 251 | memset(v,0,sizeof(*v)); |
250 | } | 252 | } |
251 | } | 253 | } |
252 | 254 | ||
253 | /* Unlike in analysis, the window is only partially applied for each | 255 | /* Unlike in analysis, the window is only partially applied for each |
254 | block. The time domain envelope is not yet handled at the point of | 256 | block. The time domain envelope is not yet handled at the point of |
255 | calling (as it relies on the previous block). */ | 257 | calling (as it relies on the previous block). */ |
256 | 258 | ||
257 | int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){ | 259 | int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){ |
258 | vorbis_info *vi=v->vi; | 260 | vorbis_info *vi=v->vi; |
259 | codec_setup_info *ci=(codec_setup_info *)vi->codec_setup; | 261 | codec_setup_info *ci=(codec_setup_info *)vi->codec_setup; |
260 | private_state *b=v->backend_state; | 262 | private_state *b=v->backend_state; |
261 | int i,j; | 263 | int i,j; |
262 | 264 | ||
263 | if(v->pcm_current>v->pcm_returned && v->pcm_returned!=-1)return(OV_EINVAL); | 265 | if(v->pcm_current>v->pcm_returned && v->pcm_returned!=-1)return(OV_EINVAL); |
264 | 266 | ||
265 | v->lW=v->W; | 267 | v->lW=v->W; |
266 | v->W=vb->W; | 268 | v->W=vb->W; |
267 | v->nW=-1; | 269 | v->nW=-1; |
268 | 270 | ||
269 | if((v->sequence==-1)|| | 271 | if((v->sequence==-1)|| |
270 | (v->sequence+1 != vb->sequence)){ | 272 | (v->sequence+1 != vb->sequence)){ |
271 | v->granulepos=-1; /* out of sequence; lose count */ | 273 | v->granulepos=-1; /* out of sequence; lose count */ |
272 | b->sample_count=-1; | 274 | b->sample_count=-1; |
273 | } | 275 | } |
274 | 276 | ||
275 | v->sequence=vb->sequence; | 277 | v->sequence=vb->sequence; |
276 | 278 | ||
277 | if(vb->pcm){ /* no pcm to process if vorbis_synthesis_trackonly | 279 | if(vb->pcm){ /* no pcm to process if vorbis_synthesis_trackonly |
278 | was called on block */ | 280 | was called on block */ |