[matroska] r772 - trunk/DvdMenuXtractor

[email protected]
Newsgroups gmane.comp.multimedia.matroska.cvs
Message-ID <[email protected]>
Author: robux4
Date: 2004-09-09 18:12:20 +0400 (Thu, 09 Sep 2004)
New Revision: 772

Modified:
   trunk/DvdMenuXtractor/DvdMenuXtractor.cpp
   trunk/DvdMenuXtractor/IFOFile.cpp
   trunk/DvdMenuXtractor/IFOFile.h
Log:
handle the Language Unit of the VTS too

Modified: trunk/DvdMenuXtractor/DvdMenuXtractor.cpp
===================================================================
--- trunk/DvdMenuXtractor/DvdMenuXtractor.cpp	2004-09-09 12:49:09 UTC (rev 771)
+++ trunk/DvdMenuXtractor/DvdMenuXtractor.cpp	2004-09-09 14:12:20 UTC (rev 772)
@@ -809,7 +809,7 @@
 				XmlFile.AddLine(IndentString(lvl)+"<!-- Cell commands -->");
 				XmlFile.AddLine(IndentString(lvl)+"<ChapterProcess>");
 				lvl++;
-				XmlFile.AddLine(IndentString(lvl)+"<ChapProcessTime>1</ChapProcessTime>");
+				XmlFile.AddLine(IndentString(lvl)+"<ChapProcessTime>0</ChapProcessTime>");
 				_buf = (unsigned char*) realloc(_buf, 1+command_tbl->nr_of_cell * 8);
 				_buf[0] = command_tbl->nr_of_cell;
 				memcpy(&_buf[1], command_tbl->cell_cmds, command_tbl->nr_of_cell * 8);
@@ -1006,7 +1006,53 @@
 		hour = end_time / 60;
 		XmlFile.AddLine(IndentString(lvl)+"<ChapterTimeEnd>"+wxString::Format("%02d:%02d:%02d.%09d", hour, min, sec, nano)+"</ChapterTimeEnd>");
 	}
