[matroska] r902 - in trunk/DvdMenuXtractor: . libdvdread/dvdread

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

Modified:
   trunk/DvdMenuXtractor/DvdMenuXtractor.cpp
   trunk/DvdMenuXtractor/VobParser.cpp
   trunk/DvdMenuXtractor/VobParser.h
   trunk/DvdMenuXtractor/libdvdread/dvdread/dvd_reader.c
Log:
support Language Unit AND Content VOB files (extraction filenames may have pbs)

Modified: trunk/DvdMenuXtractor/DvdMenuXtractor.cpp
===================================================================
--- trunk/DvdMenuXtractor/DvdMenuXtractor.cpp	2004-10-19 21:09:55 UTC (rev 901)
+++ trunk/DvdMenuXtractor/DvdMenuXtractor.cpp	2004-10-20 12:02:29 UTC (rev 902)
@@ -518,13 +518,13 @@
 	{}
 
 
-	VobParser * BuildVobMap(int16_t title)
+	VobParser * BuildVobMap(int16_t title, bool language)
 	{
 		wxFileConfig *pConfig = (wxFileConfig *)wxConfigBase::Get();
 		
 		VobParser * _VobParser = NULL;
 		try {
-			_VobParser = new VobParser(pConfig->Read("InDirectory","").c_str(), title, true);
+			_VobParser = new VobParser(pConfig->Read("InDirectory","").c_str(), title, language);
 		} catch (...)
 		{
 			m_txtDemuxLog->AppendText(wxString::Format("no VOB files found in %s for Title %02d\n",pConfig->Read("InDirectory","").c_str(),title));
@@ -553,8 +553,7 @@
 				{
                     if(IfoFile->IsACandidateCell(aVobParser.GetVobID(),aVobParser.GetCellID()))
                     {
-                        newFilename = newFilename.Format("cell_T%02d_V%03d_C%02d",
-							title, aVobParser.GetVobID(), aVobParser.GetCellID());
+                        newFilename = aVobParser.CellName();
 
                         m_txtDemuxLog->AppendText("Processing " + newFilename + "\n");
 
@@ -1209,7 +1208,7 @@
 
    virtual void AfterShow(void)
    {
-		const int NbsStep = 4;
+		const int NbsStep = 5;
 		wxString StepString, StepStringFormat = "Step %d/%d : %s...";
 		
 		m_OperationInProgress = TRUE;
@@ -1217,45 +1216,55 @@
 		m_txtDemuxLog->AppendText("Creating output directories\n");
 
 		CreatDirectories();
-
+
+		bool language = true;
 		for (int16_t title = 0; title <= IfoFile->NumberOfTitles(); title++)
-		{
-			m_txtDemuxLog->AppendText(wxString::Format("         Treating title %d VOB file(s)\n", title));
+		{
+			do {
+				if (title == 0 && !language) // doesn't exist
+				{
+					language = true;
+					break;
+				}
 
-			int Step = 1;
+				m_txtDemuxLog->AppendText(wxString::Format("         Treating Title %d %sVOB file(s)\n", title, language?"LU ":""));
 
-			StepString = StepString.Format(StepStringFormat, Step++, NbsStep, "Building vob map");
-			m_lbStep->SetLabel(StepString);
-			m_txtDemuxLog->AppendText(StepString+"\n");
-			m_lbStep->Update();
-			VobParser *aVobParser = BuildVobMap(title);
-
-			if (aVobParser != NULL)
-			{
-				StepString = StepString.Format(StepStringFormat, Step++, NbsStep, "Splitting and demuxing");
+				int Step = 1;
+
+				StepString = StepString.Format(StepStringFormat, Step++, NbsStep, "Building vob map");
 				m_lbStep->SetLabel(StepString);
-				m_txtDemuxLog->AppendText(StepString+"\n");		
+				m_txtDemuxLog->AppendText(StepString+"\n");
 				m_lbStep->Update();
-				SplitAndDemux(*aVobParser, title);
-				
-				StepString = StepString.Format(StepStringFormat, Step++, NbsStep, "Converting still to bitmap");
-				m_lbStep->SetLabel(StepString);
-				m_txtDemuxLog->AppendText(StepString+"\n");		
-				m_lbStep->Update();
-				ConvertStillToBMP(title);
-/*
-				StepString = StepString.Format(StepStringFormat, Step++, NbsStep, "Converting audio to wav");
-				m_lbStep->SetLabel(StepString);
-				m_txtDemuxLog->AppendText(StepString+"\n");		
-				m_lbStep->Update();
-				ConvertAudioToWAV(title);
-*/
-				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);
-			}
+				VobParser *aVobParser = BuildVobMap(title, language);
+
+				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, title);
+					
+					StepString = StepString.Format(StepStringFormat, Step++, NbsStep, "Converting still to bitmap");
+					m_lbStep->SetLabel(StepString);
+					m_txtDemuxLog->AppendText(StepString+"\n");		
+					m_lbStep->Update();
+					ConvertStillToBMP(title);
+
+					StepString = StepString.Format(StepStringFormat, Step++, NbsStep, "Converting audio to wav");
+					m_lbStep->SetLabel(StepString);
+					m_txtDemuxLog->AppendText(StepString+"\n");		
+					m_lbStep->Update();
+					ConvertAudioToWAV(title);
+
+					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);
+				}
+				language = !language;
+			} while (!language);
 		}
 
 		GenerateXMLScript();

Modified: trunk/DvdMenuXtractor/VobParser.cpp
===================================================================
--- trunk/DvdMenuXtractor/VobParser.cpp	2004-10-19 21:09:55 UTC (rev 901)
+++ trunk/DvdMenuXtractor/VobParser.cpp	2004-10-20 12:02:29 UTC (rev 902)
@@ -76,11 +76,12 @@
 
 // ----------------------------------------------------------------------------
 
-VobParser::VobParser(const char* dirname, int16_t title, bool menu)
+VobParser::VobParser(const char* dirname, int16_t title, bool language)
 	:m_title(title)
 	,m_demuxer(NULL)
 	,m_dvdhandle(NULL)
 	,m_stream(NULL)
+	,m_language(language)
 {
 	m_pktcount = 0;
 
@@ -91,7 +92,7 @@
 
 	if (m_dvdhandle)
 	{
-		if (menu)
+		if (m_language)
 			m_stream = DVDOpenFile(m_dvdhandle, title, DVD_READ_MENU_VOBS);
 		else
 			m_stream = DVDOpenFile(m_dvdhandle, title, DVD_READ_TITLE_VOBS);
@@ -746,5 +747,11 @@
 	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-19 21:09:55 UTC (rev 901)
+++ trunk/DvdMenuXtractor/VobParser.h	2004-10-20 12:02:29 UTC (rev 902)
@@ -524,7 +524,7 @@
 class VobParser  
 {
 public:
-	VobParser(const char* dirname, int16_t title, bool menu);
+	VobParser(const char* dirname, int16_t title, bool language);
 	void Reset();
 	bool ParseNextPacket();
 	uint32_t GetPacketCount() const;
@@ -537,12 +537,12 @@
 	void BuildMap();
 	const CellMap& GetVobMap() const;
 	virtual ~VobParser();
+	wxString CellName() const;
 
 	nav_dsi_gi m_dsi;
 	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();
@@ -566,8 +566,10 @@
 	void SkipNBytes(int n);
 
 private:
+	int16_t m_title;
 	dvd_reader_t *m_dvdhandle;
 	dvd_file_t *m_stream;
+	bool m_language;
 	uint8_t m_buff[DVD_VIDEO_LB_LEN];
 	uint32_t m_index;
 	uint32_t m_pktindex;

Modified: trunk/DvdMenuXtractor/libdvdread/dvdread/dvd_reader.c
===================================================================
--- trunk/DvdMenuXtractor/libdvdread/dvdread/dvd_reader.c	2004-10-19 21:09:55 UTC (rev 901)
+++ trunk/DvdMenuXtractor/libdvdread/dvdread/dvd_reader.c	2004-10-20 12:02:29 UTC (rev 902)
@@ -391,9 +391,10 @@
 	 */
 
 	if( strlen( path_copy ) > 1 ) {
+#if !defined(WIN32)
 	    if( path_copy[ strlen( path_copy ) - 1 ] == '/' ) 
 		path_copy[ strlen( path_copy ) - 1 ] = '\0';
-#if defined(WIN32)
+#else
 	    if( path_copy[ strlen( path_copy ) - 1 ] == '\\' ) 
 		path_copy[ strlen( path_copy ) - 1 ] = '\0';
 #endif
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.