[matroska] r775 - trunk/DvdMenuXtractor

[email protected]
Newsgroups gmane.comp.multimedia.matroska.cvs
Message-ID <[email protected]>
Author: robux4
Date: 2004-09-10 15:40:42 +0400 (Fri, 10 Sep 2004)
New Revision: 775

Modified:
   trunk/DvdMenuXtractor/DvdMenuXtractor.cpp
Log:
fix the Title->PGC mapping
fix some timecode issues

Modified: trunk/DvdMenuXtractor/DvdMenuXtractor.cpp
===================================================================
--- trunk/DvdMenuXtractor/DvdMenuXtractor.cpp	2004-09-10 10:39:58 UTC (rev 774)
+++ trunk/DvdMenuXtractor/DvdMenuXtractor.cpp	2004-09-10 11:40:42 UTC (rev 775)
@@ -1124,8 +1124,6 @@
 			// Language Units
 			if (IfoFile && IfoFile->FirstPlayPGC() && IfoFile->LanguageUnits() && IfoFile->LanguageUnits()->nr_of_lus)
 			{
-				// _TODO_: Handle the title map (to know if there are many titles)
-				
 				XmlFile.AddLine("\n"+IndentString(lvl)+"<!-- Video Manager -->");
 				XmlFile.AddLine(IndentString(lvl)+"<ChapterAtom>");
 					lvl++;
@@ -1158,52 +1156,53 @@
 						timecode_endA = HandleLanguageUnit(lvl, XmlFile, timecode_startA, *MovieFile);
 					}
 
-					DisplayTime(lvl, XmlFile, timecode_startA, timecode_endA);
-					
-					timecode_startA = timecode_endA;
-					
-					// TODO: VTS content
+					// VTS content
 					if (MovieFile->VtsTitles() && MovieFile->VtsPGCs())
 					{
+						uint64_t timecode_startB = timecode_endA, timecode_endB = timecode_endA;
 						for (int i=0; i<MovieFile->VtsTitles()->nr_of_srpts; i++)
 						{
-							XmlFile.AddLine(IndentString(lvl)+"<!-- Title #"+wxString::Format("%d",i)+" -->");
+							XmlFile.AddLine(IndentString(lvl)+wxString::Format("<!-- Title #%d -->",i));
 							XmlFile.AddLine(IndentString(lvl)+"<ChapterAtom>");
 								lvl++;
 								wxString _myUIDa = CreateUID();
 								XmlFile.AddLine(IndentString(lvl)+"<ChapterUID>"+_myUIDa+"</ChapterUID>");
-								_PrivateTT[1] = i >> 8;
-								_PrivateTT[2] = i & 0xFF;
+
+								_PrivateTT[1] = (i+1) >> 8;
+								_PrivateTT[2] = (i+1) & 0xFF;
 								XmlFile.AddLine(IndentString(lvl)+"<ChapterProcessPrivate>"+encodebase64(_PrivateTT,3)+"</ChapterProcessPrivate>");
 							
-								// TODO: so far we assume all the PGCN/PG of VtsPGCs() belongs to all titles
-
-								// add the PGC/PTT
-								uint64_t timecode_startB = timecode_startA, timecode_endB = timecode_startA;
+								// add the PGC that match this PTT
+								uint64_t timecode_startC = timecode_startB, timecode_endC = timecode_startB;
 								for (int j=0; j<MovieFile->VtsPGCs()->nr_of_pgci_srp; j++)
 								{
-									XmlFile.AddLine(IndentString(lvl)+"<ChapterAtom>");
-										lvl++;
-										wxString _myUIDa = CreateUID();
-										XmlFile.AddLine(IndentString(lvl)+"<ChapterUID>"+_myUIDa+"</ChapterUID>");
-									
-										const pgc_t *_pgc = MovieFile->VtsPGCs()->pgci_srp->pgc;
-										timecode_startB = OutputPGC(lvl, XmlFile, MovieFile->VtsPGCs()->pgci_srp->pgc, timecode_startB, j, 0);
-									
-										lvl--;
-									XmlFile.AddLine(IndentString(lvl)+"</ChapterAtom>");
+									if ((MovieFile->VtsPGCs()->pgci_srp[j].entry_id & 0x7F) == i+1)
+									{
+										XmlFile.AddLine(IndentString(lvl)+"<ChapterAtom>");
+											lvl++;
+											wxString _myUIDa = CreateUID();
+											XmlFile.AddLine(IndentString(lvl)+"<ChapterUID>"+_myUIDa+"</ChapterUID>");
+										
+											timecode_startC = OutputPGC(lvl, XmlFile, MovieFile->VtsPGCs()->pgci_srp[j].pgc, timecode_startC, j, 0);
+										
+											lvl--;
+										XmlFile.AddLine(IndentString(lvl)+"</ChapterAtom>");
+									}
 								}
-								timecode_endA = timecode_startB;
+								timecode_endB = timecode_startC;
 								
-								DisplayTime(lvl, XmlFile, timecode_startA, timecode_endA);
+								DisplayTime(lvl, XmlFile, timecode_startB, timecode_endB);
 								lvl--;
 							XmlFile.AddLine(IndentString(lvl)+"</ChapterAtom>");
+							timecode_startB = timecode_endB;
 						}
+						timecode_endA = timecode_startB;
 					}
 					
 					DisplayTime(lvl, XmlFile, timecode_startA, timecode_endA);
 					lvl--;
 				XmlFile.AddLine(IndentString(lvl)+"</ChapterAtom>");
+				timecode_startA = timecode_endA;
 			}
 
 			lvl--;
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.