[matroska] r1022 - trunk/DvdMenuXtractor
[email protected] Sun, 9 Jan 2005 12:50:26 +0300 (MSK)
Newsgroups
gmane.comp.multimedia.matroska.cvs
Message-ID
<[email protected] >
Author: robux4
Date: 2005-01-09 12:50:26 +0300 (Sun, 09 Jan 2005)
New Revision: 1022
Modified:
trunk/DvdMenuXtractor/DvdMenuXtractor.cpp
Log:
DMX: introduce the new GotoAndPlay() command, output the commands in "hex" and "ascii"
Modified: trunk/DvdMenuXtractor/DvdMenuXtractor.cpp
===================================================================
--- trunk/DvdMenuXtractor/DvdMenuXtractor.cpp 2005-01-08 15:41:48 UTC (rev 1021)
+++ trunk/DvdMenuXtractor/DvdMenuXtractor.cpp 2005-01-09 09:50:26 UTC (rev 1022)
@@ -71,7 +71,7 @@
wxString outputDirectory;
wxString mtxDirectory;
const wxString APPLICATION_NAME = "DVDMenuXtractor: DMX - a fair-use tool";
-const wxString APPLICATION_VERSION = "0.8.0";
+const wxString APPLICATION_VERSION = "0.8.1";
// ----------------------------------------------------------------------------
@@ -811,7 +811,7 @@
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)+"<ChapterProcessData>"+encodebase64(_buf,1+command_tbl->nr_of_pre * 8)+"</ChapterProcessData>");
+ XmlFile.AddLine(IndentString(lvl)+"<ChapterProcessData format=\"hex\">"+encodeHex(_buf,1+command_tbl->nr_of_pre * 8)+"</ChapterProcessData>");
lvl--;
XmlFile.AddLine(IndentString(lvl)+"</ChapterProcessCommand>");
}
@@ -826,7 +826,7 @@
_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)+"<ChapterProcessData>"+encodebase64(_buf,1+command_tbl->nr_of_cell * 8)+"</ChapterProcessData>");
+ XmlFile.AddLine(IndentString(lvl)+"<ChapterProcessData format=\"hex\">"+encodeHex(_buf,1+command_tbl->nr_of_cell * 8)+"</ChapterProcessData>");
lvl--;
XmlFile.AddLine(IndentString(lvl)+"</ChapterProcessCommand>");
}
@@ -841,7 +841,7 @@
_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)+"<ChapterProcessData>"+encodebase64(_buf,1+command_tbl->nr_of_post * 8)+"</ChapterProcessData>");
+ XmlFile.AddLine(IndentString(lvl)+"<ChapterProcessData format=\"hex\">"+encodeHex(_buf,1+command_tbl->nr_of_post * 8)+"</ChapterProcessData>");
lvl--;
XmlFile.AddLine(IndentString(lvl)+"</ChapterProcessCommand>");
}
@@ -900,7 +900,7 @@
XmlFile.AddLine(IndentString(lvl)+"</ChapterDisplay>");
_PrivatePG[1] = (program_number+1) >> 8;
_PrivatePG[2] = (program_number+1) & 0xFF;
- OutputCodecPrivate(lvl, XmlFile, encodebase64(_PrivatePG,3));
+ OutputCodecPrivate(lvl, XmlFile, _PrivatePG, 3);
// for this program
int entry_cell_num = pgc->program_map[program_number];
int program_last_cell_num = pgc->nr_of_cells;
@@ -935,12 +935,11 @@
XmlFile.AddLine(IndentString(lvl)+"<ChapterProcess>");
lvl++;
XmlFile.AddLine(IndentString(lvl)+"<ChapterProcessCodecID>0</ChapterProcessCodecID>");
- XmlFile.AddLine(IndentString(lvl)+"<!-- Post command jump to the cell's start timecode -->");
+ XmlFile.AddLine(IndentString(lvl)+"<!-- Post command: replay this cell -->");
XmlFile.AddLine(IndentString(lvl)+"<ChapterProcessCommand>");
lvl++;
XmlFile.AddLine(IndentString(lvl)+"<ChapterProcessTime>2</ChapterProcessTime>");
- XmlFile.AddLine(IndentString(lvl)+"<!-- TODO: COMMAND TO BE DEFINED -->");
- XmlFile.AddLine(IndentString(lvl)+"<ChapterProcessData>"+encodebase64(_PrivatePG,1)+"</ChapterProcessData>");
+ XmlFile.AddLine(IndentString(lvl)+"<ChapterProcessData format=\"ascii\">GotoAndPlay("+_myUID+");</ChapterProcessData>");
lvl--;
XmlFile.AddLine(IndentString(lvl)+"</ChapterProcessCommand>");
lvl--;
@@ -957,7 +956,7 @@
_PrivateCN[2] = (position.vob_id_nr) & 0xFF;
_PrivateCN[3] = position.cell_nr;
_PrivateCN[4] = cell_num - entry_cell_num + 1; // Number of angles
- OutputCodecPrivate(lvl, XmlFile, encodebase64(_PrivateCN,5));
+ OutputCodecPrivate(lvl, XmlFile, _PrivateCN, 5);
DisplayTime(lvl, XmlFile, cell_elt->start_time, cell_elt->start_time + cell_elt->duration);
if (end_time < cell_elt->start_time + cell_elt->duration)
@@ -1002,7 +1001,7 @@
_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);
+ OutputCodecPrivate(lvl, XmlFile, _PrivatePGC, 8, false);
AddCommands(lvl, XmlFile, pgc->command_tbl);
lvl--;
XmlFile.AddLine(IndentString(lvl)+"</ChapterProcess>");
@@ -1032,7 +1031,7 @@
XmlFile.AddLine(IndentString(lvl)+"</ChapterDisplay>");
_PrivatePTT[1] = (ptt_num+1) >> 8;
_PrivatePTT[2] = (ptt_num+1) & 0xFF;
- OutputCodecPrivate(lvl, XmlFile, encodebase64(_PrivatePTT,3));
+ OutputCodecPrivate(lvl, XmlFile, _PrivatePTT, 3);
XmlFile.AddLine(IndentString(lvl)+"<ChapterTimeStart>"+TimeFormat(start_time)+"</ChapterTimeStart>");
lvl--;
@@ -1043,7 +1042,7 @@
}
}
- XmlFile.AddLine(IndentString(lvl)+"<!-- Program PTT#"+wxString::Format("%d",i+1)+" in this PGC -->");
+ XmlFile.AddLine(IndentString(lvl)+"<!-- Program PGN#"+wxString::Format("%d",i+1)+" in this PGC -->");
found_time = OutputProgram(lvl, XmlFile, pgc, i, cell_list);
if (start_time > found_time)
start_time = found_time;
@@ -1138,7 +1137,7 @@
wxString _myUIDb = CreateUID();
XmlFile.AddLine(IndentString(lvl)+"<ChapterUID>"+_myUIDb+"</ChapterUID>");
- OutputCodecPrivate(lvl, XmlFile, encodebase64(_PrivateLU,4));
+ OutputCodecPrivate(lvl, XmlFile, _PrivateLU, 4);
// display the UID for the lazy rippers
XmlFile.AddLine(IndentString(lvl)+"<ChapterDisplay>");
lvl++;
@@ -1163,14 +1162,22 @@
return start_time;
}
- void OutputCodecPrivate(int lvl, wxTextFile & XmlFile, const wxString & CodecPrivate, bool bOpenClose = true)
+ wxString encodeHex(const unsigned char * buffer, unsigned int size)
{
+ wxString result;
+ for (unsigned int i=0; i<size; i++)
+ result += wxString::Format("%02X ", buffer[i]);
+ return result;
+ }
+
+ void OutputCodecPrivate(int lvl, wxTextFile & XmlFile, const unsigned char * Buffer, unsigned int BufferSize, 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>");
+ XmlFile.AddLine(IndentString(lvl)+"<ChapterProcessPrivate format=\"hex\">"+encodeHex(Buffer, BufferSize)+"</ChapterProcessPrivate>");
if (bOpenClose) {
lvl--;
XmlFile.AddLine(IndentString(lvl)+"</ChapterProcess>");
@@ -1220,7 +1227,7 @@
XmlFile.AddLine(IndentString(lvl)+"<ChapterProcess>");
lvl++;
- OutputCodecPrivate(lvl, XmlFile, encodebase64(_PrivateFP,4), false);
+ OutputCodecPrivate(lvl, XmlFile, _PrivateFP, 4, false);
// PGC commands
AddCommands(lvl, XmlFile, IfoFile->FirstPlayPGC()->command_tbl);
lvl--;
@@ -1240,7 +1247,7 @@
XmlFile.AddLine(IndentString(lvl)+"<ChapterUID>"+_myUIDa+"</ChapterUID>");
_PrivateVTS[2] = title >> 8;
_PrivateVTS[3] = title & 0xFF;
- OutputCodecPrivate(lvl, XmlFile, encodebase64(_PrivateVTS,4));
+ OutputCodecPrivate(lvl, XmlFile, _PrivateVTS, 4);
uint64_t start_time = HandleLanguageUnit(lvl, XmlFile, *IfoFile, title);
@@ -1291,7 +1298,7 @@
XmlFile.AddLine(IndentString(lvl)+"<ChapterUID>"+_myUIDa+"</ChapterUID>");
_PrivateVTS[2] = title >> 8;
_PrivateVTS[3] = title & 0xFF;
- OutputCodecPrivate(lvl, XmlFile, encodebase64(_PrivateVTS,4));
+ OutputCodecPrivate(lvl, XmlFile, _PrivateVTS, 4);
if (IfoFile->VtsTitles(title) && IfoFile->VtsPGCs(title))
{
@@ -1306,7 +1313,7 @@
_PrivateTT[1] = (i+1) >> 8;
_PrivateTT[2] = (i+1) & 0xFF;
- OutputCodecPrivate(lvl, XmlFile, encodebase64(_PrivateTT,3));
+ OutputCodecPrivate(lvl, XmlFile, _PrivateTT, 3);
// add the PGC that match this PTT
for (int k=0; k<IfoFile->VtsPGCs(title)->nr_of_pgci_srp; k++)