diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2024-03-18 00:24:39 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2024-03-26 06:36:43 +0100 |
commit | 5144455c201185861072e66884bba16c48b4812d (patch) | |
tree | ebaba44e2ea676f9eb65d8438c3b10afa14d82a4 | |
parent | 8d8b5947c336eeee9a46e62969dfefd7e112d256 (diff) | |
download | ffmpeg-5144455c201185861072e66884bba16c48b4812d.tar.gz |
avformat/hls: Don't access FFInputFormat.raw_codec_id
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>
-rw-r--r-- | libavformat/hls.c | 10 | ||||
-rw-r--r-- | 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')) |