[FFmpeg-devel] [PATCH 01/13] lavc: add a channel_layout field to AVFrame.

Nicolas George nicolas.george at normalesup.org
Sat Apr 28 16:31:43 CEST 2012


The field is filled with the codec context information.

FIXME need a minor version bump.

Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
---
 libavcodec/avcodec.h |    8 ++++++++
 libavcodec/utils.c   |    2 ++
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index c3a5192..a19e4ac 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1257,6 +1257,14 @@ typedef struct AVFrame {
      * - decoding: Read by user.
      */
     int64_t pkt_pos;
+
+    /**
+     * channel layout of the audio frame
+     * - encoding: unused
+     * - decoding: read by user.
+     */
+    int64_t channel_layout;
+
 } AVFrame;
 
 struct AVCodecInternal;
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index bd97431..85c6351 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1545,6 +1545,8 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx,
             frame->pkt_dts = avpkt->dts;
             if (frame->format == AV_SAMPLE_FMT_NONE)
                 frame->format = avctx->sample_fmt;
+            if (!frame->channel_layout)
+                frame->channel_layout = avctx->channel_layout;
         }
 
         avctx->pkt = NULL;
-- 
1.7.2.5



More information about the ffmpeg-devel mailing list