audio/ad_spdif: specify media type and sample rate in output codecpar

No idea how things previously worked without having these set, but
apparently they did...

If this was a normal encoder to muxer case, we would utilize
`avcodec_parameters_to_context`, but alas this is not.

Fixes: #13794
This commit is contained in:
Jan Ekström 2024-04-02 18:58:48 +03:00
parent e8fb386456
commit 951153e733
1 changed files with 4 additions and 1 deletions

View File

@ -196,7 +196,8 @@ static int init_filter(struct mp_filter *da)
if (!stream)
goto fail;
stream->codecpar->codec_id = spdif_ctx->codec_id;
stream->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
stream->codecpar->codec_id = spdif_ctx->codec_id;
AVDictionary *format_opts = NULL;
@ -260,6 +261,8 @@ static int init_filter(struct mp_filter *da)
abort();
}
stream->codecpar->sample_rate = samplerate;
struct mp_chmap chmap;
mp_chmap_from_channels(&chmap, num_channels);
mp_aframe_set_chmap(spdif_ctx->fmt, &chmap);