Index: /dsfilters/demux_mpc/src/bits.h
===================================================================
--- /dsfilters/demux_mpc/src/bits.h	(revision 377)
+++ /dsfilters/demux_mpc/src/bits.h	(revision 378)
@@ -105,3 +105,15 @@
 	inline void NeedBits24() { while (bits<24) { bitbuf |= (buf[0] << (24-bits)); buf++; bits+= 8; } };
 	inline void NeedBits32() { while (bits<32) { bitbuf |= (buf[0] << (24-bits)); buf++; bits+= 8; } };
+
+	// Musepack SV7 32-bit words
+	inline void NeedBits32_MPC() 
+	{
+		NeedBits32();
+		uint8	tmp[4];
+		tmp[0] = (bitbuf>> 0) & 0xff;
+		tmp[1] = (bitbuf>> 8) & 0xff; 
+		tmp[2] = (bitbuf>>16) & 0xff; 
+		tmp[3] = (bitbuf>>24) & 0xff; 
+		bitbuf = (tmp[0] << 24) | (tmp[1] << 16) | (tmp[2] << 8) | (tmp[3]);
+	}
 };
Index: /dsfilters/demux_mpc/src/mpc_file.cpp
===================================================================
--- /dsfilters/demux_mpc/src/mpc_file.cpp	(revision 377)
+++ /dsfilters/demux_mpc/src/mpc_file.cpp	(revision 378)
@@ -33,22 +33,8 @@
 }
 
-// I/O for MPC file
-int CMPCFile::Open(CMPCReader *reader)
-{
-	HRESULT		hr;
+int CMPCFile::Open_SV8()
+{
+	bool		done;
 	int			ret;
-	bool		done;
-
-	// keep a local copy of the reader
-	this->reader = reader;
-
-	// According to stream specification the first 4 bytes should be 'MPCK'
-	uint32	magick;
-	reader->Seek(0);
-	ret = reader->GetMagick(magick);			if (ret < 0) return ret;
-	if (magick != 0x4d50434b) {
-		// not a Musepack file
-		return -1;
-	}
 
 	// means no seek table
@@ -121,4 +107,128 @@
 }
 
+int CMPCFile::Open_SV7()
+{
+	int		ret;
+	bool	done;
+
+	// means no seek table
+	seek_table_position = 0;
+	seek_table_size = 0;
+
+	done = false;
+
+	// init extradata
+	extradata[0] = 'M';
+	extradata[1] = 'P';
+	extradata[2] = '+';
+	extradata[3] = stream_version;
+	extradata_size = 4;
+
+	uint8		hdr[8*4];
+	ret = reader->Read(extradata + 4, 6*4);
+	if (ret < 0) return -1;			// not enough data
+	memcpy(hdr, extradata+4, 5*4);
+	extradata_size += 6*4;
+	Bitstream	b(hdr);
+
+	b.NeedBits32_MPC();
+	audio_block_frames = (b.UGetBits(16)<<16) | b.UGetBits(16);
+
+	b.NeedBits32_MPC();
+	b.UGetBits(1);				// intensity stereo, should be 0
+	b.UGetBits(1);				// mid-side
+	b.UGetBits(6);				// max-band
+	b.UGetBits(4);				// profile
+	b.UGetBits(2);				// link
+	int samplerateidx = b.UGetBits(2);			// samplerate
+
+	switch (samplerateidx) {
+	case 0x00:	sample_rate = 44100; break;
+	case 0x01:	sample_rate = 48000; break;
+	case 0x02:	sample_rate = 37800; break;
+	case 0x03:	sample_rate = 32000; break;
+	}
+	channels = 2;
+	block_pwr = 0;
+	b.UGetBits(16);				// max-level
+
+	b.NeedBits32_MPC();
+	gain_title_db = b.SGetBits(16) / 100.0;				// title gain
+	gain_title_peak_db = b.UGetBits(16);		// title peak
+
+	b.NeedBits32_MPC();
+	gain_album_db = b.SGetBits(16) / 100.0;				// album gain
+	gain_album_peak_db = b.UGetBits(16);		// album peak
+
+
+
+	b.NeedBits32_MPC();
+	true_gapless = b.UGetBits(1);			// true gapless
+	int last_frame = b.UGetBits(11);		// last-frame samples
+	total_samples = (audio_block_frames * 1152);
+	if (true_gapless) {
+		total_samples -= (1152 - last_frame);
+	} else {
+		total_samples -= 481;		// synth delay
+	}
+	duration_10mhz = (total_samples * 10000000) / sample_rate;
+
+	fast_seeking = b.UGetBits(1);
+	b.UGetBits(16);				// 19 zero bits
+	b.UGetBits(3);
+
+	b.NeedBits32_MPC();
+	int ver = b.UGetBits(8);
+
+	//-------------------------------------------------------------------------
+	// Seek table
+	//-------------------------------------------------------------------------
+	seek_pwr = 6;
+	if (block_pwr > seek_pwr) seek_pwr = block_pwr;	
+
+	// calculate size as seen in mpc_demux.c
+	int64 tmp = 2+total_samples / (1152 << seek_pwr);
+	if (tmp < seek_table_size) tmp = seek_table_size;
+
+	// alloc memory for seek table
+	seek_table = (uint32*)malloc(tmp * sizeof(uint32));
+	if (!seek_table) return -1;
+
+	int64 pos, av;
+	reader->GetPosition(&pos, &av);
+	seek_table[0] = pos*8;		// current position in bits
+	seek_table_size = 1;
+
+	// TODO: loop through file to get complete seeking table
+
+	return 0;
+}
+
+
+// I/O for MPC file
+int CMPCFile::Open(CMPCReader *reader)
+{
+	HRESULT		hr;
+	int			ret;
+
+	// keep a local copy of the reader
+	this->reader = reader;
+
+	// According to stream specification the first 4 bytes should be 'MPCK'
+	uint32	magick;
+	reader->Seek(0);
+	ret = reader->GetMagick(magick);			if (ret < 0) return ret;
+	if (magick == 0x4d50434b) {					// MPCK
+		return Open_SV8();
+	} else
+	if ((magick&0xffffff00) == 0x4d502b00) {		// MP+
+		// stream version... only 7 is supported
+		stream_version = magick & 0x0f;
+		if (stream_version != 7) return -1;
+		return Open_SV7();
+	}
+	return -1;
+}
+
 void CMPCFile::StoreExtraDataPacket(CMPCPacket *packet)
 {
Index: /dsfilters/demux_mpc/src/mpc_file.h
===================================================================
--- /dsfilters/demux_mpc/src/mpc_file.h	(revision 377)
+++ /dsfilters/demux_mpc/src/mpc_file.h	(revision 378)
@@ -59,4 +59,7 @@
 	int				seek_pwr;
 
+	uint8			true_gapless;
+	uint8			fast_seeking;
+
 	// replay gain
 	float			gain_title_db;
@@ -83,4 +86,6 @@
 	int				extradata_size;			// current size of extradata
 	
+	int Open_SV8();
+	int Open_SV7();
 public:
 	CMPCFile();
