# HG changeset patch # User diego # Date 1277713574 0 # Node ID 13ca93203358926cf70f7861520394ce062c2756 # Parent 06d3aac894e8b57095525c5f27210db5532b56b3 Factorize MPlayer/MEncoder version string handling. The string now resides in a central object file instead of being duplicated in every file that requires a version string. diff -r 06d3aac894e8 -r 13ca93203358 Makefile --- a/Makefile Sun Jun 27 20:47:26 2010 +0000 +++ b/Makefile Mon Jun 28 08:26:14 2010 +0000 @@ -882,7 +882,7 @@ # Make sure all generated header files are created. codec-cfg.d codec-cfg.o: codecs.conf.h $(DEPS) $(MENCODER_DEPS) $(MPLAYER_DEPS): help_mp.h -$(call ADDSUFFIXES,.d .o,mpcommon vobsub stream/stream_cddb stream/network libmpdemux/muxer_avi gui/win32/gui osdep/mplayer.rc): version.h +$(call ADDSUFFIXES,.d .o,mpcommon osdep/mplayer.rc): version.h gui/%: CFLAGS += -Wno-strict-prototypes diff -r 06d3aac894e8 -r 13ca93203358 gui/win32/gui.c --- a/gui/win32/gui.c Sun Jun 27 20:47:26 2010 +0000 +++ b/gui/win32/gui.c Mon Jun 28 08:26:14 2010 +0000 @@ -29,7 +29,7 @@ #include #include -#include "version.h" +#include "mpcommon.h" #include "mplayer.h" #include "mp_fifo.h" #include "mp_msg.h" @@ -85,12 +85,12 @@ HWND hwnd = NULL; console = 1; AllocConsole(); - SetConsoleTitle(MP_TITLE); + SetConsoleTitle(mplayer_version); /* disable the close button for now */ while (!hwnd) { - hwnd = FindWindow(NULL, MP_TITLE); + hwnd = FindWindow(NULL, mplayer_version); Sleep(100); } DeleteMenu(GetSystemMenu(hwnd, 0), SC_CLOSE, MF_BYCOMMAND); diff -r 06d3aac894e8 -r 13ca93203358 libmpdemux/muxer_avi.c --- a/libmpdemux/muxer_avi.c Sun Jun 27 20:47:26 2010 +0000 +++ b/libmpdemux/muxer_avi.c Mon Jun 28 08:26:14 2010 +0000 @@ -24,8 +24,7 @@ #include #include "config.h" -#include "version.h" - +#include "mpcommon.h" #include "stream/stream.h" #include "demuxer.h" #include "stheader.h" @@ -502,7 +501,7 @@ // ============= INFO =============== // always include software info info[0].id=mmioFOURCC('I','S','F','T'); // Software: -info[0].text="MEncoder " VERSION; +info[0].text=mencoder_version; // include any optional strings i=1; if(info_name!=NULL){ diff -r 06d3aac894e8 -r 13ca93203358 mpcommon.c --- a/mpcommon.c Sun Jun 27 20:47:26 2010 +0000 +++ b/mpcommon.c Mon Jun 28 08:26:14 2010 +0000 @@ -44,6 +44,8 @@ sub_data* subdata = NULL; subtitle* vo_sub_last = NULL; +const char *mencoder_version = "MEncoder VERSION"; +const char *mplayer_version = "MPlayer VERSION"; void print_version(const char* name) { diff -r 06d3aac894e8 -r 13ca93203358 mpcommon.h --- a/mpcommon.h Sun Jun 27 20:47:26 2010 +0000 +++ b/mpcommon.h Mon Jun 28 08:26:14 2010 +0000 @@ -32,6 +32,9 @@ extern float sub_delay; extern float sub_fps; +extern const char *mencoder_version; +extern const char *mplayer_version; + extern const m_option_t noconfig_opts[]; void print_version(const char* name); diff -r 06d3aac894e8 -r 13ca93203358 stream/network.c --- a/stream/network.c Sun Jun 27 20:47:26 2010 +0000 +++ b/stream/network.c Mon Jun 28 08:26:14 2010 +0000 @@ -43,15 +43,13 @@ #include "stream.h" #include "libmpdemux/demuxer.h" #include "m_config.h" - +#include "mpcommon.h" #include "network.h" #include "tcp.h" #include "http.h" #include "cookies.h" #include "url.h" -#include "version.h" - extern int stream_cache_size; /* Variables for the command line option -user, -passwd, -bandwidth, @@ -220,12 +218,10 @@ snprintf(str, 256, "Host: %s", server_url->hostname ); http_set_field( http_hdr, str); if (network_useragent) - { snprintf(str, 256, "User-Agent: %s", network_useragent); - http_set_field(http_hdr, str); - } else - http_set_field( http_hdr, "User-Agent: MPlayer/"VERSION); + snprintf(str, 256, "User-Agent: %s", mplayer_version); + http_set_field(http_hdr, str); if (network_referrer) { char *referrer = NULL; diff -r 06d3aac894e8 -r 13ca93203358 stream/stream_cddb.c --- a/stream/stream_cddb.c Sun Jun 27 20:47:26 2010 +0000 +++ b/stream/stream_cddb.c Mon Jun 28 08:26:14 2010 +0000 @@ -71,7 +71,7 @@ #include "osdep/osdep.h" #include "cdd.h" -#include "version.h" +#include "mpcommon.h" #include "stream.h" #include "network.h" #include "libavutil/common.h" @@ -756,8 +756,8 @@ } user_name = getenv("LOGNAME"); } - sprintf(cddb_data->cddb_hello, "&hello=%s+%s+%s+%s", - user_name, host_name, "MPlayer", VERSION); + sprintf(cddb_data->cddb_hello, "&hello=%s+%s+%s", + user_name, host_name, mplayer_version); } static int cddb_retrieve(cddb_data_t *cddb_data) diff -r 06d3aac894e8 -r 13ca93203358 vobsub.c --- a/vobsub.c Sun Jun 27 20:47:26 2010 +0000 +++ b/vobsub.c Mon Jun 28 08:26:14 2010 +0000 @@ -32,8 +32,7 @@ #include #include "config.h" -#include "version.h" - +#include "mpcommon.h" #include "vobsub.h" #include "spudec.h" #include "mp_msg.h" @@ -1254,12 +1253,12 @@ fprintf(me->fidx, "# VobSub index file, v7 (do not modify this line!)\n" "#\n" - "# Generated by MPlayer " VERSION "\n" + "# Generated by %s\n" "# See for more information about MPlayer\n" "# See for more information about Vobsub\n" "#\n" "size: %ux%u\n", - orig_width, orig_height); + mplayer_version, orig_width, orig_height); if (palette) { fputs("palette:", me->fidx); for (i = 0; i < 16; ++i) {