Commit f27ac6d8 authored by Peter Ross's avatar Peter Ross

Set channel layout for 4 and 5.1 channel cdata audio files

Patch from Carl Eugen Hoyos (cehoyos at ag dot or dot at)
Signed-off-by: 's avatarPeter Ross <pross@xvid.org>
parent 989fb05f
...@@ -50,13 +50,14 @@ static int cdata_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -50,13 +50,14 @@ static int cdata_read_header(AVFormatContext *s, AVFormatParameters *ap)
AVIOContext *pb = s->pb; AVIOContext *pb = s->pb;
unsigned int sample_rate, header; unsigned int sample_rate, header;
AVStream *st; AVStream *st;
int64_t channel_layout = 0;
header = avio_rb16(pb); header = avio_rb16(pb);
switch (header) { switch (header) {
case 0x0400: cdata->channels = 1; break; case 0x0400: cdata->channels = 1; break;
case 0x0404: cdata->channels = 2; break; case 0x0404: cdata->channels = 2; break;
case 0x040C: cdata->channels = 4; break; case 0x040C: cdata->channels = 4; channel_layout = AV_CH_LAYOUT_QUAD; break;
case 0x0414: cdata->channels = 6; break; case 0x0414: cdata->channels = 6; channel_layout = AV_CH_LAYOUT_5POINT1_BACK; break;
default: default:
av_log(s, AV_LOG_INFO, "unknown header 0x%04x\n", header); av_log(s, AV_LOG_INFO, "unknown header 0x%04x\n", header);
return -1; return -1;
...@@ -72,6 +73,7 @@ static int cdata_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -72,6 +73,7 @@ static int cdata_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec->codec_tag = 0; /* no fourcc */ st->codec->codec_tag = 0; /* no fourcc */
st->codec->codec_id = CODEC_ID_ADPCM_EA_XAS; st->codec->codec_id = CODEC_ID_ADPCM_EA_XAS;
st->codec->channels = cdata->channels; st->codec->channels = cdata->channels;
st->codec->channel_layout = channel_layout;
st->codec->sample_rate = sample_rate; st->codec->sample_rate = sample_rate;
st->codec->sample_fmt = AV_SAMPLE_FMT_S16; st->codec->sample_fmt = AV_SAMPLE_FMT_S16;
av_set_pts_info(st, 64, 1, sample_rate); av_set_pts_info(st, 64, 1, sample_rate);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment