[matroska] r1045 - trunk/DvdMenuXtractor
[email protected] Wed, 19 Jan 2005 16:57:56 +0300 (MSK)
Newsgroups
gmane.comp.multimedia.matroska.cvs
Message-ID
<[email protected] >
Author: robux4
Date: 2005-01-19 16:57:56 +0300 (Wed, 19 Jan 2005)
New Revision: 1045
Modified:
trunk/DvdMenuXtractor/DvdMenuXtractor.cpp
Log:
DMX: code factorisation
Modified: trunk/DvdMenuXtractor/DvdMenuXtractor.cpp
===================================================================
--- trunk/DvdMenuXtractor/DvdMenuXtractor.cpp 2005-01-18 21:24:23 UTC (rev 1044)
+++ trunk/DvdMenuXtractor/DvdMenuXtractor.cpp 2005-01-19 13:57:56 UTC (rev 1045)
@@ -1186,7 +1186,7 @@
return start_time;
}
- wxString encodeHex(const unsigned char * buffer, unsigned int size)
+ wxString encodeHex(const unsigned char * buffer, unsigned int size) const
{
wxString result;
for (unsigned int i=0; i<size; i++)
@@ -1194,7 +1194,7 @@
return result;
}
- void OutputCodecPrivate(int lvl, wxTextFile & XmlFile, const unsigned char * Buffer, unsigned int BufferSize, bool bOpenClose = true)
+ void OutputCodecPrivate(int lvl, wxTextFile & XmlFile, const unsigned char * Buffer, unsigned int BufferSize, bool bOpenClose = true) const
{
if (bOpenClose) {
XmlFile.AddLine(IndentString(lvl)+"<ChapterProcess>");
@@ -1208,15 +1208,8 @@
}
}
- bool GenerateXMLScriptMenu(const wxString & Filename, uint16_t title)
+ void GenerateXMLScriptInfo(const wxString & Filename, uint16_t title, const wxString & editionUID) const
{
- static unsigned char _PrivateFP[] = {0x30, 0x00, 0x00, 0x00};
- static unsigned char _PrivateVM[] = {0x30, 0xC0, 0x00, 0x00};
- static unsigned char _PrivateVTS[] = {0x30, 0x80, 0x00, 0x00};
- static unsigned char _PrivateTT[] = {0x28, 0x00, 0x00};
-
- wxString line, editionUID = CreateUID();
-
// segment file
wxTextFile XmlFileSeg(Filename + InfoSuffix);
XmlFileSeg.Create();
@@ -1239,7 +1232,21 @@
lvl--;
XmlFileSeg.AddLine("</Info>");
XmlFileSeg.Write();
+ }
+
+ bool GenerateXMLScriptMenu(const wxString & Filename, uint16_t title)
+ {
+ static unsigned char _PrivateFP[] = {0x30, 0x00, 0x00, 0x00};
+ static unsigned char _PrivateVM[] = {0x30, 0xC0, 0x00, 0x00};
+ static unsigned char _PrivateVTS[] = {0x30, 0x80, 0x00, 0x00};
+ static unsigned char _PrivateTT[] = {0x28, 0x00, 0x00};
+ wxString line, editionUID = CreateUID();
+
+ GenerateXMLScriptInfo(Filename, title, editionUID);
+
+ int lvl = 0;
+
// chapter file
wxTextFile XmlFile(Filename + ChapterSuffix);
XmlFile.Create();
@@ -1320,29 +1327,11 @@
uint64_t start_timeH = uint64_t(-1);
wxString line, editionUID = CreateUID();
- // segment file
- wxTextFile XmlFileSeg(Filename + InfoSuffix);
- XmlFileSeg.Create();
- XmlFileSeg.AddLine("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>");
- XmlFileSeg.AddLine("<!DOCTYPE Chapters SYSTEM \"matroskainfos.dtd\">");
- XmlFileSeg.AddLine("");
+ GenerateXMLScriptInfo(Filename, title, editionUID);
+
int lvl = 0;
- XmlFileSeg.AddLine("<Info>");
- lvl++;
- XmlFileSeg.AddLine(IndentString(lvl)+"<SegmentFamily format=\"hex\">" + encodeHex(m_FamilyUID, 16) + "</SegmentFamily>");
- XmlFileSeg.AddLine(IndentString(lvl)+"<ChapterLink>");
- lvl++;
- XmlFileSeg.AddLine(IndentString(lvl)+"<ChapterLinkEditionUID>"+editionUID+"</ChapterLinkEditionUID>");
- XmlFileSeg.AddLine(IndentString(lvl)+"<ChapterLinkCodec>1</ChapterLinkCodec>");
- XmlFileSeg.AddLine(IndentString(lvl)+wxString::Format("<ChapterLinkID format=\"hex\">%02x 01</ChapterLinkID>", title));
- lvl--;
- XmlFileSeg.AddLine(IndentString(lvl)+"</ChapterLink>");
- lvl--;
- XmlFileSeg.AddLine("</Info>");
- XmlFileSeg.Write();
-
// chapter file
wxTextFile XmlFile(Filename + ChapterSuffix);
XmlFile.Create();