mirror of
https://github.com/owntone/owntone-server.git
synced 2025-04-01 02:03:45 -04:00
[xcode] See if we can do without asking decoder for specific sample rate/channels
We use filters now, so shouldn't be necessary. request_sample_fmt and request_channel_layout was added with commit 73b2d08.
This commit is contained in:
parent
684f55f603
commit
1379914857
@ -945,10 +945,6 @@ open_decoder(AVCodecContext **dec_ctx, unsigned int *stream_index, struct decode
|
|||||||
#else
|
#else
|
||||||
// Not const before ffmpeg 5.0
|
// Not const before ffmpeg 5.0
|
||||||
AVCodec *decoder;
|
AVCodec *decoder;
|
||||||
#endif
|
|
||||||
AVDictionary *options = NULL;
|
|
||||||
#if USE_CH_LAYOUT
|
|
||||||
char downmix_layout[64];
|
|
||||||
#endif
|
#endif
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -975,19 +971,7 @@ open_decoder(AVCodecContext **dec_ctx, unsigned int *stream_index, struct decode
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == AVMEDIA_TYPE_AUDIO)
|
ret = avcodec_open2(*dec_ctx, NULL, NULL);
|
||||||
{
|
|
||||||
(*dec_ctx)->request_sample_fmt = ctx->settings.sample_format;
|
|
||||||
#if USE_CH_LAYOUT
|
|
||||||
// option types is a string - see AV_OPT_TYPE_CHLAYOUT handling in ffmpeg:libavutil/opt.c
|
|
||||||
av_channel_layout_describe(&ctx->settings.channel_layout, downmix_layout, sizeof(downmix_layout));
|
|
||||||
av_dict_set(&options, "downmix", downmix_layout, 0);
|
|
||||||
#else
|
|
||||||
(*dec_ctx)->request_channel_layout = ctx->settings.channel_layout;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = avcodec_open2(*dec_ctx, NULL, options == NULL ? NULL : &options);
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
DPRINTF(E_LOG, L_XCODE, "Failed to open decoder for stream #%d: %s\n", *stream_index, err2str(ret));
|
DPRINTF(E_LOG, L_XCODE, "Failed to open decoder for stream #%d: %s\n", *stream_index, err2str(ret));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user