summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-01-02 03:06:06 +0100
committerDiogo Franco (Kovensky) <diogomfranco@gmail.com>2015-01-25 17:00:16 +0900
commitc9c9919b2dfedcd3cc7184326a6539440b0d6e85 (patch)
treedf7fbd4945ef5521ee805f2f137cf18feb32a5f8
parentb1c76e6a599008d62796027af91d65f18fde19ef (diff)
downloadmpv-c9c9919b2dfedcd3cc7184326a6539440b0d6e85.tar.bz2
mpv-c9c9919b2dfedcd3cc7184326a6539440b0d6e85.tar.xz
player: print config.h contents in verbose mode
It was requested that mpv should print what features etc. have been enabled at compile time. It can print the configure command line, but it obviously doesn't include autodetected features. I tried to think of a nicer way than dumping the config.h as text, but this was still the simplest way. Conflicts: player/main.c
-rw-r--r--player/main.c20
-rw-r--r--waftools/generators/headers.py5
2 files changed, 19 insertions, 6 deletions
diff --git a/player/main.c b/player/main.c
index 690cda744f..e9820b2afe 100644
--- a/player/main.c
+++ b/player/main.c
@@ -84,6 +84,10 @@
static bool terminal_initialized;
+#ifndef FULLCONFIG
+#define FULLCONFIG "(missing)\n"
+#endif
+
enum exit_reason {
EXIT_NONE,
EXIT_NORMAL,
@@ -112,6 +116,11 @@ void mp_print_version(struct mp_log *log, int always)
mpv_version, mpv_builddate);
print_libav_versions(log, v);
mp_msg(log, v, "\n");
+ // Only in verbose mode.
+ if (!always) {
+ mp_msg(log, MSGL_V, "Configuration: " CONFIGURATION "\n");
+ mp_msg(log, MSGL_V, "config.h:\n%s\n", FULLCONFIG);
+ }
}
static void shutdown_clients(struct MPContext *mpctx)
@@ -489,6 +498,11 @@ int mpv_main(int argc, char *argv[])
mp_msg_update_msglevels(mpctx->global);
+ MP_VERBOSE(mpctx, "Command line:");
+ for (int i = 0; i < argc; i++)
+ MP_VERBOSE(mpctx, " '%s'", argv[i]);
+ MP_VERBOSE(mpctx, "\n");
+
mp_print_version(mpctx->log, false);
mp_parse_cfgfiles(mpctx);
@@ -508,12 +522,6 @@ int mpv_main(int argc, char *argv[])
if (handle_help_options(mpctx))
exit_player(mpctx, EXIT_NONE);
- MP_VERBOSE(mpctx, "Configuration: " CONFIGURATION "\n");
- MP_VERBOSE(mpctx, "Command line:");
- for (int i = 0; i < argc; i++)
- MP_VERBOSE(mpctx, " '%s'", argv[i]);
- MP_VERBOSE(mpctx, "\n");
-
if (!mpctx->playlist->first && !opts->player_idle_mode) {
mp_print_version(mpctx->log, true);
MP_INFO(mpctx, "%s", mp_help_text);
diff --git a/waftools/generators/headers.py b/waftools/generators/headers.py
index 79bd71d0f0..30a4e365e4 100644
--- a/waftools/generators/headers.py
+++ b/waftools/generators/headers.py
@@ -35,10 +35,15 @@ def __write_version_h__(ctx):
__cp_to_variant__(ctx, ctx.options.variant, 'version.h')
ctx.end_msg("version.h", "PINK")
+# Approximately escape the string as C string literal
+def __escape_c_string(s):
+ return s.replace("\"", "\\\"").replace("\n", "\\n")
+
def __add_mplayer_defines__(ctx):
from sys import argv
ctx.define("CONFIGURATION", " ".join(argv))
ctx.define("MPLAYER_CONFDIR", ctx.env.CONFDIR)
+ ctx.define("FULLCONFIG", "\\n" + __escape_c_string(ctx.get_config_header()) + "\\n")
def configure(ctx):
__add_mplayer_defines__(ctx)