Browse code

Make show_banner() and show_version() print both the compile-time and the link-time/run-time libav* version numbers.

Originally committed as revision 14737 to svn://svn.ffmpeg.org/ffmpeg/trunk

Stefano Sabatini authored on 2008/08/14 05:08:37
Showing 1 changed files
... ...
@@ -196,18 +196,30 @@ void print_error(const char *filename, int err)
196 196
     }
197 197
 }
198 198
 
199
+#define PRINT_LIB_VERSION(outstream,libname,LIBNAME,indent) \
200
+    version= libname##_version(); \
201
+    fprintf(outstream, "%slib%-10s %2d.%2d.%2d / %2d.%2d.%2d\n", indent? "  " : "", #libname, \
202
+            LIB##LIBNAME##_VERSION_MAJOR, LIB##LIBNAME##_VERSION_MINOR, LIB##LIBNAME##_VERSION_MICRO, \
203
+            version >> 16, version >> 8 & 0xff, version & 0xff);
204
+
205
+void print_all_lib_versions(FILE* outstream, int indent)
206
+{
207
+    unsigned int version;
208
+    PRINT_LIB_VERSION(outstream, avutil, AVUTIL, indent);
209
+    PRINT_LIB_VERSION(outstream, avcodec, AVCODEC, indent);
210
+    PRINT_LIB_VERSION(outstream, avformat, AVFORMAT, indent);
211
+    PRINT_LIB_VERSION(outstream, avdevice, AVDEVICE, indent);
212
+#if ENABLE_AVFILTER
213
+    PRINT_LIB_VERSION(outstream, avfilter, AVFILTER, indent);
214
+#endif
215
+}
216
+
199 217
 void show_banner(void)
200 218
 {
201 219
     fprintf(stderr, "%s version " FFMPEG_VERSION ", Copyright (c) %d-2008 Fabrice Bellard, et al.\n",
202 220
             program_name, program_birth_year);
203 221
     fprintf(stderr, "  configuration: " FFMPEG_CONFIGURATION "\n");
204
-    fprintf(stderr, "  libavutil version: " AV_STRINGIFY(LIBAVUTIL_VERSION) "\n");
205
-    fprintf(stderr, "  libavcodec version: " AV_STRINGIFY(LIBAVCODEC_VERSION) "\n");
206
-    fprintf(stderr, "  libavformat version: " AV_STRINGIFY(LIBAVFORMAT_VERSION) "\n");
207
-    fprintf(stderr, "  libavdevice version: " AV_STRINGIFY(LIBAVDEVICE_VERSION) "\n");
208
-#if ENABLE_AVFILTER
209
-    fprintf(stderr, "  libavfilter version: " AV_STRINGIFY(LIBAVFILTER_VERSION) "\n");
210
-#endif
222
+    print_all_lib_versions(stderr, 1);
211 223
     fprintf(stderr, "  built on " __DATE__ " " __TIME__);
212 224
 #ifdef __GNUC__
213 225
     fprintf(stderr, ", gcc: " __VERSION__ "\n");
... ...
@@ -217,13 +229,8 @@ void show_banner(void)
217 217
 }
218 218
 
219 219
 void show_version(void) {
220
-     /* TODO: add function interface to avutil and avformat avdevice*/
221 220
     printf("%s " FFMPEG_VERSION "\n", program_name);
222
-    printf("libavutil   %d\n"
223
-           "libavcodec  %d\n"
224
-           "libavformat %d\n"
225
-           "libavdevice %d\n",
226
-           LIBAVUTIL_BUILD, avcodec_version(), LIBAVFORMAT_BUILD, LIBAVDEVICE_BUILD);
221
+    print_all_lib_versions(stdout, 0);
227 222
 }
228 223
 
229 224
 void show_license(void)