[FFmpeg-devel] [PATCH] [2/??] [3/3] Filter graphs - Parser for a graph description

Michael Niedermayer michaelni
Mon Feb 25 00:46:09 CET 2008


On Sun, Feb 24, 2008 at 09:21:39PM +0100, Vitor Sessak wrote:
> Hi
> 
> Michael Niedermayer wrote:
> > On Sat, Feb 16, 2008 at 12:45:12PM +0100, Vitor Sessak wrote:
> >> See $subj.
> >>
> > 
> >> /*
> >>  * filter graph descriptions
> >>  * copyright (c) 2007 Bobby Bingham
> > [...]
> >> #include <ctype.h>
> >> #include <string.h>
> >>
> >> #include "avfilter.h"
> >> #include "avfiltergraph.h"
> >>
> >> #define LINESIZE    240             ///< maximum length of an input line
> >>
> >> /** a comment is a line which is empty, or starts with whitespace, ';' or '#' */
> >> static inline int is_line_comment(char *line)
> >> {
> >>     return line[0] == 0     ||
> >>            isspace(line[0]) ||
> >>            line[0] == ';'   ||
> >>            line[0] == '#';
> >> }
> > 
> > A filter graph description should at least treat all whitespace outside
> > quotes equal that is '\n' == ' ' == '  '
> > Also it should be terse and it should be useable on the command line, that is
> > avoid characters which needs complicated escaping to pass the shell.
> > 
> > Heres a possible example, this is just a idea after 5min thinking and might
> > not be the best ...
> > [in]scale=400:300,crop=200:100,[+tmp]picInPic=50:50,rotate=1,split[+out],delay=50[tmp]
> > 
> > would result in a filter graph like:
> > 
> > in --> scale --> crop --> picInPic --> rotate --> split --> out
> >                              ^                      |
> >                              |                      |
> >                            delay<-------------------/
> 
> This doesn't looks to would work well with
> 
>   in --> crop --> picInPic --> rotate --> split --> vflip --> out
>                      ^                      |
>                      |                      |
>                    delay<---- hflip --------/
> 
> 
> Maybe something like
> 
> (in)crop=400:300,(tmp1)picInPic=50:50,rotate=1,split(tmp2),vflip(out); 
> (tmp2)hflip,delay(tmp1)

with the system i suggested it would be:
(in)crop=400:300,(+tmp1)picInPic=50:50,rotate=1,split(+tmp2),vflip(out),(tmp2)hflip,delay(tmp1)


> 
> And for
> 
>   in --> crop --> rotate --> vflip --> out
> 
> crop=400:300,rotate=1,vflip,split

yes (in) (out) should be default at the ends


> 
> meaning that when there is no semicolon, the (in) in the beginning and 
> the (out) in the end can be omitted. 

> Also, I don't understand the point 
> of explicitly putting a "+" in new vertexes...

filter1(abc),(def)filter2

filter1->(abc)
(def)->filter2

filter1(+abc),(+def)filter2

filter1->filter2
  |         ^
  v         |
(abc)     (def)

again, this was all just an idea ...
your ';' achives the same, though it adds an additional char to the ones
needing escaping if used in filters. Iam not even sure if we shoud use ',' as
filter seperator ...
'|' would be an alternative but it would need filter chains to be under ""
though that applies to ; () [] as well


other random ideas ...

crop=400:300|[tmp1]picInPic=50:50|rotate=1|split[tmp2]|vflip[out];[tmp2]hflip|delay[tmp1]

crop=400:300 | [tmp1]picInPic=50:50 | rotate=1 | split[tmp2] | vflip[out] ; [tmp2]hflip | delay[tmp1]

crop=400:300 | [tmp1] picInPic=50:50 | rotate=1 | split [tmp2] | vflip [out] ; [tmp2] hflip | delay [tmp1]

crop=400:300 | [tmp1] picInPic=50:50 | rotate=1 | split {hflip | delay[tmp1];} | vflip



> 
> Finally, I prefer parenthesis instead of brackets... What do you think?

Passing eval.c equation like sin(5)*eq(a,b) might get trickier escaping
wise and parsing wise with (), besides this iam fine with () as well, that
is if you provide a solution to passing equations to eval based filters
without requireing each () to be escaped individually.

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080225/fa67e7c7/attachment.pgp>



More information about the ffmpeg-devel mailing list