[matroska] r998 - trunk/DvdMenuXtractor

[email protected]
Newsgroups gmane.comp.multimedia.matroska.cvs
Message-ID <[email protected]>
Author: robux4
Date: 2005-01-03 18:12:46 +0300 (Mon, 03 Jan 2005)
New Revision: 998

Modified:
   trunk/DvdMenuXtractor/DvdMenuXtractor.cpp
   trunk/DvdMenuXtractor/README.txt
Log:
DMX: update the XML chapter output to fit the next elements

Modified: trunk/DvdMenuXtractor/DvdMenuXtractor.cpp
===================================================================
--- trunk/DvdMenuXtractor/DvdMenuXtractor.cpp	2005-01-03 14:24:21 UTC (rev 997)
+++ trunk/DvdMenuXtractor/DvdMenuXtractor.cpp	2005-01-03 15:12:46 UTC (rev 998)
@@ -73,7 +73,7 @@
 wxString outputDirectory;
 wxString mtxDirectory;
 const wxString APPLICATION_NAME = "DVDMenuXtractor: DMX - a fair-use tool";
-const wxString APPLICATION_VERSION = "0.6.2";
+const wxString APPLICATION_VERSION = "0.6.3";
 
 // ----------------------------------------------------------------------------
 
@@ -897,44 +897,44 @@
 			if (command_tbl->nr_of_pre)
 			{
 				XmlFile.AddLine(IndentString(lvl)+"<!-- Pre commands -->");
-				XmlFile.AddLine(IndentString(lvl)+"<ChapterProcess>");
+				XmlFile.AddLine(IndentString(lvl)+"<ChapterProcessCommand>");
 				lvl++;
 				XmlFile.AddLine(IndentString(lvl)+"<ChapterProcessTime>1</ChapterProcessTime>");
 				_buf[0] = command_tbl->nr_of_pre;
 				memcpy(&_buf[1], command_tbl->pre_cmds, command_tbl->nr_of_pre * 8);
-				XmlFile.AddLine(IndentString(lvl)+"<ChapterProcessCommand>"+encodebase64(_buf,1+command_tbl->nr_of_pre * 8)+"</ChapterProcessCommand>");
+				XmlFile.AddLine(IndentString(lvl)+"<ChapterProcessData>"+encodebase64(_buf,1+command_tbl->nr_of_pre * 8)+"</ChapterProcessData>");
 				lvl--;
-				XmlFile.AddLine(IndentString(lvl)+"</ChapterProcess>");
+				XmlFile.AddLine(IndentString(lvl)+"</ChapterProcessCommand>");
 			}
 
 			// Cell commands
 			if (command_tbl->nr_of_cell)
 			{
 				XmlFile.AddLine(IndentString(lvl)+"<!-- Cell commands -->");
-				XmlFile.AddLine(IndentString(lvl)+"<ChapterProcess>");
+				XmlFile.AddLine(IndentString(lvl)+"<ChapterProcessCommand>");
 				lvl++;
 				XmlFile.AddLine(IndentString(lvl)+"<ChapterProcessTime>0</ChapterProcessTime>");
 				_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);
-				XmlFile.AddLine(IndentString(lvl)+"<ChapterProcessCommand>"+encodebase64(_buf,1+command_tbl->nr_of_cell * 8)+"</ChapterProcessCommand>");
+				XmlFile.AddLine(IndentString(lvl)+"<ChapterProcessData>"+encodebase64(_buf,1+command_tbl->nr_of_cell * 8)+"</ChapterProcessData>");
 				lvl--;
