[matroska] r960 - trunk/DvdMenuXtractor

[email protected]
Newsgroups gmane.comp.multimedia.matroska.cvs
Message-ID <[email protected]>
Author: robux4
Date: 2004-12-11 19:04:55 +0300 (Sat, 11 Dec 2004)
New Revision: 960

Modified:
   trunk/DvdMenuXtractor/DvdMenuXtractor.cpp
   trunk/DvdMenuXtractor/VobParser.cpp
   trunk/DvdMenuXtractor/VobParser.h
Log:
save each cells contiguously in the output files (works for audio and video)
corresponding timecode files pending...

Modified: trunk/DvdMenuXtractor/DvdMenuXtractor.cpp
===================================================================
--- trunk/DvdMenuXtractor/DvdMenuXtractor.cpp	2004-12-11 11:08:50 UTC (rev 959)
+++ trunk/DvdMenuXtractor/DvdMenuXtractor.cpp	2004-12-11 16:04:55 UTC (rev 960)
@@ -64,13 +64,7 @@
 
 IFOFile* IfoFile = NULL;
 wxLogWindow* wxLogWin;
-wxString m2vDirectory;
-wxString audioDirectory;
-wxString subDirectory;
-wxString btnDirectory;
-wxString bmpDirectory;
-//wxString wavDirectory;
-//wxString maskDirectory;
+wxString outputDirectory;
 const wxString APPLICATION_NAME = "DVDMenu-X-tractor";
 
 // ----------------------------------------------------------------------------
@@ -543,7 +537,8 @@
 
     void SplitAndDemux(VobParser & aVobParser, int16_t title, bool language)
     {
-        wxString newFilename;
+		wxString newFilename;
+		wxString cellName;
 		uint32_t cell = 0;
 		const CellsListType *CellsList = IfoFile->GetCellsList(title, language);
 
@@ -564,6 +559,15 @@
 			IfoFile->VideoSize(title, language, _width, _height);
 			const uint32_t * _palette = IfoFile->GetPalette(title, language);
 
+			if (title == 0)
+				newFilename = "VMG";
+			else
+				newFilename = wxString::Format("VTS%02d%s", title, language?"_L":"");
+
+			demuxer.Reset();
+
+            m_txtDemuxLog->AppendText("Processing " + newFilename + "\n");
+
             while(aVobParser.ParseNextPacket())
             {
 				if(aVobParser.IsNewCell())
@@ -571,13 +575,10 @@
 					m_gaDemuxProgress->SetValue(cell);
                     if(IfoFile->IsACandidateCell(aVobParser.GetVobID(),aVobParser.GetCellID()))
                     {
-						demuxer.Reset();
-                        newFilename = CellName(title, aVobParser.GetVobID(), aVobParser.GetCellID(), language);
+						cellName = CellName(title, aVobParser.GetVobID(), aVobParser.GetCellID(), language);
 
-                        m_txtDemuxLog->AppendText("Processing " + newFilename + "\n");
-
-						Demuxer * _muxer = new VideoDemuxWriter(m2vDirectory+newFilename);
-                        if (!demuxer.AddDemuxer(0xE0, _muxer))
+						Demuxer * _muxer = new VideoDemuxWriter(outputDirectory + newFilename);
+                        if (!demuxer.AddDemuxer(VIDEO_STREAM, _muxer))
 							delete _muxer;
 
 						int _stream;
@@ -599,27 +600,27 @@
 								switch (_audioTracks.Item(_stream)->GetData()->audio_format)
 								{
 								case 0:
-									_muxer = new AC3DemuxWriter(audioDirectory+newFilename+_langName, 0x80 + _ID);
-									if (!demuxer.AddDemuxer(0x80 + _ID, _muxer))
+									_muxer = new AC3DemuxWriter(outputDirectory + newFilename+_langName, 0x80 + _ID);
+									if (!demuxer.AddDemuxer(SUBSTREAM_AC3_LOW + _ID, _muxer))
 										delete _muxer;
 									break;
 
 								case 2:
 								case 3:
-									_muxer = new MPADemuxWriter(audioDirectory+newFilename+_langName, 0xC0 + _ID);
-									if (!demuxer.AddDemuxer(0xC0 + _ID, _muxer))
+									_muxer = new MPADemuxWriter(outputDirectory + newFilename+_langName, 0xC0 + _ID);
+									if (!demuxer.AddDemuxer(AUDIO_STREAM + _ID, _muxer))
 										delete _muxer;
 									break;
 
 								case 4:
-									_muxer = new LPCMDemuxWriter(audioDirectory+newFilename+_langName, 0xA0 + _ID);
-									if (!demuxer.AddDemuxer(0xA0 + _ID, _muxer))
+									_muxer = new LPCMDemuxWriter(outputDirectory + newFilename+_langName, 0xA0 + _ID);
+									if (!demuxer.AddDemuxer(SUBSTREAM_PCM_LOW + _ID, _muxer))
 										delete _muxer;
 									break;
 
 								case 6:
-									_muxer = new DTSDemuxWriter(audioDirectory+newFilename+_langName, 0x88 + _ID);
-									if (!demuxer.AddDemuxer(0x88 + _ID, _muxer))
+									_muxer = new DTSDemuxWriter(outputDirectory + newFilename+_langName, 0x88 + _ID);
+									if (!demuxer.AddDemuxer(SUBSTREAM_DTS_LOW + _ID, _muxer))
 										delete _muxer;
 									break;
 
@@ -645,14 +646,14 @@
 										_langName = wxString::Format("_%d_un", _IDs.Item(_IDidx));
 									else
 										_langName = wxString::Format("_%d_%c%c", _IDs.Item(_IDidx), _attr->lang_code >> 8, _attr->lang_code & 0xFF);
-									_muxer = new SubDemuxWriter(subDirectory+newFilename+_langName, 0x20 + _IDs.Item(_IDidx), _width, _height, _palette, _attr->lang_code, _attr->lang_extension == 9);
-									if (!demuxer.AddDemuxer(0x20 + _IDs.Item(_IDidx), _muxer))
+									_muxer = new SubDemuxWriter(outputDirectory + newFilename+_langName, 0x20 + _IDs.Item(_IDidx), _width, _height, _palette, _attr->lang_code, _attr->lang_extension == 9);
+									if (!demuxer.AddDemuxer(SUBSTREAM_SUB_LOW + _IDs.Item(_IDidx), _muxer))
 										delete _muxer;
 								}
 							}
 							// create a possible button demuxer too
-							_muxer = new BtnDemuxWriter(btnDirectory+newFilename);
-							if (!demuxer.AddDemuxer(0x00, _muxer))
+							_muxer = new BtnDemuxWriter(outputDirectory + newFilename);
+							if (!demuxer.AddDemuxer(SUBSTREAM_PCI, _muxer))
 								delete _muxer;
 						}
                     }
