mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-03-28 12:32:17 +02:00
redspark: convert to new channel layout API
Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
parent
4e864b4780
commit
aa6aa2b25a
@ -97,26 +97,26 @@ static int redspark_read_header(AVFormatContext *s)
|
|||||||
st->duration = bytestream2_get_be32u(&gbc) * 14;
|
st->duration = bytestream2_get_be32u(&gbc) * 14;
|
||||||
redspark->samples_count = 0;
|
redspark->samples_count = 0;
|
||||||
bytestream2_skipu(&gbc, 10);
|
bytestream2_skipu(&gbc, 10);
|
||||||
par->channels = bytestream2_get_byteu(&gbc);
|
par->ch_layout.nb_channels = bytestream2_get_byteu(&gbc);
|
||||||
if (!par->channels) {
|
if (!par->ch_layout.nb_channels) {
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
coef_off = 0x54 + par->channels * 8;
|
coef_off = 0x54 + par->ch_layout.nb_channels * 8;
|
||||||
if (bytestream2_get_byteu(&gbc)) // Loop flag
|
if (bytestream2_get_byteu(&gbc)) // Loop flag
|
||||||
coef_off += 16;
|
coef_off += 16;
|
||||||
|
|
||||||
if (coef_off + par->channels * (32 + 14) > HEADER_SIZE) {
|
if (coef_off + par->ch_layout.nb_channels * (32 + 14) > HEADER_SIZE) {
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ff_alloc_extradata(par, 32 * par->channels)) {
|
if (ff_alloc_extradata(par, 32 * par->ch_layout.nb_channels)) {
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the ADPCM table */
|
/* Get the ADPCM table */
|
||||||
bytestream2_seek(&gbc, coef_off, SEEK_SET);
|
bytestream2_seek(&gbc, coef_off, SEEK_SET);
|
||||||
for (i = 0; i < par->channels; i++) {
|
for (i = 0; i < par->ch_layout.nb_channels; i++) {
|
||||||
if (bytestream2_get_bufferu(&gbc, par->extradata + i * 32, 32) != 32) {
|
if (bytestream2_get_bufferu(&gbc, par->extradata + i * 32, 32) != 32) {
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
@ -132,7 +132,7 @@ static int redspark_read_packet(AVFormatContext *s, AVPacket *pkt)
|
|||||||
{
|
{
|
||||||
AVCodecParameters *par = s->streams[0]->codecpar;
|
AVCodecParameters *par = s->streams[0]->codecpar;
|
||||||
RedSparkContext *redspark = s->priv_data;
|
RedSparkContext *redspark = s->priv_data;
|
||||||
uint32_t size = 8 * par->channels;
|
uint32_t size = 8 * par->ch_layout.nb_channels;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (avio_feof(s->pb) || redspark->samples_count == s->streams[0]->duration)
|
if (avio_feof(s->pb) || redspark->samples_count == s->streams[0]->duration)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user