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

Unified · Split

2 files
  1. doc/filters.texi +3 −0
  2. libavfilter/src_movie.c +7 −3
doc/filters.texi+3−0
@@ -28356,6 +28356,9 @@ changed, so it will generate non monotonically increasing timestamps. · 28355 unmodified lines
2835628356 Specifies the time difference between frames above which the point is
2835728357 considered a timestamp discontinuity which is removed by adjusting the later
2835828358 timestamps.
28359+
28360+@item dec_threads
28361+Specifies the number of threads for decoding
2835928362 @end table
2836028363
2836128364 It allows overlaying a second video on top of the main input of
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