aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbnnm <bananaman255@gmail.com>2017-01-30 12:46:15 +0100
committerPaul B Mahol <onemda@gmail.com>2017-01-30 13:01:07 +0100
commitebb83e2dc0b437081dc6496a724803bf5f04a8ea (patch)
treef8c3661d0f68bacb667b88485211db433e4b5876
parentec33ade7d300e7b300797b1944441c4aabaee3c8 (diff)
downloadffmpeg-ebb83e2dc0b437081dc6496a724803bf5f04a8ea.tar.gz
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>
-rw-r--r--libavformat/msf.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/libavformat/msf.c b/libavformat/msf.c
index 24654e6569..d7af0a3893 100644
--- a/libavformat/msf.c
+++ b/libavformat/msf.c
@@ -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;