-				XmlFile.AddLine(IndentString(lvl)+"</ChapterProcess>");
+				XmlFile.AddLine(IndentString(lvl)+"</ChapterProcessCommand>");
 			}
 
 			// Post commands
 			if (command_tbl->nr_of_post)
 			{
 				XmlFile.AddLine(IndentString(lvl)+"<!-- Post commands -->");
-				XmlFile.AddLine(IndentString(lvl)+"<ChapterProcess>");
+				XmlFile.AddLine(IndentString(lvl)+"<ChapterProcessCommand>");
 				lvl++;
 				XmlFile.AddLine(IndentString(lvl)+"<ChapterProcessTime>2</ChapterProcessTime>");
 				_buf = (unsigned char*) realloc(_buf, 1+command_tbl->nr_of_post * 8);
 				_buf[0] = command_tbl->nr_of_post;
 				memcpy(&_buf[1], command_tbl->post_cmds, command_tbl->nr_of_post * 8);
-				XmlFile.AddLine(IndentString(lvl)+"<ChapterProcessCommand>"+encodebase64(_buf,1+command_tbl->nr_of_post * 8)+"</ChapterProcessCommand>");
+				XmlFile.AddLine(IndentString(lvl)+"<ChapterProcessData>"+encodebase64(_buf,1+command_tbl->nr_of_post * 8)+"</ChapterProcessData>");
 				lvl--;
-				XmlFile.AddLine(IndentString(lvl)+"</ChapterProcess>");
+				XmlFile.AddLine(IndentString(lvl)+"</ChapterProcessCommand>");
 			}
 			free(_buf);
 		}
@@ -987,7 +987,7 @@
 		XmlFile.AddLine(IndentString(lvl)+"<ChapterFlagHidden>1</ChapterFlagHidden>");
 		_PrivatePG[1] = (program_number+1) >> 8;
 		_PrivatePG[2] = (program_number+1) & 0xFF;
-		XmlFile.AddLine(IndentString(lvl)+"<ChapterProcessedPrivate>"+encodebase64(_PrivatePG,3)+"</ChapterProcessedPrivate>");
+		OutputCodecPrivate(lvl, XmlFile, encodebase64(_PrivatePG,3));
 		// for this program
 		int entry_cell_num = pgc->program_map[program_number];
 		int program_last_cell_num = pgc->nr_of_cells;
@@ -1024,7 +1024,7 @@
 				_PrivateCN[2] = (position.vob_id_nr) & 0xFF;
 				_PrivateCN[3] = position.cell_nr;
 				_PrivateCN[4] = cell_num - entry_cell_num + 1; // Number of angles
-				XmlFile.AddLine(IndentString(lvl)+"<ChapterProcessedPrivate>"+encodebase64(_PrivateCN,5)+"</ChapterProcessedPrivate>");
+				OutputCodecPrivate(lvl, XmlFile, encodebase64(_PrivateCN,5));
 
 				//_TODO_: handle the vobID/cellID to determine the real timecode of the cells !
 				//          -> no, done when extracting the content streams, using the same timecode base
@@ -1054,14 +1054,6 @@
 		lvl++;
 		wxString _myUID = CreateUID();
 		XmlFile.AddLine(IndentString(lvl)+"<ChapterUID>"+_myUID+"</ChapterUID>");
-		_PrivatePGC[1] = (pgc_num+1) >> 8;
-		_PrivatePGC[2] = (pgc_num+1) & 0xFF;
-		_PrivatePGC[3] = pgc_type;
-		_PrivatePGC[4] = ((uint8_t*) &pgc->prohibited_ops)[0];
-		_PrivatePGC[5] = ((uint8_t*) &pgc->prohibited_ops)[1];
-		_PrivatePGC[6] = ((uint8_t*) &pgc->prohibited_ops)[2];
-		_PrivatePGC[7] = ((uint8_t*) &pgc->prohibited_ops)[3];
-		XmlFile.AddLine(IndentString(lvl)+"<ChapterProcessedPrivate>"+encodebase64(_PrivatePGC,8)+"</ChapterProcessedPrivate>");
 		// display the UID for the lazy rippers
 		XmlFile.AddLine(IndentString(lvl)+"<ChapterDisplay>");
 			lvl++;
@@ -1070,7 +1062,19 @@
 		XmlFile.AddLine(IndentString(lvl)+"</ChapterDisplay>");
 		
 		// PGC commands
