aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas George <nicolas.george@normalesup.org>2012-04-28 13:02:41 +0200
committerNicolas George <nicolas.george@normalesup.org>2012-04-28 20:14:48 +0200
commit4b0521eca9647a092388c44186ea07b3d4416cdb (patch)
tree3eec1df527c3088dd4f950fcead7326ec334c5e6
parent82c71913e46552f9b41ed3f63571b7777a999f68 (diff)
downloadffmpeg-4b0521eca9647a092388c44186ea07b3d4416cdb.tar.gz
lavc: add a channel_layout field to AVFrame.
The field is filled with the codec context information. FIXME need a minor version bump.
-rw-r--r--libavcodec/avcodec.h10
-rw-r--r--libavcodec/options.c1
-rw-r--r--libavcodec/utils.c2
3 files changed, 13 insertions, 0 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index c3a5192621..fed72bb69b 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1257,6 +1257,16 @@ typedef struct AVFrame {
* - decoding: Read by user.
*/
int64_t pkt_pos;
+
+ /**
+ * channel layout of the audio frame
+ * - encoding: unused
+ * - decoding: read by user.
+ * Code outside libavcodec should access this field using:
+ * av_opt_ptr(avcodec_get_frame_class(), frame, "channel_layout")
+ */
+ int64_t channel_layout;
+
} AVFrame;
struct AVCodecInternal;
diff --git a/libavcodec/options.c b/libavcodec/options.c
index ef598d5871..173729cbc2 100644
--- a/libavcodec/options.c
+++ b/libavcodec/options.c
@@ -239,6 +239,7 @@ static const AVOption frame_options[]={
{"width", "", FOFFSET(width), AV_OPT_TYPE_INT, {.dbl = 0 }, 0, INT_MAX, 0},
{"height", "", FOFFSET(height), AV_OPT_TYPE_INT, {.dbl = 0 }, 0, INT_MAX, 0},
{"format", "", FOFFSET(format), AV_OPT_TYPE_INT, {.dbl = -1 }, 0, INT_MAX, 0},
+{"channel_layout", "", FOFFSET(channel_layout), AV_OPT_TYPE_INT64, {.dbl = 0 }, 0, INT64_MAX, 0},
{NULL},
};
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index bd97431bb2..85c6351380 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;