summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-12-18 17:12:49 +0100
committerwm4 <wm4@nowhere>2013-12-18 17:12:49 +0100
commitb170248389b9129a7485d9fd0377c755b162de45 (patch)
treeebbf9978b504e1fcbbbb3c6f6ed679cf0aa937fb
parent80b34ebea4212c232865498c4d4b59ca70befb00 (diff)
downloadmpv-b170248389b9129a7485d9fd0377c755b162de45.tar.bz2
mpv-b170248389b9129a7485d9fd0377c755b162de45.tar.xz
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.
-rw-r--r--audio/decode/ad_lavc.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/audio/decode/ad_lavc.c b/audio/decode/ad_lavc.c
index 9e1ba49fc1..b2d1c879e9 100644
--- a/audio/decode/ad_lavc.c
+++ b/audio/decode/ad_lavc.c
@@ -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