diff options
author | Peter Ross <pross@xvid.org> | 2008-11-01 05:03:42 +0000 |
---|---|---|
committer | Peter Ross <pross@xvid.org> | 2008-11-01 05:03:42 +0000 |
commit | 0d72e7d0aebb03db1010d3e3180b287f3d9fc581 (patch) | |
tree | 333b9abf0bfa252a75494295b525ce2d9e4bc7db /libavcodec/utils.c | |
parent | 3a57547e33cb859e0989da2acd553ebdf84e48ef (diff) | |
download | ffmpeg-streaming-0d72e7d0aebb03db1010d3e3180b287f3d9fc581.zip ffmpeg-streaming-0d72e7d0aebb03db1010d3e3180b287f3d9fc581.tar.gz |
Add audio channel layout API to libavcodec.
Originally committed as revision 15762 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r-- | libavcodec/utils.c | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 5df4d18..9f60a79 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -740,6 +740,8 @@ static const AVOption options[]={ {"drc_scale", "percentage of dynamic range compression to apply", OFFSET(drc_scale), FF_OPT_TYPE_FLOAT, 1.0, 0.0, 1.0, A|D}, {"reservoir", "use bit reservoir", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_BIT_RESERVOIR, INT_MIN, INT_MAX, A|E, "flags2"}, {"bits_per_raw_sample", NULL, OFFSET(bits_per_raw_sample), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, +{"channel_layout", NULL, OFFSET(channel_layout), FF_OPT_TYPE_INT64, DEFAULT, 0, INT64_MAX, A|E|D, "channel_layout"}, +{"request_channel_layout", NULL, OFFSET(request_channel_layout), FF_OPT_TYPE_INT64, DEFAULT, 0, INT64_MAX, A|D, "request_channel_layout"}, {NULL}, }; @@ -1051,7 +1053,6 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode) const char *codec_name; AVCodec *p; char buf1[32]; - char channels_str[100]; int bitrate; AVRational display_aspect_ratio; @@ -1131,26 +1132,12 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode) snprintf(buf, buf_size, "Audio: %s", codec_name); - switch (enc->channels) { - case 1: - strcpy(channels_str, "mono"); - break; - case 2: - strcpy(channels_str, "stereo"); - break; - case 6: - strcpy(channels_str, "5:1"); - break; - default: - snprintf(channels_str, sizeof(channels_str), "%d channels", enc->channels); - break; - } if (enc->sample_rate) { snprintf(buf + strlen(buf), buf_size - strlen(buf), - ", %d Hz, %s", - enc->sample_rate, - channels_str); + ", %d Hz", enc->sample_rate); } + av_strlcat(buf, ", ", buf_size); + avcodec_get_channel_layout_string(buf + strlen(buf), buf_size - strlen(buf), enc->channels, enc->channel_layout); if (enc->sample_fmt != SAMPLE_FMT_NONE) { snprintf(buf + strlen(buf), buf_size - strlen(buf), ", %s", avcodec_get_sample_fmt_name(enc->sample_fmt)); |