changeset 9:97e61383cb81 libavformat

* Extend the syntax of a filename for the img reader to allow looping. Thus %125*d means substitute the frame number MOD 125 into the filename. This is a cheap method of having an infinite stream.
author philipjsg
date Wed, 11 Dec 2002 03:20:05 +0000
parents 995bb04e02f1
children 7e1ff5580f27
files utils.c
diffstat 1 files changed, 14 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/utils.c	Wed Dec 11 03:18:47 2002 +0000
+++ b/utils.c	Wed Dec 11 03:20:05 2002 +0000
@@ -1089,11 +1089,20 @@
         if (c == '\0')
             break;
         if (c == '%') {
-            nd = 0;
-            while (*p >= '0' && *p <= '9') {
-                nd = nd * 10 + *p++ - '0';
-            }
-            c = *p++;
+            do {
+                nd = 0;
+                while (isdigit(*p)) {
+                    nd = nd * 10 + *p++ - '0';
+                }
+                c = *p++;
+                if (c == '*' && nd > 0) {
+                    // The nd field is actually the modulus
+                    number = number % nd;
+                    c = *p++;
+                    nd = 0;
+                }
+            } while (isdigit(c));
+
             switch(c) {
             case '%':
                 goto addchar;