1
mirror of https://github.com/mpv-player/mpv synced 2024-08-04 14:59:58 +02:00

ad_lavc: work around deprecation warning

request_channels has been deprecated for years (request_channel_layout
is the replacement), but it appears it's still needed despite the
deprecation at least on older libavcodec versions.

So still set request_channels, but to it with the avoption API, which
hides the deprecation warning. This should also prevent mpv getting
trashed when libavcodec happens to bump its major version.
This commit is contained in:
wm4 2013-12-18 17:12:49 +01:00
parent 80b34ebea4
commit b170248389

View File

@ -211,9 +211,12 @@ static int init(struct dec_audio *da, const char *decoder)
lavc_context->codec_id = lavc_codec->id;
if (opts->downmix) {
lavc_context->request_channels = mpopts->audio_output_channels.num;
lavc_context->request_channel_layout =
mp_chmap_to_lavc(&mpopts->audio_output_channels);
// Compatibility for Libav 9
av_opt_set_int(lavc_context, "request_channels",
mpopts->audio_output_channels.num,
AV_OPT_SEARCH_CHILDREN);
}
// Always try to set - option only exists for AC3 at the moment