[FFmpeg-user] changes to ffmpeg to stop having to put an escape
Julian Gardner
joolzg at gardnersweden.com
Mon Sep 16 23:41:08 EEST 2019
A few weeks ago I had a problem with some eval code and it was pointed
out that i need to escape the ','.
So here is a small patch that needs passing on to the devel guys to have
a look at.
All this does is to ignore the fixed tokens when inside parenthesis, so
this works now
-filter_complex '[0:v] scale=160:90 [out], [v:0][out]
overlay=x=mod(10,2):y=20'
patch is here
diff --git a/libavutil/avstring.c b/libavutil/avstring.c
index 4c068f5..e19db8f 100644
--- a/libavutil/avstring.c
+++ b/libavutil/avstring.c
@@ -150,14 +150,26 @@ char *av_get_token(const char **buf, const char
*term)
{
char *out = av_malloc(strlen(*buf) + 1);
char *ret = out, *end = out;
+ int p_count = 0;
+
const char *p = *buf;
if (!out)
return NULL;
p += strspn(p, WHITESPACES);
- while (*p && !strspn(p, term)) {
+ while (*p && (!strspn(p, term) || p_count)) {
char c = *p++;
- if (c == '\\' && *p) {
+ if (c == ')') {
+ if( p_count) {
+ p_count--;
+ }
+ *out++ = c;
+ }
+ else if (c == '(') {
+ p_count++;
+ *out++ = c;
+ }
+ else if (c == '\\' && *p) {
*out++ = *p++;
end = out;
} else if (c == '\'') {
--
BR
Joolz
More information about the ffmpeg-user
mailing list