1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avformat/msf: fix codec 4 (joint stereo ATRAC3) and align

Codec 4 (frame size 98) uses joint stereo per spec and examples.
Also removed an incorrect "align" var which wasn't used anyway (it was overwrittern).

Probably all/only .AT3 of frame size 98 are JS, too.

Signed-off-by: bnnm <bananaman255@gmail.com>
This commit is contained in:
bnnm 2017-01-30 12:46:15 +01:00 committed by Paul B Mahol
parent ec33ade7d3
commit ebb83e2dc0

View File

@ -42,7 +42,7 @@ static int msf_probe(AVProbeData *p)
static int msf_read_header(AVFormatContext *s)
{
unsigned codec, align, size;
unsigned codec, size;
AVStream *st;
int ret;
@ -61,10 +61,7 @@ static int msf_read_header(AVFormatContext *s)
st->codecpar->sample_rate = avio_rb32(s->pb);
if (st->codecpar->sample_rate <= 0)
return AVERROR_INVALIDDATA;
align = avio_rb32(s->pb) ;
if (align > INT_MAX / st->codecpar->channels)
return AVERROR_INVALIDDATA;
st->codecpar->block_align = align;
// avio_rb32(s->pb); /* byte flags with encoder info */
switch (codec) {
case 0: st->codecpar->codec_id = AV_CODEC_ID_PCM_S16BE; break;
case 3: st->codecpar->block_align = 16 * st->codecpar->channels;
@ -76,8 +73,10 @@ static int msf_read_header(AVFormatContext *s)
if (ret < 0)
return ret;
memset(st->codecpar->extradata, 0, st->codecpar->extradata_size);
AV_WL16(st->codecpar->extradata, 1);
AV_WL16(st->codecpar->extradata+4, 4096);
AV_WL16(st->codecpar->extradata, 1); /* version */
AV_WL16(st->codecpar->extradata+2, 2048 * st->codecpar->channels); /* unknown size */
AV_WL16(st->codecpar->extradata+6, codec == 4 ? 1 : 0); /* joint stereo */
AV_WL16(st->codecpar->extradata+8, codec == 4 ? 1 : 0); /* joint stereo (repeat?) */
AV_WL16(st->codecpar->extradata+10, 1);
st->codecpar->codec_id = AV_CODEC_ID_ATRAC3; break;
case 7: st->need_parsing = AVSTREAM_PARSE_FULL_RAW;