[FFmpeg-devel] [PATCH 3/3] ffmpeg/ffmpeg_opt: add spec opencl device option to ffmpeg 20130408 new
Michael Niedermayer
michaelni at gmx.at
Tue Apr 9 04:15:00 CEST 2013
On Tue, Apr 09, 2013 at 09:48:05AM +0800, Wei Gao wrote:
> 2013/4/9 Michael Niedermayer <michaelni at gmx.at>
>
> > On Mon, Apr 08, 2013 at 05:26:34PM +0800, Wei Gao wrote:
> > > sorry, I found that the previous has a bug in opt_opencl(), resubmit.
> >
> > > ffmpeg_opt.c | 31 +++++++++++++++++++++++++++++++
> > > 1 file changed, 31 insertions(+)
> > > a28767916eb0e41cff4f629b3241237a5d9d97ea
> > 0003-add-spec-opencl-device-option-to-ffmpeg-20130408-new.patch
> > > From e7b23e372f5a7ee612daace85a5ff37bddf7cbe6 Mon Sep 17 00:00:00 2001
> > > From: highgod0401 <highgod0401 at gmail.com>
> > > Date: Mon, 8 Apr 2013 17:22:47 +0800
> > > Subject: [PATCH 3/3] add spec opencl device option to ffmpeg 20130408 new
> > >
> > > ---
> > > ffmpeg_opt.c | 31 +++++++++++++++++++++++++++++++
> > > 1 file changed, 31 insertions(+)
> > >
> > > diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
> > > index 63a238d..d8fbdd0 100644
> > > --- a/ffmpeg_opt.c
> > > +++ b/ffmpeg_opt.c
> > > @@ -41,6 +41,9 @@
> > > #include "libavutil/parseutils.h"
> > > #include "libavutil/pixdesc.h"
> > > #include "libavutil/pixfmt.h"
> > > +#if CONFIG_OPENCL
> > > +#include "libavutil/opencl.h"
> > > +#endif
> > >
> > > #define MATCH_PER_STREAM_OPT(name, type, outvar, fmtctx, st)\
> > > {\
> > > @@ -317,6 +320,30 @@ static int opt_attach(void *optctx, const char
> > *opt, const char *arg)
> > > return 0;
> > > }
> > >
> > > +#if CONFIG_OPENCL
> > > +static int opt_opencl(void *optctx, const char *opt, const char *arg)
> > > +{
> > > + char *content[2] = {0};
> > > + const char *temp = arg;
> > > + int i, ret = 0;
> > > + while (*temp) {
> > > + for (i = 0; i < FF_ARRAY_ELEMS(content); i++) {
> >
> > > + content[i] = av_get_token(&temp, "=,:[\n");
> > > + temp++;
> > > + if (!(*temp)) {
> >
> > iam not sure this is safe, consider temp is just a " ", IIRC
> > av_get_token will skip over it anbd temp will point to 0 temp++
> > will then point to a byte after the array
> >
>
> static int opt_opencl(void *optctx, const char *opt, const char *arg)
> {
> char *content[2] = {0};
> const char *temp = arg;
> int i, ret = 0;
> while (*temp) {
> for (i = 0; i < FF_ARRAY_ELEMS(content); i++) {
> content[i] = av_get_token(&temp, "=,:[\n");
> if (!(*temp) || !(*(temp + 1))) {
> if (i == 1)
> ret = av_opencl_set_option(content[0], content[1]);
> return ret;
> }
> temp++;
> }
> ret = av_opencl_set_option(content[0], content[1]);
> if (ret < 0)
> return ret;
> }
> return ret;
> Sorry, is it ok now? Thanks
from a quick look, it looks ok
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130409/425b0081/attachment.asc>
More information about the ffmpeg-devel
mailing list