mirror of https://github.com/mpv-player/mpv
ad_lavc: expose an option to enable threading
This commit is contained in:
parent
47c4b5c000
commit
59aed93208
|
@ -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
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -858,6 +858,7 @@ const struct MPOpts mp_default_opts = {
|
|||
.ad_lavc_param = {
|
||||
.ac3drc = 1.,
|
||||
.downmix = 1,
|
||||
.threads = 1,
|
||||
},
|
||||
.lavfdopts = {
|
||||
.allow_mimetype = 1,
|
||||
|
|
|
@ -225,6 +225,7 @@ typedef struct MPOpts {
|
|||
struct ad_lavc_param {
|
||||
float ac3drc;
|
||||
int downmix;
|
||||
int threads;
|
||||
char *avopt;
|
||||
} ad_lavc_param;
|
||||
|
||||
|
|
Loading…
Reference in New Issue