[matroska] r903 - trunk/DvdMenuXtractor

[email protected]
Newsgroups gmane.comp.multimedia.matroska.cvs
Message-ID <[email protected]>
Author: robux4
Date: 2004-10-20 16:34:45 +0400 (Wed, 20 Oct 2004)
New Revision: 903

Modified:
   trunk/DvdMenuXtractor/DvdMenuXtractor.cpp
   trunk/DvdMenuXtractor/IFOFile.cpp
   trunk/DvdMenuXtractor/IFOFile.h
   trunk/DvdMenuXtractor/VobParser.cpp
   trunk/DvdMenuXtractor/VobParser.h
Log:
filenames for extraction now correct

Modified: trunk/DvdMenuXtractor/DvdMenuXtractor.cpp
===================================================================
--- trunk/DvdMenuXtractor/DvdMenuXtractor.cpp	2004-10-20 12:02:29 UTC (rev 902)
+++ trunk/DvdMenuXtractor/DvdMenuXtractor.cpp	2004-10-20 12:34:45 UTC (rev 903)
@@ -358,7 +358,7 @@
         CellListElem* cle;
         CellsListType::Node *node;
         unsigned int i;
-        const CellsListType *CellsList = IfoFile->GetCellsList(0);
+        const CellsListType *CellsList = IfoFile->GetCellsList(0, true);
 
         m_lstcMenuCell->DeleteAllItems();
 
@@ -453,7 +453,7 @@
             CellsListType::Node *node;
             unsigned int i;
             unsigned int frameaccu = 0;
-            const CellsListType *CellsList = IfoFile->GetCellsList(0);
+            const CellsListType *CellsList = IfoFile->GetCellsList(0, true);
 
             m_lstcMenuCell->DeleteAllItems();
 
@@ -534,11 +534,16 @@
 		return _VobParser;
 	}
 
