summaryrefslogtreecommitdiff
path: root/core/multimedia/opieplayer/vorbis
Unidiff
Diffstat (limited to 'core/multimedia/opieplayer/vorbis') (more/less context) (show whitespace changes)
-rw-r--r--core/multimedia/opieplayer/vorbis/tremor/block.c2
-rw-r--r--core/multimedia/opieplayer/vorbis/tremor/info.c2
2 files changed, 3 insertions, 1 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
194int vorbis_synthesis_restart(vorbis_dsp_state *v){ 194int 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
214int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi){ 214int 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
221void vorbis_dsp_clear(vorbis_dsp_state *v){ 221void 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
257int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){ 259int 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 */
diff --git a/core/multimedia/opieplayer/vorbis/tremor/info.c b/core/multimedia/opieplayer/vorbis/tremor/info.c
index 941695e..3499ae4 100644
--- a/core/multimedia/opieplayer/vorbis/tremor/info.c
+++ b/core/multimedia/opieplayer/vorbis/tremor/info.c
@@ -52,99 +52,99 @@ static int tagcompare(const char *s1, const char *s2, int n){
52 } 52 }
53 return 0; 53 return 0;
54} 54}
55 55
56char *vorbis_comment_query(vorbis_comment *vc, char *tag, int count){ 56char *vorbis_comment_query(vorbis_comment *vc, char *tag, int count){
57 long i; 57 long i;
58 int found = 0; 58 int found = 0;
59 int taglen = strlen(tag)+1; /* +1 for the = we append */ 59 int taglen = strlen(tag)+1; /* +1 for the = we append */
60 char *fulltag = (char *)alloca(taglen+ 1); 60 char *fulltag = (char *)alloca(taglen+ 1);
61 61
62 strcpy(fulltag, tag); 62 strcpy(fulltag, tag);
63 strcat(fulltag, "="); 63 strcat(fulltag, "=");
64 64
65 for(i=0;i<vc->comments;i++){ 65 for(i=0;i<vc->comments;i++){
66 if(!tagcompare(vc->user_comments[i], fulltag, taglen)){ 66 if(!tagcompare(vc->user_comments[i], fulltag, taglen)){
67 if(count == found) 67 if(count == found)
68 /* We return a pointer to the data, not a copy */ 68 /* We return a pointer to the data, not a copy */
69 return vc->user_comments[i] + taglen; 69 return vc->user_comments[i] + taglen;
70 else 70 else
71 found++; 71 found++;
72 } 72 }
73 } 73 }
74 return NULL; /* didn't find anything */ 74 return NULL; /* didn't find anything */
75} 75}
76 76
77int vorbis_comment_query_count(vorbis_comment *vc, char *tag){ 77int vorbis_comment_query_count(vorbis_comment *vc, char *tag){
78 int i,count=0; 78 int i,count=0;
79 int taglen = strlen(tag)+1; /* +1 for the = we append */ 79 int taglen = strlen(tag)+1; /* +1 for the = we append */
80 char *fulltag = (char *)alloca(taglen+1); 80 char *fulltag = (char *)alloca(taglen+1);
81 strcpy(fulltag,tag); 81 strcpy(fulltag,tag);
82 strcat(fulltag, "="); 82 strcat(fulltag, "=");
83 83
84 for(i=0;i<vc->comments;i++){ 84 for(i=0;i<vc->comments;i++){
85 if(!tagcompare(vc->user_comments[i], fulltag, taglen)) 85 if(!tagcompare(vc->user_comments[i], fulltag, taglen))
86 count++; 86 count++;
87 } 87 }
88 88
89 return count; 89 return count;
90} 90}
91 91
92void vorbis_comment_clear(vorbis_comment *vc){ 92void vorbis_comment_clear(vorbis_comment *vc){
93 if(vc){ 93 if(vc){
94 long i; 94 long i;
95 for(i=0;i<vc->comments;i++) 95 for(i=0;i<vc->comments;i++)
96 if(vc->user_comments[i])_ogg_free(vc->user_comments[i]); 96 if(vc->user_comments[i])_ogg_free(vc->user_comments[i]);
97 if(vc->user_comments)_ogg_free(vc->user_comments); 97 if(vc->user_comments)_ogg_free(vc->user_comments);
98 if(vc->comment_lengths)_ogg_free(vc->comment_lengths); 98 if(vc->comment_lengths)_ogg_free(vc->comment_lengths);
99 if(vc->vendor)_ogg_free(vc->vendor); 99 if(vc->vendor)_ogg_free(vc->vendor);
100 }
101 memset(vc,0,sizeof(*vc)); 100 memset(vc,0,sizeof(*vc));
102} 101}
102}
103 103
104/* blocksize 0 is guaranteed to be short, 1 is guarantted to be long. 104/* blocksize 0 is guaranteed to be short, 1 is guarantted to be long.
105 They may be equal, but short will never ge greater than long */ 105 They may be equal, but short will never ge greater than long */
106int vorbis_info_blocksize(vorbis_info *vi,int zo){ 106int vorbis_info_blocksize(vorbis_info *vi,int zo){
107 codec_setup_info *ci = (codec_setup_info *)vi->codec_setup; 107 codec_setup_info *ci = (codec_setup_info *)vi->codec_setup;
108 return ci ? ci->blocksizes[zo] : -1; 108 return ci ? ci->blocksizes[zo] : -1;
109} 109}
110 110
111/* used by synthesis, which has a full, alloced vi */ 111/* used by synthesis, which has a full, alloced vi */
112void vorbis_info_init(vorbis_info *vi){ 112void vorbis_info_init(vorbis_info *vi){
113 memset(vi,0,sizeof(*vi)); 113 memset(vi,0,sizeof(*vi));
114 vi->codec_setup=(codec_setup_info *)_ogg_calloc(1,sizeof(codec_setup_info)); 114 vi->codec_setup=(codec_setup_info *)_ogg_calloc(1,sizeof(codec_setup_info));
115} 115}
116 116
117void vorbis_info_clear(vorbis_info *vi){ 117void vorbis_info_clear(vorbis_info *vi){
118 codec_setup_info *ci=(codec_setup_info *)vi->codec_setup; 118 codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
119 int i; 119 int i;
120 120
121 if(ci){ 121 if(ci){
122 122
123 for(i=0;i<ci->modes;i++) 123 for(i=0;i<ci->modes;i++)
124 if(ci->mode_param[i])_ogg_free(ci->mode_param[i]); 124 if(ci->mode_param[i])_ogg_free(ci->mode_param[i]);
125 125
126 for(i=0;i<ci->maps;i++) /* unpack does the range checking */ 126 for(i=0;i<ci->maps;i++) /* unpack does the range checking */
127 _mapping_P[ci->map_type[i]]->free_info(ci->map_param[i]); 127 _mapping_P[ci->map_type[i]]->free_info(ci->map_param[i]);
128 128
129 for(i=0;i<ci->floors;i++) /* unpack does the range checking */ 129 for(i=0;i<ci->floors;i++) /* unpack does the range checking */
130 _floor_P[ci->floor_type[i]]->free_info(ci->floor_param[i]); 130 _floor_P[ci->floor_type[i]]->free_info(ci->floor_param[i]);
131 131
132 for(i=0;i<ci->residues;i++) /* unpack does the range checking */ 132 for(i=0;i<ci->residues;i++) /* unpack does the range checking */
133 _residue_P[ci->residue_type[i]]->free_info(ci->residue_param[i]); 133 _residue_P[ci->residue_type[i]]->free_info(ci->residue_param[i]);
134 134
135 for(i=0;i<ci->books;i++){ 135 for(i=0;i<ci->books;i++){
136 if(ci->book_param[i]){ 136 if(ci->book_param[i]){
137 /* knows if the book was not alloced */ 137 /* knows if the book was not alloced */
138 vorbis_staticbook_destroy(ci->book_param[i]); 138 vorbis_staticbook_destroy(ci->book_param[i]);
139 } 139 }
140 if(ci->fullbooks) 140 if(ci->fullbooks)
141 vorbis_book_clear(ci->fullbooks+i); 141 vorbis_book_clear(ci->fullbooks+i);
142 } 142 }
143 if(ci->fullbooks) 143 if(ci->fullbooks)
144 _ogg_free(ci->fullbooks); 144 _ogg_free(ci->fullbooks);
145 145
146 _ogg_free(ci); 146 _ogg_free(ci);
147 } 147 }
148 148
149 memset(vi,0,sizeof(*vi)); 149 memset(vi,0,sizeof(*vi));
150} 150}