mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-28 20:53:54 +02:00
avcodec/wavarc: fix 8bit decoding
This commit is contained in:
parent
d7c2da1f8d
commit
64b242d030
@ -68,9 +68,9 @@ static av_cold int wavarc_init(AVCodecContext *avctx)
|
||||
av_channel_layout_default(&avctx->ch_layout, AV_RL16(avctx->extradata + 38));
|
||||
avctx->sample_rate = AV_RL32(avctx->extradata + 40);
|
||||
|
||||
switch (avctx->extradata[36]) {
|
||||
case 0: avctx->sample_fmt = AV_SAMPLE_FMT_U8P; break;
|
||||
case 1: avctx->sample_fmt = AV_SAMPLE_FMT_S16P; break;
|
||||
switch (AV_RL16(avctx->extradata + 38)) {
|
||||
case 1: avctx->sample_fmt = AV_SAMPLE_FMT_U8P; break;
|
||||
case 2: avctx->sample_fmt = AV_SAMPLE_FMT_S16P; break;
|
||||
}
|
||||
|
||||
s->shift = 0;
|
||||
@ -411,7 +411,7 @@ fail:
|
||||
const int *src = s->samples[ch] + s->offset;
|
||||
|
||||
for (int n = 0; n < frame->nb_samples; n++)
|
||||
dst[n] = src[n] * (1 << s->shift);
|
||||
dst[n] = src[n] * (1 << s->shift) + 0x80U;
|
||||
}
|
||||
break;
|
||||
case AV_SAMPLE_FMT_S16P:
|
||||
|
@ -89,7 +89,7 @@ static int wavarc_read_header(AVFormatContext *s)
|
||||
id = avio_rl32(pb);
|
||||
if (id != MKTAG('d','a','t','a'))
|
||||
avio_skip(pb, avio_rl32(pb));
|
||||
} while (id != MKTAG('d','a','t','a'));
|
||||
} while (id != MKTAG('d','a','t','a') && !avio_feof(pb));
|
||||
avio_skip(pb, 4);
|
||||
|
||||
if (AV_RL32(par->extradata + 16) != MKTAG('R','I','F','F'))
|
||||
@ -104,11 +104,6 @@ static int wavarc_read_header(AVFormatContext *s)
|
||||
avpriv_set_pts_info(st, 64, 1, par->sample_rate);
|
||||
st->start_time = 0;
|
||||
|
||||
switch (par->extradata[36]) {
|
||||
case 0: par->format = AV_SAMPLE_FMT_U8P; break;
|
||||
case 1: par->format = AV_SAMPLE_FMT_S16P; break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user