Message ID | 20170130114615.3144-1-bananaman255@gmail.com |
---|---|
State | Accepted |
Headers | show |
On 1/30/17, bananaman255@gmail.com <bananaman255@gmail.com> wrote: > From: bnnm <bananaman255@gmail.com> > > 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> > --- > libavformat/msf.c | 13 ++++++------- > 1 file changed, 6 insertions(+), 7 deletions(-) Are you sure this doesn't break any msf files?
It should work with all proper MSF. Here is my test suite, which includes most MSF variations (including some not yet supported by FFmpeg) https://www.sendspace.com/file/omvv8s For example, there is no 1ch ATRAC3-codec4 test MSF because the encoder only outputs joint stereo I'm afraid I don't know enough about FATE to set up tests of my own. 2017-01-30 13:04 GMT+01:00 Paul B Mahol <onemda@gmail.com>: > On 1/30/17, bananaman255@gmail.com <bananaman255@gmail.com> wrote: > > From: bnnm <bananaman255@gmail.com> > > > > 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> > > --- > > libavformat/msf.c | 13 ++++++------- > > 1 file changed, 6 insertions(+), 7 deletions(-) > > Are you sure this doesn't break any msf files? >
On 1/30/17, Banana M. <bananaman255@gmail.com> wrote: > It should work with all proper MSF. > Here is my test suite, which includes most MSF variations (including some > not yet supported by FFmpeg) > https://www.sendspace.com/file/omvv8s > For example, there is no 1ch ATRAC3-codec4 test MSF because the encoder > only outputs joint stereo > > I'm afraid I don't know enough about FATE to set up tests of my own. Applied.
diff --git a/libavformat/msf.c b/libavformat/msf.c index 24654e6569..8f8e80fd30 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; + //flags = 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;