Someone forgot to add `i` to the loop. Also, the format has a 16-char title that we don't currently check.
Bytestream info from: https://github.com/dcherednik/atracdenc/blob/master/src/aea.cpp Patch attached
>From b72c6ead223b393a3a117bd85d41832b2edbb504 Mon Sep 17 00:00:00 2001 From: Lynne <d...@lynne.ee> Date: Fri, 26 Feb 2021 06:23:22 +0100 Subject: [PATCH 1/2] aea: make demuxer probing actually work and set title info Someone forgot to add `i` to the loop. Also, the format has a 16-char title that we don't currently check. Bytestream info from: https://github.com/dcherednik/atracdenc/blob/master/src/aea.cpp --- libavformat/aea.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/libavformat/aea.c b/libavformat/aea.c index bdeed64254..7d85840f67 100644 --- a/libavformat/aea.c +++ b/libavformat/aea.c @@ -46,10 +46,10 @@ static int aea_read_probe(const AVProbeData *p) */ for (i = 2048; i + 211 < p->buf_size; i+= 212) { int bsm_s, bsm_e, inb_s, inb_e; - bsm_s = p->buf[0]; - inb_s = p->buf[1]; - inb_e = p->buf[210]; - bsm_e = p->buf[211]; + bsm_s = p->buf[i + 0]; + inb_s = p->buf[i + 1]; + inb_e = p->buf[i + 210]; + bsm_e = p->buf[i + 211]; if (bsm_s != bsm_e || inb_s != inb_e) return 0; @@ -61,12 +61,19 @@ static int aea_read_probe(const AVProbeData *p) static int aea_read_header(AVFormatContext *s) { + char title[17] = { 0 }; AVStream *st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); + avio_skip(s->pb, 4); + + avio_read(s->pb, title, 16); + if (strlen(title) && strlen(title) < 16) + av_dict_set(&s->metadata, "title", title, 0); + /* Parse the amount of channels and skip to pos 2048(0x800) */ - avio_skip(s->pb, 264); + avio_skip(s->pb, 244); st->codecpar->channels = avio_r8(s->pb); avio_skip(s->pb, 1783); @@ -90,11 +97,8 @@ static int aea_read_header(AVFormatContext *s) static int aea_read_packet(AVFormatContext *s, AVPacket *pkt) { int ret = av_get_packet(s->pb, pkt, s->streams[0]->codecpar->block_align); - - pkt->stream_index = 0; - if (ret <= 0) - return AVERROR(EIO); - + if (ret >= 0) + pkt->stream_index = 0; return ret; } -- 2.30.1
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".