History

lavc: add channels field to AVFrame

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.

Stefano Sabatini committed 14 years ago

Commit 23fc4dd1 parent b4c33594 files · +19 −1Browse files

Unified · Split

4 files
  1. doc/APIchanges +3 −0
  2. libavcodec/avcodec.h +11 −0
  3. libavcodec/utils.c +4 −0
  4. libavcodec/version.h +1 −1
doc/APIchanges+3−0
@@ -15,6 +15,9 @@ libavutil: 2011-04-18 · 14 unmodified lines
15 15
16API changes, most recent first:16API changes, most recent first:
17 17
182012-07-31 - xxxxxxx - lavc 54.46.100
19 Add channels field to AVFrame.
20
182012-07-30 - xxxxxxx - lavu 51.66.100212012-07-30 - xxxxxxx - lavu 51.66.100
19 Add av_get_channel_description()22 Add av_get_channel_description()
20 and av_get_standard_channel_layout() functions.23 and av_get_standard_channel_layout() functions.
libavcodec/avcodec.h+11−0
@@ -1337,6 +1337,15 @@ typedef struct AVFrame { · 1336 unmodified lines
1337 int decode_error_flags;1337 int decode_error_flags;
1338#define FF_DECODE_ERROR_INVALID_BITSTREAM 11338#define FF_DECODE_ERROR_INVALID_BITSTREAM 1
1339#define FF_DECODE_ERROR_MISSING_REFERENCE 21339#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} AVFrame;1349} AVFrame;
1341 1350
1342/**1351/**
@@ -1352,6 +1361,8 @@ int64_t av_frame_get_pkt_pos (const AVFrame *frame); · 9 unmodified lines
1352void av_frame_set_pkt_pos (AVFrame *frame, int64_t val);1361void av_frame_set_pkt_pos (AVFrame *frame, int64_t val);
1353int64_t av_frame_get_channel_layout (const AVFrame *frame);1362int64_t av_frame_get_channel_layout (const AVFrame *frame);
1354void av_frame_set_channel_layout (AVFrame *frame, int64_t val);1363void av_frame_set_channel_layout (AVFrame *frame, int64_t val);
1364int av_frame_get_channels (const AVFrame *frame);
1365void av_frame_set_channels (AVFrame *frame, int val);
1355int av_frame_get_sample_rate (const AVFrame *frame);1366int av_frame_get_sample_rate (const AVFrame *frame);
1356void av_frame_set_sample_rate (AVFrame *frame, int val);1367void av_frame_set_sample_rate (AVFrame *frame, int val);
1357AVDictionary *av_frame_get_metadata (const AVFrame *frame);1368AVDictionary *av_frame_get_metadata (const AVFrame *frame);
libavcodec/utils.c+4−0
@@ -427,6 +427,7 @@ static int audio_get_buffer(AVCodecContext *avctx, AVFrame *frame) · 426 unmodified lines
427 frame->sample_rate = avctx->sample_rate;427 frame->sample_rate = avctx->sample_rate;
428 frame->format = avctx->sample_fmt;428 frame->format = avctx->sample_fmt;
429 frame->channel_layout = avctx->channel_layout;429 frame->channel_layout = avctx->channel_layout;
430 frame->channels = avctx->channels;
430 431
431 if (avctx->debug & FF_DEBUG_BUFFERS)432 if (avctx->debug & FF_DEBUG_BUFFERS)
432 av_log(avctx, AV_LOG_DEBUG, "default_get_buffer called on frame %p, "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
724MAKE_ACCESSORS(AVFrame, frame, int64_t, pkt_duration)725MAKE_ACCESSORS(AVFrame, frame, int64_t, pkt_duration)
725MAKE_ACCESSORS(AVFrame, frame, int64_t, pkt_pos)726MAKE_ACCESSORS(AVFrame, frame, int64_t, pkt_pos)
726MAKE_ACCESSORS(AVFrame, frame, int64_t, channel_layout)727MAKE_ACCESSORS(AVFrame, frame, int64_t, channel_layout)
728MAKE_ACCESSORS(AVFrame, frame, int, channels)
727MAKE_ACCESSORS(AVFrame, frame, int, sample_rate)729MAKE_ACCESSORS(AVFrame, frame, int, sample_rate)
728MAKE_ACCESSORS(AVFrame, frame, AVDictionary *, metadata)730MAKE_ACCESSORS(AVFrame, frame, AVDictionary *, metadata)
729MAKE_ACCESSORS(AVFrame, frame, int, decode_error_flags)731MAKE_ACCESSORS(AVFrame, frame, int, decode_error_flags)
@@ -1648,6 +1650,8 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx, · 918 unmodified lines
1648 frame->format = avctx->sample_fmt;1650 frame->format = avctx->sample_fmt;
1649 if (!frame->channel_layout)1651 if (!frame->channel_layout)
1650 frame->channel_layout = avctx->channel_layout;1652 frame->channel_layout = avctx->channel_layout;
1653 if (!frame->channels)
1654 frame->channels = avctx->channels;
1651 if (!frame->sample_rate)1655 if (!frame->sample_rate)
1652 frame->sample_rate = avctx->sample_rate;1656 frame->sample_rate = avctx->sample_rate;
1653 }1657 }
libavcodec/version.h+1−1
@@ -27,7 +27,7 @@ · 26 unmodified lines
27 */27 */
28 28
29#define LIBAVCODEC_VERSION_MAJOR 5429#define LIBAVCODEC_VERSION_MAJOR 54
30#define LIBAVCODEC_VERSION_MINOR 4530#define LIBAVCODEC_VERSION_MINOR 46
31#define LIBAVCODEC_VERSION_MICRO 10031#define LIBAVCODEC_VERSION_MICRO 100
32 32
33#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \33#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t