OSDN Git Service

ffserver: deprecate inconsistent parsing behavior of Truncate option
authorStefano Sabatini <stefasab@gmail.com>
Thu, 28 Nov 2013 21:47:39 +0000 (22:47 +0100)
committerStefano Sabatini <stefasab@gmail.com>
Fri, 29 Nov 2013 09:28:03 +0000 (10:28 +0100)
Also make it accept the more consistent behavior (boolean option set to
true when specified).

ffserver.c

index a900b94..6ce09c4 100644 (file)
@@ -4232,7 +4232,15 @@ static int parse_ffconfig(const char *filename)
         } else if (!av_strcasecmp(cmd, "Truncate")) {
             if (feed) {
                 get_arg(arg, sizeof(arg), &p);
-                feed->truncate = strtod(arg, NULL);
+                /* assume Truncate is true in case no argument is specified */
+                if (!arg[0]) {
+                    feed->truncate = 1;
+                } else {
+                    av_log(NULL, AV_LOG_WARNING,
+                           "Truncate N syntax in configuration file is deprecated, "
+                           "use Truncate alone with no arguments\n");
+                    feed->truncate = strtod(arg, NULL);
+                }
             }
         } else if (!av_strcasecmp(cmd, "FileMaxSize")) {
             if (feed) {