-    void SplitAndDemux(VobParser & aVobParser, int16_t title)
+	wxString CellName(int16_t title, int16_t vobid, int16_t cellid, bool language) const
+	{
+		return wxString::Format("cell_%sT%02d_V%03d_C%02d", language?"L_":"", title, vobid, cellid);
+	}
+
+    void SplitAndDemux(VobParser & aVobParser, int16_t title, bool language)
     {
         CompositeDemuxWriter *demuxer = NULL;
         wxString newFilename;
-		const CellsListType *CellsList = IfoFile->GetCellsList(title);
+		const CellsListType *CellsList = IfoFile->GetCellsList(title, language);
 
 		aVobParser.Reset();
 		
@@ -553,7 +558,7 @@
 				{
                     if(IfoFile->IsACandidateCell(aVobParser.GetVobID(),aVobParser.GetCellID()))
                     {
-                        newFilename = aVobParser.CellName();
+                        newFilename = CellName(title, aVobParser.GetVobID(), aVobParser.GetCellID(), language);
 
                         m_txtDemuxLog->AppendText("Processing " + newFilename + "\n");
 
@@ -582,12 +587,12 @@
         }
     }
 
-    void ConvertStillToBMP(int16_t title)
+    void ConvertStillToBMP(int16_t title, bool language)
     {			
 		wxString FilenameBase;
 		CellListElem* cle;
 		CellsListType::Node *node;
-		const CellsListType *CellsList = IfoFile->GetCellsList(title);
+		const CellsListType *CellsList = IfoFile->GetCellsList(title, language);
 		int i;			
 		wxFileConfig *pConfig = (wxFileConfig *)wxConfigBase::Get();
 
@@ -602,8 +607,7 @@
 			cle = node->GetData();
 			if(cle->isStill)
 			{				
-				FilenameBase = FilenameBase.Format("cell_T%02d_V%03d_C%02d",
-					title, cle->vobid, cle->cellid);
+				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");
@@ -616,12 +620,12 @@
 		delete mpeg2decoder;
     }
 
-    void ConvertAudioToWAV(int16_t title)
+    void ConvertAudioToWAV(int16_t title, bool language)
     {	
 		wxString FilenameBase;
 		CellListElem* cle;
 		CellsListType::Node *node;
-		const CellsListType *CellsList = IfoFile->GetCellsList(title);
+		const CellsListType *CellsList = IfoFile->GetCellsList(title, language);
 		int i;			
 		wxFileConfig *pConfig = (wxFileConfig *)wxConfigBase::Get();
 
@@ -637,8 +641,7 @@
 			cle = node->GetData();
 			if(!cle->isStill)
 			{
-				FilenameBase = FilenameBase.Format("cell_T%02d_V%03d_C%02d",
-					title, cle->vobid, cle->cellid);
+				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(ac3Directory+FilenameBase+".ac3");
@@ -651,12 +654,12 @@
 		delete a52decoder;
     }
 
-    void ConvertButtonMaskToBMP(int16_t title)
+    void ConvertButtonMaskToBMP(int16_t title, bool language)
     {
 		wxString FilenameBase;
 		CellListElem* cle;
 		CellsListType::Node *node;
-		const CellsListType *CellsList = IfoFile->GetCellsList(title);
+		const CellsListType *CellsList = IfoFile->GetCellsList(title, language);
 		int i;			
 		wxFileConfig *pConfig = (wxFileConfig *)wxConfigBase::Get();
 		
@@ -670,8 +673,7 @@
 		{
 			cle = node->GetData();
 			// TODO : Select only cell with button
-			FilenameBase = FilenameBase.Format("cell_T%02d_V%03d_C%02d",
-				title, cle->vobid, cle->cellid);
+			FilenameBase = CellName(title, cle->vobid, cle->cellid, language);
 			m_txtDemuxLog->AppendText("Converting " + FilenameBase + ".sub to "+FilenameBase+".bmp ...\n");
 			//WAVWriter->SetFilename(wavDirectory+FilenameBase+".wav");
 			
@@ -1243,25 +1245,25 @@
 					m_lbStep->SetLabel(StepString);
 					m_txtDemuxLog->AppendText(StepString+"\n");		
 					m_lbStep->Update();
-					SplitAndDemux(*aVobParser, title);
+					SplitAndDemux(*aVobParser, title, language);
 					
 					StepString = StepString.Format(StepStringFormat, Step++, NbsStep, "Converting still to bitmap");
 					m_lbStep->SetLabel(StepString);
 					m_txtDemuxLog->AppendText(StepString+"\n");		
 					m_lbStep->Update();
-					ConvertStillToBMP(title);
+					ConvertStillToBMP(title, language);
 
 					StepString = StepString.Format(StepStringFormat, Step++, NbsStep, "Converting audio to wav");
 					m_lbStep->SetLabel(StepString);
 					m_txtDemuxLog->AppendText(StepString+"\n");		
 					m_lbStep->Update();
-					ConvertAudioToWAV(title);
+					ConvertAudioToWAV(title, language);
 
 					StepString = StepString.Format(StepStringFormat, Step++, NbsStep, "Converting button mask to bitmap");
 					m_lbStep->SetLabel(StepString);
 					m_txtDemuxLog->AppendText(StepString+"\n");		
 					m_lbStep->Update();
-					ConvertButtonMaskToBMP(title);
+					ConvertButtonMaskToBMP(title, language);
 				}
 				language = !language;
 			} while (!language);

Modified: trunk/DvdMenuXtractor/IFOFile.cpp
===================================================================
--- trunk/DvdMenuXtractor/IFOFile.cpp	2004-10-20 12:02:29 UTC (rev 902)
+++ trunk/DvdMenuXtractor/IFOFile.cpp	2004-10-20 12:34:45 UTC (rev 903)
@@ -223,7 +223,7 @@
 
 // ----------------------------------------------------------------------------
 
-const CellsListType* IFOFile::GetCellsList(unsigned int title)
+const CellsListType* IFOFile::GetCellsList(unsigned int title, bool language)
 {
 	CellsHashType CellsHash;
 
@@ -232,19 +232,24 @@
 	
 	ifo_handle_t *_ifo = m_ifos.Item(title)->GetData(); 
 	
-	if (_ifo->pgci_ut)
+	if (language)
 	{
-		for(int i = 0; i < _ifo->pgci_ut->nr_of_lus; i++)
+		if (_ifo->pgci_ut)
 		{
-			pgci_lu_t& lu = _ifo->pgci_ut->lu[i];
-			GetPGCCells(*lu.pgcit, &CellsHash);
+			for(int i = 0; i < _ifo->pgci_ut->nr_of_lus; i++)
+			{
+				pgci_lu_t& lu = _ifo->pgci_ut->lu[i];
+				GetPGCCells(*lu.pgcit, &CellsHash);
+			}
 		}
 	}
-	
-	// handle non-language unit cells
-	if (_ifo->vts_pgcit)
+	else
 	{
-		GetPGCCells(*_ifo->vts_pgcit, &CellsHash);
+		// handle non-language unit cells
+		if (_ifo->vts_pgcit)
+		{
+			GetPGCCells(*_ifo->vts_pgcit, &CellsHash);
+		}
 	}
 
 	// Transfer hash map to the list to be sorted

Modified: trunk/DvdMenuXtractor/IFOFile.h
===================================================================
--- trunk/DvdMenuXtractor/IFOFile.h	2004-10-20 12:02:29 UTC (rev 902)
+++ trunk/DvdMenuXtractor/IFOFile.h	2004-10-20 12:34:45 UTC (rev 903)
@@ -44,7 +44,7 @@
 	const wxArrayString& GetLanguageList(unsigned int title);
 	void AddLanguageToSelection(const int languageNumber);
 	void ClearLanguageSelection();
-	const CellsListType* GetCellsList(unsigned int title);
+	const CellsListType* GetCellsList(unsigned int title, bool language);
 	bool IsACandidateCell(const unsigned int vobid, const unsigned int cellid);
 	virtual ~IFOFile();
 	const pgc_t *FirstPlayPGC() const;

Modified: trunk/DvdMenuXtractor/VobParser.cpp
===================================================================
--- trunk/DvdMenuXtractor/VobParser.cpp	2004-10-20 12:02:29 UTC (rev 902)
+++ trunk/DvdMenuXtractor/VobParser.cpp	2004-10-20 12:34:45 UTC (rev 903)
@@ -747,11 +747,5 @@
 	return m_map;
 }
 
-wxString VobParser::CellName() const
-{
-	return wxString::Format("cell_%sT%02d_V%03d_C%02d", m_language?"L_":"",
-	                           m_title, m_dsi.vobu_vob_idn, m_dsi.vobu_c_idn);
-}
-
 // ============================================================================
 

Modified: trunk/DvdMenuXtractor/VobParser.h
===================================================================
--- trunk/DvdMenuXtractor/VobParser.h	2004-10-20 12:02:29 UTC (rev 902)
+++ trunk/DvdMenuXtractor/VobParser.h	2004-10-20 12:34:45 UTC (rev 903)
@@ -537,7 +537,6 @@
 	void BuildMap();
 	const CellMap& GetVobMap() const;
 	virtual ~VobParser();
-	wxString CellName() const;
 
 	nav_dsi_gi m_dsi;
 	nav_pci_gi m_pci;
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.