@@ -692,8 +693,8 @@
 			{				
 				FilenameBase = CellName(title, cle->vobid, cle->cellid, language);
 				m_txtDemuxLog->AppendText("Converting " + FilenameBase + ".m2v to "+FilenameBase+".bmp ...\n");
-				BMPWriter->SetFilename(bmpDirectory+FilenameBase+".bmp");
-				mpeg2decoder->ProcessFile(m2vDirectory+FilenameBase+".m2v");
+				BMPWriter->SetFilename(outputDirectory + FilenameBase+".bmp");
+				mpeg2decoder->ProcessFile(outputDirectory + FilenameBase+".m2v");
 				wxYield();
 			}
 			m_gaDemuxProgress->SetValue(i);
@@ -731,7 +732,7 @@
 				FilenameBase = CellName(title, cle->vobid, cle->cellid, language);
 				m_txtDemuxLog->AppendText("Converting " + FilenameBase + ".ac3 to "+FilenameBase+".wav ...\n");
 				WAVWriter->SetFilename(wavDirectory+FilenameBase+".wav");
-				a52decoder->ProcessFile(audioDirectory+FilenameBase+".ac3");
+				a52decoder->ProcessFile(outputDirectory + FilenameBase+".ac3");
 				wxYield();
 			}
 			m_gaDemuxProgress->SetValue(i);
@@ -767,7 +768,7 @@
 			m_txtDemuxLog->AppendText("Converting " + FilenameBase + ".sub to "+FilenameBase+".bmp ...\n");
 			//WAVWriter->SetFilename(wavDirectory+FilenameBase+".wav");
 			
-			subdecoder->ProcessFile(subDirectory+FilenameBase+".sub", maskDirectory+FilenameBase);
+			subdecoder->ProcessFile(outputDirectory + FilenameBase+".sub", maskDirectory+FilenameBase);
 			wxYield();
 			m_gaDemuxProgress->SetValue(i);
 		}
@@ -1275,33 +1276,6 @@
         }
 	}
 
