Author: robux4
Date: 2004-09-09 00:30:35 +0400 (Thu, 09 Sep 2004)
New Revision: 767
Modified:
trunk/DvdMenuXtractor/DvdMenuXtractor.cpp
Log:
Add preliminary support for the Video Manager domain that include Language Units
Modified: trunk/DvdMenuXtractor/DvdMenuXtractor.cpp
===================================================================
--- trunk/DvdMenuXtractor/DvdMenuXtractor.cpp 2004-09-08 18:13:18 UTC (rev 766)
+++ trunk/DvdMenuXtractor/DvdMenuXtractor.cpp 2004-09-08 20:30:35 UTC (rev 767)
@@ -792,6 +792,7 @@
// Pre commands
if (command_tbl->nr_of_pre)
{
+ XmlFile.AddLine(IndentString(lvl)+"<!-- Pre commands -->");
XmlFile.AddLine(IndentString(lvl)+"<ChapterProcess>");
lvl++;
XmlFile.AddLine(IndentString(lvl)+"<ChapProcessTime>1</ChapProcessTime>");
@@ -805,6 +806,7 @@
// Cell commands
if (command_tbl->nr_of_cell)
{
+ XmlFile.AddLine(IndentString(lvl)+"<!-- Cell commands -->");
XmlFile.AddLine(IndentString(lvl)+"<ChapterProcess>");
lvl++;
XmlFile.AddLine(IndentString(lvl)+"<ChapProcessTime>1</ChapProcessTime>");
@@ -819,6 +821,7 @@
// Post commands
if (command_tbl->nr_of_post)
{
+ XmlFile.AddLine(IndentString(lvl)+"<!-- Post commands -->");
XmlFile.AddLine(IndentString(lvl)+"<ChapterProcess>");
lvl++;
XmlFile.AddLine(IndentString(lvl)+"<ChapProcessTime>2</ChapProcessTime>");
@@ -833,6 +836,69 @@
}
}
+ static wxString GetPGCType(unsigned char entry_id)
+ {
+ wxString result;
+ result = wxString::Format("0x%02X = ", entry_id);
+ if (entry_id & 0x80)
+ result += "Entry + ";
+ switch (entry_id & ~0x80)
+ {
+ case 2:
+ result += "Title-Menu";
+ break;
+ case 3:
+ result += "Root Menu";
+ break;
+ case 4:
+ result += "Subpicture Menu";
+ break;
+ case 5:
+ result += "Audio Menu";
+ break;
+ case 6:
+ result += "Angle Menu";
+ break;
+ case 7:
+ result += "Chapter Menu";
+ break;
+ default:
+ result += "basic PGC";
+ break;
+ }
+ return result;
+ }
+
+ uint64_t OutputPGC(int lvl, wxTextFile & XmlFile, const pgc_t * pgc, uint64_t start_time, uint16_t pgc_num, unsigned char pgc_type)
+ {
+ static unsigned char _PrivatePGC[] = {0x20, 0x00, 0x00, 0x00};
+
+ 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;
+ XmlFile.AddLine(IndentString(lvl)+"<ChapterProcessPrivate>"+encodebase64(_PrivatePGC,4)+"</ChapterProcessPrivate>");
+ // display the UID for the lazy rippers
+ XmlFile.AddLine(IndentString(lvl)+"<ChapterDisplay>");
+ lvl++;
+ XmlFile.AddLine(IndentString(lvl)+"<ChapterString>PGC type "+GetPGCType(pgc_type)+"</ChapterString>");
+ lvl--;
+ XmlFile.AddLine(IndentString(lvl)+"</ChapterDisplay>");
+
+ // PGC commands
+ AddCommands(lvl, XmlFile, pgc->command_tbl);
+
+ // TODO: handle the PROGRAMS in the PGC
+
+ // TODO: PGC start/end times
+ XmlFile.AddLine(IndentString(lvl)+"<ChapterTimeStart>00:00:00.000000000</ChapterTimeStart>");
+ XmlFile.AddLine(IndentString(lvl)+"<ChapterTimeEnd>00:00:00.000000000</ChapterTimeEnd>");
+ lvl--;
+ return start_time;
+ }
+
void GenerateXMLScript()
{
CellListElem* cle;
@@ -841,7 +907,9 @@
CellMap& cell_map = m_VobParser->GetVobMap();
cell_info_node* cin;
- static unsigned char _PrivateFP[] = {0x30, 0x00};
+ static unsigned char _PrivateFP[] = {0x30, 0x00};
+ static unsigned char _PrivateVM[] = {0x30, 0xC0};
+ static unsigned char _PrivateLU[] = {0x2A, 0x00, 0x00, 0x00};
wxString line;
wxFileConfig *pConfig = (wxFileConfig *)wxConfigBase::Get();
@@ -854,7 +922,7 @@
XmlFile.AddLine("<!-- Matroska chapter file -->");
XmlFile.AddLine("");
- int lvl = 0;
+ int lvl = 0, i,j;
XmlFile.AddLine("<Chapters>");
lvl++;
@@ -890,6 +958,62 @@
lvl--;
}
+ // Language Units
+ if (IfoFile->LanguageUnits() && IfoFile->LanguageUnits()->nr_of_lus)
+ {
+ lvl++;
+ XmlFile.AddLine(IndentString(lvl)+"<!-- Video Manager -->");
+ XmlFile.AddLine(IndentString(lvl)+"<ChapterAtom>");
+ lvl++;
+ wxString _myUIDa = CreateUID();
+ XmlFile.AddLine(IndentString(lvl)+"<ChapterUID>"+_myUIDa+"</ChapterUID>");
+ XmlFile.AddLine(IndentString(lvl)+"<ChapterTimeStart>00:00:00.000000000</ChapterTimeStart>");
+ XmlFile.AddLine(IndentString(lvl)+"<ChapterProcessPrivate>"+encodebase64(_PrivateVM,2)+"</ChapterProcessPrivate>");
+ 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)+"<ChapterTimeStart>00:00:00.000000000</ChapterTimeStart>");
+ 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)
+ {
+ uint64_t timecode = 0;
+ for (j=0; j<_LU.pgcit->nr_of_pgci_srp; j++)
+ {
+ const pgci_srp_t &_PGC_SRP = _LU.pgcit->pgci_srp[j];
+ XmlFile.AddLine(IndentString(lvl)+"<!-- PGC type "+GetPGCType(_PGC_SRP.entry_id)+" -->");
+ XmlFile.AddLine(IndentString(lvl)+"<ChapterAtom>");
+ timecode += OutputPGC(lvl, XmlFile, _PGC_SRP.pgc, timecode, j, _PGC_SRP.entry_id);
+ XmlFile.AddLine(IndentString(lvl)+"</ChapterAtom>");
+ }
+ }
+
+ lvl--;
+ }
+ XmlFile.AddLine(IndentString(lvl)+"</ChapterAtom>");
+ lvl--;
+ XmlFile.AddLine(IndentString(lvl)+"</ChapterAtom>");
+ lvl--;
+ }
+
+
// Write the Video Manager
// Write the Video Title
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.