History

cmdutils: add opencl command line options to ffmpeg

highgod0401 committed 13 years ago

Commit d757f751 parent 567feaa3 files · +31 −0Browse files

Unified · Split

3 files
  1. cmdutils.c +24 −0
  2. cmdutils.h +4 −0
  3. cmdutils_common_opts.h +3 −0
cmdutils.c+24−0
@@ -56,6 +56,10 @@ · 55 unmodified lines
5656 #include <sys/time.h>
5757 #include <sys/resource.h>
5858 #endif
59+#if CONFIG_OPENCL
60+#include "libavutil/opencl.h"
61+#endif
62+
5963
6064 static int init_report(const char *env);
6165
@@ -955,6 +959,26 @@ int opt_timelimit(void *optctx, const char *opt, const char *arg) · 893 unmodified lines
955959 return 0;
956960 }
957961
962+#if CONFIG_OPENCL
963+int opt_opencl(void *optctx, const char *opt, const char *arg)
964+{
965+ char *key, *value;
966+ const char *opts = arg;
967+ int ret = 0;
968+ while (*opts) {
969+ ret = av_opt_get_key_value(&opts, "=", ":", 0, &key, &value);
970+ if (ret < 0)
971+ return ret;
972+ ret = av_opencl_set_option(key, value);
973+ if (ret < 0)
974+ return ret;
975+ if (*opts)
976+ opts++;
977+ }
978+ return ret;
979+}
980+#endif
981+
958982 void print_error(const char *filename, int err)
959983 {
960984 char errbuf[128];
cmdutils.h+4−0
@@ -90,6 +90,10 @@ int opt_cpuflags(void *optctx, const char *opt, const char *arg); · 89 unmodified lines
9090
9191 int opt_codec_debug(void *optctx, const char *opt, const char *arg);
9292
93+#if CONFIG_OPENCL
94+int opt_opencl(void *optctx, const char *opt, const char *arg);
95+#endif
96+
9397 /**
9498 * Limit the execution time.
9599 */
cmdutils_common_opts.h+3−0
@@ -19,3 +19,6 @@ · 18 unmodified lines
1919 { "report" , 0, {(void*)opt_report}, "generate a report" },
2020 { "max_alloc" , HAS_ARG, {.func_arg = opt_max_alloc}, "set maximum size of a single allocated block", "bytes" },
2121 { "cpuflags" , HAS_ARG | OPT_EXPERT, {.func_arg = opt_cpuflags}, "force specific cpu flags", "flags" },
22+ #if CONFIG_OPENCL
23+ { "opencl_options", HAS_ARG, {.func_arg = opt_opencl}, "set OpenCL environment options" },
24+ #endif

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