From patchwork Fri Feb 26 05:27:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lynne X-Patchwork-Id: 25994 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 1FA5A448B5B for ; Fri, 26 Feb 2021 07:27:50 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DA4B468A48B; Fri, 26 Feb 2021 07:27:49 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from w4.tutanota.de (w4.tutanota.de [81.3.6.165]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5C8A568052F for ; Fri, 26 Feb 2021 07:27:43 +0200 (EET) Received: from w3.tutanota.de (unknown [192.168.1.164]) by w4.tutanota.de (Postfix) with ESMTP id 871EA1060165 for ; Fri, 26 Feb 2021 05:27:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1614317262; s=s1; d=lynne.ee; h=From:From:To:To:Subject:Subject:Content-Description:Content-ID:Content-Type:Content-Type:Content-Transfer-Encoding:Cc:Date:Date:In-Reply-To:MIME-Version:MIME-Version:Message-ID:Message-ID:Reply-To:References:Sender; bh=y8/6Ny6vRhwqExROdnDX/7OH4hXdzDJJppT5vVBZz0k=; b=uNGDnIb0D8k8Ge2uzMse28KNArqbvesjERspwLSmPYONmbjcSw2uuJVpJbbScH+2 CMWwnHELsYmAmlGnevN6ZIwm6avTQVGlmGFHIkJFoa64PwTafk5M+ZgzE9RRfvjaV8C BVaBmOnS+pt+DINoVkdglhXjLDg21P8ctX2tfe4yS6pvjuKV5Sn3rRzcOU6/b+RM5GW En56kMN/PjYl+Y594oQlc5YBDImReAIU0mXj90QKT1kgpJ+EbYsmHAm6S2ykCT/0f28 4+3A1RYH9q8TSI8UU/aQDSQbgQQrpYcr6VykfRbfOe0kCwRf5CVJQX2caO0MWvko9XD 1D0Wf2ztFQ== Date: Fri, 26 Feb 2021 06:27:42 +0100 (CET) From: Lynne To: Ffmpeg Devel Message-ID: MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/2] aea: make demuxer probing actually work and set title info X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" 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 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; }