[FFmpeg-cvslog] r19209 - in trunk: cmdutils.c cmdutils.h ffmpeg.c

stefano subversion
Wed Jun 17 01:09:03 CEST 2009


Author: stefano
Date: Wed Jun 17 01:09:03 2009
New Revision: 19209

Log:
Move opt_loglevel() from ffmpeg.c to cmdutils.c.

Modified:
   trunk/cmdutils.c
   trunk/cmdutils.h
   trunk/ffmpeg.c

Modified: trunk/cmdutils.c
==============================================================================
--- trunk/cmdutils.c	Wed Jun 17 01:02:53 2009	(r19208)
+++ trunk/cmdutils.c	Wed Jun 17 01:09:03 2009	(r19209)
@@ -213,6 +213,41 @@ int opt_default(const char *opt, const c
     return 0;
 }
 
+int opt_loglevel(const char *opt, const char *arg)
+{
+    const struct { const char *name; int level; } const log_levels[] = {
+        { "quiet"  , AV_LOG_QUIET   },
+        { "panic"  , AV_LOG_PANIC   },
+        { "fatal"  , AV_LOG_FATAL   },
+        { "error"  , AV_LOG_ERROR   },
+        { "warning", AV_LOG_WARNING },
+        { "info"   , AV_LOG_INFO    },
+        { "verbose", AV_LOG_VERBOSE },
+        { "debug"  , AV_LOG_DEBUG   },
+    };
+    char *tail;
+    int level;
+    int i;
+
+    for (i = 0; i < FF_ARRAY_ELEMS(log_levels); i++) {
+        if (!strcmp(log_levels[i].name, arg)) {
+            av_log_set_level(log_levels[i].level);
+            return 0;
+        }
+    }
+
+    level = strtol(arg, &tail, 10);
+    if (*tail) {
+        fprintf(stderr, "Invalid loglevel \"%s\". "
+                        "Possible levels are numbers or:\n", arg);
+        for (i = 0; i < FF_ARRAY_ELEMS(log_levels); i++)
+            fprintf(stderr, "\"%s\"\n", log_levels[i].name);
+        exit(1);
+    }
+    av_log_set_level(level);
+    return 0;
+}
+
 void set_context_opts(void *ctx, void *opts_ctx, int flags)
 {
     int i;

Modified: trunk/cmdutils.h
==============================================================================
--- trunk/cmdutils.h	Wed Jun 17 01:02:53 2009	(r19208)
+++ trunk/cmdutils.h	Wed Jun 17 01:09:03 2009	(r19209)
@@ -51,6 +51,11 @@ extern struct SwsContext *sws_opts;
 int opt_default(const char *opt, const char *arg);
 
 /**
+ * Sets the libav* libraries log level.
+ */
+int opt_loglevel(const char *opt, const char *arg);
+
+/**
  * Parses a string and returns its corresponding value as a double.
  * Exits from the application if the string cannot be correctly
  * parsed or the corresponding value is invalid.

Modified: trunk/ffmpeg.c
==============================================================================
--- trunk/ffmpeg.c	Wed Jun 17 01:02:53 2009	(r19208)
+++ trunk/ffmpeg.c	Wed Jun 17 01:09:03 2009	(r19209)
@@ -2354,41 +2354,6 @@ static int opt_me_threshold(const char *
     return 0;
 }
 
-static int opt_loglevel(const char *opt, const char *arg)
-{
-    const struct { const char *name; int level; } const log_levels[] = {
-        { "quiet"  , AV_LOG_QUIET   },
-        { "panic"  , AV_LOG_PANIC   },
-        { "fatal"  , AV_LOG_FATAL   },
-        { "error"  , AV_LOG_ERROR   },
-        { "warning", AV_LOG_WARNING },
-        { "info"   , AV_LOG_INFO    },
-        { "verbose", AV_LOG_VERBOSE },
-        { "debug"  , AV_LOG_DEBUG   },
-    };
-    char *tail;
-    int level;
-    int i;
-
-    for (i = 0; i < FF_ARRAY_ELEMS(log_levels); i++) {
-        if (!strcmp(log_levels[i].name, arg)) {
-            av_log_set_level(log_levels[i].level);
-            return 0;
-        }
-    }
-
-    level = strtol(arg, &tail, 10);
-    if (*tail) {
-        fprintf(stderr, "Invalid loglevel \"%s\". "
-                        "Possible levels are numbers or:\n", arg);
-        for (i = 0; i < FF_ARRAY_ELEMS(log_levels); i++)
-            fprintf(stderr, "\"%s\"\n", log_levels[i].name);
-        av_exit(1);
-    }
-    av_log_set_level(level);
-    return 0;
-}
-
 static int opt_verbose(const char *opt, const char *arg)
 {
     verbose = parse_number_or_die(opt, arg, OPT_INT64, -10, 10);



More information about the ffmpeg-cvslog mailing list