[matroska] r890 - trunk/DvdMenuXtractor
[email protected] Sun, 17 Oct 2004 19:24:05 +0400 (MSD)
Newsgroups
gmane.comp.multimedia.matroska.cvs
Message-ID
<[email protected] >
Author: robux4
Date: 2004-10-17 19:24:05 +0400 (Sun, 17 Oct 2004)
New Revision: 890
Modified:
trunk/DvdMenuXtractor/DvdMenuXtractor.cpp
trunk/DvdMenuXtractor/IFOFile.cpp
trunk/DvdMenuXtractor/MPEG2Decoder.cpp
trunk/DvdMenuXtractor/VobParser.cpp
trunk/DvdMenuXtractor/VobParser.h
Log:
extraction somehow working again
Modified: trunk/DvdMenuXtractor/DvdMenuXtractor.cpp
===================================================================
--- trunk/DvdMenuXtractor/DvdMenuXtractor.cpp 2004-10-17 14:20:25 UTC (rev 889)
+++ trunk/DvdMenuXtractor/DvdMenuXtractor.cpp 2004-10-17 15:24:05 UTC (rev 890)
@@ -528,10 +528,11 @@
return _VobParser;
}
- void SplitAndDemux(VobParser & aVobParser)
+ void SplitAndDemux(VobParser & aVobParser, int16_t title)
{
CompositeDemuxWriter *demuxer = NULL;
wxString newFilename;
+ const CellsListType *CellsList = IfoFile->GetCellsList();
aVobParser.Reset();
@@ -546,8 +547,8 @@
{
if(IfoFile->IsACandidateCell(aVobParser.GetVobID(),aVobParser.GetCellID()))
{
- newFilename = newFilename.Format("cell_V%03d_C%02d",
- aVobParser.GetVobID(), aVobParser.GetCellID());
+ newFilename = newFilename.Format("cell_T%02d_V%03d_C%02d",
+ title, aVobParser.GetVobID(), aVobParser.GetCellID());
m_txtDemuxLog->AppendText("Processing " + newFilename + "\n");
@@ -576,7 +577,7 @@
}
}
- void ConvertStillToBMP(void)
+ void ConvertStillToBMP(int16_t title)
{
wxString FilenameBase;
CellListElem* cle;
@@ -596,8 +597,8 @@
cle = node->GetData();
if(cle->isStill)
{
- FilenameBase = FilenameBase.Format("cell_V%03d_C%02d",
- cle->vobid, cle->cellid);
+ FilenameBase = FilenameBase.Format("cell_T%02d_V%03d_C%02d",
+ title, cle->vobid, cle->cellid);
m_txtDemuxLog->AppendText("Converting " + FilenameBase + ".m2v to "+FilenameBase+".bmp ...\n");
BMPWriter->SetFilename(bmpDirectory+FilenameBase+".bmp");
mpeg2decoder->ProcessFile(m2vDirectory+FilenameBase+".m2v");
@@ -610,7 +611,7 @@
delete mpeg2decoder;
}
- void ConvertAudioToWAV(void)
+ void ConvertAudioToWAV(int16_t title)
{
wxString FilenameBase;
CellListElem* cle;
@@ -631,8 +632,8 @@
cle = node->GetData();
if(!cle->isStill)
{
- FilenameBase = FilenameBase.Format("cell_V%03d_C%02d",
- cle->vobid, cle->cellid);
+ FilenameBase = FilenameBase.Format("cell_T%02d_V%03d_C%02d",
+ title, cle->vobid, cle->cellid);
m_txtDemuxLog->AppendText("Converting " + FilenameBase + ".ac3 to "+FilenameBase+".wav ...\n");
WAVWriter->SetFilename(wavDirectory+FilenameBase+".wav");
a52decoder->ProcessFile(ac3Directory+FilenameBase+".ac3");
@@ -645,7 +646,7 @@
delete a52decoder;
}
- void ConvertButtonMaskToBMP(void)
+ void ConvertButtonMaskToBMP(int16_t title)
{
wxString FilenameBase;
CellListElem* cle;
@@ -664,8 +665,8 @@
{
cle = node->GetData();
// TODO : Select only cell with button
- FilenameBase = FilenameBase.Format("cell_V%03d_C%02d",
- cle->vobid, cle->cellid);
+ FilenameBase = FilenameBase.Format("cell_T%02d_V%03d_C%02d",
+ title, cle->vobid, cle->cellid);
m_txtDemuxLog->AppendText("Converting " + FilenameBase + ".sub to "+FilenameBase+".bmp ...\n");
//WAVWriter->SetFilename(wavDirectory+FilenameBase+".wav");
@@ -1183,22 +1184,22 @@
wxFileConfig *pConfig = (wxFileConfig *)wxConfigBase::Get();
// Create m2v directory
- wxString m2vDirectory = pConfig->Read("OutputDirectory","")+ "m2v" + wxFILE_SEP_PATH;
+ m2vDirectory = pConfig->Read("OutputDirectory","")+ "m2v" + wxFILE_SEP_PATH;
wxMkdir(m2vDirectory);
// Create ac3 directory
- wxString ac3Directory = pConfig->Read("OutputDirectory","")+ "ac3" + wxFILE_SEP_PATH;
+ ac3Directory = pConfig->Read("OutputDirectory","")+ "ac3" + wxFILE_SEP_PATH;
wxMkdir(ac3Directory);
// Create sub directory
- wxString subDirectory = pConfig->Read("OutputDirectory","")+ "sub" + wxFILE_SEP_PATH;
+ subDirectory = pConfig->Read("OutputDirectory","")+ "sub" + wxFILE_SEP_PATH;
wxMkdir(subDirectory);
// Create bmp directory
- wxString bmpDirectory = pConfig->Read("OutputDirectory","")+ "bmp" + wxFILE_SEP_PATH;
+ bmpDirectory = pConfig->Read("OutputDirectory","")+ "bmp" + wxFILE_SEP_PATH;
wxMkdir(bmpDirectory);
// Create wav directory
- wxString wavDirectory = pConfig->Read("OutputDirectory","")+ "wav" + wxFILE_SEP_PATH;
+ wavDirectory = pConfig->Read("OutputDirectory","")+ "wav" + wxFILE_SEP_PATH;
wxMkdir(wavDirectory);
// Create mask directory
- wxString maskDirectory = pConfig->Read("OutputDirectory","") + "mask" + wxFILE_SEP_PATH;
+ maskDirectory = pConfig->Read("OutputDirectory","") + "mask" + wxFILE_SEP_PATH;
wxMkdir(maskDirectory);
}
@@ -1231,25 +1232,25 @@
m_lbStep->SetLabel(StepString);
m_txtDemuxLog->AppendText(StepString+"\n");
m_lbStep->Update();
- SplitAndDemux(*aVobParser);
+ SplitAndDemux(*aVobParser, title);
StepString = StepString.Format(StepStringFormat, Step++, NbsStep, "Converting still to bitmap");
m_lbStep->SetLabel(StepString);
m_txtDemuxLog->AppendText(StepString+"\n");
m_lbStep->Update();
- ConvertStillToBMP();
+ ConvertStillToBMP(title);
/*
StepString = StepString.Format(StepStringFormat, Step++, NbsStep, "Converting audio to wav");
m_lbStep->SetLabel(StepString);
m_txtDemuxLog->AppendText(StepString+"\n");
m_lbStep->Update();
- ConvertAudioToWAV();
+ ConvertAudioToWAV(title);
*/
StepString = StepString.Format(StepStringFormat, Step++, NbsStep, "Converting button mask to bitmap");
m_lbStep->SetLabel(StepString);
m_txtDemuxLog->AppendText(StepString+"\n");
m_lbStep->Update();
- ConvertButtonMaskToBMP();
+ ConvertButtonMaskToBMP(title);
}
}
Modified: trunk/DvdMenuXtractor/IFOFile.cpp
===================================================================
--- trunk/DvdMenuXtractor/IFOFile.cpp 2004-10-17 14:20:25 UTC (rev 889)
+++ trunk/DvdMenuXtractor/IFOFile.cpp 2004-10-17 15:24:05 UTC (rev 890)
@@ -46,19 +46,19 @@
{
throw IFOInvalidFileFormatException();
}
- 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();
- }
+ 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();
}
@@ -68,10 +68,10 @@
{
for (unsigned int i=0; i<m_ifos.GetCount(); i++)
ifoClose(m_ifos.Item(i)->GetData());
- if (m_dvd)
- {
- DVDClose(m_dvd);
- }
+ if (m_dvd)
+ {
+ DVDClose(m_dvd);
+ }
m_cellsList.DeleteContents(true);
}
@@ -108,11 +108,12 @@
m_SelectionTab[i] = 0;
}
}
-
+
// ----------------------------------------------------------------------------
const pgc_t *IFOFile::FirstPlayPGC() const
-{
if (m_ifos.Item(0))
+{
+ if (m_ifos.Item(0))
return m_ifos.Item(0)->GetData()->first_play_pgc;
else
return NULL;
@@ -122,21 +123,21 @@
const pgci_ut_t *IFOFile::LanguageUnits(unsigned int title) const
{
- if (title < m_ifos.GetCount())
- {
- if (m_ifos.Item(title))
- return m_ifos.Item(title)->GetData()->pgci_ut;
- }
-
- return NULL;
-}
+ if (title < m_ifos.GetCount())
+ {
+ if (m_ifos.Item(title))
+ return m_ifos.Item(title)->GetData()->pgci_ut;
+ }
+
+ return NULL;
+}
// ----------------------------------------------------------------------------
const vts_ptt_srpt_t *IFOFile::VtsTitles(unsigned int title) const
{
- if (title && title < m_ifos.GetCount())
- {
+ if (title && title < m_ifos.GetCount())
+ {
return m_ifos.Item(title)->GetData()->vts_ptt_srpt;
}
return NULL;
@@ -146,8 +147,8 @@
const pgcit_t *IFOFile::VtsPGCs(unsigned int title) const
{
- if (title && title < m_ifos.GetCount())
- {
+ if (title && title < m_ifos.GetCount())
+ {
return m_ifos.Item(title)->GetData()->vts_pgcit;
}
return NULL;
@@ -157,9 +158,9 @@
const int16_t IFOFile::NumberOfTitles() const
{
- if (m_ifos.GetCount() && m_ifos.Item(0)->GetData()->vmgi_mat)
- return m_ifos.Item(0)->GetData()->vmgi_mat->vmg_nr_of_title_sets;
- return 0;
+ if (m_ifos.GetCount() && m_ifos.Item(0)->GetData()->vmgi_mat)
+ return m_ifos.Item(0)->GetData()->vmgi_mat->vmg_nr_of_title_sets;
+ return 0;
}
// ----------------------------------------------------------------------------
@@ -189,7 +190,7 @@
for(int i = 0; i < m_ifos.Item(0)->GetData()->pgci_ut->nr_of_lus; i++)
{
- if(m_SelectionTab[i] == 1)
+// if(m_SelectionTab[i] == 1)
{
pgci_lu_t* lu = &m_ifos.Item(0)->GetData()->pgci_ut->lu[i];
@@ -259,4 +260,4 @@
return FALSE;
}
-// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
Modified: trunk/DvdMenuXtractor/MPEG2Decoder.cpp
===================================================================
--- trunk/DvdMenuXtractor/MPEG2Decoder.cpp 2004-10-17 14:20:25 UTC (rev 889)
+++ trunk/DvdMenuXtractor/MPEG2Decoder.cpp 2004-10-17 15:24:05 UTC (rev 890)
@@ -179,8 +179,11 @@
void MPEG2Decoder::ProcessFile(const char* inputFileName)
{
FILE* inputFile = fopen(inputFileName,"rb");
- ProcessFile(inputFile);
- fclose(inputFile);
+ if (inputFile)
+ {
+ ProcessFile(inputFile);
+ fclose(inputFile);
+ }
}
// ----------------------------------------------------------------------------
Modified: trunk/DvdMenuXtractor/VobParser.cpp
===================================================================
--- trunk/DvdMenuXtractor/VobParser.cpp 2004-10-17 14:20:25 UTC (rev 889)
+++ trunk/DvdMenuXtractor/VobParser.cpp 2004-10-17 15:24:05 UTC (rev 890)
@@ -698,6 +698,8 @@
previous_cellid = -1;
m_index = 0;
m_pktindex = 0;
+ for (unsigned int i=0; i<m_files.GetCount(); i++)
+ fseek(m_files.Item(i)->GetData(),0,SEEK_SET);
if (m_demuxer)
delete m_demuxer;
m_demuxer = NULL;
@@ -709,7 +711,6 @@
{
cell_info_node* cell;
ButtonListElem* ble;
- DemuxStreamMapper* demuxer = NULL;
m_map.Clear();
@@ -730,14 +731,9 @@
cell->btt_list.Append(ble);
}
- if(demuxer)
- delete demuxer;
SetDemuxer(new DemuxStreamMapper(cell));
}
}
-
- if(demuxer)
- delete demuxer;
}
// ----------------------------------------------------------------------------
Modified: trunk/DvdMenuXtractor/VobParser.h
===================================================================
--- trunk/DvdMenuXtractor/VobParser.h 2004-10-17 14:20:25 UTC (rev 889)
+++ trunk/DvdMenuXtractor/VobParser.h 2004-10-17 15:24:05 UTC (rev 890)
@@ -453,7 +453,7 @@
Clear();
}
- cell_info_node* AddCell(uint8_t vobid = 0, uint8_t cellid = 0)
+ cell_info_node* AddCell(uint8_t vobid, uint8_t cellid)
{
cell_info_node* newnode = new cell_info_node(vobid,cellid);