[matroska] r869 - trunk/DvdMenuXtractor

[email protected]
Newsgroups gmane.comp.multimedia.matroska.cvs
Message-ID <[email protected]>
Author: robux4
Date: 2004-10-08 00:39:33 +0400 (Fri, 08 Oct 2004)
New Revision: 869

Modified:
   trunk/DvdMenuXtractor/DvdMenuXtractor.cpp
   trunk/DvdMenuXtractor/MPEG2Decoder.cpp
   trunk/DvdMenuXtractor/VobParser.cpp
   trunk/DvdMenuXtractor/VobParser.h
Log:
readded the BMP extraction of stills
prepare for the audio handling

Modified: trunk/DvdMenuXtractor/DvdMenuXtractor.cpp
===================================================================
--- trunk/DvdMenuXtractor/DvdMenuXtractor.cpp	2004-10-07 10:02:37 UTC (rev 868)
+++ trunk/DvdMenuXtractor/DvdMenuXtractor.cpp	2004-10-07 20:39:33 UTC (rev 869)
@@ -627,8 +627,8 @@
 				FilenameBase = FilenameBase.Format("cell_V%03d_C%02d",
 					cle->vobid, cle->cellid);
 				m_txtDemuxLog->AppendText("Converting " + FilenameBase + ".m2v to "+FilenameBase+".bmp ...\n");
-//				BMPWriter->SetFilename(bmpDirectory+FilenameBase+".bmp");
-//				mpeg2decoder->ProcessFile(m2vDirectory+FilenameBase+".m2v");
+				BMPWriter->SetFilename(bmpDirectory+FilenameBase+".bmp");
+				mpeg2decoder->ProcessFile(m2vDirectory+FilenameBase+".m2v");
 				wxYield();
 			}
 			m_gaDemuxProgress->SetValue(i);
@@ -666,8 +666,8 @@
 				FilenameBase = FilenameBase.Format("cell_V%03d_C%02d",
 					cle->vobid, cle->cellid);
 				m_txtDemuxLog->AppendText("Converting " + FilenameBase + ".ac3 to "+FilenameBase+".wav ...\n");
-//				WAVWriter->SetFilename(wavDirectory+FilenameBase+".wav");
-//				a52decoder->ProcessFile(ac3Directory+FilenameBase+".ac3");
+				WAVWriter->SetFilename(wavDirectory+FilenameBase+".wav");
+				a52decoder->ProcessFile(ac3Directory+FilenameBase+".ac3");
 				wxYield();
 			}
 			m_gaDemuxProgress->SetValue(i);
