diff options
author | Anton Khirnov <anton@khirnov.net> | 2019-05-13 11:11:26 +0200 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2022-03-15 09:42:32 -0300 |
commit | 07cdec42d1bb2e48efef4ea0aadd139a13de8f22 (patch) | |
tree | 0646cfbda3dea6ff7142dd8353208a2b82a7f309 /libavformat/fsb.c | |
parent | 95431618005b7651d281511488d7d318cda6bd17 (diff) | |
download | ffmpeg-07cdec42d1bb2e48efef4ea0aadd139a13de8f22.tar.gz |
fsb: convert to new channel layout API
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavformat/fsb.c')
-rw-r--r-- | libavformat/fsb.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/libavformat/fsb.c b/libavformat/fsb.c index 9e8b9ca6b1..12b67f631c 100644 --- a/libavformat/fsb.c +++ b/libavformat/fsb.c @@ -68,30 +68,30 @@ static int fsb_read_header(AVFormatContext *s) if (par->sample_rate <= 0) return AVERROR_INVALIDDATA; avio_skip(pb, 6); - par->channels = avio_rl16(pb); - if (!par->channels) + par->ch_layout.nb_channels = avio_rl16(pb); + if (!par->ch_layout.nb_channels) return AVERROR_INVALIDDATA; if (format & 0x00000100) { par->codec_id = AV_CODEC_ID_PCM_S16LE; - par->block_align = 4096 * par->channels; + par->block_align = 4096 * par->ch_layout.nb_channels; } else if (format & 0x00400000) { par->bits_per_coded_sample = 4; par->codec_id = AV_CODEC_ID_ADPCM_IMA_WAV; - par->block_align = 36 * par->channels; + par->block_align = 36 * par->ch_layout.nb_channels; } else if (format & 0x00800000) { par->codec_id = AV_CODEC_ID_ADPCM_PSX; - par->block_align = 16 * par->channels; + par->block_align = 16 * par->ch_layout.nb_channels; } else if (format & 0x02000000) { par->codec_id = AV_CODEC_ID_ADPCM_THP; - par->block_align = 8 * par->channels; - if (par->channels > INT_MAX / 32) + par->block_align = 8 * par->ch_layout.nb_channels; + if (par->ch_layout.nb_channels > INT_MAX / 32) return AVERROR_INVALIDDATA; - ret = ff_alloc_extradata(par, 32 * par->channels); + ret = ff_alloc_extradata(par, 32 * par->ch_layout.nb_channels); if (ret < 0) return ret; avio_seek(pb, 0x68, SEEK_SET); - for (c = 0; c < par->channels; c++) { + for (c = 0; c < par->ch_layout.nb_channels; c++) { avio_read(pb, par->extradata + 32 * c, 32); avio_skip(pb, 14); } @@ -125,8 +125,8 @@ static int fsb_read_header(AVFormatContext *s) return AVERROR_INVALIDDATA; avio_skip(pb, 6); - par->channels = avio_rl16(pb); - if (!par->channels) + par->ch_layout.nb_channels = avio_rl16(pb); + if (!par->ch_layout.nb_channels) return AVERROR_INVALIDDATA; switch (par->codec_id) { @@ -138,17 +138,17 @@ static int fsb_read_header(AVFormatContext *s) par->block_align = 2048; break; case AV_CODEC_ID_ADPCM_THP: - if (par->channels > INT_MAX / 32) + if (par->ch_layout.nb_channels > INT_MAX / 32) return AVERROR_INVALIDDATA; - ret = ff_alloc_extradata(par, 32 * par->channels); + ret = ff_alloc_extradata(par, 32 * par->ch_layout.nb_channels); if (ret < 0) return ret; avio_seek(pb, 0x80, SEEK_SET); - for (c = 0; c < par->channels; c++) { + for (c = 0; c < par->ch_layout.nb_channels; c++) { avio_read(pb, par->extradata + 32 * c, 32); avio_skip(pb, 14); } - par->block_align = 8 * par->channels; + par->block_align = 8 * par->ch_layout.nb_channels; break; } } else { @@ -174,14 +174,14 @@ static int fsb_read_packet(AVFormatContext *s, AVPacket *pkt) pos = avio_tell(s->pb); if (par->codec_id == AV_CODEC_ID_ADPCM_THP && - par->channels > 1) { + par->ch_layout.nb_channels > 1) { int i, ch; ret = av_new_packet(pkt, par->block_align); if (ret < 0) return ret; for (i = 0; i < 4; i++) { - for (ch = 0; ch < par->channels; ch++) { + for (ch = 0; ch < par->ch_layout.nb_channels; ch++) { pkt->data[ch * 8 + i * 2 + 0] = avio_r8(s->pb); pkt->data[ch * 8 + i * 2 + 1] = avio_r8(s->pb); } |