aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorVittorio Giovara <vittorio.giovara@gmail.com>2017-03-31 13:31:09 +0200
committerJames Almer <jamrial@gmail.com>2022-03-15 09:42:30 -0300
commit577022b09c202a9a18a69d97791a4fb62684c297 (patch)
tree272a6caa2cf469c4ed3ab30773aa6c8ce0e8df2e /libavformat
parent39cc2d05af96a3bbe3f2035c309d16129b5e495c (diff)
downloadffmpeg-577022b09c202a9a18a69d97791a4fb62684c297.tar.gz
apc: convert to new channel layout API
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/apc.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/libavformat/apc.c b/libavformat/apc.c
index 56151bb59a..1bd5ccf710 100644
--- a/libavformat/apc.c
+++ b/libavformat/apc.c
@@ -38,6 +38,7 @@ static int apc_read_header(AVFormatContext *s)
AVIOContext *pb = s->pb;
AVStream *st;
int ret;
+ int channels;
avio_rl32(pb); /* CRYO */
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)
return ret;
- if (avio_rl32(pb)) {
- st->codecpar->channels = 2;
- st->codecpar->channel_layout = AV_CH_LAYOUT_STEREO;
- } else {
- st->codecpar->channels = 1;
- st->codecpar->channel_layout = AV_CH_LAYOUT_MONO;
- }
+ channels = !!avio_rl32(pb) + 1;
+ av_channel_layout_default(&st->codecpar->ch_layout, channels);
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->block_align = 1;