@@ -1219,7 +1219,7 @@
 
     virtual void AfterShow(void)
     {
-		const int NbsStep = 5;
+		const int NbsStep = 4;
 		int Step = 1;
 		wxString StepString = "", StepStringFormat = "Step %d/%d : %s...";
 
@@ -1234,20 +1234,20 @@
         m_lbStep->SetLabel(StepString);
 		m_txtDemuxLog->AppendText(StepString+"\n");		
         m_lbStep->Update();
-//        SplitAndDemux();
+        SplitAndDemux();
 
 		StepString = StepString.Format(StepStringFormat, Step++, NbsStep, "Converting still to bitmap");
         m_lbStep->SetLabel(StepString);
 		m_txtDemuxLog->AppendText(StepString+"\n");		
         m_lbStep->Update();
         ConvertStillToBMP();
-
+/*
 		StepString = StepString.Format(StepStringFormat, Step++, NbsStep, "Converting audio to wav");
         m_lbStep->SetLabel(StepString);
 		m_txtDemuxLog->AppendText(StepString+"\n");		
         m_lbStep->Update();
         ConvertAudioToWAV();
-
+*/
 		StepString = StepString.Format(StepStringFormat, Step++, NbsStep, "Converting button mask to bitmap");
         m_lbStep->SetLabel(StepString);
 		m_txtDemuxLog->AppendText(StepString+"\n");		

Modified: trunk/DvdMenuXtractor/MPEG2Decoder.cpp
===================================================================
--- trunk/DvdMenuXtractor/MPEG2Decoder.cpp	2004-10-07 10:02:37 UTC (rev 868)
+++ trunk/DvdMenuXtractor/MPEG2Decoder.cpp	2004-10-07 20:39:33 UTC (rev 869)
@@ -150,6 +150,7 @@
         switch (state)
         {
             case -1:
+			case STATE_BUFFER:
                 size = fread(buffer, 1, BUFFER_SIZE, inputFile);
                 mpeg2_buffer(m_mpeg2dec, buffer, buffer + size);
                 break;

Modified: trunk/DvdMenuXtractor/VobParser.cpp
===================================================================
--- trunk/DvdMenuXtractor/VobParser.cpp	2004-10-07 10:02:37 UTC (rev 868)
+++ trunk/DvdMenuXtractor/VobParser.cpp	2004-10-07 20:39:33 UTC (rev 869)
@@ -16,6 +16,7 @@
 #define PRIVATE_STREAM1		0x000001BD
 #define PADDING_STREAM		0x000001BE
 #define PRIVATE_STREAM2		0x000001BF
+#define AUDIO_STREAM		0x000001C0
 #define VIDEO_STREAM		0x000001E0
 
 #define SUBSTREAM_PCI       0x00
@@ -146,7 +147,9 @@
 		SkipNBytes(1);
 		
 		DebugLog("%06d) ", m_pktindex);
-		switch(GetNext32Bits())
+		
+		uint32_t _StreamID = GetNext32Bits();
+		switch(_StreamID)
 		{
 		case SYSTEM_HEADER:
 			DebugLog("Navigation pack {\n");
@@ -164,6 +167,12 @@
 			ParseVideoPacket();
 			break;
 			
+		// TODO : MPEG audio
+		case AUDIO_STREAM:
+			DebugLog("Video pack {}\n");
+			ParseAudioPacket();
+			break;
+			
 		case PRIVATE_STREAM1:
 			DebugLog("Private stream 1 pack {\n");
 			inc_lvl();
@@ -172,7 +181,6 @@
 			DebugLog("}\n");
 			break;
 
-		// TODO : MPEG audio
 		default:
 			DebugLog("Unknown pack\n");
 		}
@@ -576,6 +584,20 @@
 	}
 }
 
+void VobParser::ParseAudioPacket()
+{
+	uint16_t length = GetNext16Bits();
+	ParsePESHeaderDataContentFlag();
+	ParsePESHeaderData();
+
+	if(m_demuxer)
+	{	
+		DebugLog("Audio stream not handled\n");
+		m_demuxer->ProcessAudioStream(&m_buff[m_index],
+			length - 3 - pes_header_data_content.PES_header_data_len);
+	}
+}
+
 // ----------------------------------------------------------------------------
 
 void VobParser::ParsePrivateStream1()

Modified: trunk/DvdMenuXtractor/VobParser.h
===================================================================
--- trunk/DvdMenuXtractor/VobParser.h	2004-10-07 10:02:37 UTC (rev 868)
+++ trunk/DvdMenuXtractor/VobParser.h	2004-10-07 20:39:33 UTC (rev 869)
@@ -161,6 +161,7 @@
 	Demuxer() : m_next(NULL) {}
 	virtual ~Demuxer() {}
 	virtual void ProcessVideoStream(uint8_t* buff, uint32_t size) {}
+	virtual void ProcessAudioStream(uint8_t* buff, uint32_t size) {}
 	virtual void ProcessVOBStream(uint8_t* buff, uint32_t size) {}
 	virtual void ProcessAC3Stream(uint8_t* buff, uint32_t size, uint8_t streamID) {}
 	virtual void ProcessSubStream(uint8_t* buff, uint32_t size, uint8_t streamID) {}
@@ -496,6 +497,12 @@
 		m_cid->hasVideo = true;
 	}
 
+	void ProcessAudioStream(uint8_t* buff, uint32_t size)
+	{
+		m_cid->stream_list.AddStream(0x0, AUDIO_STREAM_TYPE);		
+		m_cid->hasAudio = true;
+	}
+
 	void ProcessAC3Stream(uint8_t* buff, uint32_t size, uint8_t streamID)
 	{
 		m_cid->stream_list.AddStream(streamID, AC3_STREAM_TYPE);	
@@ -538,6 +545,7 @@
 	PES_header_data_content pes_header_data_content;
 protected:
 	void ParseNavPacket();
+	void ParseAudioPacket();
 	void ParseVideoPacket();
 	void ParsePrivateStream1();
 	void ParsePrivateStream2();
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.