[FFmpeg-devel] [PATCH] libavcodec/libx264.c: distinguish between x264 parameter errors
Erik Slagter
erik at slagter.name
Wed Jun 29 11:50:41 CEST 2011
On 22-06-11 20:20, Baptiste Coudurier wrote:
> Having a macro avoids this changes and return -1, so please keep the
> macro, remove the switch. It should only be a matter of:
>
> ret = x264_param_parse.
> if (ret == BAD_NAME) else if (ret == BAD_VALUE)
I (still) think it's ugly, but I'll comply.
From 2766cf5fc522fdbd1da925aa0a32bb0c512c72a9 Mon Sep 17 00:00:00 2001
From: Erik Slagter <erik at slagter.name>
Date: Wed, 29 Jun 2011 11:46:09 +0200
Subject: [PATCH] libx264.c: distinguish between x264 parameter errors.
---
libavcodec/libx264.c | 21 +++++++++++++--------
1 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index cc5b983..670a780 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -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)
{
--
1.7.4.4
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5110 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110629/61479721/attachment.p7s>
More information about the ffmpeg-devel
mailing list