[matroska] r1020 - trunk/DvdMenuXtractor
[email protected] Sat, 8 Jan 2005 14:05:08 +0300 (MSK)
Newsgroups
gmane.comp.multimedia.matroska.cvs
Message-ID
<[email protected] >
Author: robux4
Date: 2005-01-08 14:05:08 +0300 (Sat, 08 Jan 2005)
New Revision: 1020
Modified:
trunk/DvdMenuXtractor/DvdMenuXtractor.cpp
trunk/DvdMenuXtractor/IFOFile.cpp
trunk/DvdMenuXtractor/IFOFile.h
trunk/DvdMenuXtractor/VobParser.cpp
trunk/DvdMenuXtractor/VobParser.h
Log:
DMX: use the cell lists when extracting content
Modified: trunk/DvdMenuXtractor/DvdMenuXtractor.cpp
===================================================================
--- trunk/DvdMenuXtractor/DvdMenuXtractor.cpp 2005-01-08 10:08:10 UTC (rev 1019)
+++ trunk/DvdMenuXtractor/DvdMenuXtractor.cpp 2005-01-08 11:05:08 UTC (rev 1020)
@@ -737,7 +737,7 @@
m_gaDemuxProgress->SetValue(0);
m_gaDemuxProgress->SetRange(aVobParser.GetPacketCount() >> 8);
- while(aVobParser.ParseNextPacket(*IfoFile))
+ while(aVobParser.ParseNextPacket(*CellsList))
{
m_gaDemuxProgress->SetValue(aVobParser.GetPacketIndex() >> 8);
wxYield();
@@ -899,9 +899,9 @@
continue;
if (cell.block_mode) // multi-angle
- XmlFile.AddLine(IndentString(lvl)+wxString::Format("<!-- Program %sCell CN#%d (%d angles) -->",(cell_num==entry_cell_num)?"Entry ":"", cell_num, cell_num - entry_cell_num + 1));
+ XmlFile.AddLine(IndentString(lvl)+wxString::Format("<!-- Program %sCell CN#%d [%02d.%d] (%d angles) -->",(cell_num==entry_cell_num)?"Entry ":"", cell_num, cell_elt->vobid, cell_elt->cellid, cell_num - entry_cell_num + 1));
else
- XmlFile.AddLine(IndentString(lvl)+wxString::Format("<!-- Program %sCell CN#%d -->",(cell_num==entry_cell_num)?"Entry ":"", cell_num));
+ XmlFile.AddLine(IndentString(lvl)+wxString::Format("<!-- Program %sCell CN#%d [%02d.%d] -->",(cell_num==entry_cell_num)?"Entry ":"", cell_num, cell_elt->vobid, cell_elt->cellid));
if (cell.still_time == 0xFF) {
XmlFile.AddLine(IndentString(lvl)+"<!-- Infinite loop Still Cell -->");
@@ -942,18 +942,16 @@
XmlFile.AddLine(IndentString(lvl)+"</ChapterAtom>");
}
- // PGC start/end times
-// DisplayTime(lvl, XmlFile, start_time, end_time);
lvl--;
+XmlFile.AddLine("<!-- dummy --><ChapterTimeStart>00:00:00.0</ChapterTimeStart>");
XmlFile.AddLine(IndentString(lvl)+"</ChapterAtom>");
return end_time;
}
- uint64_t OutputPGC(int lvl, wxTextFile & XmlFile, const pgc_t * pgc, uint64_t start_time, uint16_t pgc_num, unsigned char pgc_type, const CellsListType & cell_list, const ttu_t * ptts)
+ void OutputPGC(int lvl, wxTextFile & XmlFile, const pgc_t * pgc, uint16_t pgc_num, unsigned char pgc_type, const CellsListType & cell_list, const ttu_t * ptts)
{
static unsigned char _PrivatePGC[] = {0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
static unsigned char _PrivatePTT[] = {0x18, 0x00, 0x00};
- uint64_t st_time = start_time;
XmlFile.AddLine(IndentString(lvl)+wxString::Format("<!-- PGC PGC_%d type %s -->",pgc_num+1,GetPGCType(pgc_type).c_str()));
XmlFile.AddLine(IndentString(lvl)+"<ChapterAtom>");
@@ -1008,9 +1006,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>");
lvl--;
+XmlFile.AddLine("<!-- dummy --><ChapterTimeStart>00:00:00.0</ChapterTimeStart>");
XmlFile.AddLine(IndentString(lvl)+"</ChapterAtom>");
break;
}
@@ -1018,14 +1015,12 @@
}
XmlFile.AddLine(IndentString(lvl)+"<!-- Program PGN#"+wxString::Format("%d",i+1)+" in this PGC -->");
- st_time = OutputProgram(lvl, XmlFile, pgc, i, cell_list);
+ OutputProgram(lvl, XmlFile, pgc, i, cell_list);
}
- // PGC start/end times
-// DisplayTime(lvl, XmlFile, start_time, st_time);
lvl--;
+XmlFile.AddLine("<!-- dummy --><ChapterTimeStart>00:00:00.0</ChapterTimeStart>");
XmlFile.AddLine(IndentString(lvl)+"</ChapterAtom>");
- return st_time;
}
// Macro to convert Binary Coded Decimal to Decimal
@@ -1088,11 +1083,10 @@
XmlFile.AddLine(IndentString(lvl)+"<ChapterTimeEnd>"+TimeFormat(end_time)+"</ChapterTimeEnd>");
}
- uint64_t HandleLanguageUnit(int lvl, wxTextFile & XmlFile, uint64_t start_time, const IFOFile & _ifo, int title)
+ void HandleLanguageUnit(int lvl, wxTextFile & XmlFile, const IFOFile & _ifo, int title)
{
static unsigned char _PrivateLU[] = {0x2A, 0x00, 0x00, 0x00};
- uint64_t timecode_startB = start_time, timecode_endB = start_time;
for (int i=0 ;i<_ifo.LanguageUnits(title)->nr_of_lus; i++)
{
XmlFile.AddLine(IndentString(lvl)+"<!-- Language Units -->");
@@ -1120,15 +1114,13 @@
for (int j=0; j<_LU.pgcit->nr_of_pgci_srp; j++)
{
const pgci_srp_t &_PGC_SRP = _LU.pgcit->pgci_srp[j];
- timecode_endB = OutputPGC(lvl, XmlFile, _PGC_SRP.pgc, timecode_endB, j, _PGC_SRP.entry_id, _ifo.CellsList(title, true), NULL);
+ OutputPGC(lvl, XmlFile, _PGC_SRP.pgc, j, _PGC_SRP.entry_id, _ifo.CellsList(title, true), NULL);
}
}
- DisplayTime(lvl, XmlFile, timecode_startB, timecode_endB);
lvl--;
+XmlFile.AddLine("<!-- dummy --><ChapterTimeStart>00:00:00.0</ChapterTimeStart>");
XmlFile.AddLine(IndentString(lvl)+"</ChapterAtom>");
- timecode_startB = timecode_endB;
}
- return timecode_endB;
}
void OutputCodecPrivate(int lvl, wxTextFile & XmlFile, const wxString & CodecPrivate, bool bOpenClose = true)
@@ -1169,7 +1161,6 @@
XmlFile.AddLine("");
int lvl = 0;
- uint64_t timecode_startA = 0, timecode_endA = 0;
XmlFile.AddLine("<Chapters>");
lvl++;
@@ -1187,7 +1178,7 @@
wxString _myUID = CreateUID();
XmlFile.AddLine(IndentString(lvl)+"<ChapterUID>"+_myUID+"</ChapterUID>");
// the First Play PGC has no cell and no time
- DisplayTime(lvl, XmlFile, timecode_startA, timecode_endA);
+ DisplayTime(lvl, XmlFile, 0, 0);
// display the UID for the lazy rippers
XmlFile.AddLine(IndentString(lvl)+"<ChapterDisplay>");
lvl++;
@@ -1203,11 +1194,10 @@
lvl--;
XmlFile.AddLine(IndentString(lvl)+"</ChapterProcess>");
lvl--;
+XmlFile.AddLine("<!-- dummy --><ChapterTimeStart>00:00:00.0</ChapterTimeStart>");
XmlFile.AddLine(IndentString(lvl)+"</ChapterAtom>");
}
- timecode_startA = timecode_endA;
-
// Language Units
if (IfoFile->FirstPlayPGC() && IfoFile->LanguageUnits(0) && IfoFile->LanguageUnits(0)->nr_of_lus)
{
@@ -1218,10 +1208,10 @@
XmlFile.AddLine(IndentString(lvl)+"<ChapterUID>"+_myUIDa+"</ChapterUID>");
OutputCodecPrivate(lvl, XmlFile, encodebase64(_PrivateVM,4));
- timecode_endA = HandleLanguageUnit(lvl, XmlFile, timecode_startA, *IfoFile, 0);
+ HandleLanguageUnit(lvl, XmlFile, *IfoFile, 0);
- DisplayTime(lvl, XmlFile, timecode_startA, timecode_endA);
lvl--;
+XmlFile.AddLine("<!-- dummy --><ChapterTimeStart>00:00:00.0</ChapterTimeStart>");
XmlFile.AddLine(IndentString(lvl)+"</ChapterAtom>");
}
lvl--;
@@ -1233,8 +1223,6 @@
// Write the Video Title Set
for (int title=1; title <= IfoFile->NumberOfTitles(); title++)
{
- timecode_endA = timecode_startA = 0; // each separate DVD domain has its own standalone segment
-
// VTS Menu
if (IfoFile->LanguageUnits(title) && IfoFile->LanguageUnits(title)->nr_of_lus)
{
@@ -1261,10 +1249,10 @@
_PrivateVTS[3] = title & 0xFF;
OutputCodecPrivate(lvl, XmlFile, encodebase64(_PrivateVTS,4));
- timecode_endA = HandleLanguageUnit(lvl, XmlFile, timecode_startA, *IfoFile, title);
+ HandleLanguageUnit(lvl, XmlFile, *IfoFile, title);
- DisplayTime(lvl, XmlFile, timecode_startA, timecode_endA);
lvl--;
+XmlFile.AddLine("<!-- dummy --><ChapterTimeStart>00:00:00.0</ChapterTimeStart>");
XmlFile.AddLine(IndentString(lvl)+"</ChapterAtom>");
lvl--;
@@ -1274,8 +1262,6 @@
XmlFile.Write();
}
- timecode_endA = timecode_startA = 0; // each separate DVD domain has its own standalone segment
-
// VTS content
wxString Filename = pConfig->Read(OutputDirSaved,"") + wxString::Format("VTS%02d_menu.xml", title);
wxTextFile XmlFile(Filename);
@@ -1302,7 +1288,6 @@
if (IfoFile->VtsTitles(title) && IfoFile->VtsPGCs(title))
{
- uint64_t timecode_startB = timecode_endA, timecode_endB = timecode_endA;
for (int i=0; i<IfoFile->VtsTitles(title)->nr_of_srpts; i++)
{
XmlFile.AddLine(IndentString(lvl)+wxString::Format("<!-- Title TTU_%d -->",i+1));
@@ -1316,27 +1301,23 @@
OutputCodecPrivate(lvl, XmlFile, encodebase64(_PrivateTT,3));
// add the PGC that match this PTT
- uint64_t timecode_startC = timecode_startB, timecode_endC = timecode_startB;
for (int k=0; k<IfoFile->VtsPGCs(title)->nr_of_pgci_srp; k++)
{
if ((IfoFile->VtsPGCs(title)->pgci_srp[k].entry_id & 0x7F) == i+1)
{
- timecode_startC = OutputPGC(lvl, XmlFile,
- IfoFile->VtsPGCs(title)->pgci_srp[k].pgc, timecode_startC, k, 0, IfoFile->CellsList(title, false), &IfoFile->VtsTitles(title)->title[i]);
+ OutputPGC(lvl, XmlFile,
+ IfoFile->VtsPGCs(title)->pgci_srp[k].pgc, k, 0, IfoFile->CellsList(title, false), &IfoFile->VtsTitles(title)->title[i]);
}
}
- timecode_endB = timecode_startC;
- DisplayTime(lvl, XmlFile, timecode_startB, timecode_endB);
lvl--;
+XmlFile.AddLine("<!-- dummy --><ChapterTimeStart>00:00:00.0</ChapterTimeStart>");
XmlFile.AddLine(IndentString(lvl)+"</ChapterAtom>");
- timecode_startB = timecode_endB;
}
- timecode_endA = timecode_startB;
}
- DisplayTime(lvl, XmlFile, timecode_startA, timecode_endA);
lvl--;
+XmlFile.AddLine("<!-- dummy --><ChapterTimeStart>00:00:00.0</ChapterTimeStart>");
XmlFile.AddLine(IndentString(lvl)+"</ChapterAtom>");
lvl--;
Modified: trunk/DvdMenuXtractor/IFOFile.cpp
===================================================================
--- trunk/DvdMenuXtractor/IFOFile.cpp 2005-01-08 10:08:10 UTC (rev 1019)
+++ trunk/DvdMenuXtractor/IFOFile.cpp 2005-01-08 11:05:08 UTC (rev 1020)
@@ -246,10 +246,10 @@
cle->isStill = (srp.pgc->cell_playback[k].still_time > 0);
if (cle->isStill)
{
- wxLogWarning("Still cell (%d.%d) detected. Assuming there is just one frame.", vob_id, cell_id);
if (srp.pgc->cell_playback[k].still_time == 0xFF) {
- wxLogWarning("Cell %d.%d with still infinite duration !", vob_id, cell_id);
+ wxLogWarning("Still cell (%d.%d) detected with infinite duration !", vob_id, cell_id);
} else {
+ wxLogWarning("Still cell (%d.%d) detected. Assuming there is just one frame.", vob_id, cell_id);
cle->nb_frames = 1; // maybe not true ?
cle->frame_dur = srp.pgc->cell_playback[k].still_time * 1000.0 / cle->nb_frames;
}
@@ -272,16 +272,13 @@
if (!ifoc)
return NULL;
- ifo_handle_t &_ifo = ifoc->Handle();
- // _todo_
-
if (language)
{
- return NULL;
+ return &ifoc->m_langCellsList;
}
else
{
- return NULL;
+ return &ifoc->m_CellsList;
}
}
@@ -296,30 +293,6 @@
// ----------------------------------------------------------------------------
-CellListElem* IFOFile::IsACandidateCell(const unsigned int vobid, const unsigned int cellid)
-{
- CellsListType::Node *node;
- CellListElem* cle;
-
- return NULL; // _todo_
-#if 0
- node = m_CellsList.GetFirst();
-
- while(node)
- {
- cle = node->GetData();
- if( cle->vobid == vobid && cle->cellid == cellid)
- {
- return cle;
- }
- node = node->GetNext();
- }
- return NULL;
-#endif
-}
-
-// ----------------------------------------------------------------------------
-
const AudioTrackList & IFOFile::AudioTracks(unsigned int title, bool language) const
{
IfoContent *_ifo = m_ifos.GetIfoTitle(title);
@@ -471,7 +444,6 @@
m_langSubs.push_back(&vmgi_mat.vmgm_subp_attr);
}
- // _todo_ handle the list of menu cells with their ID and sectors
CellsHash.clear();
if (m_handle->pgci_ut && m_handle->menu_c_adt)
{
@@ -657,11 +629,16 @@
const CellListElem * CellsListType::Get(const cell_position_t & position) const
{
+ return Get(position.vob_id_nr, position.cell_nr);
+}
+
+CellListElem * CellsListType::Get(uint16_t vob_id, uint8_t cell_id) const
+{
CellsListType::Node *node = GetFirst();
while (node)
{
CellListElem *cell = node->GetData();
- if (cell->cellid == position.cell_nr && cell->vobid == position.vob_id_nr)
+ if (cell->cellid == cell_id && cell->vobid == vob_id)
return cell;
node = node->GetNext();
}
Modified: trunk/DvdMenuXtractor/IFOFile.h
===================================================================
--- trunk/DvdMenuXtractor/IFOFile.h 2005-01-08 10:08:10 UTC (rev 1019)
+++ trunk/DvdMenuXtractor/IFOFile.h 2005-01-08 11:05:08 UTC (rev 1020)
@@ -26,6 +26,7 @@
{
public:
const CellListElem * Get(const cell_position_t & position) const;
+ CellListElem * Get(uint16_t vob_id, uint8_t cell_id) const;
void Arrange();
};
@@ -86,7 +87,6 @@
void AddLanguageToSelection(const int languageNumber);
void ClearLanguageSelection();
const CellsListType* GetCellsList(unsigned int title, bool language);
- CellListElem* IsACandidateCell(const unsigned int vobid, const unsigned int cellid);
virtual ~IFOFile();
const pgc_t *FirstPlayPGC() const;
const pgci_ut_t *LanguageUnits(unsigned int title) const;
Modified: trunk/DvdMenuXtractor/VobParser.cpp
===================================================================
--- trunk/DvdMenuXtractor/VobParser.cpp 2005-01-08 10:08:10 UTC (rev 1019)
+++ trunk/DvdMenuXtractor/VobParser.cpp 2005-01-08 11:05:08 UTC (rev 1020)
@@ -186,7 +186,7 @@
// ----------------------------------------------------------------------------
-bool VobParser::ParseNextPacket(IFOFile & IfoFile)
+bool VobParser::ParseNextPacket(const CellsListType & Cells)
{
if(GetNextPacket())
{
@@ -241,7 +241,7 @@
}
}
if (IsNewCell()) {
- CellListElem* cell = IfoFile.IsACandidateCell(GetVobID(), GetCellID());
+ CellListElem* cell = Cells.Get(GetVobID(), GetCellID());
if (cell != NULL)
{
@@ -764,14 +764,14 @@
// ----------------------------------------------------------------------------
-uint8_t VobParser::GetVobID() const
+inline uint8_t VobParser::GetVobID() const
{
return m_dsi.vobu_vob_idn;
}
// ----------------------------------------------------------------------------
-uint8_t VobParser::GetCellID() const
+inline uint8_t VobParser::GetCellID() const
{
return m_dsi.vobu_c_idn;
}
Modified: trunk/DvdMenuXtractor/VobParser.h
===================================================================
--- trunk/DvdMenuXtractor/VobParser.h 2005-01-08 10:08:10 UTC (rev 1019)
+++ trunk/DvdMenuXtractor/VobParser.h 2005-01-08 11:05:08 UTC (rev 1020)
@@ -543,18 +543,19 @@
// ============================================================================
class IFOFile;
+class CellsListType;
class VobParser
{
public:
VobParser(const char* dirname, int16_t title, bool language);
void Reset();
- bool ParseNextPacket(IFOFile & IfoFile);
+ bool ParseNextPacket(const CellsListType & Cells);
uint32_t GetPacketCount() const;
uint32_t GetPacketIndex() const;
char* GetCurrentPacketData() const;
- uint8_t GetVobID() const;
- uint8_t GetCellID() const;
+ inline uint8_t GetVobID() const;
+ inline uint8_t GetCellID() const;
bool IsNewCell();
virtual ~VobParser();
inline CompositeDemuxWriter & GetDemuxer()