[FFmpeg-devel] [PATCH] life source

Stefano Sabatini stefasab at gmail.com
Sun Dec 4 13:16:21 CET 2011


On date Sunday 2011-11-20 20:11:05 +0100, Clément Bœsch encoded:
> On Sat, Nov 19, 2011 at 11:14:46PM +0100, Stefano Sabatini wrote:
> > On date Sunday 2011-06-26 20:11:52 +0200, Stefano Sabatini encoded:
> > > From 680fc136c9f85e289b86195dc54e5b76bffe6b97 Mon Sep 17 00:00:00 2001
> > > From: Stefano Sabatini <stefano.sabatini-lala at poste.it>
> > > Date: Sun, 26 Jun 2011 19:47:18 +0200
> > > Subject: [PATCH] lavfi: add lifesrc source
> > > 
> > > ---
> > >  libavfilter/Makefile       |    1 +
> > >  libavfilter/allfilters.c   |    1 +
> > >  libavfilter/vsrc_lifesrc.c |  305 ++++++++++++++++++++++++++++++++++++++++++++
> > >  3 files changed, 307 insertions(+), 0 deletions(-)
> > >  create mode 100644 libavfilter/vsrc_lifesrc.c
> > 
> > Well since I'm in an all-play-no-work mood I worked to an updated
> > version.
> > 
> > I could also add support to "bricks" (cells which can't never be
> > filled) and provide an option for specifying connected topology, but
> > that can be done later.
> > 
> > Example:
> > ffplay -f lavfi "lifesrc=f=CREDITS:s=300x300:rule=21219, boxblur=2:2, negate"
> 
> fun :)
> 
> [...]
> > +
> > +    if (!life->filename) {
> > +        av_log(ctx, AV_LOG_ERROR, "No filename specified, aborting\n");
> > +        return AVERROR(EINVAL);
> > +    }
> > +
> > +    if ((ret = init_pattern_from_file(ctx) < 0))
> > +        return ret;
> 
> if ((ret = ...) < 0), or else it will crash with for instance an empty
> file.

Fixed.
 
> BTW, I agree with both Michael and Nicolas about having it upstream (I
> want to do something on it :)) and the random init board in case of no
> file.

Added random grid generation in case of no specified file (based on a
simple probabilistic approach), border stitching (by default) and
implemented a saner syntax for specifying rules based on the game of
life Wikipedia article. Also changed the name lifesrc -> life.

I'll apply it in a few days if no one has more comments, documentation
remarks are especially appreciated.
-- 
FFmpeg = Free Forgiving Mysterious Portable Efficient Guru
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-lavfi-add-life-source.patch
Type: text/x-diff
Size: 20370 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20111204/9636880a/attachment.bin>


More information about the ffmpeg-devel mailing list