[FFmpeg-devel] [PATCH] lavfi: complain and exit for invalid named strings in ff_parse_packing_format()

Stefano Sabatini stefano.sabatini-lala at poste.it
Tue Aug 16 02:08:30 CEST 2011


---
 libavfilter/formats.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavfilter/formats.c b/libavfilter/formats.c
index d121b3b..c863be6 100644
--- a/libavfilter/formats.c
+++ b/libavfilter/formats.c
@@ -283,8 +283,11 @@ int ff_parse_packing_format(int *ret, const char *arg, void *log_ctx)
     char *tail;
     int planar = strtol(arg, &tail, 10);
     if (*tail) {
-        planar = (strcmp(arg, "packed") != 0);
-    } else if (planar != 0 && planar != 1) {
+        planar = !strcmp(arg, "packed") ? 0:
+                 !strcmp(arg, "planar") ? 1: -1;
+    }
+
+    if (planar != 0 && planar != 1) {
         av_log(log_ctx, AV_LOG_ERROR, "Invalid packing format '%s'\n", arg);
         return AVERROR(EINVAL);
     }
-- 
1.7.2.5



More information about the ffmpeg-devel mailing list