[matroska] r774 - trunk/DvdMenuXtractor

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

Modified:
   trunk/DvdMenuXtractor/DvdMenuXtractor.cpp
Log:
allow more than one cell per program

Modified: trunk/DvdMenuXtractor/DvdMenuXtractor.cpp
===================================================================
--- trunk/DvdMenuXtractor/DvdMenuXtractor.cpp	2004-09-09 15:23:50 UTC (rev 773)
+++ trunk/DvdMenuXtractor/DvdMenuXtractor.cpp	2004-09-10 10:39:58 UTC (rev 774)
@@ -888,13 +888,22 @@
 		_PrivatePG[1] = (program_number+1) >> 8;
 		_PrivatePG[2] = (program_number+1) & 0xFF;
 		XmlFile.AddLine(IndentString(lvl)+"<ChapterProcessPrivate>"+encodebase64(_PrivatePG,3)+"</ChapterProcessPrivate>");
-		// Output cells
-		XmlFile.AddLine(IndentString(lvl)+"<!-- Program Entry Cell #"+wxString::Format("%d",pgc->program_map[program_number])+" -->");
-		do {
+		// for this program
+		int entry_cell_num = pgc->program_map[program_number];
+		int program_last_cell_num = pgc->nr_of_cells;
+		int next_program_entry_cell_num;
+		if (program_number+1 == pgc->nr_of_programs)
+			next_program_entry_cell_num = program_last_cell_num+1;
+		else
+			next_program_entry_cell_num = pgc->program_map[program_number+1];
+		for (int cell_num = entry_cell_num; cell_num<next_program_entry_cell_num; cell_num++)
+		{
+			// Output cells
+			XmlFile.AddLine(IndentString(lvl)+wxString::Format("<!-- Program %sCell #%d -->",(cell_num==entry_cell_num)?"Entry ":"", cell_num));
 			XmlFile.AddLine(IndentString(lvl)+"<ChapterAtom>");
 				lvl++;
-				const cell_position_t & position = pgc->cell_position[program_number];
-				const cell_playback_t & cell = pgc->cell_playback[program_number];
+				const cell_position_t & position = pgc->cell_position[cell_num-1];
+				const cell_playback_t & cell = pgc->cell_playback[cell_num-1];
 				wxString _myUID = CreateUID();
 				XmlFile.AddLine(IndentString(lvl)+"<ChapterUID>"+_myUID+"</ChapterUID>");
 			
@@ -904,12 +913,11 @@
 				XmlFile.AddLine(IndentString(lvl)+"<ChapterProcessPrivate>"+encodebase64(_PrivateCN,4)+"</ChapterProcessPrivate>");
 			
 				end_time = st_time + DvdTimecodeToNano(cell.playback_time);
-//XmlFile.AddLine(IndentString(lvl)+"<incorrect/>");
 				DisplayTime(lvl, XmlFile, st_time, end_time);
 				st_time = end_time;
 				lvl--;
 			XmlFile.AddLine(IndentString(lvl)+"</ChapterAtom>");
-		} while(0); // TODO: for the moment we assume there is only one cell per program
+		}
 		
 		// PGC start/end times
 		DisplayTime(lvl, XmlFile, start_time, end_time);
@@ -1116,6 +1124,8 @@
 			// 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++;
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.