[FFmpeg-cvslog] lavc: add sample rate and channel layout to AVFrame.

Anton Khirnov git at videolan.org
Mon May 7 23:06:24 CEST 2012


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Fri May  4 19:12:31 2012 +0200| [828bd088f3f74dcdb8451d58557b0d8caefa3227] | committer: Anton Khirnov

lavc: add sample rate and channel layout to AVFrame.

Rationale is the same as for video width/height etc.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=828bd088f3f74dcdb8451d58557b0d8caefa3227
---

 doc/APIchanges       |    3 +++
 libavcodec/avcodec.h |   16 ++++++++++++++++
 libavcodec/utils.c   |    4 ++++
 libavcodec/version.h |    2 +-
 4 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index fd834f1..66a0786 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,9 @@ libavutil:     2011-04-18
 
 API changes, most recent first:
 
+2012-xx-xx - xxxxxxx - lavc 54.13.0 - avcodec.h
+  Add sample_rate and channel_layout fields to AVFrame.
+
 2012-xx-xx - xxxxxxx - lavr 0.0.1
   Change AV_MIX_COEFF_TYPE_Q6 to AV_MIX_COEFF_TYPE_Q8.
 
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 8020582..bec13e7 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1207,6 +1207,22 @@ typedef struct AVFrame {
      * - decoding: Set by libavcodec.
      */
     uint8_t motion_subsample_log2;
+
+    /**
+     * Sample rate of the audio data.
+     *
+     * - encoding: unused
+     * - decoding: set by get_buffer()
+     */
+    int sample_rate;
+
+    /**
+     * Channel layout of the audio data.
+     *
+     * - encoding: unused
+     * - decoding: set by get_buffer()
+     */
+    uint64_t channel_layout;
 } AVFrame;
 
 struct AVCodecInternal;
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 4492486..2e8a86c 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -356,6 +356,10 @@ static int audio_get_buffer(AVCodecContext *avctx, AVFrame *frame)
     else            frame->pkt_pts = AV_NOPTS_VALUE;
     frame->reordered_opaque = avctx->reordered_opaque;
 
+    frame->sample_rate    = avctx->sample_rate;
+    frame->format         = avctx->sample_fmt;
+    frame->channel_layout = avctx->channel_layout;
+
     if (avctx->debug & FF_DEBUG_BUFFERS)
         av_log(avctx, AV_LOG_DEBUG, "default_get_buffer called on frame %p, "
                "internal audio buffer used\n", frame);
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 5119874..be39f4f 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -27,7 +27,7 @@
  */
 
 #define LIBAVCODEC_VERSION_MAJOR 54
-#define LIBAVCODEC_VERSION_MINOR 12
+#define LIBAVCODEC_VERSION_MINOR 13
 #define LIBAVCODEC_VERSION_MICRO  0
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \



More information about the ffmpeg-cvslog mailing list