[matroska] r898 - trunk/DvdMenuXtractor

[email protected]
Newsgroups gmane.comp.multimedia.matroska.cvs
Message-ID <[email protected]>
Author: robux4
Date: 2004-10-19 17:58:21 +0400 (Tue, 19 Oct 2004)
New Revision: 898

Modified:
   trunk/DvdMenuXtractor/DvdMenuXtractor.cpp
   trunk/DvdMenuXtractor/VobParser.cpp
   trunk/DvdMenuXtractor/VobParser.h
Log:
separate the language unit handling from the content (as done on DVDs!)

Modified: trunk/DvdMenuXtractor/DvdMenuXtractor.cpp
===================================================================
--- trunk/DvdMenuXtractor/DvdMenuXtractor.cpp	2004-10-19 13:48:10 UTC (rev 897)
+++ trunk/DvdMenuXtractor/DvdMenuXtractor.cpp	2004-10-19 13:58:21 UTC (rev 898)
@@ -524,7 +524,7 @@
 		
 		VobParser * _VobParser = NULL;
 		try {
-			_VobParser = new VobParser(pConfig->Read("InDirectory","").c_str(), title);
+			_VobParser = new VobParser(pConfig->Read("InDirectory","").c_str(), title, true);
 		} catch (...)
 		{
 			m_txtDemuxLog->AppendText(wxString::Format("no VOB files found in %s for Title %02d\n",pConfig->Read("InDirectory","").c_str(),title));

Modified: trunk/DvdMenuXtractor/VobParser.cpp
===================================================================
--- trunk/DvdMenuXtractor/VobParser.cpp	2004-10-19 13:48:10 UTC (rev 897)
+++ trunk/DvdMenuXtractor/VobParser.cpp	2004-10-19 13:58:21 UTC (rev 898)
@@ -75,16 +75,14 @@
 
 // ----------------------------------------------------------------------------
 
-VobParser::VobParser(const char* dirname, int16_t title)
+VobParser::VobParser(const char* dirname, int16_t title, boolean menu)
 	:m_title(title)
 	,m_demuxer(NULL)
 	,m_dvdhandle(NULL)
-	,m_menustream(NULL)
-	,m_vobstream(NULL)
-	,m_readingmenu(true)
+	,m_stream(NULL)
+	,m_readingmenu(menu)
 {
 	dvd_file_t *_file;
-	wxString FileName;
 
 	m_pktcount = 0;
 
@@ -93,18 +91,19 @@
 
 	if (m_dvdhandle)
 	{
-		m_menustream = DVDOpenFile(m_dvdhandle, title, DVD_READ_MENU_VOBS);
-		m_vobstream = DVDOpenFile(m_dvdhandle, title, DVD_READ_TITLE_VOBS);
+		if (m_readingmenu)
+			m_stream = DVDOpenFile(m_dvdhandle, title, DVD_READ_MENU_VOBS);
+		else
+			m_stream = DVDOpenFile(m_dvdhandle, title, DVD_READ_TITLE_VOBS);
 	}
 
-	if(m_menustream == NULL && m_vobstream == NULL)
+	if(!m_stream)
 	{
 		throw VobParserFileNotFoundException(dirname);
 	}
 	else
 	{
-		m_pktcount =  DVDFileSize(m_menustream);
-		m_pktcount += DVDFileSize(m_vobstream);
+		m_pktcount = DVDFileSize(m_stream);
 	}
 
 	Reset();
@@ -114,12 +113,9 @@
 
 VobParser::~VobParser()
 {
-	if (m_menustream)
-		DVDCloseFile(m_menustream);
+	if (m_stream)
+		DVDCloseFile(m_stream);
 
-	if (m_vobstream)
-		DVDCloseFile(m_vobstream);
-
 	if (m_dvdhandle)
 		DVDClose(m_dvdhandle);
 }
@@ -243,14 +239,8 @@
 bool VobParser::GetNextPacket()
 {
 	m_index = 0;
-	dvd_file_t *_stream;
 
-	if (m_readingmenu)
-		_stream = m_menustream;
-	else
-		_stream = m_vobstream;
-
-	return (DVDReadBlocks(_stream, m_pktindex, 1, m_buff) == 1);
+	return (DVDReadBlocks(m_stream, m_pktindex, 1, m_buff) == 1);
 }
 
 // ----------------------------------------------------------------------------
@@ -685,8 +675,7 @@
 	previous_cellid = -1;
 	m_index = 0;
 	m_pktindex = 0;
-	DVDFileSeek(m_menustream,0);
-	DVDFileSeek(m_vobstream,0);
+	DVDFileSeek(m_stream,0);
 	m_readingmenu = true;
 	if (m_demuxer)
 		delete m_demuxer;

Modified: trunk/DvdMenuXtractor/VobParser.h
===================================================================
--- trunk/DvdMenuXtractor/VobParser.h	2004-10-19 13:48:10 UTC (rev 897)
+++ trunk/DvdMenuXtractor/VobParser.h	2004-10-19 13:58:21 UTC (rev 898)
@@ -516,21 +516,7 @@
 private:
 	cell_info_node* m_cid;
 };
-/*
-class VobFile
-{
-	public:
-		VobFile(const char *dirname, int16_t title);
-		virtual ~VobFile();
 
-		size_t Read(void *buffer, size_t blocks);
-		int Seek(unsigned int blocks);
-		unsigned long Size();
-
-	protected:
-		dvd_reader_t *m_file;
-};
-*/
 // ============================================================================
 // Main class
 // ============================================================================
@@ -538,7 +524,7 @@
 class VobParser  
 {
 public:
-	VobParser(const char* dirname, int16_t title);
+	VobParser(const char* dirname, int16_t title, boolean menu);
 	void Reset();
 	bool ParseNextPacket();
 	uint32_t GetPacketCount() const;
@@ -581,8 +567,7 @@
 
 private:
 	dvd_reader_t *m_dvdhandle;
-	dvd_file_t *m_menustream;
-	dvd_file_t *m_vobstream;
+	dvd_file_t *m_stream;
 	boolean m_readingmenu;
 	uint8_t m_buff[DVD_VIDEO_LB_LEN];
 	uint32_t m_index;
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.