History

avfilter/src_movie: make the number of decode thread configurable

Limin Wang committed 5 years ago

Commit ec6187b1 parent 511096c2 files · +10 −3Browse files

Showing the changes to libavfilter (1 of 2 files). Show all

Unified · Split

libavfilter/src_movie.c+7−3
@@ -67,6 +67,7 @@ typedef struct MovieContext { · 66 unmodified lines
6767 int loop_count;
6868 int64_t discontinuity_threshold;
6969 int64_t ts_offset;
70+ int dec_threads;
7071
7172 AVFormatContext *format_ctx;
7273
@@ -90,6 +91,7 @@ static const AVOption movie_options[]= { · 17 unmodified lines
9091 { "s", "set streams", OFFSET(stream_specs), AV_OPT_TYPE_STRING, {.str = 0}, 0, 0, FLAGS },
9192 { "loop", "set loop count", OFFSET(loop_count), AV_OPT_TYPE_INT, {.i64 = 1}, 0, INT_MAX, FLAGS },
9293 { "discontinuity", "set discontinuity threshold", OFFSET(discontinuity_threshold), AV_OPT_TYPE_DURATION, {.i64 = 0}, 0, INT64_MAX, FLAGS },
94+ { "dec_threads", "set the number of threads for decoding", OFFSET(dec_threads), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, FLAGS },
9395 { NULL },
9496 };
9597
@@ -150,7 +152,7 @@ static AVStream *find_stream(void *log, AVFormatContext *avf, const char *spec) · 54 unmodified lines
150152 return found;
151153 }
152154
153−static int open_stream(AVFilterContext *ctx, MovieStream *st)
155+static int open_stream(AVFilterContext *ctx, MovieStream *st, int dec_threads)
154156 {
155157 const AVCodec *codec;
156158 int ret;
@@ -169,7 +171,9 @@ static int open_stream(AVFilterContext *ctx, MovieStream *st) · 12 unmodified lines
169171 if (ret < 0)
170172 return ret;
171173
172− st->codec_ctx->thread_count = ff_filter_get_nb_threads(ctx);
174+ if (!dec_threads)
175+ dec_threads = ff_filter_get_nb_threads(ctx);
176+ st->codec_ctx->thread_count = dec_threads;
173177
174178 if ((ret = avcodec_open2(st->codec_ctx, codec, NULL)) < 0) {
175179 av_log(ctx, AV_LOG_ERROR, "Failed to open codec\n");
@@ -314,7 +318,7 @@ static av_cold int movie_common_init(AVFilterContext *ctx) · 138 unmodified lines
314318 if (ret < 0)
315319 return ret;
316320 }
317− ret = open_stream(ctx, &movie->st[i]);
321+ ret = open_stream(ctx, &movie->st[i], movie->dec_threads);
318322 if (ret < 0)
319323 return ret;
320324 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t