[matroska] r872 - trunk/DvdMenuXtractor

[email protected]
Newsgroups gmane.comp.multimedia.matroska.cvs
Message-ID <[email protected]>
Author: robux4
Date: 2004-10-08 17:34:51 +0400 (Fri, 08 Oct 2004)
New Revision: 872

Modified:
   trunk/DvdMenuXtractor/VobParser.cpp
   trunk/DvdMenuXtractor/VobParser.h
Log:
handle all VOB files for each title (not tested)

Modified: trunk/DvdMenuXtractor/VobParser.cpp
===================================================================
--- trunk/DvdMenuXtractor/VobParser.cpp	2004-10-08 13:23:35 UTC (rev 871)
+++ trunk/DvdMenuXtractor/VobParser.cpp	2004-10-08 13:34:51 UTC (rev 872)
@@ -83,7 +83,8 @@
 {
 	FILE *_file;
 	wxString FileName;
-	
+	uint64_t fileSize = 0;
+
 	// handle all parts of this title (VIDEO_TS.vob or VTS_XX_YY.vob)
 	if (title == 0)
 	{
@@ -92,6 +93,9 @@
 		if (_file != NULL)
 		{
 			m_files.Append(_file);
+			fseek(_file,0,SEEK_END);
+			fileSize += ftell(_file);
+			fseek(_file,0,SEEK_SET);
 		}
 	}
 	else
@@ -103,6 +107,9 @@
 			if (_file != NULL)
 			{
 				m_files.Append(_file);
+				fseek(_file,0,SEEK_END);
+				fileSize += ftell(_file);
+				fseek(_file,0,SEEK_SET);
 			}
 		} while (_file != NULL);
 	}
@@ -111,14 +118,13 @@
 	{
 		throw VobParserFileNotFoundException(dirname);
 	}
+	else
+	{
+		m_file = m_files.begin();
+	}
 
-#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;
-#endif
-	
+
 	Reset();
 }
 
@@ -249,11 +255,12 @@
 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
+
+	if (feof(*m_file) && m_file != m_files.end())
+		m_file++;
+	if (m_file == m_files.end())
+		return false;
+	return (fread(m_buff, PACKET_SIZE, 1, *m_file) == 1);
 }
 
 // ----------------------------------------------------------------------------
@@ -691,9 +698,6 @@
 	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 13:23:35 UTC (rev 871)
+++ trunk/DvdMenuXtractor/VobParser.h	2004-10-08 13:34:51 UTC (rev 872)
@@ -570,6 +570,7 @@
 
 private:
 	FileHandleList m_files;
+	FileHandleList::iterator m_file;
 	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.