| @@ -67,6 +67,7 @@ typedef struct MovieContext { · 66 unmodified lines |
| 67 | int loop_count; | 67 | int loop_count; |
| 68 | int64_t discontinuity_threshold; | 68 | int64_t discontinuity_threshold; |
| 69 | int64_t ts_offset; | 69 | int64_t ts_offset; |
| | 70 | int dec_threads; |
| 70 | | 71 | |
| 71 | AVFormatContext *format_ctx; | 72 | AVFormatContext *format_ctx; |
| 72 | | 73 | |
| @@ -90,6 +91,7 @@ static const AVOption movie_options[]= { · 17 unmodified lines |
| 90 | { "s", "set streams", OFFSET(stream_specs), AV_OPT_TYPE_STRING, {.str = 0}, 0, 0, FLAGS }, | 91 | { "s", "set streams", OFFSET(stream_specs), AV_OPT_TYPE_STRING, {.str = 0}, 0, 0, FLAGS }, |
| 91 | { "loop", "set loop count", OFFSET(loop_count), AV_OPT_TYPE_INT, {.i64 = 1}, 0, INT_MAX, FLAGS }, | 92 | { "loop", "set loop count", OFFSET(loop_count), AV_OPT_TYPE_INT, {.i64 = 1}, 0, INT_MAX, FLAGS }, |
| 92 | { "discontinuity", "set discontinuity threshold", OFFSET(discontinuity_threshold), AV_OPT_TYPE_DURATION, {.i64 = 0}, 0, INT64_MAX, FLAGS }, | 93 | { "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 }, |
| 93 | { NULL }, | 95 | { NULL }, |
| 94 | }; | 96 | }; |
| 95 | | 97 | |
| @@ -150,7 +152,7 @@ static AVStream *find_stream(void *log, AVFormatContext *avf, const char *spec) · 54 unmodified lines |
| 150 | return found; | 152 | return found; |
| 151 | } | 153 | } |
| 152 | | 154 | |
| 153 | static int open_stream(AVFilterContext *ctx, MovieStream *st) | 155 | static int open_stream(AVFilterContext *ctx, MovieStream *st, int dec_threads) |
| 154 | { | 156 | { |
| 155 | const AVCodec *codec; | 157 | const AVCodec *codec; |
| 156 | int ret; | 158 | int ret; |
| @@ -169,7 +171,9 @@ static int open_stream(AVFilterContext *ctx, MovieStream *st) · 12 unmodified lines |
| 169 | if (ret < 0) | 171 | if (ret < 0) |
| 170 | return ret; | 172 | return ret; |
| 171 | | 173 | |
| 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; |
| 173 | | 177 | |
| 174 | if ((ret = avcodec_open2(st->codec_ctx, codec, NULL)) < 0) { | 178 | if ((ret = avcodec_open2(st->codec_ctx, codec, NULL)) < 0) { |
| 175 | av_log(ctx, AV_LOG_ERROR, "Failed to open codec\n"); | 179 | 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 |
| 314 | if (ret < 0) | 318 | if (ret < 0) |
| 315 | return ret; | 319 | return ret; |
| 316 | } | 320 | } |
| 317 | ret = open_stream(ctx, &movie->st[i]); | 321 | ret = open_stream(ctx, &movie->st[i], movie->dec_threads); |
| 318 | if (ret < 0) | 322 | if (ret < 0) |
| 319 | return ret; | 323 | return ret; |
| 320 | } | 324 | } |