[MPlayer-cvslog] r31577 - in trunk: Makefile gui/win32/gui.c libmpdemux/muxer_avi.c mpcommon.c mpcommon.h stream/network.c stream/stream_cddb.c vobsub.c

diego subversion at mplayerhq.hu
Mon Jun 28 10:26:15 CEST 2010


Author: diego
Date: Mon Jun 28 10:26:14 2010
New Revision: 31577

Log:
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.

Modified:
   trunk/Makefile
   trunk/gui/win32/gui.c
   trunk/libmpdemux/muxer_avi.c
   trunk/mpcommon.c
   trunk/mpcommon.h
   trunk/stream/network.c
   trunk/stream/stream_cddb.c
   trunk/vobsub.c

Modified: trunk/Makefile
==============================================================================
--- trunk/Makefile	Sun Jun 27 22:47:26 2010	(r31576)
+++ trunk/Makefile	Mon Jun 28 10:26:14 2010	(r31577)
@@ -882,7 +882,7 @@ version.h: version.sh
 # 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
 

Modified: trunk/gui/win32/gui.c
==============================================================================
--- trunk/gui/win32/gui.c	Sun Jun 27 22:47:26 2010	(r31576)
+++ trunk/gui/win32/gui.c	Mon Jun 28 10:26:14 2010	(r31577)
@@ -29,7 +29,7 @@
 #include <windowsx.h>
 #include <shlobj.h>
 
-#include "version.h"
+#include "mpcommon.h"
 #include "mplayer.h"
 #include "mp_fifo.h"
 #include "mp_msg.h"
@@ -85,12 +85,12 @@ void console_toggle(void)
         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);

Modified: trunk/libmpdemux/muxer_avi.c
==============================================================================
--- trunk/libmpdemux/muxer_avi.c	Sun Jun 27 22:47:26 2010	(r31576)
+++ trunk/libmpdemux/muxer_avi.c	Mon Jun 28 10:26:14 2010	(r31577)
@@ -24,8 +24,7 @@
 #include <limits.h>
 
 #include "config.h"
-#include "version.h"
-
+#include "mpcommon.h"
 #include "stream/stream.h"
 #include "demuxer.h"
 #include "stheader.h"
@@ -502,7 +501,7 @@ static void avifile_write_header(muxer_t
 // ============= 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){

Modified: trunk/mpcommon.c
==============================================================================
--- trunk/mpcommon.c	Sun Jun 27 22:47:26 2010	(r31576)
+++ trunk/mpcommon.c	Mon Jun 28 10:26:14 2010	(r31577)
@@ -44,6 +44,8 @@ ass_track_t* ass_track = 0; // current t
 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)
 {

Modified: trunk/mpcommon.h
==============================================================================
--- trunk/mpcommon.h	Sun Jun 27 22:47:26 2010	(r31576)
+++ trunk/mpcommon.h	Mon Jun 28 10:26:14 2010	(r31577)
@@ -32,6 +32,9 @@ extern subtitle *vo_sub_last;
 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);

Modified: trunk/stream/network.c
==============================================================================
--- trunk/stream/network.c	Sun Jun 27 22:47:26 2010	(r31576)
+++ trunk/stream/network.c	Mon Jun 28 10:26:14 2010	(r31577)
@@ -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 @@ http_send_request( URL_t *url, off_t pos
 	    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;

Modified: trunk/stream/stream_cddb.c
==============================================================================
--- trunk/stream/stream_cddb.c	Sun Jun 27 22:47:26 2010	(r31576)
+++ trunk/stream/stream_cddb.c	Mon Jun 28 10:26:14 2010	(r31577)
@@ -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 @@ static void cddb_create_hello(cddb_data_
         }
         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)

Modified: trunk/vobsub.c
==============================================================================
--- trunk/vobsub.c	Sun Jun 27 22:47:26 2010	(r31576)
+++ trunk/vobsub.c	Mon Jun 28 10:26:14 2010	(r31577)
@@ -32,8 +32,7 @@
 #include <sys/types.h>
 
 #include "config.h"
-#include "version.h"
-
+#include "mpcommon.h"
 #include "vobsub.h"
 #include "spudec.h"
 #include "mp_msg.h"
@@ -1254,12 +1253,12 @@ static void create_idx(vobsub_out_t *me,
     fprintf(me->fidx,
             "# VobSub index file, v7 (do not modify this line!)\n"
             "#\n"
-            "# Generated by MPlayer " VERSION "\n"
+            "# Generated by %s\n"
             "# See <URL:http://www.mplayerhq.hu/> for more information about MPlayer\n"
             "# See <URL:http://wiki.multimedia.cx/index.php?title=VOBsub> 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) {


More information about the MPlayer-cvslog mailing list