-		AddCommands(lvl, XmlFile, pgc->command_tbl);
+		XmlFile.AddLine(IndentString(lvl)+"<ChapterProcess>");
+			lvl++;
+			_PrivatePGC[1] = (pgc_num+1) >> 8;
+			_PrivatePGC[2] = (pgc_num+1) & 0xFF;
+			_PrivatePGC[3] = pgc_type;
+			_PrivatePGC[4] = ((uint8_t*) &pgc->prohibited_ops)[0];
+			_PrivatePGC[5] = ((uint8_t*) &pgc->prohibited_ops)[1];
+			_PrivatePGC[6] = ((uint8_t*) &pgc->prohibited_ops)[2];
+			_PrivatePGC[7] = ((uint8_t*) &pgc->prohibited_ops)[3];
+			OutputCodecPrivate(lvl, XmlFile, encodebase64(_PrivatePGC,8), false);
+			AddCommands(lvl, XmlFile, pgc->command_tbl);
+			lvl--;
+		XmlFile.AddLine(IndentString(lvl)+"</ChapterProcess>");
 
 		// Handle the Programs/Cells in the PGC
 		for (int i=0; i< pgc->nr_of_programs; i++)
@@ -1088,15 +1092,15 @@
 						lvl++;
 							wxString _myUIDa = CreateUID();
 							XmlFile.AddLine(IndentString(lvl)+"<ChapterUID>"+_myUIDa+"</ChapterUID>");
-							_PrivatePTT[1] = (ptt_num+1) >> 8;
-							_PrivatePTT[2] = (ptt_num+1) & 0xFF;
-							XmlFile.AddLine(IndentString(lvl)+"<ChapterProcessedPrivate>"+encodebase64(_PrivatePTT,3)+"</ChapterProcessedPrivate>");
 							// display the UID for the lazy rippers
 							XmlFile.AddLine(IndentString(lvl)+"<ChapterDisplay>");
 								lvl++;
 								XmlFile.AddLine(IndentString(lvl)+wxString::Format("<ChapterString>Your Name Here For Chapter #%d</ChapterString>", ptt_num+1));
 								lvl--;
 							XmlFile.AddLine(IndentString(lvl)+"</ChapterDisplay>");
+							_PrivatePTT[1] = (ptt_num+1) >> 8;
+							_PrivatePTT[2] = (ptt_num+1) & 0xFF;
+							OutputCodecPrivate(lvl, XmlFile, encodebase64(_PrivatePTT,3));
 				
 						// PTT start times (no end time, it's only a reference used to seek)
 						XmlFile.AddLine(IndentString(lvl)+"<ChapterTimeStart>"+TimeFormat(st_time)+"</ChapterTimeStart>");
@@ -1197,7 +1201,7 @@
 
 				wxString _myUIDb = CreateUID();
 				XmlFile.AddLine(IndentString(lvl)+"<ChapterUID>"+_myUIDb+"</ChapterUID>");
-				XmlFile.AddLine(IndentString(lvl)+"<ChapterProcessedPrivate>"+encodebase64(_PrivateLU,4)+"</ChapterProcessedPrivate>");
+				OutputCodecPrivate(lvl, XmlFile, encodebase64(_PrivateLU,4));
 				// display the UID for the lazy rippers
 				XmlFile.AddLine(IndentString(lvl)+"<ChapterDisplay>");
 					lvl++;
@@ -1221,6 +1225,20 @@
 		return timecode_endB;
 	}
 
+	void OutputCodecPrivate(int lvl, wxTextFile & XmlFile, const wxString & CodecPrivate, bool bOpenClose = true)
+	{
+		if (bOpenClose) {
+			XmlFile.AddLine(IndentString(lvl)+"<ChapterProcess>");
+			lvl++;
+		}
+		XmlFile.AddLine(IndentString(lvl)+"<ChapterProcessCodecID>1</ChapterProcessCodecID>");
+		XmlFile.AddLine(IndentString(lvl)+"<ChapterProcessPrivate>"+CodecPrivate+"</ChapterProcessPrivate>");
+		if (bOpenClose) {
+			lvl--;
+			XmlFile.AddLine(IndentString(lvl)+"</ChapterProcess>");
+		}
+	}
+	
 	void GenerateXMLScript()
 	{
 		if (!IfoFile)
@@ -1271,9 +1289,13 @@
 						lvl--;
 					XmlFile.AddLine(IndentString(lvl)+"</ChapterDisplay>");
 					
-					XmlFile.AddLine(IndentString(lvl)+"<ChapterProcessedPrivate>"+encodebase64(_PrivateFP,4)+"</ChapterProcessedPrivate>");
-					// PGC commands
-					AddCommands(lvl, XmlFile, IfoFile->FirstPlayPGC()->command_tbl);
+					XmlFile.AddLine(IndentString(lvl)+"<ChapterProcess>");
+						lvl++;
+						OutputCodecPrivate(lvl, XmlFile, encodebase64(_PrivateFP,4), false);
+						// PGC commands
+						AddCommands(lvl, XmlFile, IfoFile->FirstPlayPGC()->command_tbl);
+						lvl--;
+					XmlFile.AddLine(IndentString(lvl)+"</ChapterProcess>");
 					lvl--;
 				XmlFile.AddLine(IndentString(lvl)+"</ChapterAtom>");
 			}