+	
+	uint64_t HandleLanguageUnit(int lvl, wxTextFile & XmlFile, uint64_t start_time, const IFOFile & _ifo)
+	{
+		static unsigned char _PrivateLU[]  = {0x2A, 0x00, 0x00, 0x00};
 
+		uint64_t timecode_startB = start_time, timecode_endB = start_time;
+		for (int i=0 ;i<_ifo.LanguageUnits()->nr_of_lus; i++)
+		{
+			XmlFile.AddLine(IndentString(lvl)+"<!-- Language Units -->");
+			XmlFile.AddLine(IndentString(lvl)+"<ChapterAtom>");
+				lvl++;
+				// the Language Unit for a given language
+				const pgci_lu_t &_LU = _ifo.LanguageUnits()->lu[i];
+				_PrivateLU[1] = _LU.lang_code >> 8;
+				_PrivateLU[2] = _LU.lang_code & 0xFF;
+				_PrivateLU[3] = _LU.zero_1;
+				XmlFile.AddLine(IndentString(lvl)+"<!-- language: "+char(_LU.lang_code>>8)+char(_LU.lang_code&0xFF)+" -->");
+
+				wxString _myUIDb = CreateUID();
+				XmlFile.AddLine(IndentString(lvl)+"<ChapterUID>"+_myUIDb+"</ChapterUID>");
+				XmlFile.AddLine(IndentString(lvl)+"<ChapterProcessPrivate>"+encodebase64(_PrivateLU,4)+"</ChapterProcessPrivate>");
+				// display the UID for the lazy rippers
+				XmlFile.AddLine(IndentString(lvl)+"<ChapterDisplay>");
+					lvl++;
+					XmlFile.AddLine(IndentString(lvl)+"<ChapterString>Language Unit for "+char(_LU.lang_code>>8)+char(_LU.lang_code&0xFF)+"</ChapterString>");
+					lvl--;
+				XmlFile.AddLine(IndentString(lvl)+"</ChapterDisplay>");
+				
+				if (_LU.pgcit)
+				{
+					for (int j=0; j<_LU.pgcit->nr_of_pgci_srp; j++)
+					{
+						const pgci_srp_t &_PGC_SRP = _LU.pgcit->pgci_srp[j];
+						XmlFile.AddLine("\n"+IndentString(lvl)+"<!-- PGC type "+GetPGCType(_PGC_SRP.entry_id)+" -->");
+						XmlFile.AddLine(IndentString(lvl)+"<ChapterAtom>");
+						timecode_endB = OutputPGC(lvl, XmlFile, _PGC_SRP.pgc, timecode_endB, j, _PGC_SRP.entry_id);
+						XmlFile.AddLine(IndentString(lvl)+"</ChapterAtom>");
+					}
+				}
+				DisplayTime(lvl, XmlFile, timecode_startB, timecode_endB);
+				lvl--;
+			XmlFile.AddLine(IndentString(lvl)+"</ChapterAtom>");
+			timecode_startB = timecode_endB;
+		}
+		return timecode_endB;
+	}
+
 	void GenerateXMLScript()
 	{
 		CellListElem* cle;
@@ -1017,7 +1063,7 @@
 
 		static unsigned char _PrivateFP[]  = {0x30, 0x00};
 		static unsigned char _PrivateVM[]  = {0x30, 0xC0};
-		static unsigned char _PrivateLU[]  = {0x2A, 0x00, 0x00, 0x00};
+		static unsigned char _PrivateVTS[] = {0x30, 0x80};
 
 		wxString line;
 		wxFileConfig *pConfig = (wxFileConfig *)wxConfigBase::Get();
@@ -1041,9 +1087,8 @@
 			XmlFile.AddLine(IndentString(lvl)+"<EditionProcessed>1</EditionProcessed>"); // DVD style menu
 
 			// Write the first play PGC
-			if (IfoFile->FirstPlayPGC())
+			if (IfoFile && IfoFile->FirstPlayPGC())
 			{
-				lvl++;
 				XmlFile.AddLine(IndentString(lvl)+"<!-- First Play PGC -->");
 				XmlFile.AddLine(IndentString(lvl)+"<ChapterAtom>");
 					lvl++;
@@ -1063,110 +1108,59 @@
 					AddCommands(lvl, XmlFile, IfoFile->FirstPlayPGC()->command_tbl);
 					lvl--;
 				XmlFile.AddLine(IndentString(lvl)+"</ChapterAtom>");
-				lvl--;
 			}
 			
 			timecode_startA = timecode_endA;
 			
 			// Language Units
-			if (IfoFile->LanguageUnits() && IfoFile->LanguageUnits()->nr_of_lus)
+			if (IfoFile && IfoFile->FirstPlayPGC() && IfoFile->LanguageUnits() && IfoFile->LanguageUnits()->nr_of_lus)
 			{
-				lvl++;
-				XmlFile.AddLine(IndentString(lvl)+"<!-- Video Manager -->");
+				XmlFile.AddLine("\n"+IndentString(lvl)+"<!-- Video Manager -->");
 				XmlFile.AddLine(IndentString(lvl)+"<ChapterAtom>");
 					lvl++;
 					wxString _myUIDa = CreateUID();
 					XmlFile.AddLine(IndentString(lvl)+"<ChapterUID>"+_myUIDa+"</ChapterUID>");
 					XmlFile.AddLine(IndentString(lvl)+"<ChapterProcessPrivate>"+encodebase64(_PrivateVM,2)+"</ChapterProcessPrivate>");
-					uint64_t timecode_startB = timecode_startA, timecode_endB = timecode_startA;
-					for (i=0 ;i<IfoFile->LanguageUnits()->nr_of_lus; i++)
-					{
-						XmlFile.AddLine(IndentString(lvl)+"<!-- Language Units -->");
-						XmlFile.AddLine(IndentString(lvl)+"<ChapterAtom>");
-							lvl++;
-							// the Language Unit for a given language
-							const pgci_lu_t &_LU = IfoFile->LanguageUnits()->lu[i];
-							_PrivateLU[1] = _LU.lang_code >> 8;
-							_PrivateLU[2] = _LU.lang_code & 0xFF;
-							_PrivateLU[3] = _LU.zero_1;
-							XmlFile.AddLine(IndentString(lvl)+"<!-- language: "+char(_LU.lang_code>>8)+char(_LU.lang_code&0xFF)+" -->");
-
-							wxString _myUIDb = CreateUID();
-							XmlFile.AddLine(IndentString(lvl)+"<ChapterUID>"+_myUIDb+"</ChapterUID>");
-							XmlFile.AddLine(IndentString(lvl)+"<ChapterProcessPrivate>"+encodebase64(_PrivateLU,4)+"</ChapterProcessPrivate>");
-							// display the UID for the lazy rippers
-							XmlFile.AddLine(IndentString(lvl)+"<ChapterDisplay>");
-								lvl++;
-								XmlFile.AddLine(IndentString(lvl)+"<ChapterString>Language Unit for "+char(_LU.lang_code>>8)+char(_LU.lang_code&0xFF)+"</ChapterString>");
-								lvl--;
-							XmlFile.AddLine(IndentString(lvl)+"</ChapterDisplay>");
-							
-							if (_LU.pgcit)
-							{
-								for (j=0; j<_LU.pgcit->nr_of_pgci_srp; j++)
-								{
-									const pgci_srp_t &_PGC_SRP = _LU.pgcit->pgci_srp[j];
-									XmlFile.AddLine("\n"+IndentString(lvl)+"<!-- PGC type "+GetPGCType(_PGC_SRP.entry_id)+" -->");
-									XmlFile.AddLine(IndentString(lvl)+"<ChapterAtom>");
-									timecode_endB = OutputPGC(lvl, XmlFile, _PGC_SRP.pgc, timecode_endB, j, _PGC_SRP.entry_id);
-									XmlFile.AddLine(IndentString(lvl)+"</ChapterAtom>");
-								}
-							}
-						DisplayTime(lvl, XmlFile, timecode_startB, timecode_endB);
-						timecode_startB = timecode_endB;
-						timecode_endA = timecode_endB;
-						lvl--;
-					}
-					XmlFile.AddLine(IndentString(lvl)+"</ChapterAtom>");
+					
+					timecode_endA = HandleLanguageUnit(lvl, XmlFile, timecode_startA, *IfoFile);
+				
 					DisplayTime(lvl, XmlFile, timecode_startA, timecode_endA);
 					lvl--;
 				XmlFile.AddLine(IndentString(lvl)+"</ChapterAtom>");
-				lvl--;
 			}
 
 			timecode_startA = timecode_endA;
+			
+			// Write the Video Title Set
+			if (MovieFile)
+			{
+				XmlFile.AddLine("\n"+IndentString(lvl)+"<!-- Video Title Set -->");
+				XmlFile.AddLine(IndentString(lvl)+"<ChapterAtom>");
+					lvl++;
+					wxString _myUIDa = CreateUID();
+					XmlFile.AddLine(IndentString(lvl)+"<ChapterUID>"+_myUIDa+"</ChapterUID>");
+					XmlFile.AddLine(IndentString(lvl)+"<ChapterProcessPrivate>"+encodebase64(_PrivateVTS,2)+"</ChapterProcessPrivate>");
+				
+					// VTS Menu
+					if (MovieFile->LanguageUnits() && MovieFile->LanguageUnits()->nr_of_lus)
+					{
+						timecode_endA = HandleLanguageUnit(lvl, XmlFile, timecode_startA, *MovieFile);
+					}
 
-			// Write the Video Manager
-			
-			// Write the Video Title
-/*			if (MovieFile->ttto())*/
-			{
+					DisplayTime(lvl, XmlFile, timecode_startA, timecode_endA);
+					
+					timecode_startA = timecode_endA;
+					
+					// TODO: VTS content
+					
+					lvl--;
+				XmlFile.AddLine(IndentString(lvl)+"</ChapterAtom>");
 			}
 
 			lvl--;
 		XmlFile.AddLine(IndentString(lvl)+"</EditionEntry>");
 		lvl--;
 		XmlFile.AddLine("</Chapters>");
-#if 0
-		XmlFile.AddLine(IndentString(lvl)+"<pages>");
-
-		for (node = CellsList->GetFirst(); node != NULL; node = node->GetNext() )
-		{
-			cle = node->GetData();
-			cin = cell_map.GetCell(cle->vobid, cle->cellid);
-			ButtonListElem* ble;
-			ButtonsListType::Node *ble_node;
-
-			lvl++;
-			XmlFile.AddLine(line.Format(IndentString(lvl)+"<page vobid=\"%d\" cellid=\"%d\" isstill=\"%s\">",
-				cle->vobid, cle->cellid,
-				cle->isStill?"true":"false"));
-			for(ble_node = cin->btt_list.GetFirst(); ble_node != NULL; ble_node = ble_node->GetNext() )
-			{
-				ble = ble_node->GetData();
-				lvl++;
-				XmlFile.AddLine(IndentString(lvl) + line.Format("<button x1=\"%d\" y1=\"%d\" x2=\"%d\" y2=\"%d\" />",
-					ble->x1, ble->y1, ble->x2, ble->y2 ));
-				lvl--;
-			}
-
-			XmlFile.AddLine(IndentString(lvl)+"</page>");
-			lvl--;
-
-		}
-
-		XmlFile.AddLine(IndentString(lvl)+"</pages>");
-#endif
 		XmlFile.Write();
 	}
 

Modified: trunk/DvdMenuXtractor/IFOFile.cpp
===================================================================
--- trunk/DvdMenuXtractor/IFOFile.cpp	2004-09-09 12:49:09 UTC (rev 771)
+++ trunk/DvdMenuXtractor/IFOFile.cpp	2004-09-09 14:12:20 UTC (rev 772)
@@ -94,7 +94,7 @@
 
 // ----------------------------------------------------------------------------
 
-const pgc_t *IFOFile::FirstPlayPGC()
+const pgc_t *IFOFile::FirstPlayPGC() const
 {
 	if (m_ifo)
 		return m_ifo->first_play_pgc;
@@ -104,7 +104,7 @@
 
 // ----------------------------------------------------------------------------
 
-const pgci_ut_t *IFOFile::LanguageUnits()
+const pgci_ut_t *IFOFile::LanguageUnits() const
 {
 	if (m_ifo)
 		return m_ifo->pgci_ut;

Modified: trunk/DvdMenuXtractor/IFOFile.h
===================================================================
--- trunk/DvdMenuXtractor/IFOFile.h	2004-09-09 12:49:09 UTC (rev 771)
+++ trunk/DvdMenuXtractor/IFOFile.h	2004-09-09 14:12:20 UTC (rev 772)
@@ -43,8 +43,8 @@
 	const CellsListType* GetCellsList();
 	bool IsACandidateCell(const unsigned int vobid, const unsigned int cellid);
 	virtual ~IFOFile();
-	const pgc_t *FirstPlayPGC();
-	const pgci_ut_t *LanguageUnits();
+	const pgc_t *FirstPlayPGC() const;
+	const pgci_ut_t *LanguageUnits() const;
 
 private:
 	ifo_handle_t* m_ifo;
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.