libx264.c: distinguish between x264 parameter errors.
authorErik Slagter <erik@slagter.name>
Mon, 18 Jul 2011 18:04:15 +0000 (20:04 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 20 Jul 2011 00:20:08 +0000 (02:20 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/libx264.c

index cc5b983..670a780 100644 (file)
@@ -198,14 +198,19 @@ static void check_default_settings(AVCodecContext *avctx)
     }
 }
 
     }
 }
 
-#define OPT_STR(opt, param)                                             \
-    do {                                                                \
-        if (param && x264_param_parse(&x4->params, opt, param) < 0) {   \
-            av_log(avctx, AV_LOG_ERROR,                                 \
-                   "bad value for '%s': '%s'\n", opt, param);           \
-            return -1;                                                  \
-        }                                                               \
-    } while (0);                                                        \
+#define OPT_STR(opt, param)                                                   \
+    do {                                                                      \
+        int ret;                                                              \
+        if (param && (ret = x264_param_parse(&x4->params, opt, param)) < 0) { \
+            if(ret == X264_PARAM_BAD_NAME)                                    \
+                av_log(avctx, AV_LOG_ERROR,                                   \
+                        "bad option '%s': '%s'\n", opt, param);               \
+            else                                                              \
+                av_log(avctx, AV_LOG_ERROR,                                   \
+                        "bad value for '%s': '%s'\n", opt, param);            \
+            return -1;                                                        \
+        }                                                                     \
+    } while (0);
 
 static av_cold int X264_init(AVCodecContext *avctx)
 {
 
 static av_cold int X264_init(AVCodecContext *avctx)
 {