@@ -1288,7 +1310,7 @@
 					lvl++;
 					wxString _myUIDa = CreateUID();
 					XmlFile.AddLine(IndentString(lvl)+"<ChapterUID>"+_myUIDa+"</ChapterUID>");
-					XmlFile.AddLine(IndentString(lvl)+"<ChapterProcessedPrivate>"+encodebase64(_PrivateVM,4)+"</ChapterProcessedPrivate>");
+					OutputCodecPrivate(lvl, XmlFile, encodebase64(_PrivateVM,4));
 					
 					timecode_endA = HandleLanguageUnit(lvl, XmlFile, timecode_startA, *IfoFile, 0);
 				
@@ -1331,7 +1353,7 @@
 						XmlFile.AddLine(IndentString(lvl)+"<ChapterUID>"+_myUIDa+"</ChapterUID>");
 						_PrivateVTS[2] = title >> 8;
 						_PrivateVTS[3] = title & 0xFF;
-						XmlFile.AddLine(IndentString(lvl)+"<ChapterProcessedPrivate>"+encodebase64(_PrivateVTS,4)+"</ChapterProcessedPrivate>");
+						OutputCodecPrivate(lvl, XmlFile, encodebase64(_PrivateVTS,4));
 
 						timecode_endA = HandleLanguageUnit(lvl, XmlFile, timecode_startA, *IfoFile, title);
 
@@ -1370,7 +1392,7 @@
 					XmlFile.AddLine(IndentString(lvl)+"<ChapterUID>"+_myUIDa+"</ChapterUID>");
 					_PrivateVTS[2] = title >> 8;
 					_PrivateVTS[3] = title & 0xFF;
-					XmlFile.AddLine(IndentString(lvl)+"<ChapterProcessedPrivate>"+encodebase64(_PrivateVTS,4)+"</ChapterProcessedPrivate>");
+					OutputCodecPrivate(lvl, XmlFile, encodebase64(_PrivateVTS,4));
 
 					if (IfoFile->VtsTitles(title) && IfoFile->VtsPGCs(title))
 					{
@@ -1385,7 +1407,7 @@
 
 								_PrivateTT[1] = (i+1) >> 8;
 								_PrivateTT[2] = (i+1) & 0xFF;
-								XmlFile.AddLine(IndentString(lvl)+"<ChapterProcessedPrivate>"+encodebase64(_PrivateTT,3)+"</ChapterProcessedPrivate>");
+								OutputCodecPrivate(lvl, XmlFile, encodebase64(_PrivateTT,3));
 							
 								// add the PGC that match this PTT
 								uint64_t timecode_startC = timecode_startB, timecode_endC = timecode_startB;

Modified: trunk/DvdMenuXtractor/README.txt
===================================================================
--- trunk/DvdMenuXtractor/README.txt	2005-01-03 14:24:21 UTC (rev 997)
+++ trunk/DvdMenuXtractor/README.txt	2005-01-03 15:12:46 UTC (rev 998)
@@ -2,7 +2,7 @@
 * The duration of still frames is not handled yet (only lasts as normal frames)
 
 TODO :
-* update the XML output according to the changes in the specs
+* fix the time in the XML chapter for the higher level elements
 * support infinite still frames in the chapter XML file
 * detect when a file was empty and therefore not written
 * make use of the cancel buttons
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.