diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libffmpeg/ff_video_decoder.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/libffmpeg/ff_video_decoder.c b/src/libffmpeg/ff_video_decoder.c index 077ff2fad..9ab4f9daf 100644 --- a/src/libffmpeg/ff_video_decoder.c +++ b/src/libffmpeg/ff_video_decoder.c @@ -67,6 +67,7 @@ typedef struct ff_video_class_s { video_decoder_class_t decoder_class; int pp_quality; + int thread_count; xine_t *xine; } ff_video_class_t; @@ -368,6 +369,12 @@ static void init_video_codec (ff_video_decoder_t *this, unsigned int codec_type) _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_HANDLED, 0); return; } + + if (this->class->thread_count > 1) { + avcodec_thread_init(this->context, this->class->thread_count); + this->context->thread_count = this->class->thread_count; + } + pthread_mutex_unlock(&ffmpeg_lock); lprintf("lavc decoder opened\n"); @@ -422,6 +429,12 @@ static void init_video_codec (ff_video_decoder_t *this, unsigned int codec_type) } +static void thread_count_cb(void *user_data, xine_cfg_entry_t *entry) { + ff_video_class_t *class = (ff_video_class_t *) user_data; + + class->thread_count = entry->num_value; +} + static void pp_quality_cb(void *user_data, xine_cfg_entry_t *entry) { ff_video_class_t *class = (ff_video_class_t *) user_data; @@ -1530,6 +1543,15 @@ void *init_video_plugin (xine_t *xine, void *data) { "too much."), 10, pp_quality_cb, this); + this->thread_count = xine->config->register_num(config, "video.processing.ffmpeg_thread_count", 1, + _("FFmpeg video decoding thread count"), + _("You can adjust the number of video decoding threads which FFmpeg may use.\n" + "Higher values should speed up decoding but it depends on the codec used " + "whether parallel decoding is supported. A rule of thumb is to have one " + "decoding thread per logical CPU (typically 1 to 4). A change will take " + "effect with playing the next stream."), + 10, thread_count_cb, this); + return this; } |