Author: robux4
Date: 2004-10-08 17:23:35 +0400 (Fri, 08 Oct 2004)
New Revision: 871
Modified:
trunk/DvdMenuXtractor/VobParser.cpp
trunk/DvdMenuXtractor/VobParser.h
Log:
prepare the vob parser to handle a list of files for the existing VOB files
Modified: trunk/DvdMenuXtractor/VobParser.cpp
===================================================================
--- trunk/DvdMenuXtractor/VobParser.cpp 2004-10-08 12:46:31 UTC (rev 870)
+++ trunk/DvdMenuXtractor/VobParser.cpp 2004-10-08 13:23:35 UTC (rev 871)
@@ -75,22 +75,49 @@
// ----------------------------------------------------------------------------
+WX_DEFINE_LIST(FileHandleList);
+
VobParser::VobParser(const char* dirname, int16_t title)
:m_title(title)
+ ,m_demuxer(NULL)
{
- // _TODO handle all parts of this title (VIDEO_TS.vob or VTS_XX_YY.vob)
- m_file = NULL;
-// m_file = fopen(dirname,"rb");
- if(!m_file)
+ FILE *_file;
+ wxString FileName;
+
+ // handle all parts of this title (VIDEO_TS.vob or VTS_XX_YY.vob)
+ if (title == 0)
{
+ FileName = wxString::Format("%sVIDEO_TS.VOB",dirname);
+ _file = fopen(FileName.c_str(),"rb");
+ if (_file != NULL)
+ {
+ m_files.Append(_file);
+ }
+ }
+ else
+ {
+ int i=0;
+ do {
+ FileName = wxString::Format("%sVTS_%02d_%02d.VOB",dirname,title,i++);
+ _file = fopen(FileName.c_str(),"rb");
+ if (_file != NULL)
+ {
+ m_files.Append(_file);
+ }
+ } while (_file != NULL);
+ }
+
+ if(!m_files.GetCount())
+ {
throw VobParserFileNotFoundException(dirname);
}
+#ifdef TODO_VOB_FILES_LIST
// Get file size
fseek(m_file,0,SEEK_END);
uint32_t fileSize = ftell(m_file);
m_pktcount = fileSize / PACKET_SIZE;
- m_demuxer = NULL;
+#endif
Reset();
}
@@ -99,10 +126,8 @@
VobParser::~VobParser()
{
- if(m_file)
- {
- fclose(m_file);
- }
+ for (int i=0; i<m_files.GetCount(); i++)
+ fclose(m_files.Item(i)->GetData());
}
// ----------------------------------------------------------------------------
@@ -224,7 +249,11 @@
bool VobParser::GetNextPacket()
{
m_index = 0;
+#ifdef TODO_VOB_FILES_LIST
return (fread(m_buff, PACKET_SIZE, 1, m_file) == 1);
+#else
+ return false;
+#endif
}
// ----------------------------------------------------------------------------
@@ -662,7 +691,9 @@
if (m_demuxer)
delete m_demuxer;
m_demuxer = NULL;
+#ifdef TODO_VOB_FILES_LIST
fseek(m_file, 0, SEEK_SET);
+#endif
}
// ----------------------------------------------------------------------------
Modified: trunk/DvdMenuXtractor/VobParser.h
===================================================================
--- trunk/DvdMenuXtractor/VobParser.h 2004-10-08 12:46:31 UTC (rev 870)
+++ trunk/DvdMenuXtractor/VobParser.h 2004-10-08 13:23:35 UTC (rev 871)
@@ -522,6 +522,8 @@
// Main class
// ============================================================================
+WX_DECLARE_LIST(FILE, FileHandleList);
+
class VobParser
{
public:
@@ -567,7 +569,7 @@
void SkipNBytes(int n);
private:
- FILE* m_file;
+ FileHandleList m_files;
uint8_t m_buff[PACKET_SIZE];
uint32_t m_index;
uint32_t m_pktindex;
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.