aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2021-08-23 23:17:05 -0300
committerJames Almer <jamrial@gmail.com>2022-03-15 09:42:31 -0300
commita64494df49d24ae495d55b709527e7ce5cd40ec8 (patch)
treedc4ac6b2aec8c9ff661ed51f142645de58f4eff1
parentd03b32778753ec594e78cb0af6d6b389d5a05afa (diff)
downloadffmpeg-a64494df49d24ae495d55b709527e7ce5cd40ec8.tar.gz
derf: convert to new channel layout API
Signed-off-by: James Almer <jamrial@gmail.com>
-rw-r--r--libavformat/derf.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/libavformat/derf.c b/libavformat/derf.c
index d50a853194..9da7fc4f19 100644
--- a/libavformat/derf.c
+++ b/libavformat/derf.c
@@ -38,6 +38,7 @@ static int derf_probe(const AVProbeData *p)
static int derf_read_header(AVFormatContext *s)
{
unsigned data_size;
+ int channels;
AVIOContext *pb = s->pb;
AVCodecParameters *par;
AVStream *st;
@@ -52,15 +53,12 @@ static int derf_read_header(AVFormatContext *s)
par->codec_type = AVMEDIA_TYPE_AUDIO;
par->codec_id = AV_CODEC_ID_DERF_DPCM;
par->format = AV_SAMPLE_FMT_S16;
- par->channels = avio_rl32(pb);
- if (par->channels != 1 && par->channels != 2)
+ channels = avio_rl32(pb);
+ if (channels != 1 && channels != 2)
return AVERROR_INVALIDDATA;
- if (par->channels == 1)
- par->channel_layout = AV_CH_LAYOUT_MONO;
- else if (par->channels == 2)
- par->channel_layout = AV_CH_LAYOUT_STEREO;
+ av_channel_layout_default(&par->ch_layout, channels);
data_size = avio_rl32(pb);
- st->duration = data_size / par->channels;
+ st->duration = data_size / channels;
par->sample_rate = 22050;
par->block_align = 1;