Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Subject: [FFmpeg-devel] [PATCH 02/15] avformat/hls: Don't access FFInputFormat.raw_codec_id
Date: Sat, 23 Mar 2024 03:06:10 +0100
Message-ID: <GV1P250MB0737A7EFBC0FAF1B462C75078F302@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <GV1P250MB07376CBB2E248FDF0C78CF8C8F302@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM>

It is an implementation detail of other input formats whether
they use raw_codec_id or not. The HLS demuxer should not rely
on this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/hls.c                   | 10 ++++++----
 libavformat/hls_sample_encryption.c |  1 +
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/libavformat/hls.c b/libavformat/hls.c
index f6b44c2e35..94defa9384 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -2100,10 +2100,12 @@ static int hls_read_header(AVFormatContext *s)
          */
         if (seg && seg->key_type == KEY_SAMPLE_AES && pls->is_id3_timestamped &&
             pls->audio_setup_info.codec_id != AV_CODEC_ID_NONE) {
-            void *iter = NULL;
-            while ((in_fmt = av_demuxer_iterate(&iter)))
-                if (ffifmt(in_fmt)->raw_codec_id == pls->audio_setup_info.codec_id)
-                    break;
+            av_assert1(pls->audio_setup_info.codec_id == AV_CODEC_ID_AAC ||
+                       pls->audio_setup_info.codec_id == AV_CODEC_ID_AC3 ||
+                       pls->audio_setup_info.codec_id == AV_CODEC_ID_EAC3);
+            // Keep this list in sync with ff_hls_senc_read_audio_setup_info()
+            in_fmt = av_find_input_format(pls->audio_setup_info.codec_id == AV_CODEC_ID_AAC ? "aac" :
+                                          pls->audio_setup_info.codec_id == AV_CODEC_ID_AC3 ? "ac3" : "eac3");
         } else {
             pls->ctx->probesize = s->probesize > 0 ? s->probesize : 1024 * 4;
             pls->ctx->max_analyze_duration = s->max_analyze_duration > 0 ? s->max_analyze_duration : 4 * AV_TIME_BASE;
diff --git a/libavformat/hls_sample_encryption.c b/libavformat/hls_sample_encryption.c
index d5b4c11b66..f412836d4f 100644
--- a/libavformat/hls_sample_encryption.c
+++ b/libavformat/hls_sample_encryption.c
@@ -64,6 +64,7 @@ void ff_hls_senc_read_audio_setup_info(HLSAudioSetupInfo *info, const uint8_t *b
 
     info->codec_tag = AV_RL32(buf);
 
+    /* Always keep this list in sync with the one from hls_read_header() */
     if (info->codec_tag == MKTAG('z','a','a','c'))
         info->codec_id = AV_CODEC_ID_AAC;
     else if (info->codec_tag == MKTAG('z','a','c','3'))
-- 
2.40.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-request@ffmpeg.org with subject "unsubscribe".

  reply	other threads:[~2024-03-23  2:06 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-23  2:03 [FFmpeg-devel] [PATCH 01/15] configure: Make hls demuxer select AAC, AC3 and EAC3 demuxers Andreas Rheinhardt
2024-03-23  2:06 ` Andreas Rheinhardt [this message]
2024-03-23  2:06 ` [FFmpeg-devel] [PATCH 03/15] avformat/fitsdec: Don't use AVBPrint for temporary storage Andreas Rheinhardt
2024-03-23  2:06 ` [FFmpeg-devel] [PATCH 04/15] avformat/g722: Inline constants Andreas Rheinhardt
2024-03-23  2:06 ` [FFmpeg-devel] [PATCH 05/15] avformat/wvedec: Inline constant Andreas Rheinhardt
2024-03-23  2:06 ` [FFmpeg-devel] [PATCH 06/15] avformat/fsb: Don't set data_offset manually Andreas Rheinhardt
2024-03-23  2:06 ` [FFmpeg-devel] [PATCH 07/15] avformat/avr: Combine skips Andreas Rheinhardt
2024-03-23  2:06 ` [FFmpeg-devel] [PATCH 08/15] avformat/wady: " Andreas Rheinhardt
2024-03-23  2:06 ` [FFmpeg-devel] [PATCH 09/15] avformat/argo_cvg: Avoid relocations for ArgoCVGOverride Andreas Rheinhardt
2024-03-23  2:06 ` [FFmpeg-devel] [PATCH 10/15] avformat/lafdec: Fix shadowing Andreas Rheinhardt
2024-03-23  2:06 ` [FFmpeg-devel] [PATCH 11/15] avformat/cdg: Don't store avio_size() return value in int Andreas Rheinhardt
2024-03-23  2:06 ` [FFmpeg-devel] [PATCH 12/15] avformat/pcmdec: Avoid av_freep(&(void*){NULL}) Andreas Rheinhardt
2024-03-23  2:06 ` [FFmpeg-devel] [PATCH 13/15] avformat/pcmdec: Reindent after the previous commit Andreas Rheinhardt
2024-03-23  2:06 ` [FFmpeg-devel] [PATCH 14/15] avformat/vqf: Return 0 on success in read_packet Andreas Rheinhardt
2024-03-23  2:06 ` [FFmpeg-devel] [PATCH 15/15] avformat/internal: Move FF_FMT_INIT_CLEANUP to demux.h Andreas Rheinhardt
2024-03-25  1:54 ` [FFmpeg-devel] [PATCH 01/15] configure: Make hls demuxer select AAC, AC3 and EAC3 demuxers Andreas Rheinhardt

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=GV1P250MB0737A7EFBC0FAF1B462C75078F302@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM \
    --to=andreas.rheinhardt@outlook.com \
    --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