1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

apc: convert to new channel layout API

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
Vittorio Giovara 2017-03-31 13:31:09 +02:00 committed by James Almer
parent 39cc2d05af
commit 577022b09c

View File

@ -38,6 +38,7 @@ static int apc_read_header(AVFormatContext *s)
AVIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVStream *st; AVStream *st;
int ret; int ret;
int channels;
avio_rl32(pb); /* CRYO */ avio_rl32(pb); /* CRYO */
avio_rl32(pb); /* _APC */ avio_rl32(pb); /* _APC */
@ -57,16 +58,11 @@ static int apc_read_header(AVFormatContext *s)
if ((ret = ff_get_extradata(s, st->codecpar, pb, 2 * 4)) < 0) if ((ret = ff_get_extradata(s, st->codecpar, pb, 2 * 4)) < 0)
return ret; return ret;
if (avio_rl32(pb)) { channels = !!avio_rl32(pb) + 1;
st->codecpar->channels = 2; av_channel_layout_default(&st->codecpar->ch_layout, channels);
st->codecpar->channel_layout = AV_CH_LAYOUT_STEREO;
} else {
st->codecpar->channels = 1;
st->codecpar->channel_layout = AV_CH_LAYOUT_MONO;
}
st->codecpar->bits_per_coded_sample = 4; st->codecpar->bits_per_coded_sample = 4;
st->codecpar->bit_rate = (int64_t)st->codecpar->bits_per_coded_sample * st->codecpar->channels st->codecpar->bit_rate = (int64_t)st->codecpar->bits_per_coded_sample * channels
* st->codecpar->sample_rate; * st->codecpar->sample_rate;
st->codecpar->block_align = 1; st->codecpar->block_align = 1;