Lines Matching +full:- +full:vc
2 * Copyright (C) 2002-2009, Xiph.org Foundation
34 function: maintain the info structure, info <-> header packets
53 while(bytes--){ in _v_readstring()
58 void vorbis_comment_init(vorbis_comment *vc){ in vorbis_comment_init() argument
59 memset(vc,0,sizeof(*vc)); in vorbis_comment_init()
62 /* This is more or less the same as strncasecmp - but that doesn't exist
74 char *vorbis_comment_query(vorbis_comment *vc, char *tag, int count){ in vorbis_comment_query() argument
83 for(i=0;i<vc->comments;i++){ in vorbis_comment_query()
84 if(!tagcompare(vc->user_comments[i], fulltag, taglen)){ in vorbis_comment_query()
87 return vc->user_comments[i] + taglen; in vorbis_comment_query()
95 int vorbis_comment_query_count(vorbis_comment *vc, char *tag){ in vorbis_comment_query_count() argument
102 for(i=0;i<vc->comments;i++){ in vorbis_comment_query_count()
103 if(!tagcompare(vc->user_comments[i], fulltag, taglen)) in vorbis_comment_query_count()
110 void vorbis_comment_clear(vorbis_comment *vc){ in vorbis_comment_clear() argument
111 if(vc){ in vorbis_comment_clear()
113 for(i=0;i<vc->comments;i++) in vorbis_comment_clear()
114 if(vc->user_comments[i])_ogg_free(vc->user_comments[i]); in vorbis_comment_clear()
115 if(vc->user_comments)_ogg_free(vc->user_comments); in vorbis_comment_clear()
116 if(vc->comment_lengths)_ogg_free(vc->comment_lengths); in vorbis_comment_clear()
117 if(vc->vendor)_ogg_free(vc->vendor); in vorbis_comment_clear()
119 memset(vc,0,sizeof(*vc)); in vorbis_comment_clear()
125 codec_setup_info *ci = (codec_setup_info *)vi->codec_setup; in vorbis_info_blocksize()
126 return ci ? ci->blocksizes[zo] : -1; in vorbis_info_blocksize()
132 vi->codec_setup=(codec_setup_info *)_ogg_calloc(1,sizeof(codec_setup_info)); in vorbis_info_init()
136 codec_setup_info *ci=(codec_setup_info *)vi->codec_setup; in vorbis_info_clear()
141 if(ci->mode_param)_ogg_free(ci->mode_param); in vorbis_info_clear()
143 if(ci->map_param){ in vorbis_info_clear()
144 for(i=0;i<ci->maps;i++) /* unpack does the range checking */ in vorbis_info_clear()
145 mapping_clear_info(ci->map_param+i); in vorbis_info_clear()
146 _ogg_free(ci->map_param); in vorbis_info_clear()
149 if(ci->floor_param){ in vorbis_info_clear()
150 for(i=0;i<ci->floors;i++) /* unpack does the range checking */ in vorbis_info_clear()
151 if(ci->floor_type[i]) in vorbis_info_clear()
152 floor1_free_info(ci->floor_param[i]); in vorbis_info_clear()
154 floor0_free_info(ci->floor_param[i]); in vorbis_info_clear()
155 _ogg_free(ci->floor_param); in vorbis_info_clear()
156 _ogg_free(ci->floor_type); in vorbis_info_clear()
159 if(ci->residue_param){ in vorbis_info_clear()
160 for(i=0;i<ci->residues;i++) /* unpack does the range checking */ in vorbis_info_clear()
161 res_clear_info(ci->residue_param+i); in vorbis_info_clear()
162 _ogg_free(ci->residue_param); in vorbis_info_clear()
165 if(ci->book_param){ in vorbis_info_clear()
166 for(i=0;i<ci->books;i++) in vorbis_info_clear()
167 vorbis_book_clear(ci->book_param+i); in vorbis_info_clear()
168 _ogg_free(ci->book_param); in vorbis_info_clear()
180 codec_setup_info *ci=(codec_setup_info *)vi->codec_setup; in _vorbis_unpack_info()
183 vi->version=oggpack_read(opb,32); in _vorbis_unpack_info()
184 if(vi->version!=0)return(OV_EVERSION); in _vorbis_unpack_info()
186 vi->channels=oggpack_read(opb,8); in _vorbis_unpack_info()
187 vi->rate=oggpack_read(opb,32); in _vorbis_unpack_info()
189 vi->bitrate_upper=oggpack_read(opb,32); in _vorbis_unpack_info()
190 vi->bitrate_nominal=oggpack_read(opb,32); in _vorbis_unpack_info()
191 vi->bitrate_lower=oggpack_read(opb,32); in _vorbis_unpack_info()
193 ci->blocksizes[0]=1<<oggpack_read(opb,4); in _vorbis_unpack_info()
194 ci->blocksizes[1]=1<<oggpack_read(opb,4); in _vorbis_unpack_info()
197 if(vi->rate>=64000 || ci->blocksizes[1]>4096)goto err_out; in _vorbis_unpack_info()
199 if(vi->rate<64000 && ci->blocksizes[1]>4096)goto err_out; in _vorbis_unpack_info()
202 if(vi->rate<1)goto err_out; in _vorbis_unpack_info()
203 if(vi->channels<1)goto err_out; in _vorbis_unpack_info()
204 if(ci->blocksizes[0]<64)goto err_out; in _vorbis_unpack_info()
205 if(ci->blocksizes[1]<ci->blocksizes[0])goto err_out; in _vorbis_unpack_info()
206 if(ci->blocksizes[1]>8192)goto err_out; in _vorbis_unpack_info()
216 int _vorbis_unpack_comment(vorbis_comment *vc,oggpack_buffer *opb){ in _vorbis_unpack_comment() argument
220 vc->vendor=(char *)_ogg_calloc(vendorlen+1,1); in _vorbis_unpack_comment()
221 if(!vc->vendor)goto err_out; in _vorbis_unpack_comment()
222 _v_readstring(opb,vc->vendor,vendorlen); in _vorbis_unpack_comment()
223 vc->comments=oggpack_read(opb,32); in _vorbis_unpack_comment()
224 if(vc->comments<0)goto err_out; in _vorbis_unpack_comment()
225 vc->user_comments=(char **)_ogg_calloc(vc->comments+1,sizeof(*vc->user_comments)); in _vorbis_unpack_comment()
226 if (!vc->user_comments){ in _vorbis_unpack_comment()
227 vc->comments=0; in _vorbis_unpack_comment()
230 vc->comment_lengths=(int *)_ogg_calloc(vc->comments+1, sizeof(*vc->comment_lengths)); in _vorbis_unpack_comment()
231 if (!vc->comment_lengths)goto err_out; in _vorbis_unpack_comment()
233 for(i=0;i<vc->comments;i++){ in _vorbis_unpack_comment()
236 vc->comment_lengths[i]=len; in _vorbis_unpack_comment()
237 vc->user_comments[i]=(char *)_ogg_calloc(len+1,1); in _vorbis_unpack_comment()
238 if(!vc->user_comments[i])goto err_out; in _vorbis_unpack_comment()
239 _v_readstring(opb,vc->user_comments[i],len); in _vorbis_unpack_comment()
245 vorbis_comment_clear(vc); in _vorbis_unpack_comment()
252 codec_setup_info *ci=(codec_setup_info *)vi->codec_setup; in _vorbis_unpack_books()
257 ci->books=oggpack_read(opb,8)+1; in _vorbis_unpack_books()
258 ci->book_param=(codebook *)_ogg_calloc(ci->books,sizeof(*ci->book_param)); in _vorbis_unpack_books()
259 if(!ci->book_param){ in _vorbis_unpack_books()
260 ci->books=0; in _vorbis_unpack_books()
263 for(i=0;i<ci->books;i++) in _vorbis_unpack_books()
264 if(vorbis_book_unpack(opb,ci->book_param+i))goto err_out; in _vorbis_unpack_books()
268 for(;i>=0;i--) in _vorbis_unpack_books()
272 ci->floors=oggpack_read(opb,6)+1; in _vorbis_unpack_books()
273 ci->floor_param=_ogg_calloc(ci->floors, sizeof(*ci->floor_param)); in _vorbis_unpack_books()
274 ci->floor_type=_ogg_calloc(ci->floors, sizeof(*ci->floor_type)); in _vorbis_unpack_books()
275 if(!ci->floor_param || !ci->floor_type){ in _vorbis_unpack_books()
276 ci->floors=0; in _vorbis_unpack_books()
279 for(i=0;i<ci->floors;i++){ in _vorbis_unpack_books()
280 ci->floor_type[i]=(char)oggpack_read(opb,16); in _vorbis_unpack_books()
281 if(ci->floor_type[i]<0 || ci->floor_type[i]>=VI_FLOORB)goto err_out; in _vorbis_unpack_books()
282 if(ci->floor_type[i]) in _vorbis_unpack_books()
283 ci->floor_param[i]=floor1_info_unpack(vi,opb); in _vorbis_unpack_books()
285 ci->floor_param[i]=floor0_info_unpack(vi,opb); in _vorbis_unpack_books()
286 if(!ci->floor_param[i])goto err_out; in _vorbis_unpack_books()
290 ci->residues=oggpack_read(opb,6)+1; in _vorbis_unpack_books()
291 ci->residue_param=_ogg_calloc(ci->residues, sizeof(*ci->residue_param)); in _vorbis_unpack_books()
292 if (!ci->residue_param){ in _vorbis_unpack_books()
293 ci->residues=0; in _vorbis_unpack_books()
296 for(i=0;i<ci->residues;i++) in _vorbis_unpack_books()
297 if(res_unpack(ci->residue_param+i,vi,opb))goto err_out; in _vorbis_unpack_books()
300 ci->maps=oggpack_read(opb,6)+1; in _vorbis_unpack_books()
301 ci->map_param=_ogg_calloc(ci->maps, sizeof(*ci->map_param)); in _vorbis_unpack_books()
302 if (!ci->map_param){ in _vorbis_unpack_books()
303 ci->maps=0; in _vorbis_unpack_books()
306 for(i=0;i<ci->maps;i++){ in _vorbis_unpack_books()
308 if(mapping_info_unpack(ci->map_param+i,vi,opb))goto err_out; in _vorbis_unpack_books()
312 ci->modes=oggpack_read(opb,6)+1; in _vorbis_unpack_books()
313 ci->mode_param= in _vorbis_unpack_books()
314 (vorbis_info_mode *)_ogg_calloc(ci->modes, sizeof(*ci->mode_param)); in _vorbis_unpack_books()
315 if (!ci->mode_param){ in _vorbis_unpack_books()
316 ci->modes=0; in _vorbis_unpack_books()
319 for(i=0;i<ci->modes;i++){ in _vorbis_unpack_books()
320 ci->mode_param[i].blockflag=(unsigned char)oggpack_read(opb,1); in _vorbis_unpack_books()
323 ci->mode_param[i].mapping=(unsigned char)oggpack_read(opb,8); in _vorbis_unpack_books()
324 if(ci->mode_param[i].mapping>=ci->maps)goto err_out; in _vorbis_unpack_books()
340 int vorbis_dsp_headerin(vorbis_info *vi,vorbis_comment *vc,ogg_packet *op){ in vorbis_dsp_headerin() argument
344 oggpack_readinit(&opb,op->packet); in vorbis_dsp_headerin()
347 /* Also verify header-ness, vorbis */ in vorbis_dsp_headerin()
359 if(!op->b_o_s){ in vorbis_dsp_headerin()
363 if(vi->rate!=0){ in vorbis_dsp_headerin()
371 if(vi->rate==0){ in vorbis_dsp_headerin()
376 return(_vorbis_unpack_comment(vc,&opb)); in vorbis_dsp_headerin()
379 if(vi->rate==0 || vc->vendor==NULL){ in vorbis_dsp_headerin()