[matroska] r870 - trunk/DvdMenuXtractor

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

Modified:
   trunk/DvdMenuXtractor/
   trunk/DvdMenuXtractor/DvdMenuXtractor.cpp
   trunk/DvdMenuXtractor/VobParser.cpp
   trunk/DvdMenuXtractor/VobParser.h
Log:
Prepare for the handling of all VOB files of the DVD


Property changes on: trunk/DvdMenuXtractor
___________________________________________________________________
Name: svn:ignore
   + build


Modified: trunk/DvdMenuXtractor/DvdMenuXtractor.cpp
===================================================================
--- trunk/DvdMenuXtractor/DvdMenuXtractor.cpp	2004-10-07 20:39:33 UTC (rev 869)
+++ trunk/DvdMenuXtractor/DvdMenuXtractor.cpp	2004-10-08 12:46:31 UTC (rev 870)
@@ -247,7 +247,6 @@
         pConfig->SetPath("/Input");
 
         pConfig->Write("InDirectory",    m_edInDir->GetValue());	
-		pConfig->Write("MenuVOBFilename", m_edInDir->GetValue() + "VIDEO_TS.VOB");
         pConfig->Write("OutputDirectory",m_edOutDir->GetValue());	
     }
 private:
@@ -506,33 +505,24 @@
         fgs->Fit(this);
         fgs->SetSizeHints(this);
 
-		m_VobParser = NULL;
         m_OperationInProgress = FALSE;
     }
 
 	~wxMyWizardPage4()
-	{
-		if(m_VobParser)
-		{
-			delete m_VobParser;
-		}
-	}
+	{}
 
 
-	void BuildVobMap(void)
+	VobParser * BuildVobMap(int16_t title)
 	{
 		wxFileConfig *pConfig = (wxFileConfig *)wxConfigBase::Get();
 		
-		if(m_VobParser)
-		{
-			delete m_VobParser;
-			m_VobParser = NULL;
-		}
-        m_VobParser = new VobParser(pConfig->Read("MenuVOBFilename","").c_str());
-		m_VobParser->BuildMap();
+      VobParser * _VobParser = new VobParser(pConfig->Read("InDirectory","").c_str(), title);
+		if (_VobParser != NULL)
+			_VobParser->BuildMap();
+		return _VobParser;
 	}
 
-    void SplitAndDemux(void)
+    void SplitAndDemux(VobParser & aVobParser)
     {
         wxFileConfig *pConfig = (wxFileConfig *)wxConfigBase::Get();
         CompositeDemuxWriter *demuxer = NULL;
@@ -557,35 +547,35 @@
 		wxString maskDirectory = pConfig->Read("OutputDirectory","") + "mask" + wxFILE_SEP_PATH;
 		wxMkdir(maskDirectory);
 
-		m_VobParser->Reset();
+		aVobParser.Reset();
 		
 		// TODO, build VOB map & extract only real data for each cell
         try
         {
-            m_gaDemuxProgress->SetRange(m_VobParser->GetPacketCount());
+            m_gaDemuxProgress->SetRange(aVobParser.GetPacketCount());
 
-            while(m_VobParser->ParseNextPacket())
+            while(aVobParser.ParseNextPacket())
             {
-				if(m_VobParser->IsNewCell())
+				if(aVobParser.IsNewCell())
 				{
-                    if(IfoFile->IsACandidateCell(m_VobParser->GetVobID(),m_VobParser->GetCellID()))
+                    if(IfoFile->IsACandidateCell(aVobParser.GetVobID(),aVobParser.GetCellID()))
                     {
                         newFilename = newFilename.Format("cell_V%03d_C%02d",
-							m_VobParser->GetVobID(), m_VobParser->GetCellID());
+							aVobParser.GetVobID(), aVobParser.GetCellID());
 
                         m_txtDemuxLog->AppendText("Processing " + newFilename + "\n");
 
                         demuxer = new CompositeDemuxWriter();
                         demuxer->AddDemuxer(new VideoDemuxWriter(m2vDirectory+newFilename));
                         demuxer->AddDemuxer(new AC3DemuxWriter(ac3Directory+newFilename));
-						if(m_VobParser->m_pci.btn_ns > 0)
+						if(aVobParser.m_pci.btn_ns > 0)
 						{
 							demuxer->AddDemuxer(new SubDemuxWriter(subDirectory+newFilename));
 						}
                     }
-                    m_VobParser->SetDemuxer(demuxer);
+                    aVobParser.SetDemuxer(demuxer);
                 }
-                m_gaDemuxProgress->SetValue(m_VobParser->GetPacketIndex());
+                m_gaDemuxProgress->SetValue(aVobParser.GetPacketIndex());
                 wxYield();
             }
             if(demuxer)
@@ -1217,47 +1207,52 @@
         }
 	}
 
