gosu 0.7.45 → 0.7.46

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. data/COPYING +6 -11
  2. data/Gosu/{ButtonsWin.hpp → Buttons.hpp} +91 -4
  3. data/Gosu/ButtonsMac.hpp +91 -4
  4. data/Gosu/Graphics.hpp +10 -0
  5. data/Gosu/ImageData.hpp +1 -0
  6. data/Gosu/Input.hpp +2 -3
  7. data/Gosu/Version.hpp +2 -2
  8. data/Gosu/Window.hpp +1 -1
  9. data/GosuImpl/Audio/AudioToolboxFile.hpp +4 -0
  10. data/GosuImpl/Graphics/BitmapApple.mm +5 -11
  11. data/GosuImpl/Graphics/ClipRectStack.hpp +2 -2
  12. data/GosuImpl/Graphics/Common.hpp +1 -1
  13. data/GosuImpl/Graphics/DrawOpQueue.hpp +30 -29
  14. data/GosuImpl/Graphics/Graphics.cpp +2 -3
  15. data/GosuImpl/Graphics/TextMac.cpp +9 -5
  16. data/GosuImpl/Graphics/TextTouch.mm +8 -4
  17. data/GosuImpl/Graphics/Texture.cpp +4 -1
  18. data/GosuImpl/InputMac.mm +24 -45
  19. data/GosuImpl/InputX.cpp +25 -39
  20. data/GosuImpl/RubyGosu.swg +11 -0
  21. data/GosuImpl/RubyGosu_wrap.cxx +109 -40
  22. data/GosuImpl/RubyGosu_wrap.h +1 -1
  23. data/GosuImpl/TextInputWin.cpp +1 -1
  24. data/GosuImpl/TextInputX.cpp +3 -1
  25. data/GosuImpl/WinMain.cpp +3 -4
  26. data/GosuImpl/WindowMac.mm +83 -73
  27. data/GosuImpl/WindowWin.cpp +65 -58
  28. data/dependencies/libogg/AUTHORS +4 -0
  29. data/dependencies/libogg/CHANGES +70 -0
  30. data/dependencies/libogg/COPYING +28 -0
  31. data/dependencies/libogg/include/ogg/ogg.h +209 -0
  32. data/dependencies/libogg/include/ogg/os_types.h +147 -0
  33. data/dependencies/libogg/src/bitwise.c +857 -0
  34. data/dependencies/libogg/src/framing.c +2089 -0
  35. data/dependencies/libvorbis/AUTHORS +3 -0
  36. data/dependencies/libvorbis/CHANGES +126 -0
  37. data/dependencies/libvorbis/COPYING +28 -0
  38. data/dependencies/libvorbis/include/vorbis/codec.h +243 -0
  39. data/dependencies/libvorbis/include/vorbis/vorbisenc.h +436 -0
  40. data/dependencies/libvorbis/include/vorbis/vorbisfile.h +206 -0
  41. data/dependencies/libvorbis/lib/analysis.c +120 -0
  42. data/dependencies/libvorbis/lib/backends.h +144 -0
  43. data/dependencies/libvorbis/lib/barkmel.c +64 -0
  44. data/dependencies/libvorbis/lib/bitrate.c +253 -0
  45. data/dependencies/libvorbis/lib/bitrate.h +59 -0
  46. data/dependencies/libvorbis/lib/block.c +1046 -0
  47. data/dependencies/libvorbis/lib/books/coupled/res_books_51.h +12257 -0
  48. data/dependencies/libvorbis/lib/books/coupled/res_books_stereo.h +15783 -0
  49. data/dependencies/libvorbis/lib/books/floor/floor_books.h +1547 -0
  50. data/dependencies/libvorbis/lib/books/uncoupled/res_books_uncoupled.h +7758 -0
  51. data/dependencies/libvorbis/lib/codebook.c +479 -0
  52. data/dependencies/libvorbis/lib/codebook.h +119 -0
  53. data/dependencies/libvorbis/lib/codec_internal.h +167 -0
  54. data/dependencies/libvorbis/lib/envelope.c +375 -0
  55. data/dependencies/libvorbis/lib/envelope.h +80 -0
  56. data/dependencies/libvorbis/lib/floor0.c +222 -0
  57. data/dependencies/libvorbis/lib/floor1.c +1099 -0
  58. data/dependencies/libvorbis/lib/highlevel.h +58 -0
  59. data/dependencies/libvorbis/lib/info.c +664 -0
  60. data/dependencies/libvorbis/lib/lookup.c +94 -0
  61. data/dependencies/libvorbis/lib/lookup.h +32 -0
  62. data/dependencies/libvorbis/lib/lookup_data.h +192 -0
  63. data/dependencies/libvorbis/lib/lpc.c +160 -0
  64. data/dependencies/libvorbis/lib/lpc.h +29 -0
  65. data/dependencies/libvorbis/lib/lsp.c +456 -0
  66. data/dependencies/libvorbis/lib/lsp.h +28 -0
  67. data/dependencies/libvorbis/lib/mapping0.c +816 -0
  68. data/dependencies/libvorbis/lib/masking.h +785 -0
  69. data/dependencies/libvorbis/lib/mdct.c +563 -0
  70. data/dependencies/libvorbis/lib/mdct.h +71 -0
  71. data/dependencies/libvorbis/lib/misc.h +57 -0
  72. data/dependencies/libvorbis/lib/modes/floor_all.h +260 -0
  73. data/dependencies/libvorbis/lib/modes/psych_11.h +51 -0
  74. data/dependencies/libvorbis/lib/modes/psych_16.h +133 -0
  75. data/dependencies/libvorbis/lib/modes/psych_44.h +642 -0
  76. data/dependencies/libvorbis/lib/modes/psych_8.h +101 -0
  77. data/dependencies/libvorbis/lib/modes/residue_16.h +163 -0
  78. data/dependencies/libvorbis/lib/modes/residue_44.h +292 -0
  79. data/dependencies/libvorbis/lib/modes/residue_44p51.h +451 -0
  80. data/dependencies/libvorbis/lib/modes/residue_44u.h +318 -0
  81. data/dependencies/libvorbis/lib/modes/residue_8.h +109 -0
  82. data/dependencies/libvorbis/lib/modes/setup_11.h +143 -0
  83. data/dependencies/libvorbis/lib/modes/setup_16.h +153 -0
  84. data/dependencies/libvorbis/lib/modes/setup_22.h +128 -0
  85. data/dependencies/libvorbis/lib/modes/setup_32.h +132 -0
  86. data/dependencies/libvorbis/lib/modes/setup_44.h +117 -0
  87. data/dependencies/libvorbis/lib/modes/setup_44p51.h +74 -0
  88. data/dependencies/libvorbis/lib/modes/setup_44u.h +74 -0
  89. data/dependencies/libvorbis/lib/modes/setup_8.h +149 -0
  90. data/dependencies/libvorbis/lib/modes/setup_X.h +225 -0
  91. data/dependencies/libvorbis/lib/os.h +186 -0
  92. data/dependencies/libvorbis/lib/psy.c +1203 -0
  93. data/dependencies/libvorbis/lib/psy.h +154 -0
  94. data/dependencies/libvorbis/lib/psytune.c +524 -0
  95. data/dependencies/libvorbis/lib/registry.c +45 -0
  96. data/dependencies/libvorbis/lib/registry.h +32 -0
  97. data/dependencies/libvorbis/lib/res0.c +889 -0
  98. data/dependencies/libvorbis/lib/scales.h +90 -0
  99. data/dependencies/libvorbis/lib/sharedbook.c +579 -0
  100. data/dependencies/libvorbis/lib/smallft.c +1255 -0
  101. data/dependencies/libvorbis/lib/smallft.h +34 -0
  102. data/dependencies/libvorbis/lib/synthesis.c +184 -0
  103. data/dependencies/libvorbis/lib/tone.c +54 -0
  104. data/dependencies/libvorbis/lib/vorbisenc.c +1215 -0
  105. data/dependencies/libvorbis/lib/vorbisfile.c +2337 -0
  106. data/dependencies/libvorbis/lib/window.c +2135 -0
  107. data/dependencies/libvorbis/lib/window.h +26 -0
  108. data/dependencies/ogg_vorbis.license +28 -0
  109. data/lib/gosu/swig_patches.rb +2 -2
  110. data/linux/extconf.rb +17 -3
  111. metadata +96 -17
  112. data/Gosu/ButtonsX.hpp +0 -141
  113. data/GosuImpl/Audio/AudioSDL.cpp +0 -315
