summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DOCS/man/en/options.rst6
-rw-r--r--audio/decode/ad_lavc.c3
-rw-r--r--mpvcore/options.c1
-rw-r--r--mpvcore/options.h1
4 files changed, 11 insertions, 0 deletions
diff --git a/DOCS/man/en/options.rst b/DOCS/man/en/options.rst
index 501475f33a..efe18f9eab 100644
--- a/DOCS/man/en/options.rst
+++ b/DOCS/man/en/options.rst
@@ -42,6 +42,12 @@ OPTIONS
requested number of output channels is set with the ``--channels`` option.
Useful for playing surround audio on a stereo system.
+``--ad-lavc-threads=<0-16>``
+ Number of threads to use for decoding. Whether threading is actually
+ supported depends on codec. As of this writing, it's supported for some
+ lossless codecs only. 0 means autodetect number of cores on the
+ machine and use that, up to the maximum of 16 (default: 1).
+
``--ad-lavc-o=<key>=<value>[,<key>=<value>[,...]]``
Pass AVOptions to libavcodec decoder. Note, a patch to make the o=
unneeded and pass all unknown options through the AVOption system is
diff --git a/audio/decode/ad_lavc.c b/audio/decode/ad_lavc.c
index b364616e73..8837f681eb 100644
--- a/audio/decode/ad_lavc.c
+++ b/audio/decode/ad_lavc.c
@@ -56,6 +56,7 @@ static int decode_new_packet(struct dec_audio *da);
const m_option_t ad_lavc_decode_opts_conf[] = {
OPT_FLOATRANGE("ac3drc", ad_lavc_param.ac3drc, 0, 0, 2),
OPT_FLAG("downmix", ad_lavc_param.downmix, 0),
+ OPT_INTRANGE("threads", ad_lavc_param.threads, 0, 1, 16),
OPT_STRING("o", ad_lavc_param.avopt, 0),
{0}
};
@@ -249,6 +250,8 @@ static int init(struct dec_audio *da, const char *decoder)
if (sh->lav_headers)
mp_copy_lav_codec_headers(lavc_context, sh->lav_headers);
+ mp_set_avcodec_threads(lavc_context, opts->threads);
+
/* open it */
if (avcodec_open2(lavc_context, lavc_codec, NULL) < 0) {
mp_tmsg(MSGT_DECAUDIO, MSGL_ERR, "Could not open codec.\n");
diff --git a/mpvcore/options.c b/mpvcore/options.c
index 08b1f10fe2..ab9969c315 100644
--- a/mpvcore/options.c
+++ b/mpvcore/options.c
@@ -858,6 +858,7 @@ const struct MPOpts mp_default_opts = {
.ad_lavc_param = {
.ac3drc = 1.,
.downmix = 1,
+ .threads = 1,
},
.lavfdopts = {
.allow_mimetype = 1,
diff --git a/mpvcore/options.h b/mpvcore/options.h
index cb700cb775..09a39059bb 100644
--- a/mpvcore/options.h
+++ b/mpvcore/options.h
@@ -225,6 +225,7 @@ typedef struct MPOpts {
struct ad_lavc_param {
float ac3drc;
int downmix;
+ int threads;
char *avopt;
} ad_lavc_param;