[FFmpeg-devel] [PATCH] avformat/matroska: Add support for A_ATRAC/AT1

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Mon Feb 12 12:55:14 EET 2024


asivery via ffmpeg-devel:
> I apologize for not having responded earlier.
> I've attached the updated patch.
> 
> 
> From 68c77320954e44a7f02e95537fc9a6436da7549c Mon Sep 17 00:00:00 2001
> From: asivery <asivery at protonmail.com>
> Date: Sun, 11 Feb 2024 23:13:07 +0100
> Subject: [PATCH] avformat/matroska: Add support for A_ATRAC/AT1
> 
> Signed-off-by: asivery <asivery at protonmail.com>
> ---

Send your patch either via git send-email or as an attachment; if you
have comments for your patch (that are not supposed to be part of the
eventual commit and not its commit message), then put them here, in
between the --- and the affected files.

>  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},

This audio part of this list is ordered by the Matroska CodecID (i.e.
the string on the left). Please keep it that way.

>      {"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 },

Please keep this list sorted alphabetically.

>      { AV_CODEC_ID_NONE,      0xFFFFFFFF }
>  };
>  



More information about the ffmpeg-devel mailing list