-	void CreatDirectories() 
-	{
-        wxFileConfig *pConfig = (wxFileConfig *)wxConfigBase::Get();
-
-	    // Create m2v directory
-        m2vDirectory = pConfig->Read("OutputDirectory","")+ "m2v" + wxFILE_SEP_PATH;
-        wxMkdir(m2vDirectory);
-        // Create ac3 directory
-        audioDirectory = pConfig->Read("OutputDirectory","")+ "audio" + wxFILE_SEP_PATH;
-        wxMkdir(audioDirectory);
-        // Create sub directory
-        subDirectory = pConfig->Read("OutputDirectory","")+ "sub" + wxFILE_SEP_PATH;
-        wxMkdir(subDirectory);
-        // Create sub directory
-        btnDirectory = pConfig->Read("OutputDirectory","")+ "buttons" + wxFILE_SEP_PATH;
-        wxMkdir(btnDirectory);
-        // Create bmp directory
-        bmpDirectory = pConfig->Read("OutputDirectory","")+ "bmp" + wxFILE_SEP_PATH;
-        wxMkdir(bmpDirectory);
-		// Create wav directory
-//        wavDirectory = pConfig->Read("OutputDirectory","")+ "wav" + wxFILE_SEP_PATH;
-//        wxMkdir(wavDirectory);
-		// Create mask directory
-//		maskDirectory = pConfig->Read("OutputDirectory","") + "mask" + wxFILE_SEP_PATH;
-//        wxMkdir(maskDirectory);
-	}
-
    virtual void AfterShow(void)
    {
 		const int NbsStep = 3;
@@ -1311,7 +1285,7 @@
 
 		m_txtDemuxLog->AppendText("Creating output directories\n");
 
-		CreatDirectories();
+		outputDirectory = wxConfigBase::Get()->Read("OutputDirectory","")+ wxFILE_SEP_PATH;
 
 		bool language = true;
 		for (int16_t title = 0; title <= IfoFile->NumberOfTitles(); title++)
@@ -1345,7 +1319,7 @@
 					m_lbStep->SetLabel(StepString);
 					m_txtDemuxLog->AppendText(StepString+"\n");		
 					m_lbStep->Update();
-					ConvertStillToBMP(title, language);
+// TODO with file output offset					ConvertStillToBMP(title, language);
 /*
 					StepString = StepString.Format(StepStringFormat, Step++, NbsStep, "Converting audio to wav");
 					m_lbStep->SetLabel(StepString);

Modified: trunk/DvdMenuXtractor/VobParser.cpp
===================================================================
--- trunk/DvdMenuXtractor/VobParser.cpp	2004-12-11 11:08:50 UTC (rev 959)
+++ trunk/DvdMenuXtractor/VobParser.cpp	2004-12-11 16:04:55 UTC (rev 960)
@@ -21,24 +21,6 @@
 #define PRIVATE_STREAM1		0xBD
 #define PADDING_STREAM		0xBE
 #define PRIVATE_STREAM2		0xBF
-#define AUDIO_STREAM		0xC0
-#define VIDEO_STREAM		0xE0
-
-#define SUBSTREAM_PCI       0x00
-#define SUBSTREAM_DSI       0x01
-
-#define SUBSTREAM_SUB_LOW		0x20
-#define SUBSTREAM_SUB_HIGH		(SUBSTREAM_SUB_LOW + 32)
-
-#define SUBSTREAM_AC3_LOW		0x80
-#define SUBSTREAM_AC3_HIGH		(SUBSTREAM_AC3_LOW + 8)
-
-#define SUBSTREAM_DTS_LOW		0x88
-#define SUBSTREAM_DTS_HIGH		(SUBSTREAM_DTS_LOW + 8)
-
-#define SUBSTREAM_PCM_LOW		0xA0
-#define SUBSTREAM_PCM_HIGH		(SUBSTREAM_PCM_LOW + 8)
-
 #define CURRENT_OFFSET		(m_pktindex * DVD_VIDEO_LB_LEN + m_index)
 
 #define USE_DEBUG_LOG 1

Modified: trunk/DvdMenuXtractor/VobParser.h
===================================================================
--- trunk/DvdMenuXtractor/VobParser.h	2004-12-11 11:08:50 UTC (rev 959)
+++ trunk/DvdMenuXtractor/VobParser.h	2004-12-11 16:04:55 UTC (rev 960)
@@ -26,6 +26,24 @@
 #define PCM_STREAM_TYPE			(AUDIO_STREAM_TYPE | 0x20)
 
 
+#define AUDIO_STREAM		0xC0
+#define VIDEO_STREAM		0xE0
+
+#define SUBSTREAM_PCI       0x00
+#define SUBSTREAM_DSI       0x01
+
+#define SUBSTREAM_SUB_LOW		0x20
+#define SUBSTREAM_SUB_HIGH		(SUBSTREAM_SUB_LOW + 32)
+
+#define SUBSTREAM_AC3_LOW		0x80
+#define SUBSTREAM_AC3_HIGH		(SUBSTREAM_AC3_LOW + 8)
+
+#define SUBSTREAM_DTS_LOW		0x88
+#define SUBSTREAM_DTS_HIGH		(SUBSTREAM_DTS_LOW + 8)
+
+#define SUBSTREAM_PCM_LOW		0xA0
+#define SUBSTREAM_PCM_HIGH		(SUBSTREAM_PCM_LOW + 8)
+
 // ============================================================================
 // Type
 // ============================================================================
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.