commit 23fc4dd6e7e150ea163a867dfaee2062ade90b74
Author: Stefano Sabatini <[email protected]>
Date: Mon Jul 30 15:24:30 2012 +0200
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.
commit 5085b46496f0df5f4f7259d03f21d3f814aa28e2
Author: Stefano Sabatini <[email protected]>
Date: Wed Feb 6 01:40:38 2013 +0100
lavc: change type of AVFrame.channels field from int64_t to int
"channels" is an int in all the other places in the libraries, and the
av_frame_*_channels() accessors return and set an int, so this should not
implicate ABI breaks.
This makes it possible to compile Chromium against libav, fixing
the following compile error:
media/filters/audio_file_reader.cc: In member function 'int
media::AudioFileReader::Read(media::AudioBus*)':
media/filters/audio_file_reader.cc:183:21: error: 'struct AVFrame' has
no member named 'channels'
media/filters/audio_file_reader.cc:188:52: error: 'struct AVFrame' has
no member named 'channels'
media/filters/ffmpeg_audio_decoder.cc: In member function 'void
media::FFmpegAudioDecoder::RunDecodeLoop(const
scoped_refptr<media::DecoderBuffer>&, bool)':
media/filters/ffmpeg_audio_decoder.cc:401:22: error: 'struct AVFrame'
has no member named 'channels'
media/filters/ffmpeg_audio_decoder.cc:406:53: error: 'struct AVFrame'
has no member named 'channels'
Signed-off-by: Paweł Hajdan, Jr <[email protected]>
---
doc/APIchanges | 3 +++
libavcodec/utils.c | 5 +++++
libavutil/frame.h | 5 +++++
libavutil/version.h | 2 +-
4 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/doc/APIchanges b/doc/APIchanges
index e4597b9..7976073 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,9 @@ libavutil: 2012-10-22
API changes, most recent first:
+2013-xx-xx - lavu 52.11.0 - frame.h
+ Add AVFrame->channels field.
+
2013-xx-xx - lavfi 3.7.0 - avfilter.h
Add AVFilter.priv_class for exporting filter options through the AVOptions
API
in the similar way private options work in lavc and lavf.
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index dfb2f54..8561219 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -594,6 +594,8 @@ int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame,
int flags)
frame->channel_layout = (1ULL << avctx->channels) - 1;
}
}
+ if (!frame->channels)
+ frame->channels = avctx->channels;
break;
default: return AVERROR(EINVAL);
}
@@ -1464,6 +1466,9 @@ int attribute_align_arg
avcodec_decode_audio4(AVCodecContext *avctx,
if (!(planar && channels > AV_NUM_DATA_POINTERS))
frame->extended_data = frame->data;
+ if (!frame->channels)
+ frame->channels = avctx->channels;
+
return ret;
}
diff --git a/libavutil/frame.h b/libavutil/frame.h
index adc23b2..a260cc9 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -316,6 +316,11 @@ typedef struct AVFrame {
uint64_t channel_layout;
/**
+ * Number of channels of the audio data.
+ */
+ int channels;
+
+ /**
* AVBuffer references backing the data for this frame. If all elements of
* this array are NULL, then this frame is not reference counted.
*
diff --git a/libavutil/version.h b/libavutil/version.h
index 6e8daa2..066c061 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -37,7 +37,7 @@
*/
#define LIBAVUTIL_VERSION_MAJOR 52
-#define LIBAVUTIL_VERSION_MINOR 10
+#define LIBAVUTIL_VERSION_MINOR 11
#define LIBAVUTIL_VERSION_MICRO 0
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
--
1.8.1.5
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel