This is required otherwise it is not always possible to guess the number of channels from the layout, for example if the channel layout is unknown.
Unified · Split
| @@ -15,6 +15,9 @@ libavutil: 2011-04-18 · 14 unmodified lines | ||
| 15 | 15 | |
| 16 | 16 | API changes, most recent first: |
| 17 | 17 | |
| 18 | +2012-07-31 - xxxxxxx - lavc 54.46.100 | |
| 19 | + Add channels field to AVFrame. | |
| 20 | + | |
| 18 | 21 | 2012-07-30 - xxxxxxx - lavu 51.66.100 |
| 19 | 22 | Add av_get_channel_description() |
| 20 | 23 | and av_get_standard_channel_layout() functions. |
| @@ -1337,6 +1337,15 @@ typedef struct AVFrame { · 1336 unmodified lines | ||
| 1337 | 1337 | int decode_error_flags; |
| 1338 | 1338 | #define FF_DECODE_ERROR_INVALID_BITSTREAM 1 |
| 1339 | 1339 | #define FF_DECODE_ERROR_MISSING_REFERENCE 2 |
| 1340 | + | |
| 1341 | + /** | |
| 1342 | + * number of audio channels, only used for audio. | |
| 1343 | + * Code outside libavcodec should access this field using: | |
| 1344 | + * av_frame_get_channels(frame) | |
| 1345 | + * - encoding: unused | |
| 1346 | + * - decoding: Read by user. | |
| 1347 | + */ | |
| 1348 | + int64_t channels; | |
| 1340 | 1349 | } AVFrame; |
| 1341 | 1350 | |
| 1342 | 1351 | /** |
| @@ -1352,6 +1361,8 @@ int64_t av_frame_get_pkt_pos (const AVFrame *frame); · 9 unmodified lines | ||
| 1352 | 1361 | void av_frame_set_pkt_pos (AVFrame *frame, int64_t val); |
| 1353 | 1362 | int64_t av_frame_get_channel_layout (const AVFrame *frame); |
| 1354 | 1363 | void av_frame_set_channel_layout (AVFrame *frame, int64_t val); |
| 1364 | +int av_frame_get_channels (const AVFrame *frame); | |
| 1365 | +void av_frame_set_channels (AVFrame *frame, int val); | |
| 1355 | 1366 | int av_frame_get_sample_rate (const AVFrame *frame); |
| 1356 | 1367 | void av_frame_set_sample_rate (AVFrame *frame, int val); |
| 1357 | 1368 | AVDictionary *av_frame_get_metadata (const AVFrame *frame); |
| @@ -427,6 +427,7 @@ static int audio_get_buffer(AVCodecContext *avctx, AVFrame *frame) · 426 unmodified lines | ||
| 427 | 427 | frame->sample_rate = avctx->sample_rate; |
| 428 | 428 | frame->format = avctx->sample_fmt; |
| 429 | 429 | frame->channel_layout = avctx->channel_layout; |
| 430 | + frame->channels = avctx->channels; | |
| 430 | 431 | |
| 431 | 432 | if (avctx->debug & FF_DEBUG_BUFFERS) |
| 432 | 433 | av_log(avctx, AV_LOG_DEBUG, "default_get_buffer called on frame %p, " |
| @@ -724,6 +725,7 @@ MAKE_ACCESSORS(AVFrame, frame, int64_t, best_effort_timestamp) · 291 unmodified lines | ||
| 724 | 725 | MAKE_ACCESSORS(AVFrame, frame, int64_t, pkt_duration) |
| 725 | 726 | MAKE_ACCESSORS(AVFrame, frame, int64_t, pkt_pos) |
| 726 | 727 | MAKE_ACCESSORS(AVFrame, frame, int64_t, channel_layout) |
| 728 | +MAKE_ACCESSORS(AVFrame, frame, int, channels) | |
| 727 | 729 | MAKE_ACCESSORS(AVFrame, frame, int, sample_rate) |
| 728 | 730 | MAKE_ACCESSORS(AVFrame, frame, AVDictionary *, metadata) |
| 729 | 731 | MAKE_ACCESSORS(AVFrame, frame, int, decode_error_flags) |
| @@ -1648,6 +1650,8 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx, · 918 unmodified lines | ||
| 1648 | 1650 | frame->format = avctx->sample_fmt; |
| 1649 | 1651 | if (!frame->channel_layout) |
| 1650 | 1652 | frame->channel_layout = avctx->channel_layout; |
| 1653 | + if (!frame->channels) | |
| 1654 | + frame->channels = avctx->channels; | |
| 1651 | 1655 | if (!frame->sample_rate) |
| 1652 | 1656 | frame->sample_rate = avctx->sample_rate; |
| 1653 | 1657 | } |
| @@ -27,7 +27,7 @@ · 26 unmodified lines | ||
| 27 | 27 | */ |
| 28 | 28 | |
| 29 | 29 | #define LIBAVCODEC_VERSION_MAJOR 54 |
| 30 | −#define LIBAVCODEC_VERSION_MINOR 45 | |
| 30 | +#define LIBAVCODEC_VERSION_MINOR 46 | |
| 31 | 31 | #define LIBAVCODEC_VERSION_MICRO 100 |
| 32 | 32 | |
| 33 | 33 | #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ |