1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
|
From 3c409c5ff76b90e0cef72edf4fc36c02f5c79271 Mon Sep 17 00:00:00 2001
From: Thiago Santos <thiago.sousa.santos@collabora.com>
Date: Mon, 22 Apr 2013 11:16:30 -0300
Subject: [PATCH 7/8] tremor: more function renaming
Add ivorbis prefix to some more functions to avoid clashing with libvorbis
ones'
As mentioned in the previous commit:
This is particularly harmful for iOS applications that link to both libvorbis
and tremor as an iOS app puts all symbols together in the same binary.
---
iseeking_example.c | 48 ++++++++---------
ivorbisfile.h | 58 ++++++++++----------
ivorbisfile_example.c | 14 ++---
synthesis.c | 6 +--
vorbisfile.c | 144 +++++++++++++++++++++++++-------------------------
5 files changed, 135 insertions(+), 135 deletions(-)
diff --git a/iseeking_example.c b/iseeking_example.c
index de534eb..c97d252 100644
--- a/iseeking_example.c
+++ b/iseeking_example.c
@@ -39,27 +39,27 @@ void _verify(OggVorbis_File *ov,
ogg_int64_t pos;
/* verify the raw position, the pcm position and position decode */
- if(val!=-1 && ov_raw_tell(ov)<val){
+ if(val!=-1 && ivorbis_ov_raw_tell(ov)<val){
fprintf(stderr,"raw position out of tolerance: requested %ld, got %ld\n",
- (long)val,(long)ov_raw_tell(ov));
+ (long)val,(long)ivorbis_ov_raw_tell(ov));
exit(1);
}
- if(pcmval!=-1 && ov_pcm_tell(ov)>pcmval){
+ if(pcmval!=-1 && ivorbis_ov_pcm_tell(ov)>pcmval){
fprintf(stderr,"pcm position out of tolerance: requested %ld, got %ld\n",
- (long)pcmval,(long)ov_pcm_tell(ov));
+ (long)pcmval,(long)ivorbis_ov_pcm_tell(ov));
exit(1);
}
- if(timeval!=-1 && ov_time_tell(ov)>timeval){
+ if(timeval!=-1 && ivorbis_ov_time_tell(ov)>timeval){
fprintf(stderr,"time position out of tolerance: requested %ld, got %ld\n",
- (long)timeval,(long)ov_time_tell(ov));
+ (long)timeval,(long)ivorbis_ov_time_tell(ov));
exit(1);
}
- pos=ov_pcm_tell(ov);
+ pos=ivorbis_ov_pcm_tell(ov);
if(pos<0 || pos>pcmlength){
fprintf(stderr,"pcm position out of bounds: got %ld\n",(long)pos);
exit(1);
}
- bread=ov_read(ov,buffer,4096,&dummy);
+ bread=ivorbis_ov_read(ov,buffer,4096,&dummy);
if(bigassbuffer){
for(j=0;j<bread;j++){
if(buffer[j]!=bigassbuffer[j+pos*4]){
@@ -94,18 +94,18 @@ int main(){
/* open the file/pipe on stdin */
- if(ov_open(stdin, &ov, NULL, 0) < 0) {
+ if(ivorbis_ov_open(stdin, &ov, NULL, 0) < 0) {
fprintf(stderr,"Could not open input as an OggVorbis file.\n\n");
exit(1);
}
- if(ov_seekable(&ov)){
+ if(ivorbis_ov_seekable(&ov)){
/* to simplify our own lives, we want to assume the whole file is
stereo. Verify this to avoid potentially mystifying users
(pissing them off is OK, just don't confuse them) */
for(i=0;i<ov.links;i++){
- vorbis_info *vi=ov_info(&ov,i);
+ vorbis_info *vi=ivorbis_ov_info(&ov,i);
if(vi->channels!=2){
fprintf(stderr,"Sorry; right now seeking_test can only use Vorbis files\n"
"that are entirely stereo.\n\n");
@@ -115,13 +115,13 @@ int main(){
/* because we want to do sample-level verification that the seek
does what it claimed, decode the entire file into memory */
- pcmlength=ov_pcm_total(&ov,-1);
- timelength=ov_time_total(&ov,-1);
+ pcmlength=ivorbis_ov_pcm_total(&ov,-1);
+ timelength=ivorbis_ov_time_total(&ov,-1);
bigassbuffer=malloc(pcmlength*4); /* w00t */
if(bigassbuffer){
i=0;
while(i<pcmlength*4){
- int ret=ov_read(&ov,bigassbuffer+i,pcmlength*4-i,&dummy);
+ int ret=ivorbis_ov_read(&ov,bigassbuffer+i,pcmlength*4-i,&dummy);
if(ret<0)continue;
if(ret){
i+=ret;
@@ -143,7 +143,7 @@ int main(){
for(i=0;i<1000;i++){
ogg_int64_t val=rand()*length/RAND_MAX;
fprintf(stderr,"\r\t%d [raw position %ld]... ",i,(long)val);
- ret=ov_raw_seek(&ov,val);
+ ret=ivorbis_ov_raw_seek(&ov,val);
if(ret<0){
fprintf(stderr,"seek failed: %d\n",ret);
exit(1);
@@ -162,7 +162,7 @@ int main(){
for(i=0;i<1000;i++){
ogg_int64_t val=(double)rand()*pcmlength/RAND_MAX;
fprintf(stderr,"\r\t%d [pcm position %ld]... ",i,(long)val);
- ret=ov_pcm_seek_page(&ov,val);
+ ret=ivorbis_ov_pcm_seek_page(&ov,val);
if(ret<0){
fprintf(stderr,"seek failed: %d\n",ret);
exit(1);
@@ -181,14 +181,14 @@ int main(){
for(i=0;i<1000;i++){
ogg_int64_t val=(double)rand()*pcmlength/RAND_MAX;
fprintf(stderr,"\r\t%d [pcm position %ld]... ",i,(long)val);
- ret=ov_pcm_seek(&ov,val);
+ ret=ivorbis_ov_pcm_seek(&ov,val);
if(ret<0){
fprintf(stderr,"seek failed: %d\n",ret);
exit(1);
}
- if(ov_pcm_tell(&ov)!=val){
+ if(ivorbis_ov_pcm_tell(&ov)!=val){
fprintf(stderr,"Declared position didn't perfectly match request: %ld != %ld\n",
- (long)val,(long)ov_pcm_tell(&ov));
+ (long)val,(long)ivorbis_ov_pcm_tell(&ov));
exit(1);
}
@@ -205,7 +205,7 @@ int main(){
for(i=0;i<1000;i++){
ogg_int64_t val=(double)rand()*timelength/RAND_MAX;
fprintf(stderr,"\r\t%d [time position %ld]... ",i,(long)val);
- ret=ov_time_seek_page(&ov,val);
+ ret=ivorbis_ov_time_seek_page(&ov,val);
if(ret<0){
fprintf(stderr,"seek failed: %d\n",ret);
exit(1);
@@ -224,14 +224,14 @@ int main(){
for(i=0;i<1000;i++){
ogg_int64_t val=(double)rand()*timelength/RAND_MAX;
fprintf(stderr,"\r\t%d [time position %ld]... ",i,(long)val);
- ret=ov_time_seek(&ov,val);
+ ret=ivorbis_ov_time_seek(&ov,val);
if(ret<0){
fprintf(stderr,"seek failed: %d\n",ret);
exit(1);
}
- if(ov_time_tell(&ov)<val-1 || ov_time_tell(&ov)>val+1){
+ if(ivorbis_ov_time_tell(&ov)<val-1 || ivorbis_ov_time_tell(&ov)>val+1){
fprintf(stderr,"Declared position didn't perfectly match request: %ld != %ld\n",
- (long)val,(long)ov_time_tell(&ov));
+ (long)val,(long)ivorbis_ov_time_tell(&ov));
exit(1);
}
@@ -247,7 +247,7 @@ int main(){
fprintf(stderr,"Standard input was not seekable.\n");
}
- ov_clear(&ov);
+ ivorbis_ov_clear(&ov);
return 0;
}
diff --git a/ivorbisfile.h b/ivorbisfile.h
index fda6205..30f30b8 100644
--- a/ivorbisfile.h
+++ b/ivorbisfile.h
@@ -42,7 +42,7 @@ typedef struct {
int (*seek_func) (void *datasource, ogg_int64_t offset, int whence);
int (*close_func) (void *datasource);
long (*tell_func) (void *datasource);
-} ov_callbacks;
+} ivorbis_ov_callbacks;
#define NOTOPEN 0
#define PARTOPEN 1
@@ -81,44 +81,44 @@ typedef struct OggVorbis_File {
vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */
vorbis_block vb; /* local working space for packet->PCM decode */
- ov_callbacks callbacks;
+ ivorbis_ov_callbacks callbacks;
} OggVorbis_File;
-extern int ov_clear(OggVorbis_File *vf);
-extern int ov_open(FILE *f,OggVorbis_File *vf,const char *initial,long ibytes);
-extern int ov_open_callbacks(void *datasource, OggVorbis_File *vf,
- const char *initial, long ibytes, ov_callbacks callbacks);
+extern int ivorbis_ov_clear(OggVorbis_File *vf);
+extern int ivorbis_ov_open(FILE *f,OggVorbis_File *vf,const char *initial,long ibytes);
+extern int ivorbis_ov_open_callbacks(void *datasource, OggVorbis_File *vf,
+ const char *initial, long ibytes, ivorbis_ov_callbacks callbacks);
-extern int ov_test(FILE *f,OggVorbis_File *vf,const char *initial,long ibytes);
-extern int ov_test_callbacks(void *datasource, OggVorbis_File *vf,
- const char *initial, long ibytes, ov_callbacks callbacks);
-extern int ov_test_open(OggVorbis_File *vf);
+extern int ivorbis_ov_test(FILE *f,OggVorbis_File *vf,const char *initial,long ibytes);
+extern int ivorbis_ov_test_callbacks(void *datasource, OggVorbis_File *vf,
+ const char *initial, long ibytes, ivorbis_ov_callbacks callbacks);
+extern int ivorbis_ov_test_open(OggVorbis_File *vf);
-extern long ov_bitrate(OggVorbis_File *vf,int i);
-extern long ov_bitrate_instant(OggVorbis_File *vf);
-extern long ov_streams(OggVorbis_File *vf);
-extern long ov_seekable(OggVorbis_File *vf);
-extern long ov_serialnumber(OggVorbis_File *vf,int i);
+extern long ivorbis_ov_bitrate(OggVorbis_File *vf,int i);
+extern long ivorbis_ov_bitrate_instant(OggVorbis_File *vf);
+extern long ivorbis_ov_streams(OggVorbis_File *vf);
+extern long ivorbis_ov_seekable(OggVorbis_File *vf);
+extern long ivorbis_ov_serialnumber(OggVorbis_File *vf,int i);
-extern ogg_int64_t ov_raw_total(OggVorbis_File *vf,int i);
-extern ogg_int64_t ov_pcm_total(OggVorbis_File *vf,int i);
-extern ogg_int64_t ov_time_total(OggVorbis_File *vf,int i);
+extern ogg_int64_t ivorbis_ov_raw_total(OggVorbis_File *vf,int i);
+extern ogg_int64_t ivorbis_ov_pcm_total(OggVorbis_File *vf,int i);
+extern ogg_int64_t ivorbis_ov_time_total(OggVorbis_File *vf,int i);
-extern int ov_raw_seek(OggVorbis_File *vf,ogg_int64_t pos);
-extern int ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos);
-extern int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos);
-extern int ov_time_seek(OggVorbis_File *vf,ogg_int64_t pos);
-extern int ov_time_seek_page(OggVorbis_File *vf,ogg_int64_t pos);
+extern int ivorbis_ov_raw_seek(OggVorbis_File *vf,ogg_int64_t pos);
+extern int ivorbis_ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos);
+extern int ivorbis_ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos);
+extern int ivorbis_ov_time_seek(OggVorbis_File *vf,ogg_int64_t pos);
+extern int ivorbis_ov_time_seek_page(OggVorbis_File *vf,ogg_int64_t pos);
-extern ogg_int64_t ov_raw_tell(OggVorbis_File *vf);
-extern ogg_int64_t ov_pcm_tell(OggVorbis_File *vf);
-extern ogg_int64_t ov_time_tell(OggVorbis_File *vf);
+extern ogg_int64_t ivorbis_ov_raw_tell(OggVorbis_File *vf);
+extern ogg_int64_t ivorbis_ov_pcm_tell(OggVorbis_File *vf);
+extern ogg_int64_t ivorbis_ov_time_tell(OggVorbis_File *vf);
-extern vorbis_info *ov_info(OggVorbis_File *vf,int link);
-extern vorbis_comment *ov_comment(OggVorbis_File *vf,int link);
+extern vorbis_info *ivorbis_ov_info(OggVorbis_File *vf,int link);
+extern vorbis_comment *ivorbis_ov_comment(OggVorbis_File *vf,int link);
-extern long ov_read(OggVorbis_File *vf,char *buffer,int length,
+extern long ivorbis_ov_read(OggVorbis_File *vf,char *buffer,int length,
int *bitstream);
#ifdef __cplusplus
diff --git a/ivorbisfile_example.c b/ivorbisfile_example.c
index 7b0cf10..482e33d 100644
--- a/ivorbisfile_example.c
+++ b/ivorbisfile_example.c
@@ -43,7 +43,7 @@ int main(){
_setmode( _fileno( stdout ), _O_BINARY );
#endif
- if(ov_open(stdin, &vf, NULL, 0) < 0) {
+ if(ivorbis_ov_open(stdin, &vf, NULL, 0) < 0) {
fprintf(stderr,"Input does not appear to be an Ogg bitstream.\n");
exit(1);
}
@@ -51,20 +51,20 @@ int main(){
/* Throw the comments plus a few lines about the bitstream we're
decoding */
{
- char **ptr=ov_comment(&vf,-1)->user_comments;
- vorbis_info *vi=ov_info(&vf,-1);
+ char **ptr=ivorbis_ov_comment(&vf,-1)->user_comments;
+ vorbis_info *vi=ivorbis_ov_info(&vf,-1);
while(*ptr){
fprintf(stderr,"%s\n",*ptr);
++ptr;
}
fprintf(stderr,"\nBitstream is %d channel, %ldHz\n",vi->channels,vi->rate);
fprintf(stderr,"\nDecoded length: %ld samples\n",
- (long)ov_pcm_total(&vf,-1));
- fprintf(stderr,"Encoded by: %s\n\n",ov_comment(&vf,-1)->vendor);
+ (long)ivorbis_ov_pcm_total(&vf,-1));
+ fprintf(stderr,"Encoded by: %s\n\n",ivorbis_ov_comment(&vf,-1)->vendor);
}
while(!eof){
- long ret=ov_read(&vf,pcmout,sizeof(pcmout),¤t_section);
+ long ret=ivorbis_ov_read(&vf,pcmout,sizeof(pcmout),¤t_section);
if (ret == 0) {
/* EOF */
eof=1;
@@ -84,7 +84,7 @@ int main(){
}
/* cleanup */
- ov_clear(&vf);
+ ivorbis_ov_clear(&vf);
fprintf(stderr,"Done.\n");
return(0);
diff --git a/synthesis.c b/synthesis.c
index 1e1d1c7..82148c4 100644
--- a/synthesis.c
+++ b/synthesis.c
@@ -24,7 +24,7 @@
#include "misc.h"
#include "block.h"
-static int _vorbis_synthesis1(vorbis_block *vb,ogg_packet *op,int decodep){
+static int _ivorbis_synthesis1(vorbis_block *vb,ogg_packet *op,int decodep){
vorbis_dsp_state *vd= vb ? vb->vd : 0;
private_state *b= vd ? (private_state *)vd->backend_state: 0;
vorbis_info *vi= vd ? vd->vi : 0;
@@ -91,13 +91,13 @@ static int _vorbis_synthesis1(vorbis_block *vb,ogg_packet *op,int decodep){
}
int vorbis_synthesis(vorbis_block *vb,ogg_packet *op){
- return _vorbis_synthesis1(vb,op,1);
+ return _ivorbis_synthesis1(vb,op,1);
}
/* used to track pcm position without actually performing decode.
Useful for sequential 'fast forward' */
int vorbis_synthesis_trackonly(vorbis_block *vb,ogg_packet *op){
- return _vorbis_synthesis1(vb,op,0);
+ return _ivorbis_synthesis1(vb,op,0);
}
long vorbis_packet_blocksize(vorbis_info *vi,ogg_packet *op){
diff --git a/vorbisfile.c b/vorbisfile.c
index ac0eb88..5370e7e 100644
--- a/vorbisfile.c
+++ b/vorbisfile.c
@@ -645,7 +645,7 @@ static int _open_seekable2(OggVorbis_File *vf){
vf->pcmlengths[0]=pcmoffset;
vf->pcmlengths[1]-=pcmoffset;
- return(ov_raw_seek(vf,dataoffset));
+ return(ivorbis_ov_raw_seek(vf,dataoffset));
}
/* clear out the current logical bitstream decoder */
@@ -866,8 +866,8 @@ static int _fseek64_wrap(FILE *f,ogg_int64_t off,int whence){
return fseek(f,off,whence);
}
-static int _ov_open1(void *f,OggVorbis_File *vf,const char *initial,
- long ibytes, ov_callbacks callbacks){
+static int _ivorbis_ov_open1(void *f,OggVorbis_File *vf,const char *initial,
+ long ibytes, ivorbis_ov_callbacks callbacks){
int offsettest=((f && callbacks.seek_func)?callbacks.seek_func(f,0,SEEK_CUR):-1);
ogg_uint32_t *serialno_list=NULL;
int serialno_list_size=0;
@@ -904,7 +904,7 @@ static int _ov_open1(void *f,OggVorbis_File *vf,const char *initial,
numbers, load subsequent vorbis setup headers */
if((ret=_fetch_headers(vf,vf->vi,vf->vc,&serialno_list,&serialno_list_size,NULL))<0){
vf->datasource=NULL;
- ov_clear(vf);
+ ivorbis_ov_clear(vf);
}else{
/* serial number list for first link needs to be held somewhere
for second stage of seekable stream open; this saves having to
@@ -925,14 +925,14 @@ static int _ov_open1(void *f,OggVorbis_File *vf,const char *initial,
return(ret);
}
-static int _ov_open2(OggVorbis_File *vf){
+static int _ivorbis_ov_open2(OggVorbis_File *vf){
if(vf->ready_state != PARTOPEN) return OV_EINVAL;
vf->ready_state=OPENED;
if(vf->seekable){
int ret=_open_seekable2(vf);
if(ret){
vf->datasource=NULL;
- ov_clear(vf);
+ ivorbis_ov_clear(vf);
}
return(ret);
}else
@@ -943,7 +943,7 @@ static int _ov_open2(OggVorbis_File *vf){
/* clear out the OggVorbis_File struct */
-int ov_clear(OggVorbis_File *vf){
+int ivorbis_ov_clear(OggVorbis_File *vf){
if(vf){
vorbis_block_clear(&vf->vb);
vorbis_dsp_clear(&vf->vd);
@@ -981,30 +981,30 @@ int ov_clear(OggVorbis_File *vf){
0) OK
*/
-int ov_open_callbacks(void *f,OggVorbis_File *vf,
- const char *initial,long ibytes,ov_callbacks callbacks){
- int ret=_ov_open1(f,vf,initial,ibytes,callbacks);
+int ivorbis_ov_open_callbacks(void *f,OggVorbis_File *vf,
+ const char *initial,long ibytes,ivorbis_ov_callbacks callbacks){
+ int ret=_ivorbis_ov_open1(f,vf,initial,ibytes,callbacks);
if(ret)return ret;
- return _ov_open2(vf);
+ return _ivorbis_ov_open2(vf);
}
-int ov_open(FILE *f,OggVorbis_File *vf,const char *initial,long ibytes){
- ov_callbacks callbacks = {
+int ivorbis_ov_open(FILE *f,OggVorbis_File *vf,const char *initial,long ibytes){
+ ivorbis_ov_callbacks callbacks = {
(size_t (*)(void *, size_t, size_t, void *)) fread,
(int (*)(void *, ogg_int64_t, int)) _fseek64_wrap,
(int (*)(void *)) fclose,
(long (*)(void *)) ftell
};
- return ov_open_callbacks((void *)f, vf, initial, ibytes, callbacks);
+ return ivorbis_ov_open_callbacks((void *)f, vf, initial, ibytes, callbacks);
}
-int ov_fopen(const char *path,OggVorbis_File *vf){
+int ivorbis_ov_fopen(const char *path,OggVorbis_File *vf){
int ret;
FILE *f = fopen(path,"rb");
if(!f) return -1;
- ret = ov_open(f,vf,NULL,0);
+ ret = ivorbis_ov_open(f,vf,NULL,0);
if(ret) fclose(f);
return ret;
}
@@ -1012,38 +1012,38 @@ int ov_fopen(const char *path,OggVorbis_File *vf){
/* Only partially open the vorbis file; test for Vorbisness, and load
the headers for the first chain. Do not seek (although test for
- seekability). Use ov_test_open to finish opening the file, else
- ov_clear to close/free it. Same return codes as open. */
+ seekability). Use ivorbis_ov_test_open to finish opening the file, else
+ ivorbis_ov_clear to close/free it. Same return codes as open. */
-int ov_test_callbacks(void *f,OggVorbis_File *vf,
- const char *initial,long ibytes,ov_callbacks callbacks)
+int ivorbis_ov_test_callbacks(void *f,OggVorbis_File *vf,
+ const char *initial,long ibytes,ivorbis_ov_callbacks callbacks)
{
- return _ov_open1(f,vf,initial,ibytes,callbacks);
+ return _ivorbis_ov_open1(f,vf,initial,ibytes,callbacks);
}
-int ov_test(FILE *f,OggVorbis_File *vf,const char *initial,long ibytes){
- ov_callbacks callbacks = {
+int ivorbis_ov_test(FILE *f,OggVorbis_File *vf,const char *initial,long ibytes){
+ ivorbis_ov_callbacks callbacks = {
(size_t (*)(void *, size_t, size_t, void *)) fread,
(int (*)(void *, ogg_int64_t, int)) _fseek64_wrap,
(int (*)(void *)) fclose,
(long (*)(void *)) ftell
};
- return ov_test_callbacks((void *)f, vf, initial, ibytes, callbacks);
+ return ivorbis_ov_test_callbacks((void *)f, vf, initial, ibytes, callbacks);
}
-int ov_test_open(OggVorbis_File *vf){
+int ivorbis_ov_test_open(OggVorbis_File *vf){
if(vf->ready_state!=PARTOPEN)return(OV_EINVAL);
- return _ov_open2(vf);
+ return _ivorbis_ov_open2(vf);
}
/* How many logical bitstreams in this physical bitstream? */
-long ov_streams(OggVorbis_File *vf){
+long ivorbis_ov_streams(OggVorbis_File *vf){
return vf->links;
}
/* Is the FILE * associated with vf seekable? */
-long ov_seekable(OggVorbis_File *vf){
+long ivorbis_ov_seekable(OggVorbis_File *vf){
return vf->seekable;
}
@@ -1056,24 +1056,24 @@ long ov_seekable(OggVorbis_File *vf){
If you want the actual bitrate field settings, get them from the
vorbis_info structs */
-long ov_bitrate(OggVorbis_File *vf,int i){
+long ivorbis_ov_bitrate(OggVorbis_File *vf,int i){
if(vf->ready_state<OPENED)return(OV_EINVAL);
if(i>=vf->links)return(OV_EINVAL);
- if(!vf->seekable && i!=0)return(ov_bitrate(vf,0));
+ if(!vf->seekable && i!=0)return(ivorbis_ov_bitrate(vf,0));
if(i<0){
ogg_int64_t bits=0;
int i;
for(i=0;i<vf->links;i++)
bits+=(vf->offsets[i+1]-vf->dataoffsets[i])*8;
- /* This once read: return(rint(bits/ov_time_total(vf,-1)));
+ /* This once read: return(rint(bits/ivorbis_ov_time_total(vf,-1)));
* gcc 3.x on x86 miscompiled this at optimisation level 2 and above,
* so this is slightly transformed to make it work.
*/
- return(bits*1000/ov_time_total(vf,-1));
+ return(bits*1000/ivorbis_ov_time_total(vf,-1));
}else{
if(vf->seekable){
/* return the actual bitrate */
- return((vf->offsets[i+1]-vf->dataoffsets[i])*8000/ov_time_total(vf,i));
+ return((vf->offsets[i+1]-vf->dataoffsets[i])*8000/ivorbis_ov_time_total(vf,i));
}else{
/* return nominal if set */
if(vf->vi[i].bitrate_nominal>0){
@@ -1096,7 +1096,7 @@ long ov_bitrate(OggVorbis_File *vf,int i){
additional data to offer since last call (or at beginning of stream),
EINVAL if stream is only partially open
*/
-long ov_bitrate_instant(OggVorbis_File *vf){
+long ivorbis_ov_bitrate_instant(OggVorbis_File *vf){
int link=(vf->seekable?vf->current_link:0);
long ret;
if(vf->ready_state<OPENED)return(OV_EINVAL);
@@ -1108,9 +1108,9 @@ long ov_bitrate_instant(OggVorbis_File *vf){
}
/* Guess */
-long ov_serialnumber(OggVorbis_File *vf,int i){
- if(i>=vf->links)return(ov_serialnumber(vf,vf->links-1));
- if(!vf->seekable && i>=0)return(ov_serialnumber(vf,-1));
+long ivorbis_ov_serialnumber(OggVorbis_File *vf,int i){
+ if(i>=vf->links)return(ivorbis_ov_serialnumber(vf,vf->links-1));
+ if(!vf->seekable && i>=0)return(ivorbis_ov_serialnumber(vf,-1));
if(i<0){
return(vf->current_serialno);
}else{
@@ -1123,14 +1123,14 @@ long ov_serialnumber(OggVorbis_File *vf,int i){
OV_EINVAL if the stream is not seekable (we can't know the length)
or if stream is only partially open
*/
-ogg_int64_t ov_raw_total(OggVorbis_File *vf,int i){
+ogg_int64_t ivorbis_ov_raw_total(OggVorbis_File *vf,int i){
if(vf->ready_state<OPENED)return(OV_EINVAL);
if(!vf->seekable || i>=vf->links)return(OV_EINVAL);
if(i<0){
ogg_int64_t acc=0;
int i;
for(i=0;i<vf->links;i++)
- acc+=ov_raw_total(vf,i);
+ acc+=ivorbis_ov_raw_total(vf,i);
return(acc);
}else{
return(vf->offsets[i+1]-vf->offsets[i]);
@@ -1142,14 +1142,14 @@ ogg_int64_t ov_raw_total(OggVorbis_File *vf,int i){
OV_EINVAL if the stream is not seekable (we can't know the
length) or only partially open
*/
-ogg_int64_t ov_pcm_total(OggVorbis_File *vf,int i){
+ogg_int64_t ivorbis_ov_pcm_total(OggVorbis_File *vf,int i){
if(vf->ready_state<OPENED)return(OV_EINVAL);
if(!vf->seekable || i>=vf->links)return(OV_EINVAL);
if(i<0){
ogg_int64_t acc=0;
int i;
for(i=0;i<vf->links;i++)
- acc+=ov_pcm_total(vf,i);
+ acc+=ivorbis_ov_pcm_total(vf,i);
return(acc);
}else{
return(vf->pcmlengths[i*2+1]);
@@ -1161,14 +1161,14 @@ ogg_int64_t ov_pcm_total(OggVorbis_File *vf,int i){
OV_EINVAL if the stream is not seekable (we can't know the
length) or only partially open
*/
-ogg_int64_t ov_time_total(OggVorbis_File *vf,int i){
+ogg_int64_t ivorbis_ov_time_total(OggVorbis_File *vf,int i){
if(vf->ready_state<OPENED)return(OV_EINVAL);
if(!vf->seekable || i>=vf->links)return(OV_EINVAL);
if(i<0){
ogg_int64_t acc=0;
int i;
for(i=0;i<vf->links;i++)
- acc+=ov_time_total(vf,i);
+ acc+=ivorbis_ov_time_total(vf,i);
return(acc);
}else{
return(((ogg_int64_t)vf->pcmlengths[i*2+1])*1000/vf->vi[i].rate);
@@ -1182,7 +1182,7 @@ ogg_int64_t ov_time_total(OggVorbis_File *vf,int i){
returns zero on success, nonzero on failure */
-int ov_raw_seek(OggVorbis_File *vf,ogg_int64_t pos){
+int ivorbis_ov_raw_seek(OggVorbis_File *vf,ogg_int64_t pos){
ogg_stream_state work_os;
int ret;
@@ -1288,7 +1288,7 @@ int ov_raw_seek(OggVorbis_File *vf,ogg_int64_t pos){
if(!lastblock){
pagepos=_get_next_page(vf,&og,-1);
if(pagepos<0){
- vf->pcm_offset=ov_pcm_total(vf,-1);
+ vf->pcm_offset=ivorbis_ov_pcm_total(vf,-1);
break;
}
}else{
@@ -1387,10 +1387,10 @@ ogg_int64_t rescale64(ogg_int64_t x, ogg_int64_t from, ogg_int64_t to){
Seek to the last [granule marked] page preceding the specified pos
location, such that decoding past the returned point will quickly
arrive at the requested position. */
-int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos){
+int ivorbis_ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos){
int link=-1;
ogg_int64_t result=0;
- ogg_int64_t total=ov_pcm_total(vf,-1);
+ ogg_int64_t total=ivorbis_ov_pcm_total(vf,-1);
if(vf->ready_state<OPENED)return(OV_EINVAL);
if(!vf->seekable)return(OV_ENOSEEK);
@@ -1534,7 +1534,7 @@ int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos){
if(ogg_page_serialno(&og)==vf->current_serialno &&
(ogg_page_granulepos(&og)>-1 ||
!ogg_page_continued(&og))){
- return ov_raw_seek(vf,result);
+ return ivorbis_ov_raw_seek(vf,result);
}
vf->offset=result;
}
@@ -1555,7 +1555,7 @@ int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos){
}
/* verify result */
- if(vf->pcm_offset>pos || pos>ov_pcm_total(vf,-1)){
+ if(vf->pcm_offset>pos || pos>ivorbis_ov_pcm_total(vf,-1)){
result=OV_EFAULT;
goto seek_error;
}
@@ -1573,9 +1573,9 @@ int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos){
/* seek to a sample offset relative to the decompressed pcm stream
returns zero on success, nonzero on failure */
-int ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos){
+int ivorbis_ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos){
int thisblock,lastblock=0;
- int ret=ov_pcm_seek_page(vf,pos);
+ int ret=ivorbis_ov_pcm_seek_page(vf,pos);
if(ret<0)return(ret);
if((ret=_make_decode_ready(vf)))return ret;
@@ -1661,15 +1661,15 @@ int ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos){
if(samples<target)
if(_fetch_and_process_packet(vf,NULL,1,1)<=0)
- vf->pcm_offset=ov_pcm_total(vf,-1); /* eof */
+ vf->pcm_offset=ivorbis_ov_pcm_total(vf,-1); /* eof */
}
return 0;
}
/* seek to a playback time relative to the decompressed pcm stream
returns zero on success, nonzero on failure */
-int ov_time_seek(OggVorbis_File *vf,ogg_int64_t milliseconds){
- /* translate time to PCM position and call ov_pcm_seek */
+int ivorbis_ov_time_seek(OggVorbis_File *vf,ogg_int64_t milliseconds){
+ /* translate time to PCM position and call ivorbis_ov_pcm_seek */
int link=-1;
ogg_int64_t pcm_total=0;
@@ -1681,7 +1681,7 @@ int ov_time_seek(OggVorbis_File *vf,ogg_int64_t milliseconds){
/* which bitstream section does this time offset occur in? */
for(link=0;link<vf->links;link++){
- ogg_int64_t addsec = ov_time_total(vf,link);
+ ogg_int64_t addsec = ivorbis_ov_time_total(vf,link);
if(milliseconds<time_total+addsec)break;
time_total+=addsec;
pcm_total+=vf->pcmlengths[link*2+1];
@@ -1692,14 +1692,14 @@ int ov_time_seek(OggVorbis_File *vf,ogg_int64_t milliseconds){
/* enough information to convert time offset to pcm offset */
{
ogg_int64_t target=pcm_total+(milliseconds-time_total)*vf->vi[link].rate/1000;
- return(ov_pcm_seek(vf,target));
+ return(ivorbis_ov_pcm_seek(vf,target));
}
}
-/* page-granularity version of ov_time_seek
+/* page-granularity version of ivorbis_ov_time_seek
returns zero on success, nonzero on failure */
-int ov_time_seek_page(OggVorbis_File *vf,ogg_int64_t milliseconds){
- /* translate time to PCM position and call ov_pcm_seek */
+int ivorbis_ov_time_seek_page(OggVorbis_File *vf,ogg_int64_t milliseconds){
+ /* translate time to PCM position and call ivorbis_ov_pcm_seek */
int link=-1;
ogg_int64_t pcm_total=0;
@@ -1711,7 +1711,7 @@ int ov_time_seek_page(OggVorbis_File *vf,ogg_int64_t milliseconds){
/* which bitstream section does this time offset occur in? */
for(link=0;link<vf->links;link++){
- ogg_int64_t addsec = ov_time_total(vf,link);
+ ogg_int64_t addsec = ivorbis_ov_time_total(vf,link);
if(milliseconds<time_total+addsec)break;
time_total+=addsec;
pcm_total+=vf->pcmlengths[link*2+1];
@@ -1722,38 +1722,38 @@ int ov_time_seek_page(OggVorbis_File *vf,ogg_int64_t milliseconds){
/* enough information to convert time offset to pcm offset */
{
ogg_int64_t target=pcm_total+(milliseconds-time_total)*vf->vi[link].rate/1000;
- return(ov_pcm_seek_page(vf,target));
+ return(ivorbis_ov_pcm_seek_page(vf,target));
}
}
/* tell the current stream offset cursor. Note that seek followed by
tell will likely not give the set offset due to caching */
-ogg_int64_t ov_raw_tell(OggVorbis_File *vf){
+ogg_int64_t ivorbis_ov_raw_tell(OggVorbis_File *vf){
if(vf->ready_state<OPENED)return(OV_EINVAL);
return(vf->offset);
}
/* return PCM offset (sample) of next PCM sample to be read */
-ogg_int64_t ov_pcm_tell(OggVorbis_File *vf){
+ogg_int64_t ivorbis_ov_pcm_tell(OggVorbis_File *vf){
if(vf->ready_state<OPENED)return(OV_EINVAL);
return(vf->pcm_offset);
}
/* return time offset (milliseconds) of next PCM sample to be read */
-ogg_int64_t ov_time_tell(OggVorbis_File *vf){
+ogg_int64_t ivorbis_ov_time_tell(OggVorbis_File *vf){
int link=0;
ogg_int64_t pcm_total=0;
ogg_int64_t time_total=0;
if(vf->ready_state<OPENED)return(OV_EINVAL);
if(vf->seekable){
- pcm_total=ov_pcm_total(vf,-1);
- time_total=ov_time_total(vf,-1);
+ pcm_total=ivorbis_ov_pcm_total(vf,-1);
+ time_total=ivorbis_ov_time_total(vf,-1);
/* which bitstream section does this time offset occur in? */
for(link=vf->links-1;link>=0;link--){
pcm_total-=vf->pcmlengths[link*2+1];
- time_total-=ov_time_total(vf,link);
+ time_total-=ivorbis_ov_time_total(vf,link);
if(vf->pcm_offset>=pcm_total)break;
}
}
@@ -1769,7 +1769,7 @@ ogg_int64_t ov_time_tell(OggVorbis_File *vf){
current bitstream. NULL in the case that the machine is not
initialized */
-vorbis_info *ov_info(OggVorbis_File *vf,int link){
+vorbis_info *ivorbis_ov_info(OggVorbis_File *vf,int link){
if(vf->seekable){
if(link<0)
if(vf->ready_state>=STREAMSET)
@@ -1787,7 +1787,7 @@ vorbis_info *ov_info(OggVorbis_File *vf,int link){
}
/* grr, strong typing, grr, no templates/inheritence, grr */
-vorbis_comment *ov_comment(OggVorbis_File *vf,int link){
+vorbis_comment *ivorbis_ov_comment(OggVorbis_File *vf,int link){
if(vf->seekable){
if(link<0)
if(vf->ready_state>=STREAMSET)
@@ -1811,7 +1811,7 @@ vorbis_comment *ov_comment(OggVorbis_File *vf,int link){
nature must surface: Multiple bitstream sections do not necessarily
have to have the same number of channels or sampling rate.
- ov_read returns the sequential logical bitstream number currently
+ ivorbis_ov_read returns the sequential logical bitstream number currently
being decoded along with the PCM data in order that the toplevel
application can take action on channel/sample rate changes. This
number will be incremented even for streamed (non-seekable) streams
@@ -1831,7 +1831,7 @@ vorbis_comment *ov_comment(OggVorbis_File *vf,int link){
*section) set to the logical bitstream number */
-long ov_read(OggVorbis_File *vf,char *buffer,int bytes_req,int *bitstream){
+long ivorbis_ov_read(OggVorbis_File *vf,char *buffer,int bytes_req,int *bitstream){
int i,j;
ogg_int32_t **pcm;
@@ -1860,7 +1860,7 @@ long ov_read(OggVorbis_File *vf,char *buffer,int bytes_req,int *bitstream){
/* yay! proceed to pack data into the byte buffer */
- long channels=ov_info(vf,-1)->channels;
+ long channels=ivorbis_ov_info(vf,-1)->channels;
if(samples>(bytes_req/(2*channels)))
samples=bytes_req/(2*channels);
--
2.1.4
|