[FFmpeg-devel] [PATCH] ffmpeg: make opt_ functions return an int

Stefano Sabatini stefano.sabatini-lala at poste.it
Mon Jun 27 12:03:15 CEST 2011


After the OPT_FUNC2 functions removal, all the opt_ functions need to
have two parameters and return an int.
---
 ffmpeg.c |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index f2716a3..33c4c01 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -4054,7 +4054,7 @@ static int64_t getmaxrss(void)
 #endif
 }
 
-static void parse_matrix_coeffs(uint16_t *dest, const char *str)
+static int parse_matrix_coeffs(uint16_t *dest, const char *str)
 {
     int i;
     const char *p = str;
@@ -4065,22 +4065,23 @@ static void parse_matrix_coeffs(uint16_t *dest, const char *str)
         p = strchr(p, ',');
         if(!p) {
             fprintf(stderr, "Syntax error in matrix \"%s\" at coeff %d\n", str, i);
-            ffmpeg_exit(1);
+            return AVERROR(EINVAL);
         }
         p++;
     }
+    return 0;
 }
 
-static void opt_inter_matrix(const char *opt, const char *arg)
+static int opt_inter_matrix(const char *opt, const char *arg)
 {
     inter_matrix = av_mallocz(sizeof(uint16_t) * 64);
-    parse_matrix_coeffs(inter_matrix, arg);
+    return parse_matrix_coeffs(inter_matrix, arg);
 }
 
-static void opt_intra_matrix(const char *opt, const char *arg)
+static int opt_intra_matrix(const char *opt, const char *arg)
 {
     intra_matrix = av_mallocz(sizeof(uint16_t) * 64);
-    parse_matrix_coeffs(intra_matrix, arg);
+    return parse_matrix_coeffs(intra_matrix, arg);
 }
 
 static void show_usage(void)
@@ -4375,10 +4376,10 @@ static void log_callback_null(void* ptr, int level, const char* fmt, va_list vl)
 {
 }
 
-static void opt_passlogfile(const char *opt, const char *arg)
+static int opt_passlogfile(const char *opt, const char *arg)
 {
     pass_logfilename_prefix = arg;
-    opt_default("passlogfile", arg);
+    return opt_default("passlogfile", arg);
 }
 
 static const OptionDef options[] = {
-- 
1.7.2.5



More information about the ffmpeg-devel mailing list