From e6bea0ec5a5acfed719dfbd89a812a1aa31a9ac5 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 22 Dec 2013 14:33:15 +0100 Subject: Don't include version.h from make options.c I find this annoying. It's the reason common/version.c exists at all. options.c did this for the user agent, which contains the version number. Because not including version.h means you can't build the user agent and use it in mp_default_opts anymore, do something rather awkward in main.c to initialize the default user agent. --- player/main.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'player') diff --git a/player/main.c b/player/main.c index 5183f56ea3..df74d4cb56 100644 --- a/player/main.c +++ b/player/main.c @@ -98,7 +98,8 @@ void mp_print_version(struct mp_log *log, int always) { int v = always ? MSGL_INFO : MSGL_V; mp_msg(log, v, - "%s (C) 2000-2013 mpv/MPlayer/mplayer2 projects\n built on %s\n", mplayer_version, mplayer_builddate); + "%s (C) 2000-2013 mpv/MPlayer/mplayer2 projects\n built on %s\n", + mpv_version, mpv_builddate); print_libav_versions(log, v); mp_msg(log, v, "\n"); } @@ -300,9 +301,13 @@ static int mpv_main(int argc, char *argv[]) mpctx->log = mp_log_new(mpctx, mpctx->global->log, "!cplayer"); mpctx->statusline = mp_log_new(mpctx, mpctx->log, "!statusline"); + struct MPOpts *def_opts = talloc_ptrtype(mpctx, def_opts); + *def_opts = mp_default_opts; + def_opts->network_useragent = (char *)mpv_version; + // Create the config context and register the options mpctx->mconfig = m_config_new(mpctx, mpctx->log, sizeof(struct MPOpts), - &mp_default_opts, mp_opts); + def_opts, mp_opts); mpctx->opts = mpctx->mconfig->optstruct; mpctx->mconfig->includefunc = cfg_include; mpctx->mconfig->includefunc_ctx = mpctx; -- cgit v1.2.3