comparison avcodec.h @ 8098:c2ab7a8958ed libavcodec

Add audio channel layout API to libavcodec.
author pross
date Sat, 01 Nov 2008 05:03:42 +0000
parents 444659c2b8a6
children 04295cbc0e9b
comparison
equal deleted inserted replaced
8097:7818ed859f66 8098:c2ab7a8958ed
28 28
29 29
30 #include "libavutil/avutil.h" 30 #include "libavutil/avutil.h"
31 31
32 #define LIBAVCODEC_VERSION_MAJOR 52 32 #define LIBAVCODEC_VERSION_MAJOR 52
33 #define LIBAVCODEC_VERSION_MINOR 1 33 #define LIBAVCODEC_VERSION_MINOR 2
34 #define LIBAVCODEC_VERSION_MICRO 0 34 #define LIBAVCODEC_VERSION_MICRO 0
35 35
36 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ 36 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
37 LIBAVCODEC_VERSION_MINOR, \ 37 LIBAVCODEC_VERSION_MINOR, \
38 LIBAVCODEC_VERSION_MICRO) 38 LIBAVCODEC_VERSION_MICRO)
343 SAMPLE_FMT_S32, ///< signed 32 bits 343 SAMPLE_FMT_S32, ///< signed 32 bits
344 SAMPLE_FMT_FLT, ///< float 344 SAMPLE_FMT_FLT, ///< float
345 SAMPLE_FMT_DBL, ///< double 345 SAMPLE_FMT_DBL, ///< double
346 SAMPLE_FMT_NB ///< Number of sample formats. DO NOT USE if dynamically linking to libavcodec 346 SAMPLE_FMT_NB ///< Number of sample formats. DO NOT USE if dynamically linking to libavcodec
347 }; 347 };
348
349 /* Audio channel masks */
350 #define CHANNEL_FRONT_LEFT 0x00000001
351 #define CHANNEL_FRONT_RIGHT 0x00000002
352 #define CHANNEL_FRONT_CENTER 0x00000004
353 #define CHANNEL_LOW_FREQUENCY 0x00000008
354 #define CHANNEL_BACK_LEFT 0x00000010
355 #define CHANNEL_BACK_RIGHT 0x00000020
356 #define CHANNEL_FRONT_LEFT_OF_CENTER 0x00000040
357 #define CHANNEL_FRONT_RIGHT_OF_CENTER 0x00000080
358 #define CHANNEL_BACK_CENTER 0x00000100
359 #define CHANNEL_SIDE_LEFT 0x00000200
360 #define CHANNEL_SIDE_RIGHT 0x00000400
361 #define CHANNEL_TOP_CENTER 0x00000800
362 #define CHANNEL_TOP_FRONT_LEFT 0x00001000
363 #define CHANNEL_TOP_FRONT_CENTER 0x00002000
364 #define CHANNEL_TOP_FRONT_RIGHT 0x00004000
365 #define CHANNEL_TOP_BACK_LEFT 0x00008000
366 #define CHANNEL_TOP_BACK_CENTER 0x00010000
367 #define CHANNEL_TOP_BACK_RIGHT 0x00020000
368 #define CHANNEL_STEREO_LEFT 0x20000000 ///< Stereo downmix.
369 #define CHANNEL_STEREO_RIGHT 0x40000000 ///< See CHANNEL_STEREO_LEFT.
370
371 /* Audio channel convenience macros */
372 #define CHANNEL_LAYOUT_MONO (CHANNEL_FRONT_CENTER)
373 #define CHANNEL_LAYOUT_STEREO (CHANNEL_FRONT_LEFT|CHANNEL_FRONT_RIGHT)
374 #define CHANNEL_LAYOUT_SURROUND (CHANNEL_LAYOUT_STEREO|CHANNEL_FRONT_CENTER)
375 #define CHANNEL_LAYOUT_QUAD (CHANNEL_LAYOUT_STEREO|CHANNEL_BACK_LEFT|CHANNEL_BACK_RIGHT)
376 #define CHANNEL_LAYOUT_5POINT0 (CHANNEL_LAYOUT_SURROUND|CHANNEL_SIDE_LEFT|CHANNEL_SIDE_RIGHT)
377 #define CHANNEL_LAYOUT_5POINT1 (CHANNEL_LAYOUT_5POINT0|CHANNEL_LOW_FREQUENCY)
378 #define CHANNEL_LAYOUT_7POINT1 (CHANNEL_LAYOUT_5POINT1|CHANNEL_BACK_LEFT|CHANNEL_BACK_RIGHT)
379 #define CHANNEL_LAYOUT_7POINT1_WIDE (CHANNEL_LAYOUT_SURROUND|CHANNEL_LOW_FREQUENCY|\
380 CHANNEL_BACK_LEFT|CHANNEL_BACK_RIGHT|\
381 CHANNEL_FRONT_LEFT_OF_CENTER|CHANNEL_FRONT_RIGHT_OF_CENTER)
382 #define CHANNEL_LAYOUT_STEREO_DOWNMIX (CHANNEL_STEREO_LEFT|CHANNEL_STEREO_RIGHT)
348 383
349 /* in bytes */ 384 /* in bytes */
350 #define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48khz 32bit audio 385 #define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48khz 32bit audio
351 386
352 /** 387 /**
2196 * - encoding: Set by user. 2231 * - encoding: Set by user.
2197 * - decoding: unused 2232 * - decoding: unused
2198 */ 2233 */
2199 int64_t timecode_frame_start; 2234 int64_t timecode_frame_start;
2200 2235
2236 #if LIBAVCODEC_VERSION_MAJOR < 53
2201 /** 2237 /**
2202 * Decoder should decode to this many channels if it can (0 for default) 2238 * Decoder should decode to this many channels if it can (0 for default)
2203 * - encoding: unused 2239 * - encoding: unused
2204 * - decoding: Set by user. 2240 * - decoding: Set by user.
2241 * @deprecated Deprecated in favor of request_channel_layout.
2205 */ 2242 */
2206 int request_channels; 2243 int request_channels;
2244 #endif
2207 2245
2208 /** 2246 /**
2209 * Percentage of dynamic range compression to be applied by the decoder. 2247 * Percentage of dynamic range compression to be applied by the decoder.
2210 * The default value is 1.0, corresponding to full compression. 2248 * The default value is 1.0, corresponding to full compression.
2211 * - encoding: unused 2249 * - encoding: unused
2226 * This field is applicable only when sample_fmt is SAMPLE_FMT_S32. 2264 * This field is applicable only when sample_fmt is SAMPLE_FMT_S32.
2227 * - encoding: set by user. 2265 * - encoding: set by user.
2228 * - decoding: set by libavcodec. 2266 * - decoding: set by libavcodec.
2229 */ 2267 */
2230 int bits_per_raw_sample; 2268 int bits_per_raw_sample;
2269
2270 /**
2271 * Audio channel layout.
2272 * - encoding: set by user.
2273 * - decoding: set by libavcodec.
2274 */
2275 int64_t channel_layout;
2276
2277 /**
2278 * Request decoder to use this channel layout if it can (0 for default)
2279 * - encoding: unused
2280 * - decoding: Set by user.
2281 */
2282 int64_t request_channel_layout;
2231 } AVCodecContext; 2283 } AVCodecContext;
2232 2284
2233 /** 2285 /**
2234 * AVCodec. 2286 * AVCodec.
2235 */ 2287 */
2267 * You \e should use the NULL_IF_CONFIG_SMALL() macro to define it. 2319 * You \e should use the NULL_IF_CONFIG_SMALL() macro to define it.
2268 */ 2320 */
2269 const char *long_name; 2321 const char *long_name;
2270 const int *supported_samplerates; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0 2322 const int *supported_samplerates; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0
2271 const enum SampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1 2323 const enum SampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1
2324 const int64_t *channel_layouts; ///< array of support channel layouts, or NULL if unknown. array is terminated by 0
2272 } AVCodec; 2325 } AVCodec;
2273 2326
2274 /** 2327 /**
2275 * four components are given, that's all. 2328 * four components are given, that's all.
2276 * the last component is alpha 2329 * the last component is alpha