[FFmpeg-cvslog] cmdutils: add opencl command line options to ffmpeg

highgod0401 git at videolan.org
Thu Apr 11 16:07:03 CEST 2013


ffmpeg | branch: master | highgod0401 <highgod0401 at gmail.com> | Thu Apr 11 20:16:29 2013 +0800| [d757f7510bc2abe805627d4dc6cf5ebba2ee1fcf] | committer: Michael Niedermayer

cmdutils: add opencl command line options to ffmpeg

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d757f7510bc2abe805627d4dc6cf5ebba2ee1fcf
---

 cmdutils.c             |   24 ++++++++++++++++++++++++
 cmdutils.h             |    4 ++++
 cmdutils_common_opts.h |    3 +++
 3 files changed, 31 insertions(+)

diff --git a/cmdutils.c b/cmdutils.c
index ee42fea..4634ae2 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -56,6 +56,10 @@
 #include <sys/time.h>
 #include <sys/resource.h>
 #endif
+#if CONFIG_OPENCL
+#include "libavutil/opencl.h"
+#endif
+
 
 static int init_report(const char *env);
 
@@ -955,6 +959,26 @@ int opt_timelimit(void *optctx, const char *opt, const char *arg)
     return 0;
 }
 
+#if CONFIG_OPENCL
+int opt_opencl(void *optctx, const char *opt, const char *arg)
+{
+    char *key, *value;
+    const char *opts = arg;
+    int ret = 0;
+    while (*opts) {
+        ret = av_opt_get_key_value(&opts, "=", ":", 0, &key, &value);
+        if (ret < 0)
+            return ret;
+        ret = av_opencl_set_option(key, value);
+        if (ret < 0)
+            return ret;
+        if (*opts)
+            opts++;
+    }
+    return ret;
+}
+#endif
+
 void print_error(const char *filename, int err)
 {
     char errbuf[128];
diff --git a/cmdutils.h b/cmdutils.h
index 63e10f3..bcb43bf 100644
--- a/cmdutils.h
+++ b/cmdutils.h
@@ -90,6 +90,10 @@ int opt_cpuflags(void *optctx, const char *opt, const char *arg);
 
 int opt_codec_debug(void *optctx, const char *opt, const char *arg);
 
+#if CONFIG_OPENCL
+int opt_opencl(void *optctx, const char *opt, const char *arg);
+#endif
+
 /**
  * Limit the execution time.
  */
diff --git a/cmdutils_common_opts.h b/cmdutils_common_opts.h
index ccef21c..878c748 100644
--- a/cmdutils_common_opts.h
+++ b/cmdutils_common_opts.h
@@ -19,3 +19,6 @@
     { "report"     , 0,        {(void*)opt_report}, "generate a report" },
     { "max_alloc"  , HAS_ARG,  {.func_arg = opt_max_alloc},     "set maximum size of a single allocated block", "bytes" },
     { "cpuflags"   , HAS_ARG | OPT_EXPERT, {.func_arg = opt_cpuflags}, "force specific cpu flags", "flags" },
+    #if CONFIG_OPENCL
+    { "opencl_options", HAS_ARG, {.func_arg = opt_opencl},      "set OpenCL environment options" },
+    #endif



More information about the ffmpeg-cvslog mailing list