-    virtual void AfterShow(void)
-    {
+   virtual void AfterShow(void)
+   {
 		const int NbsStep = 4;
 		int Step = 1;
 		wxString StepString = "", StepStringFormat = "Step %d/%d : %s...";
-
-        m_OperationInProgress = TRUE;		
+		
+		m_OperationInProgress = TRUE;
 		StepString = StepString.Format(StepStringFormat, Step++, NbsStep, "Building vob map");
-        m_lbStep->SetLabel(StepString);
+		m_lbStep->SetLabel(StepString);
 		m_txtDemuxLog->AppendText(StepString+"\n");
-        m_lbStep->Update();
-		BuildVobMap();
-		
-		StepString = StepString.Format(StepStringFormat, Step++, NbsStep, "Splitting and demuxing");
-        m_lbStep->SetLabel(StepString);
-		m_txtDemuxLog->AppendText(StepString+"\n");		
-        m_lbStep->Update();
-        SplitAndDemux();
-
-		StepString = StepString.Format(StepStringFormat, Step++, NbsStep, "Converting still to bitmap");
-        m_lbStep->SetLabel(StepString);
-		m_txtDemuxLog->AppendText(StepString+"\n");		
-        m_lbStep->Update();
-        ConvertStillToBMP();
+		m_lbStep->Update();
+		for (int16_t title = 0; title < IfoFile->NumberOfTitles(); title++)
+		{
+			VobParser *aVobParser = BuildVobMap(title);
+			if (aVobParser != NULL)
+			{
+				StepString = StepString.Format(StepStringFormat, Step++, NbsStep, "Splitting and demuxing");
+				m_lbStep->SetLabel(StepString);
+				m_txtDemuxLog->AppendText(StepString+"\n");		
+				m_lbStep->Update();
+				SplitAndDemux(*aVobParser);
+				
+				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 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");		
-        m_lbStep->Update();
-        ConvertButtonMaskToBMP();
-		
+				StepString = StepString.Format(StepStringFormat, Step++, NbsStep, "Converting button mask to bitmap");
+				m_lbStep->SetLabel(StepString);
+				m_txtDemuxLog->AppendText(StepString+"\n");		
+				m_lbStep->Update();
+				ConvertButtonMaskToBMP();
+			}
+		}
+
 		GenerateXMLScript();
 
-        m_OperationInProgress = FALSE;
-    }
+		m_OperationInProgress = FALSE;
+	}
 
     virtual bool PageChanging(bool goingForward)
     {
@@ -1277,8 +1272,6 @@
     wxGauge* m_gaDemuxProgress;
     wxTextCtrl* m_txtDemuxLog;
     bool m_OperationInProgress;
-
-	VobParser *m_VobParser;
 };
 
 // ----------------------------------------------------------------------------

Modified: trunk/DvdMenuXtractor/VobParser.cpp
===================================================================
--- trunk/DvdMenuXtractor/VobParser.cpp	2004-10-07 20:39:33 UTC (rev 869)
+++ trunk/DvdMenuXtractor/VobParser.cpp	2004-10-08 12:46:31 UTC (rev 870)
@@ -75,12 +75,15 @@
 
 // ----------------------------------------------------------------------------
 
-VobParser::VobParser(const char* filename)
+VobParser::VobParser(const char* dirname, int16_t title)
+  :m_title(title)
 {
-	m_file = fopen(filename,"rb");
+	// _TODO handle all parts of this title (VIDEO_TS.vob or VTS_XX_YY.vob)
+	m_file = NULL;
+//	m_file = fopen(dirname,"rb");
 	if(!m_file)
 	{
-		throw VobParserFileNotFoundException(filename);
+		throw VobParserFileNotFoundException(dirname);
 	}
 
 	// Get file size

Modified: trunk/DvdMenuXtractor/VobParser.h
===================================================================
--- trunk/DvdMenuXtractor/VobParser.h	2004-10-07 20:39:33 UTC (rev 869)
+++ trunk/DvdMenuXtractor/VobParser.h	2004-10-08 12:46:31 UTC (rev 870)
@@ -525,7 +525,7 @@
 class VobParser  
 {
 public:
-	VobParser(const char* filename);
+	VobParser(const char* dirname, int16_t title);
 	void Reset();
 	bool ParseNextPacket();
 	uint32_t GetPacketCount() const;
@@ -543,6 +543,7 @@
 	nav_pci_gi m_pci;
 	packet_info pktinfo;
 	PES_header_data_content pes_header_data_content;
+   int16_t m_title;
 protected:
 	void ParseNavPacket();
 	void ParseAudioPacket();
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.