@@ -0,0 +1,3 @@
1
+ Monty <monty@xiph.org>
2
+
3
+ and the rest of the Xiph.org Foundation.
@@ -0,0 +1,126 @@
1
+ libvorbis 1.3.2 (2010-11-01) -- "Xiph.Org libVorbis I 20101101 (Schaufenugget)"
2
+
3
+ * vorbis: additional proofing against invalid/malicious
4
+ streams in floor, residue, and bos/eos packet trimming
5
+ code (see SVN for details).
6
+ * vorbis: Added programming documentation tree for the
7
+ low-level calls
8
+ * vorbisfile: Correct handling of serial numbers array
9
+ element [0] on non-seekable streams
10
+ * vorbisenc: Back out an [old] AoTuV HF weighting that was
11
+ first enabled in 1.3.0; there are a few samples where I
12
+ really don't like the effect it causes.
13
+ * vorbis: return correct timestamp for granule positions
14
+ with high bit set.
15
+ * vorbisfile: the [undocumented] half-rate decode api made no
16
+ attempt to keep the pcm offset tracking consistent in seeks.
17
+ Fix and add a testing mode to seeking_example.c to torture
18
+ test seeking in halfrate mode. Also remove requirement that
19
+ halfrate mode only work with seekable files.
20
+ * vorbisfile: Fix a chaining bug in raw_seeks where seeking
21
+ out of the current link would fail due to not
22
+ reinitializing the decode machinery.
23
+ * vorbisfile: improve seeking strategy. Reduces the
24
+ necessary number of seek callbacks in an open or seek
25
+ operation by well over 2/3.
26
+
27
+ libvorbis 1.3.1 (2010-02-26) -- "Xiph.Org libVorbis I 20100325 (Everywhere)"
28
+
29
+ * tweak + minor arithmetic fix in floor1 fit
30
+ * revert noise norm to conservative 1.2.3 behavior pending
31
+ more listening testing
32
+
33
+ libvorbis 1.3.0 (2010-02-25) -- unreleased staging snapshot
34
+
35
+ * Optimized surround support for 5.1 encoding at 44.1/48kHz
36
+ * Added encoder control call to disable channel coupling
37
+ * Correct an overflow bug in very low-bitrate encoding on 32 bit
38
+ machines that caused inflated bitrates
39
+ * Numerous API hardening, leak and build fixes
40
+ * Correct bug in 22kHz compand setup that could cause a crash
41
+ * Correct bug in 16kHz codebooks that could cause unstable pure
42
+ tones at high bitrates
43
+
44
+ libvorbis 1.2.3 (2009-07-09) -- "Xiph.Org libVorbis I 20090709"
45
+
46
+ * correct a vorbisfile bug that prevented proper playback of
47
+ Vorbis files where all audio in a logical stream is in a
48
+ single page
49
+ * Additional decode setup hardening against malicious streams
50
+ * Add 'OV_EXCLUDE_STATIC_CALLBACKS' define for developers who
51
+ wish to avoid unused symbol warnings from the static callbacks
52
+ defined in vorbisfile.h
53
+
54
+ libvorbis 1.2.2 (2009-06-24) -- "Xiph.Org libVorbis I 20090624"
55
+
56
+ * define VENDOR and ENCODER strings
57
+ * seek correctly in files bigger than 2 GB (Windows)
58
+ * fix regression from CVE-2008-1420; 1.0b1 files work again
59
+ * mark all tables as constant to reduce memory occupation
60
+ * additional decoder hardening against malicious streams
61
+ * substantially reduce amount of seeking performed by Vorbisfile
62
+ * Multichannel decode bugfix
63
+ * build system updates
64
+ * minor specification clarifications/fixes
65
+
66
+ libvorbis 1.2.1 (unreleased) -- "Xiph.Org libVorbis I 20080501"
67
+
68
+ * Improved robustness with corrupt streams.
69
+ * New ov_read_filter() vorbisfile call allows filtering decoded
70
+ audio as floats before converting to integer samples.
71
+ * Fix an encoder bug with multichannel streams.
72
+ * Replaced RTP payload format draft with RFC 5215.
73
+ * Bare bones self test under 'make check'.
74
+ * Fix a problem encoding some streams between 14 and 28 kHz.
75
+ * Fix a numerical instability in the edge extrapolation filter.
76
+ * Build system improvements.
77
+ * Specification correction.
78
+
79
+ libvorbis 1.2.0 (2007-07-25) -- "Xiph.Org libVorbis I 20070622"
80
+
81
+ * new ov_fopen() convenience call that avoids the common
82
+ stdio conflicts with ov_open() and MSVC runtimes.
83
+ * libvorbisfile now handles multiplexed streams
84
+ * improve robustness to corrupt input streams
85
+ * fix a minor encoder bug
86
+ * updated RTP draft
87
+ * build system updates
88
+ * minor corrections to the specification
89
+
90
+ libvorbis 1.1.2 (2005-11-27) -- "Xiph.Org libVorbis I 20050304"
91
+
92
+ * fix a serious encoder bug with gcc 4 optimized builds
93
+ * documentation and spec fixes
94
+ * updated VS2003 and XCode builds
95
+ * new draft RTP encapsulation spec
96
+
97
+ libvorbis 1.1.1 (2005-06-27) -- "Xiph.Org libVorbis I 20050304"
98
+
99
+ * bug fix to the bitrate management encoder interface
100
+ * bug fix to properly set packetno field in the encoder
101
+ * new draft RTP encapsulation spec
102
+ * library API documentation improvements
103
+
104
+ libvorbis 1.1.0 (2004-09-22) -- "Xiph.Org libVorbis I 20040629"
105
+
106
+ * merges tuning improvements from Aoyumi's aoTuV with fixups
107
+ * new managed bitrate (CBR) mode support
108
+ * new vorbis_encoder_ctl() interface
109
+ * extensive documentation updates
110
+ * application/ogg mimetype is now official
111
+ * autotools cleanup from Thomas Vander Stichele
112
+ * SymbianOS build support from Colin Ward at CSIRO
113
+ * various bugfixes
114
+ * various packaging improvements
115
+
116
+ libvorbis 1.0.1 (2003-11-17) -- "Xiph.Org libVorbis I 20030909"
117
+
118
+ * numerous bug fixes
119
+ * specification corrections
120
+ * new crosslap and halfrate APIs for game use
121
+ * packaging and build updates
122
+
123
+ libvorbis 1.0.0 (2002-07-19) -- "Xiph.Org libVorbis I 20020717"
124
+
125
+ * first stable release
126
+
@@ -0,0 +1,28 @@
1
+ Copyright (c) 2002-2008 Xiph.org Foundation
2
+
3
+ Redistribution and use in source and binary forms, with or without
4
+ modification, are permitted provided that the following conditions
5
+ are met:
6
+
7
+ - Redistributions of source code must retain the above copyright
8
+ notice, this list of conditions and the following disclaimer.
9
+
10
+ - Redistributions in binary form must reproduce the above copyright
11
+ notice, this list of conditions and the following disclaimer in the
12
+ documentation and/or other materials provided with the distribution.
13
+
14
+ - Neither the name of the Xiph.org Foundation nor the names of its
15
+ contributors may be used to endorse or promote products derived from
16
+ this software without specific prior written permission.
17
+
18
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
+ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION
22
+ OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,243 @@
1
+ /********************************************************************
2
+ * *
3
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7
+ * *
8
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 *
9
+ * by the Xiph.Org Foundation http://www.xiph.org/ *
10
+
11
+ ********************************************************************
12
+
13
+ function: libvorbis codec headers
14
+ last mod: $Id: codec.h 17021 2010-03-24 09:29:41Z xiphmont $
15
+
16
+ ********************************************************************/
17
+
18
+ #ifndef _vorbis_codec_h_
19
+ #define _vorbis_codec_h_
20
+
21
+ #ifdef __cplusplus
22
+ extern "C"
23
+ {
24
+ #endif /* __cplusplus */
25
+
26
+ #include <ogg/ogg.h>
27
+
28
+ typedef struct vorbis_info{
29
+ int version;
30
+ int channels;
31
+ long rate;
32
+
33
+ /* The below bitrate declarations are *hints*.
34
+ Combinations of the three values carry the following implications:
35
+
36
+ all three set to the same value:
37
+ implies a fixed rate bitstream
38
+ only nominal set:
39
+ implies a VBR stream that averages the nominal bitrate. No hard
40
+ upper/lower limit
41
+ upper and or lower set:
42
+ implies a VBR bitstream that obeys the bitrate limits. nominal
43
+ may also be set to give a nominal rate.
44
+ none set:
45
+ the coder does not care to speculate.
46
+ */
47
+
48
+ long bitrate_upper;
49
+ long bitrate_nominal;
50
+ long bitrate_lower;
51
+ long bitrate_window;
52
+
53
+ void *codec_setup;
54
+ } vorbis_info;
55
+
56
+ /* vorbis_dsp_state buffers the current vorbis audio
57
+ analysis/synthesis state. The DSP state belongs to a specific
58
+ logical bitstream ****************************************************/
59
+ typedef struct vorbis_dsp_state{
60
+ int analysisp;
61
+ vorbis_info *vi;
62
+
63
+ float **pcm;
64
+ float **pcmret;
65
+ int pcm_storage;
66
+ int pcm_current;
67
+ int pcm_returned;
68
+
69
+ int preextrapolate;
70
+ int eofflag;
71
+
72
+ long lW;
73
+ long W;
74
+ long nW;
75
+ long centerW;
76
+
77
+ ogg_int64_t granulepos;
78
+ ogg_int64_t sequence;
79
+
80
+ ogg_int64_t glue_bits;
81
+ ogg_int64_t time_bits;
82
+ ogg_int64_t floor_bits;
83
+ ogg_int64_t res_bits;
84
+
85
+ void *backend_state;
86
+ } vorbis_dsp_state;
87
+
88
+ typedef struct vorbis_block{
89
+ /* necessary stream state for linking to the framing abstraction */
90
+ float **pcm; /* this is a pointer into local storage */
91
+ oggpack_buffer opb;
92
+
93
+ long lW;
94
+ long W;
95
+ long nW;
96
+ int pcmend;
97
+ int mode;
98
+
99
+ int eofflag;
100
+ ogg_int64_t granulepos;
101
+ ogg_int64_t sequence;
102
+ vorbis_dsp_state *vd; /* For read-only access of configuration */
103
+
104
+ /* local storage to avoid remallocing; it's up to the mapping to
105
+ structure it */
106
+ void *localstore;
107
+ long localtop;
108
+ long localalloc;
109
+ long totaluse;
110
+ struct alloc_chain *reap;
111
+
112
+ /* bitmetrics for the frame */
113
+ long glue_bits;
114
+ long time_bits;
115
+ long floor_bits;
116
+ long res_bits;
117
+
118
+ void *internal;
119
+
120
+ } vorbis_block;
121
+
122
+ /* vorbis_block is a single block of data to be processed as part of
123
+ the analysis/synthesis stream; it belongs to a specific logical
124
+ bitstream, but is independent from other vorbis_blocks belonging to
125
+ that logical bitstream. *************************************************/
126
+
127
+ struct alloc_chain{
128
+ void *ptr;
129
+ struct alloc_chain *next;
130
+ };
131
+
132
+ /* vorbis_info contains all the setup information specific to the
133
+ specific compression/decompression mode in progress (eg,
134
+ psychoacoustic settings, channel setup, options, codebook
135
+ etc). vorbis_info and substructures are in backends.h.
136
+ *********************************************************************/
137
+
138
+ /* the comments are not part of vorbis_info so that vorbis_info can be
139
+ static storage */
140
+ typedef struct vorbis_comment{
141
+ /* unlimited user comment fields. libvorbis writes 'libvorbis'
142
+ whatever vendor is set to in encode */
143
+ char **user_comments;
144
+ int *comment_lengths;
145
+ int comments;
146
+ char *vendor;
147
+
148
+ } vorbis_comment;
149
+
150
+
151
+ /* libvorbis encodes in two abstraction layers; first we perform DSP
152
+ and produce a packet (see docs/analysis.txt). The packet is then
153
+ coded into a framed OggSquish bitstream by the second layer (see
154
+ docs/framing.txt). Decode is the reverse process; we sync/frame
155
+ the bitstream and extract individual packets, then decode the
156
+ packet back into PCM audio.
157
+
158
+ The extra framing/packetizing is used in streaming formats, such as
159
+ files. Over the net (such as with UDP), the framing and
160
+ packetization aren't necessary as they're provided by the transport
161
+ and the streaming layer is not used */
162
+
163
+ /* Vorbis PRIMITIVES: general ***************************************/
164
+
165
+ extern void vorbis_info_init(vorbis_info *vi);
166
+ extern void vorbis_info_clear(vorbis_info *vi);
167
+ extern int vorbis_info_blocksize(vorbis_info *vi,int zo);
168
+ extern void vorbis_comment_init(vorbis_comment *vc);
169
+ extern void vorbis_comment_add(vorbis_comment *vc, const char *comment);
170
+ extern void vorbis_comment_add_tag(vorbis_comment *vc,
171
+ const char *tag, const char *contents);
172
+ extern char *vorbis_comment_query(vorbis_comment *vc, const char *tag, int count);
173
+ extern int vorbis_comment_query_count(vorbis_comment *vc, const char *tag);
174
+ extern void vorbis_comment_clear(vorbis_comment *vc);
175
+
176
+ extern int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb);
177
+ extern int vorbis_block_clear(vorbis_block *vb);
178
+ extern void vorbis_dsp_clear(vorbis_dsp_state *v);
179
+ extern double vorbis_granule_time(vorbis_dsp_state *v,
180
+ ogg_int64_t granulepos);
181
+
182
+ extern const char *vorbis_version_string(void);
183
+
184
+ /* Vorbis PRIMITIVES: analysis/DSP layer ****************************/
185
+
186
+ extern int vorbis_analysis_init(vorbis_dsp_state *v,vorbis_info *vi);
187
+ extern int vorbis_commentheader_out(vorbis_comment *vc, ogg_packet *op);
188
+ extern int vorbis_analysis_headerout(vorbis_dsp_state *v,
189
+ vorbis_comment *vc,
190
+ ogg_packet *op,
191
+ ogg_packet *op_comm,
192
+ ogg_packet *op_code);
193
+ extern float **vorbis_analysis_buffer(vorbis_dsp_state *v,int vals);
194
+ extern int vorbis_analysis_wrote(vorbis_dsp_state *v,int vals);
195
+ extern int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb);
196
+ extern int vorbis_analysis(vorbis_block *vb,ogg_packet *op);
197
+
198
+ extern int vorbis_bitrate_addblock(vorbis_block *vb);
199
+ extern int vorbis_bitrate_flushpacket(vorbis_dsp_state *vd,
200
+ ogg_packet *op);
201
+
202
+ /* Vorbis PRIMITIVES: synthesis layer *******************************/
203
+ extern int vorbis_synthesis_idheader(ogg_packet *op);
204
+ extern int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc,
205
+ ogg_packet *op);
206
+
207
+ extern int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi);
208
+ extern int vorbis_synthesis_restart(vorbis_dsp_state *v);
209
+ extern int vorbis_synthesis(vorbis_block *vb,ogg_packet *op);
210
+ extern int vorbis_synthesis_trackonly(vorbis_block *vb,ogg_packet *op);
211
+ extern int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb);
212
+ extern int vorbis_synthesis_pcmout(vorbis_dsp_state *v,float ***pcm);
213
+ extern int vorbis_synthesis_lapout(vorbis_dsp_state *v,float ***pcm);
214
+ extern int vorbis_synthesis_read(vorbis_dsp_state *v,int samples);
215
+ extern long vorbis_packet_blocksize(vorbis_info *vi,ogg_packet *op);
216
+
217
+ extern int vorbis_synthesis_halfrate(vorbis_info *v,int flag);
218
+ extern int vorbis_synthesis_halfrate_p(vorbis_info *v);
219
+
220
+ /* Vorbis ERRORS and return codes ***********************************/
221
+
222
+ #define OV_FALSE -1
223
+ #define OV_EOF -2
224
+ #define OV_HOLE -3
225
+
226
+ #define OV_EREAD -128
227
+ #define OV_EFAULT -129
228
+ #define OV_EIMPL -130
229
+ #define OV_EINVAL -131
230
+ #define OV_ENOTVORBIS -132
231
+ #define OV_EBADHEADER -133
232
+ #define OV_EVERSION -134
233
+ #define OV_ENOTAUDIO -135
234
+ #define OV_EBADPACKET -136
235
+ #define OV_EBADLINK -137
236
+ #define OV_ENOSEEK -138
237
+
238
+ #ifdef __cplusplus
239
+ }
240
+ #endif /* __cplusplus */
241
+
242
+ #endif
243
+
@@ -0,0 +1,436 @@
1
+ /********************************************************************
2
+ * *
3
+ * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5
+ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6
+ * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
7
+ * *
8
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 *
9
+ * by the Xiph.Org Foundation http://www.xiph.org/ *
10
+ * *
11
+ ********************************************************************
12
+
13
+ function: vorbis encode-engine setup
14
+ last mod: $Id: vorbisenc.h 17021 2010-03-24 09:29:41Z xiphmont $
15
+
16
+ ********************************************************************/
17
+
18
+ /** \file
19
+ * Libvorbisenc is a convenient API for setting up an encoding
20
+ * environment using libvorbis. Libvorbisenc encapsulates the
21
+ * actions needed to set up the encoder properly.
22
+ */
23
+
24
+ #ifndef _OV_ENC_H_
25
+ #define _OV_ENC_H_
26
+
27
+ #ifdef __cplusplus
28
+ extern "C"
29
+ {
30
+ #endif /* __cplusplus */
31
+
32
+ #include "codec.h"
33
+
34
+ /**
35
+ * This is the primary function within libvorbisenc for setting up managed
36
+ * bitrate modes.
37
+ *
38
+ * Before this function is called, the \ref vorbis_info
39
+ * struct should be initialized by using vorbis_info_init() from the libvorbis
40
+ * API. After encoding, vorbis_info_clear() should be called.
41
+ *
42
+ * The max_bitrate, nominal_bitrate, and min_bitrate settings are used to set
43
+ * constraints for the encoded file. This function uses these settings to
44
+ * select the appropriate encoding mode and set it up.
45
+ *
46
+ * \param vi Pointer to an initialized \ref vorbis_info struct.
47
+ * \param channels The number of channels to be encoded.
48
+ * \param rate The sampling rate of the source audio.
49
+ * \param max_bitrate Desired maximum bitrate (limit). -1 indicates unset.
50
+ * \param nominal_bitrate Desired average, or central, bitrate. -1 indicates unset.
51
+ * \param min_bitrate Desired minimum bitrate. -1 indicates unset.
52
+ *
53
+ * \return Zero for success, and negative values for failure.
54
+ *
55
+ * \retval 0 Success.
56
+ * \retval OV_EFAULT Internal logic fault; indicates a bug or heap/stack corruption.
57
+ * \retval OV_EINVAL Invalid setup request, eg, out of range argument.
58
+ * \retval OV_EIMPL Unimplemented mode; unable to comply with bitrate request.
59
+ */
60
+ extern int vorbis_encode_init(vorbis_info *vi,
61
+ long channels,
62
+ long rate,
63
+
64
+ long max_bitrate,
65
+ long nominal_bitrate,
66
+ long min_bitrate);
67
+
68
+ /**
69
+ * This function performs step-one of a three-step bitrate-managed encode
70
+ * setup. It functions similarly to the one-step setup performed by \ref
71
+ * vorbis_encode_init but allows an application to make further encode setup
72
+ * tweaks using \ref vorbis_encode_ctl before finally calling \ref
73
+ * vorbis_encode_setup_init to complete the setup process.
74
+ *
75
+ * Before this function is called, the \ref vorbis_info struct should be
76
+ * initialized by using vorbis_info_init() from the libvorbis API. After
77
+ * encoding, vorbis_info_clear() should be called.
78
+ *
79
+ * The max_bitrate, nominal_bitrate, and min_bitrate settings are used to set
80
+ * constraints for the encoded file. This function uses these settings to
81
+ * select the appropriate encoding mode and set it up.
82
+ *
83
+ * \param vi Pointer to an initialized vorbis_info struct.
84
+ * \param channels The number of channels to be encoded.
85
+ * \param rate The sampling rate of the source audio.
86
+ * \param max_bitrate Desired maximum bitrate (limit). -1 indicates unset.
87
+ * \param nominal_bitrate Desired average, or central, bitrate. -1 indicates unset.
88
+ * \param min_bitrate Desired minimum bitrate. -1 indicates unset.
89
+ *
90
+ * \return Zero for success, and negative for failure.
91
+ *
92
+ * \retval 0 Success
93
+ * \retval OV_EFAULT Internal logic fault; indicates a bug or heap/stack corruption.
94
+ * \retval OV_EINVAL Invalid setup request, eg, out of range argument.
95
+ * \retval OV_EIMPL Unimplemented mode; unable to comply with bitrate request.
96
+ */
97
+ extern int vorbis_encode_setup_managed(vorbis_info *vi,
98
+ long channels,
99
+ long rate,
100
+
101
+ long max_bitrate,
102
+ long nominal_bitrate,
103
+ long min_bitrate);
104
+
105
+ /**
106
+ * This function performs step-one of a three-step variable bitrate
107
+ * (quality-based) encode setup. It functions similarly to the one-step setup
108
+ * performed by \ref vorbis_encode_init_vbr() but allows an application to
109
+ * make further encode setup tweaks using \ref vorbis_encode_ctl() before
110
+ * finally calling \ref vorbis_encode_setup_init to complete the setup
111
+ * process.
112
+ *
113
+ * Before this function is called, the \ref vorbis_info struct should be
114
+ * initialized by using \ref vorbis_info_init() from the libvorbis API. After
115
+ * encoding, vorbis_info_clear() should be called.
116
+ *
117
+ * \param vi Pointer to an initialized vorbis_info struct.
118
+ * \param channels The number of channels to be encoded.
119
+ * \param rate The sampling rate of the source audio.
120
+ * \param quality Desired quality level, currently from -0.1 to 1.0 (lo to hi).
121
+ *
122
+ * \return Zero for success, and negative values for failure.
123
+ *
124
+ * \retval 0 Success
125
+ * \retval OV_EFAULT Internal logic fault; indicates a bug or heap/stack corruption.
126
+ * \retval OV_EINVAL Invalid setup request, eg, out of range argument.
127
+ * \retval OV_EIMPL Unimplemented mode; unable to comply with quality level request.
128
+ */
129
+ extern int vorbis_encode_setup_vbr(vorbis_info *vi,
130
+ long channels,
131
+ long rate,
132
+
133
+ float quality
134
+ );
135
+
136
+ /**
137
+ * This is the primary function within libvorbisenc for setting up variable
138
+ * bitrate ("quality" based) modes.
139
+ *
140
+ *
141
+ * Before this function is called, the vorbis_info struct should be
142
+ * initialized by using vorbis_info_init() from the libvorbis API. After
143
+ * encoding, vorbis_info_clear() should be called.
144
+ *
145
+ * \param vi Pointer to an initialized vorbis_info struct.
146
+ * \param channels The number of channels to be encoded.
147
+ * \param rate The sampling rate of the source audio.
148
+ * \param base_quality Desired quality level, currently from -0.1 to 1.0 (lo to hi).
149
+ *
150
+ *
151
+ * \return Zero for success, or a negative number for failure.
152
+ *
153
+ * \retval 0 Success
154
+ * \retval OV_EFAULT Internal logic fault; indicates a bug or heap/stack corruption.
155
+ * \retval OV_EINVAL Invalid setup request, eg, out of range argument.
156
+ * \retval OV_EIMPL Unimplemented mode; unable to comply with quality level request.
157
+ */
158
+ extern int vorbis_encode_init_vbr(vorbis_info *vi,
159
+ long channels,
160
+ long rate,
161
+
162
+ float base_quality
163
+ );
164
+
165
+ /**
166
+ * This function performs the last stage of three-step encoding setup, as
167
+ * described in the API overview under managed bitrate modes.
168
+ *
169
+ * Before this function is called, the \ref vorbis_info struct should be
170
+ * initialized by using vorbis_info_init() from the libvorbis API, one of
171
+ * \ref vorbis_encode_setup_managed() or \ref vorbis_encode_setup_vbr() called to
172
+ * initialize the high-level encoding setup, and \ref vorbis_encode_ctl()
173
+ * called if necessary to make encoding setup changes.
174
+ * vorbis_encode_setup_init() finalizes the highlevel encoding structure into
175
+ * a complete encoding setup after which the application may make no further
176
+ * setup changes.
177
+ *
178
+ * After encoding, vorbis_info_clear() should be called.
179
+ *
180
+ * \param vi Pointer to an initialized \ref vorbis_info struct.
181
+ *
182
+ * \return Zero for success, and negative values for failure.
183
+ *
184
+ * \retval 0 Success.
185
+ * \retval OV_EFAULT Internal logic fault; indicates a bug or heap/stack corruption.
186
+ *
187
+ * \retval OV_EINVAL Attempt to use vorbis_encode_setup_init() without first
188
+ * calling one of vorbis_encode_setup_managed() or vorbis_encode_setup_vbr() to
189
+ * initialize the high-level encoding setup
190
+ *
191
+ */
192
+ extern int vorbis_encode_setup_init(vorbis_info *vi);
193
+
194
+ /**
195
+ * This function implements a generic interface to miscellaneous encoder
196
+ * settings similar to the classic UNIX 'ioctl()' system call. Applications
197
+ * may use vorbis_encode_ctl() to query or set bitrate management or quality
198
+ * mode details by using one of several \e request arguments detailed below.
199
+ * vorbis_encode_ctl() must be called after one of
200
+ * vorbis_encode_setup_managed() or vorbis_encode_setup_vbr(). When used
201
+ * to modify settings, \ref vorbis_encode_ctl() must be called before \ref
202
+ * vorbis_encode_setup_init().
203
+ *
204
+ * \param vi Pointer to an initialized vorbis_info struct.
205
+ *
206
+ * \param number Specifies the desired action; See \ref encctlcodes "the list
207
+ * of available requests".
208
+ *
209
+ * \param arg void * pointing to a data structure matching the request
210
+ * argument.
211
+ *
212
+ * \retval 0 Success. Any further return information (such as the result of a
213
+ * query) is placed into the storage pointed to by *arg.
214
+ *
215
+ * \retval OV_EINVAL Invalid argument, or an attempt to modify a setting after
216
+ * calling vorbis_encode_setup_init().
217
+ *
218
+ * \retval OV_EIMPL Unimplemented or unknown request
219
+ */
220
+ extern int vorbis_encode_ctl(vorbis_info *vi,int number,void *arg);
221
+
222
+ /**
223
+ * \deprecated This is a deprecated interface. Please use vorbis_encode_ctl()
224
+ * with the \ref ovectl_ratemanage2_arg struct and \ref
225
+ * OV_ECTL_RATEMANAGE2_GET and \ref OV_ECTL_RATEMANAGE2_SET calls in new code.
226
+ *
227
+ * The \ref ovectl_ratemanage_arg structure is used with vorbis_encode_ctl()
228
+ * and the \ref OV_ECTL_RATEMANAGE_GET, \ref OV_ECTL_RATEMANAGE_SET, \ref
229
+ * OV_ECTL_RATEMANAGE_AVG, \ref OV_ECTL_RATEMANAGE_HARD calls in order to
230
+ * query and modify specifics of the encoder's bitrate management
231
+ * configuration.
232
+ */
233
+ struct ovectl_ratemanage_arg {
234
+ int management_active; /**< nonzero if bitrate management is active*/
235
+ /** hard lower limit (in kilobits per second) below which the stream bitrate
236
+ will never be allowed for any given bitrate_hard_window seconds of time.*/
237
+ long bitrate_hard_min;
238
+ /** hard upper limit (in kilobits per second) above which the stream bitrate
239
+ will never be allowed for any given bitrate_hard_window seconds of time.*/
240
+ long bitrate_hard_max;
241
+ /** the window period (in seconds) used to regulate the hard bitrate minimum
242
+ and maximum*/
243
+ double bitrate_hard_window;
244
+ /** soft lower limit (in kilobits per second) below which the average bitrate
245
+ tracker will start nudging the bitrate higher.*/
246
+ long bitrate_av_lo;
247
+ /** soft upper limit (in kilobits per second) above which the average bitrate
248
+ tracker will start nudging the bitrate lower.*/
249
+ long bitrate_av_hi;
250
+ /** the window period (in seconds) used to regulate the average bitrate
251
+ minimum and maximum.*/
252
+ double bitrate_av_window;
253
+ /** Regulates the relative centering of the average and hard windows; in
254
+ libvorbis 1.0 and 1.0.1, the hard window regulation overlapped but
255
+ followed the average window regulation. In libvorbis 1.1 a bit-reservoir
256
+ interface replaces the old windowing interface; the older windowing
257
+ interface is simulated and this field has no effect.*/
258
+ double bitrate_av_window_center;
259
+ };
260
+
261
+ /**
262
+ * \name struct ovectl_ratemanage2_arg
263
+ *
264
+ * The ovectl_ratemanage2_arg structure is used with vorbis_encode_ctl() and
265
+ * the OV_ECTL_RATEMANAGE2_GET and OV_ECTL_RATEMANAGE2_SET calls in order to
266
+ * query and modify specifics of the encoder's bitrate management
267
+ * configuration.
268
+ *
269
+ */
270
+ struct ovectl_ratemanage2_arg {
271
+ int management_active; /**< nonzero if bitrate management is active */
272
+ /** Lower allowed bitrate limit in kilobits per second */
273
+ long bitrate_limit_min_kbps;
274
+ /** Upper allowed bitrate limit in kilobits per second */
275
+ long bitrate_limit_max_kbps;
276
+ long bitrate_limit_reservoir_bits; /**<Size of the bitrate reservoir in bits */
277
+ /** Regulates the bitrate reservoir's preferred fill level in a range from 0.0
278
+ * to 1.0; 0.0 tries to bank bits to buffer against future bitrate spikes, 1.0
279
+ * buffers against future sudden drops in instantaneous bitrate. Default is
280
+ * 0.1
281
+ */
282
+ double bitrate_limit_reservoir_bias;
283
+ /** Average bitrate setting in kilobits per second */
284
+ long bitrate_average_kbps;
285
+ /** Slew rate limit setting for average bitrate adjustment; sets the minimum
286
+ * time in seconds the bitrate tracker may swing from one extreme to the
287
+ * other when boosting or damping average bitrate.
288
+ */
289
+ double bitrate_average_damping;
290
+ };
291
+
292
+
293
+ /**
294
+ * \name vorbis_encode_ctl() codes
295
+ *
296
+ * \anchor encctlcodes
297
+ *
298
+ * These values are passed as the \c number parameter of vorbis_encode_ctl().
299
+ * The type of the referent of that function's \c arg pointer depends on these
300
+ * codes.
301
+ */
302
+ /*@{*/
303
+
304
+ /**
305
+ * Query the current encoder bitrate management setting.
306
+ *
307
+ *Argument: <tt>struct ovectl_ratemanage2_arg *</tt>
308
+ *
309
+ * Used to query the current encoder bitrate management setting. Also used to
310
+ * initialize fields of an ovectl_ratemanage2_arg structure for use with
311
+ * \ref OV_ECTL_RATEMANAGE2_SET.
312
+ */
313
+ #define OV_ECTL_RATEMANAGE2_GET 0x14
314
+
315
+ /**
316
+ * Set the current encoder bitrate management settings.
317
+ *
318
+ * Argument: <tt>struct ovectl_ratemanage2_arg *</tt>
319
+ *
320
+ * Used to set the current encoder bitrate management settings to the values
321
+ * listed in the ovectl_ratemanage2_arg. Passing a NULL pointer will disable
322
+ * bitrate management.
323
+ */
324
+ #define OV_ECTL_RATEMANAGE2_SET 0x15
325
+
326
+ /**
327
+ * Returns the current encoder hard-lowpass setting (kHz) in the double
328
+ * pointed to by arg.
329
+ *
330
+ * Argument: <tt>double *</tt>
331
+ */
332
+ #define OV_ECTL_LOWPASS_GET 0x20
333
+
334
+ /**
335
+ * Sets the encoder hard-lowpass to the value (kHz) pointed to by arg. Valid
336
+ * lowpass settings range from 2 to 99.
337
+ *
338
+ * Argument: <tt>double *</tt>
339
+ */
340
+ #define OV_ECTL_LOWPASS_SET 0x21
341
+
342
+ /**
343
+ * Returns the current encoder impulse block setting in the double pointed
344
+ * to by arg.
345
+ *
346
+ * Argument: <tt>double *</tt>
347
+ */
348
+ #define OV_ECTL_IBLOCK_GET 0x30
349
+
350
+ /**
351
+ * Sets the impulse block bias to the the value pointed to by arg.
352
+ *
353
+ * Argument: <tt>double *</tt>
354
+ *
355
+ * Valid range is -15.0 to 0.0 [default]. A negative impulse block bias will
356
+ * direct to encoder to use more bits when incoding short blocks that contain
357
+ * strong impulses, thus improving the accuracy of impulse encoding.
358
+ */
359
+ #define OV_ECTL_IBLOCK_SET 0x31
360
+
361
+ /**
362
+ * Returns the current encoder coupling setting in the int pointed
363
+ * to by arg.
364
+ *
365
+ * Argument: <tt>int *</tt>
366
+ */
367
+ #define OV_ECTL_COUPLING_GET 0x40
368
+
369
+ /**
370
+ * Enables/disables channel coupling in multichannel encoding according to arg.
371
+ *
372
+ * Argument: <tt>int *</tt>
373
+ *
374
+ * Zero disables channel coupling for multichannel inputs, nonzer enables
375
+ * channel coupling. Setting has no effect on monophonic encoding or
376
+ * multichannel counts that do not offer coupling. At present, coupling is
377
+ * available for stereo and 5.1 encoding.
378
+ */
379
+ #define OV_ECTL_COUPLING_SET 0x41
380
+
381
+ /* deprecated rate management supported only for compatibility */
382
+
383
+ /**
384
+ * Old interface to querying bitrate management settings.
385
+ *
386
+ * Deprecated after move to bit-reservoir style management in 1.1 rendered
387
+ * this interface partially obsolete.
388
+
389
+ * \deprecated Please use \ref OV_ECTL_RATEMANAGE2_GET instead.
390
+ *
391
+ * Argument: <tt>struct ovectl_ratemanage_arg *</tt>
392
+ */
393
+ #define OV_ECTL_RATEMANAGE_GET 0x10
394
+ /**
395
+ * Old interface to modifying bitrate management settings.
396
+ *
397
+ * deprecated after move to bit-reservoir style management in 1.1 rendered
398
+ * this interface partially obsolete.
399
+ *
400
+ * \deprecated Please use \ref OV_ECTL_RATEMANAGE2_SET instead.
401
+ *
402
+ * Argument: <tt>struct ovectl_ratemanage_arg *</tt>
403
+ */
404
+ #define OV_ECTL_RATEMANAGE_SET 0x11
405
+ /**
406
+ * Old interface to setting average-bitrate encoding mode.
407
+ *
408
+ * Deprecated after move to bit-reservoir style management in 1.1 rendered
409
+ * this interface partially obsolete.
410
+ *
411
+ * \deprecated Please use \ref OV_ECTL_RATEMANAGE2_SET instead.
412
+ *
413
+ * Argument: <tt>struct ovectl_ratemanage_arg *</tt>
414
+ */
415
+ #define OV_ECTL_RATEMANAGE_AVG 0x12
416
+ /**
417
+ * Old interface to setting bounded-bitrate encoding modes.
418
+ *
419
+ * deprecated after move to bit-reservoir style management in 1.1 rendered
420
+ * this interface partially obsolete.
421
+ *
422
+ * \deprecated Please use \ref OV_ECTL_RATEMANAGE2_SET instead.
423
+ *
424
+ * Argument: <tt>struct ovectl_ratemanage_arg *</tt>
425
+ */
426
+ #define OV_ECTL_RATEMANAGE_HARD 0x13
427
+
428
+ /*@}*/
429
+
430
+
431
+
432
+ #ifdef __cplusplus
433
+ }
434
+ #endif /* __cplusplus */
435
+
436
+ #endif