From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 85466494E9 for ; Mon, 12 Feb 2024 00:35:11 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id EEEFD68D129; Mon, 12 Feb 2024 02:35:08 +0200 (EET) Received: from mail-40138.protonmail.ch (mail-40138.protonmail.ch [185.70.40.138]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E36A468A9C8 for ; Mon, 12 Feb 2024 02:35:02 +0200 (EET) Date: Mon, 12 Feb 2024 00:34:48 +0000 To: FFmpeg development discussions and patches Message-ID: In-Reply-To: References: Feedback-ID: 33509725:user:proton MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH] avformat/matroska: Add support for A_ATRAC/AT1 X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: asivery via ffmpeg-devel Reply-To: FFmpeg development discussions and patches Cc: asivery Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: I apologize for not having responded earlier. I've attached the updated patch. >From 68c77320954e44a7f02e95537fc9a6436da7549c Mon Sep 17 00:00:00 2001 From: asivery Date: Sun, 11 Feb 2024 23:13:07 +0100 Subject: [PATCH] avformat/matroska: Add support for A_ATRAC/AT1 Signed-off-by: asivery --- libavformat/matroska.c | 1 + libavformat/matroskadec.c | 8 ++++++++ libavformat/matroskaenc.c | 1 + 3 files changed, 10 insertions(+) diff --git a/libavformat/matroska.c b/libavformat/matroska.c index 5878594e68..ae9ecc8207 100644 --- a/libavformat/matroska.c +++ b/libavformat/matroska.c @@ -53,6 +53,7 @@ const CodecTags ff_mkv_codec_tags[]={ {"A_REAL/ATRC" , AV_CODEC_ID_ATRAC3}, {"A_REAL/COOK" , AV_CODEC_ID_COOK}, {"A_REAL/SIPR" , AV_CODEC_ID_SIPR}, + {"A_ATRAC/AT1" , AV_CODEC_ID_ATRAC1}, {"A_TRUEHD" , AV_CODEC_ID_TRUEHD}, {"A_TTA1" , AV_CODEC_ID_TTA}, {"A_VORBIS" , AV_CODEC_ID_VORBIS}, diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 8f000f86be..1bb6e8605a 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -2779,6 +2779,14 @@ static int mka_parse_audio_codec(MatroskaTrack *track, AVCodecParameters *par, return AVERROR(ENOMEM); break; } + case AV_CODEC_ID_ATRAC1: + /* ATRAC1 uses a constant frame size. + * Typical ATRAC1 streams are either mono or stereo. + * At most, ATRAC1 was used to store 8 channels of audio. */ + if (track->audio.channels > 8) + return AVERROR_INVALIDDATA; + par->block_align = track->audio.channels * 212; + break; case AV_CODEC_ID_FLAC: if (track->codec_priv.size) { ret = matroska_parse_flac(s, track, extradata_offset); diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 1457a6890c..aa25657f8f 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -3483,6 +3483,7 @@ static const AVCodecTag additional_audio_tags[] = { { AV_CODEC_ID_QDM2, 0xFFFFFFFF }, { AV_CODEC_ID_RA_144, 0xFFFFFFFF }, { AV_CODEC_ID_TRUEHD, 0xFFFFFFFF }, + { AV_CODEC_ID_ATRAC1, 0xFFFFFFFF }, { AV_CODEC_ID_NONE, 0xFFFFFFFF } }; -- 2.34.1 On Friday, August 4th, 2023 at 7:30 PM, Andreas Rheinhardt wrote: > Andreas Rheinhardt: > > > asivery: > > > > > Signed-off-by: asivery asivery@protonmail.com > > > --- > > > libavformat/matroska.c | 1 + > > > libavformat/matroskadec.c | 2 ++ > > > 2 files changed, 3 insertions(+) > > > > > > diff --git a/libavformat/matroska.c b/libavformat/matroska.c > > > index 90d94b65bf..37305a523c 100644 > > > --- a/libavformat/matroska.c > > > +++ b/libavformat/matroska.c > > > @@ -55,6 +55,7 @@ const CodecTags ff_mkv_codec_tags[]={ > > > {"A_REAL/ATRC" , AV_CODEC_ID_ATRAC3}, > > > {"A_REAL/COOK" , AV_CODEC_ID_COOK}, > > > {"A_REAL/SIPR" , AV_CODEC_ID_SIPR}, > > > + {"A_ATRAC/AT1" , AV_CODEC_ID_ATRAC1}, > > > {"A_TRUEHD" , AV_CODEC_ID_TRUEHD}, > > > {"A_TTA1" , AV_CODEC_ID_TTA}, > > > {"A_VORBIS" , AV_CODEC_ID_VORBIS}, > > > diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c > > > index d582f566a2..0aa8e6f3b3 100644 > > > --- a/libavformat/matroskadec.c > > > +++ b/libavformat/matroskadec.c > > > @@ -2795,6 +2795,8 @@ static int matroska_parse_tracks(AVFormatContext s) > > > track->audio.frame_size); > > > if (!track->audio.buf) > > > return AVERROR(ENOMEM); > > > + } else if (codec_id == AV_CODEC_ID_ATRAC1) { > > > + st->codecpar->block_align = track->audio.channels * 212; / Constant ATRAC frame size */ > > > } else if (codec_id == AV_CODEC_ID_FLAC && track->codec_priv.size) { > > > ret = matroska_parse_flac(s, track, &extradata_offset); > > > if (ret < 0) > > > -- > > > 2.34.1 > > > > This patch is broken. The indentation is off. > > > > - Andreas > > > Apart from this: The result of the multiplication may not fit into an > int; looking at the other atrac1 code it seems that we only support mono > and stereo files. Is this a limitation of FFmpeg or of the format? > > - Andreas > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".