[FFmpeg-cvslog] avformat/msf: fix codec 4 (joint stereo ATRAC3) and align

bnnm git at videolan.org
Mon Jan 30 18:35:33 EET 2017


ffmpeg | branch: master | bnnm <bananaman255 at gmail.com> | Mon Jan 30 12:46:15 2017 +0100| [ebb83e2dc0b437081dc6496a724803bf5f04a8ea] | committer: Paul B Mahol

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 at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ebb83e2dc0b437081dc6496a724803bf5f04a8ea
---

 libavformat/msf.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/libavformat/msf.c b/libavformat/msf.c
index 24654e6..d7af0a3 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;



More information about the ffmpeg-cvslog mailing list