author | koda |
Fri, 21 Sep 2012 01:29:33 +0200 | |
changeset 7699 | 2455207a2c71 |
parent 7697 | 767d3c4153a1 |
child 7849 | a12155461b34 |
permissions | -rw-r--r-- |
5170
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
1 |
/******************************************************************** |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
2 |
* * |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
3 |
* THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. * |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
4 |
* * |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
5 |
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
6 |
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
7 |
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
8 |
* * |
7697
767d3c4153a1
switch the Tremor implementation from the Cocos2D one to the lowmem-no-byte branch and let's see what happens
koda
parents:
6045
diff
changeset
|
9 |
* THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2003 * |
5170
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
10 |
* BY THE Xiph.Org FOUNDATION http://www.xiph.org/ * |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
11 |
* * |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
12 |
******************************************************************** |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
13 |
|
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
14 |
function: stdio-based convenience library for opening/seeking/decoding |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
15 |
|
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
16 |
********************************************************************/ |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
17 |
|
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
18 |
#ifndef _OV_FILE_H_ |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
19 |
#define _OV_FILE_H_ |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
20 |
|
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
21 |
#ifdef __cplusplus |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
22 |
extern "C" |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
23 |
{ |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
24 |
#endif /* __cplusplus */ |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
25 |
|
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
26 |
#include <stdio.h> |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
27 |
#include "ivorbiscodec.h" |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
28 |
|
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
29 |
/* The function prototypes for the callbacks are basically the same as for |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
30 |
* the stdio functions fread, fseek, fclose, ftell. |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
31 |
* The one difference is that the FILE * arguments have been replaced with |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
32 |
* a void * - this is to be used as a pointer to whatever internal data these |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
33 |
* functions might need. In the stdio case, it's just a FILE * cast to a void * |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
34 |
* |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
35 |
* If you use other functions, check the docs for these functions and return |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
36 |
* the right values. For seek_func(), you *MUST* return -1 if the stream is |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
37 |
* unseekable |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
38 |
*/ |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
39 |
typedef struct { |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
40 |
size_t (*read_func) (void *ptr, size_t size, size_t nmemb, void *datasource); |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
41 |
int (*seek_func) (void *datasource, ogg_int64_t offset, int whence); |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
42 |
int (*close_func) (void *datasource); |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
43 |
long (*tell_func) (void *datasource); |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
44 |
} ov_callbacks; |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
45 |
|
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
46 |
typedef struct OggVorbis_File { |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
47 |
void *datasource; /* Pointer to a FILE *, etc. */ |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
48 |
int seekable; |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
49 |
ogg_int64_t offset; |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
50 |
ogg_int64_t end; |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
51 |
ogg_sync_state *oy; |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
52 |
|
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
53 |
/* If the FILE handle isn't seekable (eg, a pipe), only the current |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
54 |
stream appears */ |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
55 |
int links; |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
56 |
ogg_int64_t *offsets; |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
57 |
ogg_int64_t *dataoffsets; |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
58 |
ogg_uint32_t *serialnos; |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
59 |
ogg_int64_t *pcmlengths; |
7697
767d3c4153a1
switch the Tremor implementation from the Cocos2D one to the lowmem-no-byte branch and let's see what happens
koda
parents:
6045
diff
changeset
|
60 |
vorbis_info vi; |
767d3c4153a1
switch the Tremor implementation from the Cocos2D one to the lowmem-no-byte branch and let's see what happens
koda
parents:
6045
diff
changeset
|
61 |
vorbis_comment vc; |
5170
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
62 |
|
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
63 |
/* Decoding working state local storage */ |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
64 |
ogg_int64_t pcm_offset; |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
65 |
int ready_state; |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
66 |
ogg_uint32_t current_serialno; |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
67 |
int current_link; |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
68 |
|
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
69 |
ogg_int64_t bittrack; |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
70 |
ogg_int64_t samptrack; |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
71 |
|
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
72 |
ogg_stream_state *os; /* take physical pages, weld into a logical |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
73 |
stream of packets */ |
7697
767d3c4153a1
switch the Tremor implementation from the Cocos2D one to the lowmem-no-byte branch and let's see what happens
koda
parents:
6045
diff
changeset
|
74 |
vorbis_dsp_state *vd; /* central working state for the packet->PCM decoder */ |
5170
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
75 |
|
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
76 |
ov_callbacks callbacks; |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
77 |
|
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
78 |
} OggVorbis_File; |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
79 |
|
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
80 |
extern int ov_clear(OggVorbis_File *vf); |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
81 |
extern int ov_open(FILE *f,OggVorbis_File *vf,char *initial,long ibytes); |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
82 |
extern int ov_open_callbacks(void *datasource, OggVorbis_File *vf, |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
83 |
char *initial, long ibytes, ov_callbacks callbacks); |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
84 |
|
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
85 |
extern int ov_test(FILE *f,OggVorbis_File *vf,char *initial,long ibytes); |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
86 |
extern int ov_test_callbacks(void *datasource, OggVorbis_File *vf, |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
87 |
char *initial, long ibytes, ov_callbacks callbacks); |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
88 |
extern int ov_test_open(OggVorbis_File *vf); |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
89 |
|
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
90 |
extern long ov_bitrate(OggVorbis_File *vf,int i); |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
91 |
extern long ov_bitrate_instant(OggVorbis_File *vf); |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
92 |
extern long ov_streams(OggVorbis_File *vf); |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
93 |
extern long ov_seekable(OggVorbis_File *vf); |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
94 |
extern long ov_serialnumber(OggVorbis_File *vf,int i); |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
95 |
|
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
96 |
extern ogg_int64_t ov_raw_total(OggVorbis_File *vf,int i); |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
97 |
extern ogg_int64_t ov_pcm_total(OggVorbis_File *vf,int i); |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
98 |
extern ogg_int64_t ov_time_total(OggVorbis_File *vf,int i); |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
99 |
|
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
100 |
extern int ov_raw_seek(OggVorbis_File *vf,ogg_int64_t pos); |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
101 |
extern int ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos); |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
102 |
extern int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos); |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
103 |
extern int ov_time_seek(OggVorbis_File *vf,ogg_int64_t pos); |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
104 |
extern int ov_time_seek_page(OggVorbis_File *vf,ogg_int64_t pos); |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
105 |
|
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
106 |
extern ogg_int64_t ov_raw_tell(OggVorbis_File *vf); |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
107 |
extern ogg_int64_t ov_pcm_tell(OggVorbis_File *vf); |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
108 |
extern ogg_int64_t ov_time_tell(OggVorbis_File *vf); |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
109 |
|
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
110 |
extern vorbis_info *ov_info(OggVorbis_File *vf,int link); |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
111 |
extern vorbis_comment *ov_comment(OggVorbis_File *vf,int link); |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
112 |
|
7697
767d3c4153a1
switch the Tremor implementation from the Cocos2D one to the lowmem-no-byte branch and let's see what happens
koda
parents:
6045
diff
changeset
|
113 |
extern long ov_read(OggVorbis_File *vf,void *buffer,int length, |
5170
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
114 |
int *bitstream); |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
115 |
|
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
116 |
#ifdef __cplusplus |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
117 |
} |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
118 |
#endif /* __cplusplus */ |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
119 |
|
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
120 |
#endif |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
121 |
|
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
122 |