Index: mppenc/branches/r2d/libmpcenc/encode_sv7.c
===================================================================
--- mppenc/branches/r2d/libmpcenc/encode_sv7.c	(revision 80)
+++ mppenc/branches/r2d/libmpcenc/encode_sv7.c	(revision 116)
@@ -80,10 +80,8 @@
 // writes SV8-header
 void
-WriteHeader_SV8 ( mpc_encoder_t*e,
+writeStreamInfo ( mpc_encoder_t*e,
 				  const unsigned int  MaxBand,
                   const unsigned int  MS_on,
                   const unsigned int  SamplesCount,
-                  const unsigned int  StreamVersion,
-				  const unsigned int  PNS_on,
                   const unsigned int  SampleFreq,
 				  const unsigned int  ChannelCount)
@@ -93,5 +91,5 @@
 	int i;
 
-    writeBits ( e, StreamVersion,  8 );    // StreamVersion
+    writeBits ( e, 0x08,  8 );    // StreamVersion
 
 	for( i = 0; i < samplesCountLen; i++) // nb of samples
@@ -109,8 +107,34 @@
 	writeBits ( e, ChannelCount - 1  ,  4 );    // Channels
 	writeBits ( e, MaxBand - 1  ,  5 );    // Bandwidth
-	writeBits ( e, 0            ,  1 );    // former IS-Flag (not supported anymore)
 	writeBits ( e, MS_on        ,  1 );    // MS-Coding Flag
-	writeBits ( e, PNS_on       ,  1 );    // PNS flag
 	writeBits ( e, FRAMES_PER_BLOCK_PWR,  4 );    // frames per block (log2 unit)
+}
+
+// writes encoder signature
+void writeEncoderInfo ( mpc_encoder_t * e,
+						const int profile,
+						const int PNS_on,
+						const int version_major,
+						const int version_minor,
+						const int version_implement,
+						const int version_build )
+{
+	writeBits ( e, profile,  4 );
+	writeBits ( e, PNS_on,  1 );
+	writeBits ( e, 0,  3 ); // unused
+	writeBits ( e, version_major,  4 );
+	writeBits ( e, version_minor,  8 );
+	writeBits ( e, version_implement,  4 );
+	writeBits ( e, version_build,  8 );
+}
+
+// writes replay gain info
+void writeGainInfo ( mpc_encoder_t * e )
+{
+	writeBits ( e, 1,  8 ); // version
+	writeBits ( e, 0,  16 ); // Title gain
+	writeBits ( e, 0,  16 ); // Title peak
+	writeBits ( e, 0,  16 ); // Album gain
+	writeBits ( e, 0,  16 ); // Album peak
 }
 
Index: mppenc/branches/r2d/libmpcenc/libmpcenc.h
===================================================================
--- mppenc/branches/r2d/libmpcenc/libmpcenc.h	(revision 80)
+++ mppenc/branches/r2d/libmpcenc/libmpcenc.h	(revision 116)
@@ -25,9 +25,4 @@
 #ifndef NULL
 #define NULL 0
-#endif
-
-// FIXME : remove MPPENC_VERSION from here
-#ifndef MPPENC_VERSION
-# define MPPENC_VERSION   "1.15w-6"
 #endif
 
Index: mppenc/branches/r2d/src/config.h
===================================================================
--- mppenc/branches/r2d/src/config.h	(revision 80)
+++ mppenc/branches/r2d/src/config.h	(revision 116)
@@ -45,9 +45,8 @@
 #define MPPDEC_BUILD  "--Alpha--"
 
-#ifndef MPPENC_VERSION
-# define MPPENC_VERSION   "1.15w-6"
-#endif
-
-#define MPPENC_BUILD  "--Alpha--"
+#define MPPENC_MAJOR 1
+#define MPPENC_MINOR 17
+#define MPPENC_IMPLEMENT 0
+#define MPPENC_BUILD 0
 
 /* end of config.h */
Index: mppenc/branches/r2d/src/mppenc.c
===================================================================
--- mppenc/branches/r2d/src/mppenc.c	(revision 80)
+++ mppenc/branches/r2d/src/mppenc.c	(revision 116)
@@ -59,5 +59,15 @@
 Bool_t        FrontendPresent = 0;      // Flag for frontend-detection
 Bool_t        XLevel          = 1;      // Encode extreme levels with relative SCFs
