From: Romain Beauxis <toots@rastageeks.org>
To: ffmpeg-devel@ffmpeg.org
Cc: Romain Beauxis <toots@rastageeks.org>
Subject: [FFmpeg-devel] [PATCH v2] libavformat/hlsenc.c: Populate OTI using AAC profile in write_codec_attr.
Date: Mon, 1 Jan 2024 09:52:50 -0600
Message-ID: <20240101155249.80569-1-toots@rastageeks.org> (raw)
This patch populates the third entry for HLS codec attribute using the
AAC profile.
The HLS specifications[1] require this value to be the Object Type ID as
referred to in table 1.3 of ISO/IEC 14496-3:2009[2].
The numerical constants in the code refer to these OTIs minus one, as
documented in commit 372597e[3], confirmed by comparing the values in the
code with the values in the table mentioned above.
Links:
1: https://datatracker.ietf.org/doc/html/rfc6381#section-3.3
2: https://csclub.uwaterloo.ca/~ehashman/ISO14496-3-2009.pdf
3: https://github.com/FFmpeg/FFmpeg/commit/372597e5381c097455a7b73849254d56083eb056
Changes in this version:
- Default value set to "mp4a.40.2" when profile is unknown for backward
compatibility.
---
libavformat/hlsenc.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 7049956dd7..55123d2297 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -418,8 +418,11 @@ static void write_codec_attr(AVStream *st, VariantStream *vs)
} else if (st->codecpar->codec_id == AV_CODEC_ID_MP3) {
snprintf(attr, sizeof(attr), "mp4a.40.34");
} else if (st->codecpar->codec_id == AV_CODEC_ID_AAC) {
- /* TODO : For HE-AAC, HE-AACv2, the last digit needs to be set to 5 and 29 respectively */
- snprintf(attr, sizeof(attr), "mp4a.40.2");
+ if (st->codecpar->profile != AV_PROFILE_UNKNOWN)
+ snprintf(attr, sizeof(attr), "mp4a.40.%d", st->codecpar->profile+1);
+ else
+ // This is for backward compatibility with the previous implementation.
+ snprintf(attr, sizeof(attr), "mp4a.40.2");
} else if (st->codecpar->codec_id == AV_CODEC_ID_AC3) {
snprintf(attr, sizeof(attr), "ac-3");
} else if (st->codecpar->codec_id == AV_CODEC_ID_EAC3) {
--
2.39.3 (Apple Git-145)
_______________________________________________
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".
next reply other threads:[~2024-01-01 15:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-01 15:52 Romain Beauxis [this message]
2024-01-02 3:29 ` Steven Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240101155249.80569-1-toots@rastageeks.org \
--to=toots@rastageeks.org \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git