annotate win64-mingw/include/vorbis/vorbisenc.h @ 120:c9cf28b398fb

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