From 82ce07d64052afeaf8a16abae5e9e1319509bb4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= Date: Mon, 20 May 2024 20:39:01 +0200 Subject: [PATCH] ad_spdif: check for AC3 if parser fails to detect profile c522d0dfbd9b9663c4e084261a353ee45991fd86 added parser to avoid opening decoder and left decoder only for DTS. Since then more audio codec needs decoder, so open decoder always when it might be needed. Exclude only AC3, other codec have profile to be extracted. Fixes: c522d0dfbd9b9663c4e084261a353ee45991fd86 --- audio/decode/ad_spdif.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/audio/decode/ad_spdif.c b/audio/decode/ad_spdif.c index 65e1bf8654..81f021b8eb 100644 --- a/audio/decode/ad_spdif.c +++ b/audio/decode/ad_spdif.c @@ -121,12 +121,13 @@ static void determine_codec_params(struct mp_filter *da, AVPacket *pkt, av_parser_parse2(parser, ctx, &d, &s, pkt->data, pkt->size, 0, 0, 0); *out_profile = profile = ctx->profile; *out_rate = ctx->sample_rate; + spdif_ctx->codec->codec_profile = avcodec_profile_name(spdif_ctx->codec_id, profile); avcodec_free_context(&ctx); av_parser_close(parser); } - if (profile != AV_PROFILE_UNKNOWN || spdif_ctx->codec_id != AV_CODEC_ID_DTS) + if (profile != AV_PROFILE_UNKNOWN || spdif_ctx->codec_id == AV_CODEC_ID_AC3) return; const AVCodec *codec = avcodec_find_decoder(spdif_ctx->codec_id);