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. --- common/common.h | 4 ++-- common/version.c | 4 ++-- options/options.c | 4 +--- player/main.c | 9 +++++++-- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/common/common.h b/common/common.h index 9e751ee851..ae2fb8f2d5 100644 --- a/common/common.h +++ b/common/common.h @@ -59,8 +59,8 @@ enum stream_type { STREAM_TYPE_COUNT, }; -extern const char *mplayer_version; -extern const char *mplayer_builddate; +extern const char *mpv_version; +extern const char *mpv_builddate; char *mp_format_time(double time, bool fractions); char *mp_format_time_fmt(const char *fmt, double time); diff --git a/common/version.c b/common/version.c index 23a0c59bc3..83177a5fc7 100644 --- a/common/version.c +++ b/common/version.c @@ -22,5 +22,5 @@ #define BUILDDATE "UNKNOWN" #endif -const char *mplayer_version = "mpv " VERSION; -const char *mplayer_builddate = BUILDDATE; +const char *mpv_version = "mpv " VERSION; +const char *mpv_builddate = BUILDDATE; diff --git a/options/options.c b/options/options.c index 0604c40b29..84005536b2 100644 --- a/options/options.c +++ b/options/options.c @@ -29,9 +29,9 @@ #include "options.h" #include "config.h" -#include "version.h" #include "m_config.h" #include "m_option.h" +#include "common/common.h" #include "stream/tv.h" #include "stream/stream_radio.h" #include "video/csputils.h" @@ -740,8 +740,6 @@ const struct MPOpts mp_default_opts = { .index_mode = -1, - .network_useragent = "mpv " VERSION, - .ad_lavc_param = { .ac3drc = 1., .downmix = 1, 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