-const char    About []        = "MPC Encoder  " MPPENC_VERSION "  " MPPENC_BUILD "   (C) 1999-2005 Buschmann/Klemm/Piecha/MDT";
+
+#if MPPENC_MINOR % 2 == 0
+#define _cat(a,b,c,d) #a"."#b"."#c"."#d" --stable--"
+#else
+#define _cat(a,b,c,d) #a"."#b"."#c"."#d" --unstable--"
+#endif
+
+#define cat(a,b,c,d) _cat(a,b,c,d)
+#define MPPENC_VERSION cat(MPPENC_MAJOR,MPPENC_MINOR,MPPENC_IMPLEMENT,MPPENC_BUILD)
+
+const char    About []        = "MPC Encoder " MPPENC_VERSION " (C) 1999-2005 Buschmann/Klemm/Piecha/MDT";
 
 
@@ -1623,9 +1633,12 @@
 //     e.BufferedBits     = 0;
 	writeMagic(&e);
-	WriteHeader_SV8 ( &e, m.Max_Band, m.MS_Channelmode > 0, SamplesInWAVE,
-					   0x08, m.PNS > 0, m.SampleFreq,
-					   Wave.Channels > 2 ? 2 : Wave.Channels);
+	writeStreamInfo ( &e, m.Max_Band, m.MS_Channelmode > 0, SamplesInWAVE,
+					   m.SampleFreq, Wave.Channels > 2 ? 2 : Wave.Channels);
 	writeBlock(&e, "SI", TRUE);
-
+	writeGainInfo(&e);
+	writeBlock(&e, "RG", FALSE);
+	writeEncoderInfo(&e, m.MainQual, m.PNS > 0, MPPENC_MAJOR, MPPENC_MINOR,
+					  MPPENC_IMPLEMENT, MPPENC_BUILD);
+	writeBlock(&e, "EI", FALSE);
 
     // initialize timer
@@ -1731,4 +1744,5 @@
     // write the last incomplete block
 	writeBlock(&e, "AD", FALSE);
+	writeBlock(&e, "SE", FALSE); // write end of stream block
     ShowProgress (&m, SamplesInWAVE, SamplesInWAVE, e.outputBits );
 
@@ -1769,5 +1783,5 @@
         FrontendPresent = SearchForFrontend (); // search for presence of Windows Frontend
         if ( FrontendPresent )
-            SendStartupMessage ( MPPENC_VERSION, 7, MPPENC_BUILD );
+            SendStartupMessage ( MPPENC_VERSION, 8);
     }
 
Index: mppenc/branches/r2d/src/mppenc.h
===================================================================
--- mppenc/branches/r2d/src/mppenc.h	(revision 80)
+++ mppenc/branches/r2d/src/mppenc.h	(revision 116)
@@ -106,11 +106,18 @@
 // FIXME : put in lib header
 void         Init_SV8             ( mpc_encoder_t* );
-void WriteHeader_SV8 ( mpc_encoder_t*e, const unsigned int  MaxBand,
+void writeStreamInfo ( mpc_encoder_t*e,
+					   const unsigned int  MaxBand,
 					   const unsigned int  MS_on,
 					   const unsigned int  SamplesCount,
-					   const unsigned int  StreamVersion,
-					   const unsigned int  PNS_on,
 					   const unsigned int  SampleFreq,
 					   const unsigned int  ChannelCount);
+void writeEncoderInfo ( mpc_encoder_t * e,
+						const int profile,
+						const int PNS_on,
+						const int version_major,
+						const int version_minor,
+						const int version_implement,
+						const int version_build );
+void writeGainInfo ( mpc_encoder_t * e );
 void writeBlock ( mpc_encoder_t * e, const char * key, const mpc_bool_t addCRC);
 void writeMagic(mpc_encoder_t * e);
@@ -152,5 +159,5 @@
 void   SendQuitMessage     ( void );
 void   SendModeMessage     ( const int );
-void   SendStartupMessage  ( const char*, const int, const char* );
+void   SendStartupMessage  ( const char*, const int);
 void   SendProgressMessage ( const int, const float, const float );
 #else
@@ -160,5 +167,5 @@
 # define SendQuitMessage()              (void)0
 # define SendModeMessage(x)             (void)0
-# define SendStartupMessage(x,y,s)      (void)0
+# define SendStartupMessage(x,y)        (void)0
 # define SendProgressMessage(x,y,z)     (void)0
 #endif /* _WIN32 */
Index: mppenc/branches/r2d/src/winmsg.c
===================================================================
--- mppenc/branches/r2d/src/winmsg.c	(revision 80)
+++ mppenc/branches/r2d/src/winmsg.c	(revision 116)
@@ -51,10 +51,9 @@
 void
 SendStartupMessage ( const char*  Version,
-                     const int    SV,
-                     const char*  Build )
+                     const int    SV)
 {
     char  startup [120];
 
-    sprintf ( startup, "#START#MP+ v%s SV%i %s#", Version, SV, Build );   // fill startup-message
+    sprintf ( startup, "#START#MP+ v%s SV%i", Version, SV);   // fill startup-message
     SendMsg ( startup );
 }
