]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/commitdiff
Implement common show version and banner.
authorbenoit <benoit@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Thu, 27 Sep 2007 06:38:40 +0000 (06:38 +0000)
committerbenoit <benoit@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Thu, 27 Sep 2007 06:38:40 +0000 (06:38 +0000)
Patch by Stefano Sabatini [stefano sabatini-lala poste it]

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@10600 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

cmdutils.c
cmdutils.h
ffmpeg.c
ffserver.c

index 6726c3642be184a9a43128eda9c52a358d4f8c78..2228a7e050b82beba05adabd44499181db266ec0 100644 (file)
@@ -26,6 +26,7 @@
 #include "avformat.h"
 #include "cmdutils.h"
 #include "avstring.h"
+#include "version.h"
 
 #undef exit
 
@@ -152,6 +153,31 @@ void print_error(const char *filename, int err)
     }
 }
 
+void show_banner(const char *program_name, int program_birth_year)
+{
+    fprintf(stderr, "%s version " FFMPEG_VERSION ", Copyright (c) %d-2007 Fabrice Bellard, et al.\n",
+            program_name, program_birth_year);
+    fprintf(stderr, "  configuration: " FFMPEG_CONFIGURATION "\n");
+    fprintf(stderr, "  libavutil version: " AV_STRINGIFY(LIBAVUTIL_VERSION) "\n");
+    fprintf(stderr, "  libavcodec version: " AV_STRINGIFY(LIBAVCODEC_VERSION) "\n");
+    fprintf(stderr, "  libavformat version: " AV_STRINGIFY(LIBAVFORMAT_VERSION) "\n");
+    fprintf(stderr, "  built on " __DATE__ " " __TIME__);
+#ifdef __GNUC__
+    fprintf(stderr, ", gcc: " __VERSION__ "\n");
+#else
+    fprintf(stderr, ", using a non-gcc compiler\n");
+#endif
+}
+
+void show_version(const char *program_name) {
+     /* TODO: add function interface to avutil and avformat */
+    printf("%s " FFMPEG_VERSION "\n", program_name);
+    printf("libavutil   %d\n"
+           "libavcodec  %d\n"
+           "libavformat %d\n",
+           LIBAVUTIL_BUILD, avcodec_build(), LIBAVFORMAT_BUILD);
+}
+
 void show_license(void)
 {
 #ifdef CONFIG_GPL
index e44b6b5bd18ea1f43d20127b042d588092ba27f3..36734efd5e4d44385bb6260a254a4a34520c8b9d 100644 (file)
@@ -64,6 +64,23 @@ void parse_options(int argc, char **argv, const OptionDef *options,
 
 void print_error(const char *filename, int err);
 
+/**
+ * Prints the banner of the program on stderr. The banner message
+ * depends on the current versions of the repository and of the libav*
+ * libraries.
+ * @param program_name Name of the program.
+ * @param program_birth_year Year of birth of the program.
+ */
+void show_banner(const char *program_name, int program_birth_year);
+
+/**
+ * Prints the version of the program on stdout. The version message
+ * depends on the current versions of the repository and of the libav*
+ * libraries.
+ * @param program_name Name of the program.
+ */
+void show_version(const char *program_name);
+
 /**
  * Prints on stdout the license of the program, which depends on the license of
  * the compiled libav* libraries.
index 0687780610785405d9c12379c38c4db73eb9a689..62d3be73d66ee0d216aa52f6310388bd69d89cc9 100644 (file)
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -63,6 +63,9 @@
 
 #undef exit
 
+static const char program_name[] = "FFmpeg";
+static const int program_birth_year = 2000;
+
 /* select an input stream for an output stream */
 typedef struct AVStreamMap {
     int file_index;
@@ -3564,12 +3567,7 @@ static void opt_audio_bsf(const char *arg)
 
 static void opt_show_version(void)
 {
-    /* TODO: add function interface to avutil and avformat */
-    fprintf(stderr, "ffmpeg      " FFMPEG_VERSION "\n"
-           "libavutil   %d\n"
-           "libavcodec  %d\n"
-           "libavformat %d\n",
-           LIBAVUTIL_BUILD, avcodec_build(), LIBAVFORMAT_BUILD);
+    show_version(program_name);
     exit(0);
 }
 
@@ -3736,21 +3734,6 @@ const OptionDef options[] = {
     { NULL, },
 };
 
-static void show_banner(void)
-{
-    fprintf(stderr, "FFmpeg version " FFMPEG_VERSION ", Copyright (c) 2000-2007 Fabrice Bellard, et al.\n");
-    fprintf(stderr, "  configuration: " FFMPEG_CONFIGURATION "\n");
-    fprintf(stderr, "  libavutil version: " AV_STRINGIFY(LIBAVUTIL_VERSION) "\n");
-    fprintf(stderr, "  libavcodec version: " AV_STRINGIFY(LIBAVCODEC_VERSION) "\n");
-    fprintf(stderr, "  libavformat version: " AV_STRINGIFY(LIBAVFORMAT_VERSION) "\n");
-    fprintf(stderr, "  built on " __DATE__ " " __TIME__);
-#ifdef __GNUC__
-    fprintf(stderr, ", gcc: " __VERSION__ "\n");
-#else
-    fprintf(stderr, ", using a non-gcc compiler\n");
-#endif
-}
-
 static void opt_show_license(void)
 {
     show_license();
@@ -3866,7 +3849,7 @@ int main(int argc, char **argv)
     avformat_opts = av_alloc_format_context();
     sws_opts = sws_getContext(16,16,0, 16,16,0, sws_flags, NULL,NULL,NULL);
 
-    show_banner();
+    show_banner(program_name, program_birth_year);
     if (argc <= 1) {
         show_help();
         exit(1);
index 90bc9089730ed418a5994ff6c73988ecdcf0a3a1..ef960787663d1efd0d5889ead95e496ceaf5ba1d 100644 (file)
@@ -53,6 +53,9 @@
 
 #undef exit
 
+static const char program_name[] = "FFserver";
+static const int program_birth_year = 2000;
+
 /* maximum number of simultaneous HTTP connections */
 #define HTTP_MAX_CONNECTIONS 2000
 
@@ -4313,14 +4316,9 @@ static int parse_ffconfig(const char *filename)
         return 0;
 }
 
-static void show_banner(void)
-{
-    printf("ffserver version " FFMPEG_VERSION ", Copyright (c) 2000-2006 Fabrice Bellard, et al.\n");
-}
-
 static void show_help(void)
 {
-    show_banner();
+    show_banner(program_name, program_birth_year);
     printf("usage: ffserver [-L] [-h] [-f configfile]\n"
            "Hyper fast multi format Audio/Video streaming server\n"
            "\n"
@@ -4375,7 +4373,7 @@ int main(int argc, char **argv)
             break;
         switch(c) {
         case 'L':
-            show_banner();
+            show_banner(program_name, program_birth_year);
             show_license();
             exit(0);
         case '?':