[FFmpeg-cvslog] r18726 - trunk/libavfilter/graphparser.c

Michael Niedermayer michaelni
Fri May 8 17:12:26 CEST 2009


On Fri, May 08, 2009 at 11:24:12AM +0200, Vitor Sessak wrote:
> Michael Niedermayer wrote:
>> On Fri, May 08, 2009 at 01:38:02AM +0200, Vitor Sessak wrote:
>>> stefano wrote:
>>>> Author: stefano
>>>> Date: Fri May  1 20:17:59 2009
>>>> New Revision: 18726
>>>> Log:
>>>> Make graphparser.c use av_get_token().
>>>> This also avoids the need for '\=' escaping.
>>>> Modified:
>>>>    trunk/libavfilter/graphparser.c
>>>> Modified: trunk/libavfilter/graphparser.c
>>>> ==============================================================================
>>>> --- trunk/libavfilter/graphparser.c	Fri May  1 16:38:07 2009	(r18725)
>>>> +++ trunk/libavfilter/graphparser.c	Fri May  1 20:17:59 2009	(r18726)
>>>> @@ -26,6 +26,7 @@
>>>>  #include "graphparser.h"
>>>>  #include "avfilter.h"
>>>>  #include "avfiltergraph.h"
>>>> +#include "parseutils.h"
>>>>   #define WHITESPACES " \n\t"
>>>>  @@ -44,49 +45,6 @@ static int link_filter(AVFilterContext *
>>>>  }
>>>>   /**
>>>> - * Consumes a string from *buf.
>>>> - * @return a copy of the consumed string, which should be free'd after 
>>>> use
>>>> - */
>>>> -static char *consume_string(const char **buf)
>>>> -{
>>>> -    char *out = av_malloc(strlen(*buf) + 1);
>>>> -    char *ret = out;
>>>> -
>>>> -    *buf += strspn(*buf, WHITESPACES);
>>>> -
>>>> -    do{
>>>> -        char c = *(*buf)++;
>>>> -        switch (c) {
>>>> -        case '\\':
>>>> -            *out++ = *(*buf)++;
>>>> -            break;
>>>> -        case '\'':
>>>> -            while(**buf && **buf != '\'')
>>>> -                *out++ = *(*buf)++;
>>>> -            if(**buf) (*buf)++;
>>>> -            break;
>>>> -        case 0:
>>>> -        case ']':
>>>> -        case '[':
>>>> -        case '=':
>>>> -        case ',':
>>>> -        case ';':
>>>> -        case ' ':
>>>> -        case '\n':
>>>> -            *out++ = 0;
>>>> -            break;
>>>> -        default:
>>>> -            *out++ = c;
>>>> -        }
>>>> -    } while(out[-1]);
>>>> -
>>>> -    (*buf)--;
>>>> -    *buf += strspn(*buf, WHITESPACES);
>>>> -
>>>> -    return ret;
>>>> -}
>>>> -
>>>> -/**
>>>>   * Parse "[linkname]"
>>>>   * @param name a pointer (that need to be free'd after use) to the name 
>>>> between
>>>>   *        parenthesis
>>>> @@ -97,7 +55,7 @@ static char *parse_link_name(const char      char 
>>>> *name;
>>>>      (*buf)++;
>>>>  -    name = consume_string(buf);
>>>> +    name = av_get_token(buf, "]");
>>>>       if(!name[0]) {
>>>>          av_log(log_ctx, AV_LOG_ERROR,
>>>> @@ -162,12 +120,12 @@ static AVFilterContext *parse_filter(con
>>>>                                       int index, AVClass *log_ctx)
>>>>  {
>>>>      char *opts = NULL;
>>>> -    char *name = consume_string(buf);
>>>> +    char *name = av_get_token(buf, "=,");
>>> This caused a regression with the example
>>>
>>> ./ffmpeg -i in.avi -s 240x320 -vfilters "[in]split [T1], fifo, 
>>> [T2]overlay='0:240'[out]; [T1]fifo, crop=0:0:-1:240, vflip[T2]" out.avi
>>>
>>> In particular to parse "[in]split [T1]". Fix attached.
>>>
>>> -Vitor
>>>  graphparser.c |    2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>> 5d2de7c848bf785e3d66c1dbae01871371f8105d  gparser.diff
>>> Index: libavfilter/graphparser.c
>>> ===================================================================
>>> --- libavfilter/graphparser.c	(revision 18769)
>>> +++ libavfilter/graphparser.c	(working copy)
>>> @@ -120,7 +120,7 @@
>>>                                       int index, AVClass *log_ctx)
>>>  {
>>>      char *opts = NULL;
>>> -    char *name = av_get_token(buf, "=,");
>>> +    char *name = av_get_token(buf, "=,[]");
>> does it really need ] too?
>
> Not really. But "name]" do not seems a reasonable filter name to me 
> anyway...

please remove it from the list of terminating chars if it is not a
terminating char

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

Good people do not need laws to tell them to act responsibly, while bad
people will find a way around the laws. -- Plato
-------------- 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-cvslog/attachments/20090508/dbd3eaf6/attachment.pgp>



More information about the ffmpeg-cvslog mailing list