mirror of https://github.com/mpv-player/mpv
ad_spdif: set codec params
It seems that we decode small portion of the audio to determine codec params. We can remember that information. Fixes: #14178
This commit is contained in:
parent
7b77672794
commit
6eb0f4b27f
|
@ -45,6 +45,7 @@
|
||||||
|
|
||||||
struct spdifContext {
|
struct spdifContext {
|
||||||
struct mp_log *log;
|
struct mp_log *log;
|
||||||
|
struct mp_codec_params *codec;
|
||||||
enum AVCodecID codec_id;
|
enum AVCodecID codec_id;
|
||||||
AVFormatContext *lavf_ctx;
|
AVFormatContext *lavf_ctx;
|
||||||
AVPacket *avpkt;
|
AVPacket *avpkt;
|
||||||
|
@ -151,6 +152,13 @@ static void determine_codec_params(struct mp_filter *da, AVPacket *pkt,
|
||||||
*out_profile = profile = ctx->profile;
|
*out_profile = profile = ctx->profile;
|
||||||
*out_rate = ctx->sample_rate;
|
*out_rate = ctx->sample_rate;
|
||||||
|
|
||||||
|
struct mp_codec_params *c = spdif_ctx->codec;
|
||||||
|
c->codec_profile = av_get_profile_name(ctx->codec, ctx->profile);
|
||||||
|
if (!c->codec_profile)
|
||||||
|
c->codec_profile = avcodec_profile_name(ctx->codec_id, ctx->profile);
|
||||||
|
c->codec = ctx->codec_descriptor->name;
|
||||||
|
c->codec_desc = ctx->codec_descriptor->long_name;
|
||||||
|
|
||||||
done:
|
done:
|
||||||
av_frame_free(&frame);
|
av_frame_free(&frame);
|
||||||
avcodec_free_context(&ctx);
|
avcodec_free_context(&ctx);
|
||||||
|
@ -432,6 +440,7 @@ static struct mp_decoder *create(struct mp_filter *parent,
|
||||||
|
|
||||||
struct spdifContext *spdif_ctx = da->priv;
|
struct spdifContext *spdif_ctx = da->priv;
|
||||||
spdif_ctx->log = da->log;
|
spdif_ctx->log = da->log;
|
||||||
|
spdif_ctx->codec = codec;
|
||||||
spdif_ctx->pool = mp_aframe_pool_create(spdif_ctx);
|
spdif_ctx->pool = mp_aframe_pool_create(spdif_ctx);
|
||||||
spdif_ctx->public.f = da;
|
spdif_ctx->public.f = da;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue