annotate DEPENDENCIES/mingw32/include/vorbis/vorbisenc.h @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents 5fdf0c0f9433
children
rev   line source
Chris@17 1 /********************************************************************
Chris@17 2 * *
Chris@17 3 * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
Chris@17 4 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
Chris@17 5 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
Chris@17 6 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
Chris@17 7 * *
Chris@17 8 * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 *
Chris@17 9 * by the Xiph.Org Foundation http://www.xiph.org/ *
Chris@17 10 * *
Chris@17 11 ********************************************************************
Chris@17 12
Chris@17 13 function: vorbis encode-engine setup
Chris@17 14 last mod: $Id: vorbisenc.h 17021 2010-03-24 09:29:41Z xiphmont $
Chris@17 15
Chris@17 16 ********************************************************************/
Chris@17 17
Chris@17 18 /** \file
Chris@17 19 * Libvorbisenc is a convenient API for setting up an encoding
Chris@17 20 * environment using libvorbis. Libvorbisenc encapsulates the
Chris@17 21 * actions needed to set up the encoder properly.
Chris@17 22 */
Chris@17 23
Chris@17 24 #ifndef _OV_ENC_H_
Chris@17 25 #define _OV_ENC_H_
Chris@17 26
Chris@17 27 #ifdef __cplusplus
Chris@17 28 extern "C"
Chris@17 29 {
Chris@17 30 #endif /* __cplusplus */
Chris@17 31
Chris@17 32 #include "codec.h"
Chris@17 33
Chris@17 34 /**
Chris@17 35 * This is the primary function within libvorbisenc for setting up managed
Chris@17 36 * bitrate modes.
Chris@17 37 *
Chris@17 38 * Before this function is called, the \ref vorbis_info
Chris@17 39 * struct should be initialized by using vorbis_info_init() from the libvorbis
Chris@17 40 * API. After encoding, vorbis_info_clear() should be called.
Chris@17 41 *
Chris@17 42 * The max_bitrate, nominal_bitrate, and min_bitrate settings are used to set
Chris@17 43 * constraints for the encoded file. This function uses these settings to
Chris@17 44 * select the appropriate encoding mode and set it up.
Chris@17 45 *
Chris@17 46 * \param vi Pointer to an initialized \ref vorbis_info struct.
Chris@17 47 * \param channels The number of channels to be encoded.
Chris@17 48 * \param rate The sampling rate of the source audio.
Chris@17 49 * \param max_bitrate Desired maximum bitrate (limit). -1 indicates unset.
Chris@17 50 * \param nominal_bitrate Desired average, or central, bitrate. -1 indicates unset.
Chris@17 51 * \param min_bitrate Desired minimum bitrate. -1 indicates unset.
Chris@17 52 *
Chris@17 53 * \return Zero for success, and negative values for failure.
Chris@17 54 *
Chris@17 55 * \retval 0 Success.
Chris@17 56 * \retval OV_EFAULT Internal logic fault; indicates a bug or heap/stack corruption.
Chris@17 57 * \retval OV_EINVAL Invalid setup request, eg, out of range argument.
Chris@17 58 * \retval OV_EIMPL Unimplemented mode; unable to comply with bitrate request.
Chris@17 59 */
Chris@17 60 extern int vorbis_encode_init(vorbis_info *vi,
Chris@17 61 long channels,
Chris@17 62 long rate,
Chris@17 63
Chris@17 64 long max_bitrate,
Chris@17 65 long nominal_bitrate,
Chris@17 66 long min_bitrate);
Chris@17 67
Chris@17 68 /**
Chris@17 69 * This function performs step-one of a three-step bitrate-managed encode
Chris@17 70 * setup. It functions similarly to the one-step setup performed by \ref
Chris@17 71 * vorbis_encode_init but allows an application to make further encode setup
Chris@17 72 * tweaks using \ref vorbis_encode_ctl before finally calling \ref
Chris@17 73 * vorbis_encode_setup_init to complete the setup process.
Chris@17 74 *
Chris@17 75 * Before this function is called, the \ref vorbis_info struct should be
Chris@17 76 * initialized by using vorbis_info_init() from the libvorbis API. After
Chris@17 77 * encoding, vorbis_info_clear() should be called.
Chris@17 78 *
Chris@17 79 * The max_bitrate, nominal_bitrate, and min_bitrate settings are used to set
Chris@17 80 * constraints for the encoded file. This function uses these settings to
Chris@17 81 * select the appropriate encoding mode and set it up.
Chris@17 82 *
Chris@17 83 * \param vi Pointer to an initialized vorbis_info struct.
Chris@17 84 * \param channels The number of channels to be encoded.
Chris@17 85 * \param rate The sampling rate of the source audio.
Chris@17 86 * \param max_bitrate Desired maximum bitrate (limit). -1 indicates unset.
Chris@17 87 * \param nominal_bitrate Desired average, or central, bitrate. -1 indicates unset.
Chris@17 88 * \param min_bitrate Desired minimum bitrate. -1 indicates unset.
Chris@17 89 *
Chris@17 90 * \return Zero for success, and negative for failure.
Chris@17 91 *
Chris@17 92 * \retval 0 Success
Chris@17 93 * \retval OV_EFAULT Internal logic fault; indicates a bug or heap/stack corruption.
Chris@17 94 * \retval OV_EINVAL Invalid setup request, eg, out of range argument.
Chris@17 95 * \retval OV_EIMPL Unimplemented mode; unable to comply with bitrate request.
Chris@17 96 */
Chris@17 97 extern int vorbis_encode_setup_managed(vorbis_info *vi,
Chris@17 98 long channels,
Chris@17 99 long rate,
Chris@17 100
Chris@17 101 long max_bitrate,
Chris@17 102 long nominal_bitrate,
Chris@17 103 long min_bitrate);
Chris@17 104
Chris@17 105 /**
Chris@17 106 * This function performs step-one of a three-step variable bitrate
Chris@17 107 * (quality-based) encode setup. It functions similarly to the one-step setup
Chris@17 108 * performed by \ref vorbis_encode_init_vbr() but allows an application to
Chris@17 109 * make further encode setup tweaks using \ref vorbis_encode_ctl() before
Chris@17 110 * finally calling \ref vorbis_encode_setup_init to complete the setup
Chris@17 111 * process.
Chris@17 112 *
Chris@17 113 * Before this function is called, the \ref vorbis_info struct should be
Chris@17 114 * initialized by using \ref vorbis_info_init() from the libvorbis API. After
Chris@17 115 * encoding, vorbis_info_clear() should be called.
Chris@17 116 *
Chris@17 117 * \param vi Pointer to an initialized vorbis_info struct.
Chris@17 118 * \param channels The number of channels to be encoded.
Chris@17 119 * \param rate The sampling rate of the source audio.
Chris@17 120 * \param quality Desired quality level, currently from -0.1 to 1.0 (lo to hi).
Chris@17 121 *
Chris@17 122 * \return Zero for success, and negative values for failure.
Chris@17 123 *
Chris@17 124 * \retval 0 Success
Chris@17 125 * \retval OV_EFAULT Internal logic fault; indicates a bug or heap/stack corruption.
Chris@17 126 * \retval OV_EINVAL Invalid setup request, eg, out of range argument.
Chris@17 127 * \retval OV_EIMPL Unimplemented mode; unable to comply with quality level request.
Chris@17 128 */
Chris@17 129 extern int vorbis_encode_setup_vbr(vorbis_info *vi,
Chris@17 130 long channels,
Chris@17 131 long rate,
Chris@17 132
Chris@17 133 float quality
Chris@17 134 );
Chris@17 135
Chris@17 136 /**
Chris@17 137 * This is the primary function within libvorbisenc for setting up variable
Chris@17 138 * bitrate ("quality" based) modes.
Chris@17 139 *
Chris@17 140 *
Chris@17 141 * Before this function is called, the vorbis_info struct should be
Chris@17 142 * initialized by using vorbis_info_init() from the libvorbis API. After
Chris@17 143 * encoding, vorbis_info_clear() should be called.
Chris@17 144 *
Chris@17 145 * \param vi Pointer to an initialized vorbis_info struct.
Chris@17 146 * \param channels The number of channels to be encoded.
Chris@17 147 * \param rate The sampling rate of the source audio.
Chris@17 148 * \param base_quality Desired quality level, currently from -0.1 to 1.0 (lo to hi).
Chris@17 149 *
Chris@17 150 *
Chris@17 151 * \return Zero for success, or a negative number for failure.
Chris@17 152 *
Chris@17 153 * \retval 0 Success
Chris@17 154 * \retval OV_EFAULT Internal logic fault; indicates a bug or heap/stack corruption.
Chris@17 155 * \retval OV_EINVAL Invalid setup request, eg, out of range argument.
Chris@17 156 * \retval OV_EIMPL Unimplemented mode; unable to comply with quality level request.
Chris@17 157 */
Chris@17 158 extern int vorbis_encode_init_vbr(vorbis_info *vi,
Chris@17 159 long channels,
Chris@17 160 long rate,
Chris@17 161
Chris@17 162 float base_quality
Chris@17 163 );
Chris@17 164
Chris@17 165 /**
Chris@17 166 * This function performs the last stage of three-step encoding setup, as
Chris@17 167 * described in the API overview under managed bitrate modes.
Chris@17 168 *
Chris@17 169 * Before this function is called, the \ref vorbis_info struct should be
Chris@17 170 * initialized by using vorbis_info_init() from the libvorbis API, one of
Chris@17 171 * \ref vorbis_encode_setup_managed() or \ref vorbis_encode_setup_vbr() called to
Chris@17 172 * initialize the high-level encoding setup, and \ref vorbis_encode_ctl()
Chris@17 173 * called if necessary to make encoding setup changes.
Chris@17 174 * vorbis_encode_setup_init() finalizes the highlevel encoding structure into
Chris@17 175 * a complete encoding setup after which the application may make no further
Chris@17 176 * setup changes.
Chris@17 177 *
Chris@17 178 * After encoding, vorbis_info_clear() should be called.
Chris@17 179 *
Chris@17 180 * \param vi Pointer to an initialized \ref vorbis_info struct.
Chris@17 181 *
Chris@17 182 * \return Zero for success, and negative values for failure.
Chris@17 183 *
Chris@17 184 * \retval 0 Success.
Chris@17 185 * \retval OV_EFAULT Internal logic fault; indicates a bug or heap/stack corruption.
Chris@17 186 *
Chris@17 187 * \retval OV_EINVAL Attempt to use vorbis_encode_setup_init() without first
Chris@17 188 * calling one of vorbis_encode_setup_managed() or vorbis_encode_setup_vbr() to
Chris@17 189 * initialize the high-level encoding setup
Chris@17 190 *
Chris@17 191 */
Chris@17 192 extern int vorbis_encode_setup_init(vorbis_info *vi);
Chris@17 193
Chris@17 194 /**
Chris@17 195 * This function implements a generic interface to miscellaneous encoder
Chris@17 196 * settings similar to the classic UNIX 'ioctl()' system call. Applications
Chris@17 197 * may use vorbis_encode_ctl() to query or set bitrate management or quality
Chris@17 198 * mode details by using one of several \e request arguments detailed below.
Chris@17 199 * vorbis_encode_ctl() must be called after one of
Chris@17 200 * vorbis_encode_setup_managed() or vorbis_encode_setup_vbr(). When used
Chris@17 201 * to modify settings, \ref vorbis_encode_ctl() must be called before \ref
Chris@17 202 * vorbis_encode_setup_init().
Chris@17 203 *
Chris@17 204 * \param vi Pointer to an initialized vorbis_info struct.
Chris@17 205 *
Chris@17 206 * \param number Specifies the desired action; See \ref encctlcodes "the list
Chris@17 207 * of available requests".
Chris@17 208 *
Chris@17 209 * \param arg void * pointing to a data structure matching the request
Chris@17 210 * argument.
Chris@17 211 *
Chris@17 212 * \retval 0 Success. Any further return information (such as the result of a
Chris@17 213 * query) is placed into the storage pointed to by *arg.
Chris@17 214 *
Chris@17 215 * \retval OV_EINVAL Invalid argument, or an attempt to modify a setting after
Chris@17 216 * calling vorbis_encode_setup_init().
Chris@17 217 *
Chris@17 218 * \retval OV_EIMPL Unimplemented or unknown request
Chris@17 219 */
Chris@17 220 extern int vorbis_encode_ctl(vorbis_info *vi,int number,void *arg);
Chris@17 221
Chris@17 222 /**
Chris@17 223 * \deprecated This is a deprecated interface. Please use vorbis_encode_ctl()
Chris@17 224 * with the \ref ovectl_ratemanage2_arg struct and \ref
Chris@17 225 * OV_ECTL_RATEMANAGE2_GET and \ref OV_ECTL_RATEMANAGE2_SET calls in new code.
Chris@17 226 *
Chris@17 227 * The \ref ovectl_ratemanage_arg structure is used with vorbis_encode_ctl()
Chris@17 228 * and the \ref OV_ECTL_RATEMANAGE_GET, \ref OV_ECTL_RATEMANAGE_SET, \ref
Chris@17 229 * OV_ECTL_RATEMANAGE_AVG, \ref OV_ECTL_RATEMANAGE_HARD calls in order to
Chris@17 230 * query and modify specifics of the encoder's bitrate management
Chris@17 231 * configuration.
Chris@17 232 */
Chris@17 233 struct ovectl_ratemanage_arg {
Chris@17 234 int management_active; /**< nonzero if bitrate management is active*/
Chris@17 235 /** hard lower limit (in kilobits per second) below which the stream bitrate
Chris@17 236 will never be allowed for any given bitrate_hard_window seconds of time.*/
Chris@17 237 long bitrate_hard_min;
Chris@17 238 /** hard upper limit (in kilobits per second) above which the stream bitrate
Chris@17 239 will never be allowed for any given bitrate_hard_window seconds of time.*/
Chris@17 240 long bitrate_hard_max;
Chris@17 241 /** the window period (in seconds) used to regulate the hard bitrate minimum
Chris@17 242 and maximum*/
Chris@17 243 double bitrate_hard_window;
Chris@17 244 /** soft lower limit (in kilobits per second) below which the average bitrate
Chris@17 245 tracker will start nudging the bitrate higher.*/
Chris@17 246 long bitrate_av_lo;
Chris@17 247 /** soft upper limit (in kilobits per second) above which the average bitrate
Chris@17 248 tracker will start nudging the bitrate lower.*/
Chris@17 249 long bitrate_av_hi;
Chris@17 250 /** the window period (in seconds) used to regulate the average bitrate
Chris@17 251 minimum and maximum.*/
Chris@17 252 double bitrate_av_window;
Chris@17 253 /** Regulates the relative centering of the average and hard windows; in
Chris@17 254 libvorbis 1.0 and 1.0.1, the hard window regulation overlapped but
Chris@17 255 followed the average window regulation. In libvorbis 1.1 a bit-reservoir
Chris@17 256 interface replaces the old windowing interface; the older windowing
Chris@17 257 interface is simulated and this field has no effect.*/
Chris@17 258 double bitrate_av_window_center;
Chris@17 259 };
Chris@17 260
Chris@17 261 /**
Chris@17 262 * \name struct ovectl_ratemanage2_arg
Chris@17 263 *
Chris@17 264 * The ovectl_ratemanage2_arg structure is used with vorbis_encode_ctl() and
Chris@17 265 * the OV_ECTL_RATEMANAGE2_GET and OV_ECTL_RATEMANAGE2_SET calls in order to
Chris@17 266 * query and modify specifics of the encoder's bitrate management
Chris@17 267 * configuration.
Chris@17 268 *
Chris@17 269 */
Chris@17 270 struct ovectl_ratemanage2_arg {
Chris@17 271 int management_active; /**< nonzero if bitrate management is active */
Chris@17 272 /** Lower allowed bitrate limit in kilobits per second */
Chris@17 273 long bitrate_limit_min_kbps;
Chris@17 274 /** Upper allowed bitrate limit in kilobits per second */
Chris@17 275 long bitrate_limit_max_kbps;
Chris@17 276 long bitrate_limit_reservoir_bits; /**<Size of the bitrate reservoir in bits */
Chris@17 277 /** Regulates the bitrate reservoir's preferred fill level in a range from 0.0
Chris@17 278 * to 1.0; 0.0 tries to bank bits to buffer against future bitrate spikes, 1.0
Chris@17 279 * buffers against future sudden drops in instantaneous bitrate. Default is
Chris@17 280 * 0.1
Chris@17 281 */
Chris@17 282 double bitrate_limit_reservoir_bias;
Chris@17 283 /** Average bitrate setting in kilobits per second */
Chris@17 284 long bitrate_average_kbps;
Chris@17 285 /** Slew rate limit setting for average bitrate adjustment; sets the minimum
Chris@17 286 * time in seconds the bitrate tracker may swing from one extreme to the
Chris@17 287 * other when boosting or damping average bitrate.
Chris@17 288 */
Chris@17 289 double bitrate_average_damping;
Chris@17 290 };
Chris@17 291
Chris@17 292
Chris@17 293 /**
Chris@17 294 * \name vorbis_encode_ctl() codes
Chris@17 295 *
Chris@17 296 * \anchor encctlcodes
Chris@17 297 *
Chris@17 298 * These values are passed as the \c number parameter of vorbis_encode_ctl().
Chris@17 299 * The type of the referent of that function's \c arg pointer depends on these
Chris@17 300 * codes.
Chris@17 301 */
Chris@17 302 /*@{*/
Chris@17 303
Chris@17 304 /**
Chris@17 305 * Query the current encoder bitrate management setting.
Chris@17 306 *
Chris@17 307 *Argument: <tt>struct ovectl_ratemanage2_arg *</tt>
Chris@17 308 *
Chris@17 309 * Used to query the current encoder bitrate management setting. Also used to
Chris@17 310 * initialize fields of an ovectl_ratemanage2_arg structure for use with
Chris@17 311 * \ref OV_ECTL_RATEMANAGE2_SET.
Chris@17 312 */
Chris@17 313 #define OV_ECTL_RATEMANAGE2_GET 0x14
Chris@17 314
Chris@17 315 /**
Chris@17 316 * Set the current encoder bitrate management settings.
Chris@17 317 *
Chris@17 318 * Argument: <tt>struct ovectl_ratemanage2_arg *</tt>
Chris@17 319 *
Chris@17 320 * Used to set the current encoder bitrate management settings to the values
Chris@17 321 * listed in the ovectl_ratemanage2_arg. Passing a NULL pointer will disable
Chris@17 322 * bitrate management.
Chris@17 323 */
Chris@17 324 #define OV_ECTL_RATEMANAGE2_SET 0x15
Chris@17 325
Chris@17 326 /**
Chris@17 327 * Returns the current encoder hard-lowpass setting (kHz) in the double
Chris@17 328 * pointed to by arg.
Chris@17 329 *
Chris@17 330 * Argument: <tt>double *</tt>
Chris@17 331 */
Chris@17 332 #define OV_ECTL_LOWPASS_GET 0x20
Chris@17 333
Chris@17 334 /**
Chris@17 335 * Sets the encoder hard-lowpass to the value (kHz) pointed to by arg. Valid
Chris@17 336 * lowpass settings range from 2 to 99.
Chris@17 337 *
Chris@17 338 * Argument: <tt>double *</tt>
Chris@17 339 */
Chris@17 340 #define OV_ECTL_LOWPASS_SET 0x21
Chris@17 341
Chris@17 342 /**
Chris@17 343 * Returns the current encoder impulse block setting in the double pointed
Chris@17 344 * to by arg.
Chris@17 345 *
Chris@17 346 * Argument: <tt>double *</tt>
Chris@17 347 */
Chris@17 348 #define OV_ECTL_IBLOCK_GET 0x30
Chris@17 349
Chris@17 350 /**
Chris@17 351 * Sets the impulse block bias to the the value pointed to by arg.
Chris@17 352 *
Chris@17 353 * Argument: <tt>double *</tt>
Chris@17 354 *
Chris@17 355 * Valid range is -15.0 to 0.0 [default]. A negative impulse block bias will
Chris@17 356 * direct to encoder to use more bits when incoding short blocks that contain
Chris@17 357 * strong impulses, thus improving the accuracy of impulse encoding.
Chris@17 358 */
Chris@17 359 #define OV_ECTL_IBLOCK_SET 0x31
Chris@17 360
Chris@17 361 /**
Chris@17 362 * Returns the current encoder coupling setting in the int pointed
Chris@17 363 * to by arg.
Chris@17 364 *
Chris@17 365 * Argument: <tt>int *</tt>
Chris@17 366 */
Chris@17 367 #define OV_ECTL_COUPLING_GET 0x40
Chris@17 368
Chris@17 369 /**
Chris@17 370 * Enables/disables channel coupling in multichannel encoding according to arg.
Chris@17 371 *
Chris@17 372 * Argument: <tt>int *</tt>
Chris@17 373 *
Chris@17 374 * Zero disables channel coupling for multichannel inputs, nonzer enables
Chris@17 375 * channel coupling. Setting has no effect on monophonic encoding or
Chris@17 376 * multichannel counts that do not offer coupling. At present, coupling is
Chris@17 377 * available for stereo and 5.1 encoding.
Chris@17 378 */
Chris@17 379 #define OV_ECTL_COUPLING_SET 0x41
Chris@17 380
Chris@17 381 /* deprecated rate management supported only for compatibility */
Chris@17 382
Chris@17 383 /**
Chris@17 384 * Old interface to querying bitrate management settings.
Chris@17 385 *
Chris@17 386 * Deprecated after move to bit-reservoir style management in 1.1 rendered
Chris@17 387 * this interface partially obsolete.
Chris@17 388
Chris@17 389 * \deprecated Please use \ref OV_ECTL_RATEMANAGE2_GET instead.
Chris@17 390 *
Chris@17 391 * Argument: <tt>struct ovectl_ratemanage_arg *</tt>
Chris@17 392 */
Chris@17 393 #define OV_ECTL_RATEMANAGE_GET 0x10
Chris@17 394 /**
Chris@17 395 * Old interface to modifying bitrate management settings.
Chris@17 396 *
Chris@17 397 * deprecated after move to bit-reservoir style management in 1.1 rendered
Chris@17 398 * this interface partially obsolete.
Chris@17 399 *
Chris@17 400 * \deprecated Please use \ref OV_ECTL_RATEMANAGE2_SET instead.
Chris@17 401 *
Chris@17 402 * Argument: <tt>struct ovectl_ratemanage_arg *</tt>
Chris@17 403 */
Chris@17 404 #define OV_ECTL_RATEMANAGE_SET 0x11
Chris@17 405 /**
Chris@17 406 * Old interface to setting average-bitrate encoding mode.
Chris@17 407 *
Chris@17 408 * Deprecated after move to bit-reservoir style management in 1.1 rendered
Chris@17 409 * this interface partially obsolete.
Chris@17 410 *
Chris@17 411 * \deprecated Please use \ref OV_ECTL_RATEMANAGE2_SET instead.
Chris@17 412 *
Chris@17 413 * Argument: <tt>struct ovectl_ratemanage_arg *</tt>
Chris@17 414 */
Chris@17 415 #define OV_ECTL_RATEMANAGE_AVG 0x12
Chris@17 416 /**
Chris@17 417 * Old interface to setting bounded-bitrate encoding modes.
Chris@17 418 *
Chris@17 419 * deprecated after move to bit-reservoir style management in 1.1 rendered
Chris@17 420 * this interface partially obsolete.
Chris@17 421 *
Chris@17 422 * \deprecated Please use \ref OV_ECTL_RATEMANAGE2_SET instead.
Chris@17 423 *
Chris@17 424 * Argument: <tt>struct ovectl_ratemanage_arg *</tt>
Chris@17 425 */
Chris@17 426 #define OV_ECTL_RATEMANAGE_HARD 0x13
Chris@17 427
Chris@17 428 /*@}*/
Chris@17 429
Chris@17 430
Chris@17 431
Chris@17 432 #ifdef __cplusplus
Chris@17 433 }
Chris@17 434 #endif /* __cplusplus */
Chris@17 435
Chris@17 436 #endif