ad_spdif: check for AC3 if parser fails to detect profile

c522d0dfbd 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: c522d0dfbd
This commit is contained in:
Kacper Michajłow 2024-05-20 20:39:01 +02:00
parent 6eb0f4b27f
commit 82ce07d640
1 changed files with 2 additions and 1 deletions

View File

@ -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);