Author: robux4
Date: 2004-09-21 00:41:42 +0400 (Tue, 21 Sep 2004)
New Revision: 832
Modified:
trunk/DvdMenuXtractor/DvdMenuXtractor.cpp
trunk/DvdMenuXtractor/IFOFile.cpp
trunk/DvdMenuXtractor/IFOFile.h
Log:
handle multiple VTS
Modified: trunk/DvdMenuXtractor/DvdMenuXtractor.cpp
===================================================================
--- trunk/DvdMenuXtractor/DvdMenuXtractor.cpp 2004-09-19 07:34:00 UTC (rev 831)
+++ trunk/DvdMenuXtractor/DvdMenuXtractor.cpp 2004-09-20 20:41:42 UTC (rev 832)
@@ -1051,15 +1051,21 @@
void GenerateXMLScript()
{
+ if (!IfoFile)
+ {
+ myfprintf(stderr, "No IFO file loaded !");
+ return;
+ }
+
CellListElem* cle;
CellsListType::Node *node;
const CellsListType *CellsList = IfoFile->GetCellsList();
CellMap& cell_map = m_VobParser->GetVobMap();
cell_info_node* cin;
- static unsigned char _PrivateFP[] = {0x30, 0x00};
- static unsigned char _PrivateVM[] = {0x30, 0xC0};
- static unsigned char _PrivateVTS[] = {0x30, 0x80};
+ 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;
@@ -1084,7 +1090,7 @@
XmlFile.AddLine(IndentString(lvl)+"<EditionProcessed>1</EditionProcessed>"); // DVD style menu
// Write the first play PGC
- if (IfoFile && IfoFile->FirstPlayPGC())
+ if (IfoFile->FirstPlayPGC())
{
XmlFile.AddLine(IndentString(lvl)+"<!-- First Play PGC -->");
XmlFile.AddLine(IndentString(lvl)+"<ChapterAtom>");
@@ -1100,7 +1106,7 @@
lvl--;
XmlFile.AddLine(IndentString(lvl)+"</ChapterDisplay>");
- XmlFile.AddLine(IndentString(lvl)+"<ChapterProcessPrivate>"+encodebase64(_PrivateFP,2)+"</ChapterProcessPrivate>");
+ XmlFile.AddLine(IndentString(lvl)+"<ChapterProcessPrivate>"+encodebase64(_PrivateFP,4)+"</ChapterProcessPrivate>");
// PGC commands
AddCommands(lvl, XmlFile, IfoFile->FirstPlayPGC()->command_tbl);
lvl--;
@@ -1110,14 +1116,14 @@
timecode_startA = timecode_endA;
// Language Units
- if (IfoFile && IfoFile->FirstPlayPGC() && IfoFile->LanguageUnits(0) && IfoFile->LanguageUnits(0)->nr_of_lus)
+ if (IfoFile->FirstPlayPGC() && IfoFile->LanguageUnits(0) && IfoFile->LanguageUnits(0)->nr_of_lus)
{
XmlFile.AddLine("\n"+IndentString(lvl)+"<!-- Video Manager -->");
XmlFile.AddLine(IndentString(lvl)+"<ChapterAtom>");
lvl++;
wxString _myUIDa = CreateUID();
XmlFile.AddLine(IndentString(lvl)+"<ChapterUID>"+_myUIDa+"</ChapterUID>");
- XmlFile.AddLine(IndentString(lvl)+"<ChapterProcessPrivate>"+encodebase64(_PrivateVM,2)+"</ChapterProcessPrivate>");
+ XmlFile.AddLine(IndentString(lvl)+"<ChapterProcessPrivate>"+encodebase64(_PrivateVM,4)+"</ChapterProcessPrivate>");
timecode_endA = HandleLanguageUnit(lvl, XmlFile, timecode_startA, *IfoFile, 0);
@@ -1129,26 +1135,28 @@
timecode_startA = timecode_endA;
// Write the Video Title Set
-// if (MovieFile)
+ for (int title=1; title <= IfoFile->NumberOfTitles(); title++)
{
XmlFile.AddLine("\n"+IndentString(lvl)+"<!-- Video Title Set -->");
XmlFile.AddLine(IndentString(lvl)+"<ChapterAtom>");
lvl++;
wxString _myUIDa = CreateUID();
XmlFile.AddLine(IndentString(lvl)+"<ChapterUID>"+_myUIDa+"</ChapterUID>");
- XmlFile.AddLine(IndentString(lvl)+"<ChapterProcessPrivate>"+encodebase64(_PrivateVTS,2)+"</ChapterProcessPrivate>");
+ _PrivateVTS[2] = title >> 8;
+ _PrivateVTS[3] = title & 0xFF;
+ XmlFile.AddLine(IndentString(lvl)+"<ChapterProcessPrivate>"+encodebase64(_PrivateVTS,4)+"</ChapterProcessPrivate>");
// VTS Menu
- if (IfoFile->LanguageUnits(1) && IfoFile->LanguageUnits(1)->nr_of_lus)
+ if (IfoFile->LanguageUnits(title) && IfoFile->LanguageUnits(title)->nr_of_lus)
{
timecode_endA = HandleLanguageUnit(lvl, XmlFile, timecode_startA, *IfoFile, 1);
}
// VTS content
- if (IfoFile->VtsTitles() && IfoFile->VtsPGCs())
+ if (IfoFile->VtsTitles(title) && IfoFile->VtsPGCs(title))
{
uint64_t timecode_startB = timecode_endA, timecode_endB = timecode_endA;
- for (int i=0; i<IfoFile->VtsTitles()->nr_of_srpts; i++)
+ for (int i=0; i<IfoFile->VtsTitles(title)->nr_of_srpts; i++)
{
XmlFile.AddLine(IndentString(lvl)+wxString::Format("<!-- Title TTU_%d -->",i+1));
XmlFile.AddLine(IndentString(lvl)+"<ChapterAtom>");
@@ -1162,12 +1170,12 @@
// add the PGC that match this PTT
uint64_t timecode_startC = timecode_startB, timecode_endC = timecode_startB;
- for (int k=0; k<IfoFile->VtsPGCs()->nr_of_pgci_srp; k++)
+ for (int k=0; k<IfoFile->VtsPGCs(title)->nr_of_pgci_srp; k++)
{
- if ((IfoFile->VtsPGCs()->pgci_srp[k].entry_id & 0x7F) == i+1)
+ if ((IfoFile->VtsPGCs(title)->pgci_srp[k].entry_id & 0x7F) == i+1)
{
timecode_startC = OutputPGC(lvl, XmlFile,
- IfoFile->VtsPGCs()->pgci_srp[k].pgc, timecode_startC, k, 0, &IfoFile->VtsTitles()->title[i]);
+ IfoFile->VtsPGCs(title)->pgci_srp[k].pgc, timecode_startC, k, 0, &IfoFile->VtsTitles(title)->title[i]);
}
}
timecode_endB = timecode_startC;
@@ -1184,7 +1192,7 @@
lvl--;
XmlFile.AddLine(IndentString(lvl)+"</ChapterAtom>");
timecode_startA = timecode_endA;
- }
+ }
lvl--;
XmlFile.AddLine(IndentString(lvl)+"</EditionEntry>");
@@ -1210,7 +1218,7 @@
m_lbStep->SetLabel(StepString);
m_txtDemuxLog->AppendText(StepString+"\n");
m_lbStep->Update();
- SplitAndDemux();
+// SplitAndDemux();
StepString = StepString.Format(StepStringFormat, Step++, NbsStep, "Converting still to bitmap");
m_lbStep->SetLabel(StepString);
Modified: trunk/DvdMenuXtractor/IFOFile.cpp
===================================================================
--- trunk/DvdMenuXtractor/IFOFile.cpp 2004-09-19 07:34:00 UTC (rev 831)
+++ trunk/DvdMenuXtractor/IFOFile.cpp 2004-09-20 20:41:42 UTC (rev 832)
@@ -9,6 +9,7 @@
#include "wx/listimpl.cpp"
//WX_DEFINE_LIST(ButtonsListType);
WX_DEFINE_LIST(CellsListType);
+WX_DEFINE_LIST(IfoHandleList);
// ----------------------------------------------------------------------------
@@ -45,10 +46,17 @@
{
throw IFOInvalidFileFormatException();
}
- m_ifo_0 = ifoOpen(m_dvd,0);
- m_ifo_1 = ifoOpen(m_dvd,1);
- if (!m_ifo_0 || !m_ifo_1)
+ m_ifos.Append(ifoOpen(m_dvd,0));
+
+ if (m_ifos.GetCount() && m_ifos.Item(0)->GetData()->vmgi_mat)
{
+ for (int i=1; i<=m_ifos.Item(0)->GetData()->vmgi_mat->vmg_nr_of_title_sets; i++)
+ {
+ m_ifos.Append(ifoOpen(m_dvd,i));
+ }
+ }
+ if (m_ifos.GetCount() < 2)
+ {
throw IFOInvalidFileFormatException();
}
ClearLanguageSelection();
@@ -58,14 +66,8 @@
IFOFile::~IFOFile()
{
- if(m_ifo_0)
- {
- ifoClose(m_ifo_0);
- }
- if (m_ifo_1)
- {
- ifoClose(m_ifo_1);
- }
+ for (int i=0; i<m_ifos.GetCount(); i++)
+ ifoClose(m_ifos.Item(i)->GetData());
if (m_dvd)
{
DVDClose(m_dvd);
@@ -79,9 +81,9 @@
{
m_languageList.Clear();
- for(int i=0; i < m_ifo_0->pgci_ut->nr_of_lus; i++)
+ for(int i=0; i < m_ifos.Item(0)->GetData()->pgci_ut->nr_of_lus; i++)
{
- pgci_lu_t* lu = &m_ifo_0->pgci_ut->lu[i];
+ pgci_lu_t* lu = &m_ifos.Item(0)->GetData()->pgci_ut->lu[i];
m_languageList.Add(DecodeLanguage(lu->lang_code));
}
@@ -100,7 +102,7 @@
void IFOFile::ClearLanguageSelection()
{
- for(int i = 0; i < m_ifo_0->pgci_ut->nr_of_lus; i++)
+ for(int i = 0; i < m_ifos.Item(0)->GetData()->pgci_ut->nr_of_lus; i++)
{
m_SelectionTab[i] = 0;
}
@@ -109,8 +111,8 @@
// ----------------------------------------------------------------------------
const pgc_t *IFOFile::FirstPlayPGC() const
-{
if (m_ifo_0)
- return m_ifo_0->first_play_pgc;
+{
if (m_ifos.Item(0))
+ return m_ifos.Item(0)->GetData()->first_play_pgc;
else
return NULL;
}
@@ -119,42 +121,48 @@
const pgci_ut_t *IFOFile::LanguageUnits(int title) const
{
- if (title == 0)
+ if (title < m_ifos.GetCount())
{
- if (m_ifo_0)
- return m_ifo_0->pgci_ut;
+ if (m_ifos.Item(title))
+ return m_ifos.Item(title)->GetData()->pgci_ut;
}
- else
- {
- if (m_ifo_1)
- return m_ifo_1->pgci_ut;
- }
return NULL;
}
// ----------------------------------------------------------------------------
-const vts_ptt_srpt_t *IFOFile::VtsTitles() const
+const vts_ptt_srpt_t *IFOFile::VtsTitles(int title) const
{
- if (m_ifo_1)
- return m_ifo_1->vts_ptt_srpt;
- else
- return NULL;
+ if (title && title < m_ifos.GetCount())
+ {
+ return m_ifos.Item(title)->GetData()->vts_ptt_srpt;
+ }
+ return NULL;
}
// ----------------------------------------------------------------------------
-const pgcit_t *IFOFile::VtsPGCs() const
+const pgcit_t *IFOFile::VtsPGCs(int title) const
{
- if (m_ifo_1)
- return m_ifo_1->vts_pgcit;
- else
- return NULL;
+ if (title && title < m_ifos.GetCount())
+ {
+ return m_ifos.Item(title)->GetData()->vts_pgcit;
+ }
+ return NULL;
}
// ----------------------------------------------------------------------------
+const int16_t IFOFile::NumberOfTitles() const
+{
+ if (m_ifos.Item(0) && m_ifos.Item(0)->GetData()->vmgi_mat)
+ return m_ifos.Item(0)->GetData()->vmgi_mat->vmg_nr_of_title_sets;
+ return 0;
+}
+
+// ----------------------------------------------------------------------------
+
// declare a hash map with int keys and CellListElem* values
WX_DECLARE_HASH_MAP( int, CellListElem*, wxIntegerHash, wxIntegerEqual, CellsHashType );
#define MAKE_CELLS_KEY(__cell_elem__) ((__cell_elem__->vobid << 8) | __cell_elem__->cellid)
@@ -178,11 +186,11 @@
CellsHashType CellsHash;
CellListElem* cle;
- for(int i = 0; i < m_ifo_0->pgci_ut->nr_of_lus; i++)
+ for(int i = 0; i < m_ifos.Item(0)->GetData()->pgci_ut->nr_of_lus; i++)
{
if(m_SelectionTab[i] == 1)
{
- pgci_lu_t* lu = &m_ifo_0->pgci_ut->lu[i];
+ pgci_lu_t* lu = &m_ifos.Item(0)->GetData()->pgci_ut->lu[i];
for(int j=0; j < lu->pgcit->nr_of_pgci_srp; j++)
{
Modified: trunk/DvdMenuXtractor/IFOFile.h
===================================================================
--- trunk/DvdMenuXtractor/IFOFile.h 2004-09-19 07:34:00 UTC (rev 831)
+++ trunk/DvdMenuXtractor/IFOFile.h 2004-09-20 20:41:42 UTC (rev 832)
@@ -31,6 +31,8 @@
} CellListElem;
WX_DECLARE_LIST(CellListElem, CellsListType);
+WX_DECLARE_LIST(ifo_handle_t, IfoHandleList);
+
// ----------------------------------------------------------------------------
class IFOFile
@@ -45,12 +47,12 @@
virtual ~IFOFile();
const pgc_t *FirstPlayPGC() const;
const pgci_ut_t *LanguageUnits(int title) const;
- const vts_ptt_srpt_t *VtsTitles() const;
- const pgcit_t *VtsPGCs() const;
+ const vts_ptt_srpt_t *VtsTitles(int title) const;
+ const pgcit_t *VtsPGCs(int title) const;
+ const int16_t NumberOfTitles() const;
private:
- ifo_handle_t* m_ifo_0;
- ifo_handle_t* m_ifo_1;
+ IfoHandleList m_ifos;
dvd_reader_t* m_dvd;
wxArrayString m_languageList;
CellsListType m_cellsList;
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.