[FFmpeg-devel] [PATCH 3/3 v2] doc/examples: Add "thread_type" and "threads" flags to fffuzz
Pawel Golinski
golpaw1 at gmail.com
Sat Apr 16 00:12:43 CEST 2016
---
doc/examples/fffuzz.c | 38 ++++++++++++++++++++++++++++++++------
1 file changed, 32 insertions(+), 6 deletions(-)
diff --git a/doc/examples/fffuzz.c b/doc/examples/fffuzz.c
index fdf97e7..50bccee 100644
--- a/doc/examples/fffuzz.c
+++ b/doc/examples/fffuzz.c
@@ -225,7 +225,11 @@ static void exit_with_usage_msg(char* prog_name)
"-f format_name, -format format_name\n"
"\tSets the decode format to format_name\n"
"-c codec_name, -codec codec_name\n"
- "\tSets the decode codec to codec_name\n\n", prog_name);
+ "\tSets the decode codec to codec_name\n"
+ "-t slice|frame, -thread_type slice|frame\n"
+ "\tSets threading mode (slice or frame threads)\n"
+ "-n thread_num, -threads thread_num\n"
+ "\tSets thread number to thread_num\n\n", prog_name);
exit(1);
}
@@ -236,17 +240,21 @@ int main (int argc, char **argv)
const char *dst_filename = NULL;
char* format = NULL;
char* codec = NULL;
+ char* thread_type = NULL;
+ char* threads = NULL;
static struct option long_options[] =
{
- {"input", required_argument, NULL, 'i'},
- {"output", required_argument, NULL, 'o'},
- {"format", required_argument, NULL, 'f'},
- {"codec", required_argument, NULL, 'c'},
+ {"input", required_argument, NULL, 'i'},
+ {"output", required_argument, NULL, 'o'},
+ {"format", required_argument, NULL, 'f'},
+ {"codec", required_argument, NULL, 'c'},
+ {"thread_type", required_argument, NULL, 't'},
+ {"threads", required_argument, NULL, 'n'},
{0, 0, 0, 0}
};
- while ((opt = getopt_long_only(argc, argv, "", long_options, NULL)) != -1) {
+ while ((opt = getopt_long_only(argc, argv, "i:o:f:c:t:n:", long_options, NULL)) != -1) {
switch (opt) {
case 'i':
src_filename = optarg;
@@ -260,6 +268,12 @@ int main (int argc, char **argv)
case 'c':
codec = optarg;
break;
+ case 't':
+ thread_type = optarg;
+ break;
+ case 'n':
+ threads = optarg;
+ break;
}
}
@@ -306,6 +320,18 @@ int main (int argc, char **argv)
ret = 1;
goto end;
}
+ /* set threading mode */
+ if (av_dict_set(&opts, "thread_type", thread_type, 0) < 0) {
+ fprintf(stderr, "Could not set thread_type.\n");
+ ret = 1;
+ goto end;
+ }
+ /* set number of threads */
+ if (av_dict_set(&opts, "threads", threads, 0) < 0) {
+ fprintf(stderr, "Could not set threads.\n");
+ ret = 1;
+ goto end;
+ }
if (format) {
fmt = av_find_input_format(format);
--
2.6.4 (Apple Git-63)
More information about the ffmpeg-devel
mailing list