Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenkernel/intern/writeffmpeg.c')
-rw-r--r--source/blender/blenkernel/intern/writeffmpeg.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
index 0991d804882..7fc9e8cc0ef 100644
--- a/source/blender/blenkernel/intern/writeffmpeg.c
+++ b/source/blender/blenkernel/intern/writeffmpeg.c
@@ -567,9 +567,6 @@ static AVStream *alloc_video_stream(FFMpegContext *context,
/* Set up the codec context */
c = st->codec;
- c->thread_count = BLI_system_thread_count();
- c->thread_type = FF_THREAD_SLICE;
-
c->codec_id = codec_id;
c->codec_type = AVMEDIA_TYPE_VIDEO;
@@ -727,6 +724,20 @@ static AVStream *alloc_video_stream(FFMpegContext *context,
set_ffmpeg_properties(rd, c, "video", &opts);
+ if (codec->capabilities & AV_CODEC_CAP_AUTO_THREADS) {
+ c->thread_count = 0;
+ }
+ else {
+ c->thread_count = BLI_system_thread_count();
+ }
+
+ if (codec->capabilities & AV_CODEC_CAP_FRAME_THREADS) {
+ c->thread_type = FF_THREAD_FRAME;
+ }
+ else if (codec->capabilities & AV_CODEC_CAP_SLICE_THREADS) {
+ c->thread_type = FF_THREAD_SLICE;
+ }
+
if (avcodec_open2(c, codec, &opts) < 0) {
BLI_strncpy(error, IMB_ffmpeg_last_error(), error_size);
av_dict_free(&opts);