[matroska] r919 - trunk/DvdMenuXtractor

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

Modified:
   trunk/DvdMenuXtractor/VobParser.cpp
   trunk/DvdMenuXtractor/VobParser.h
   trunk/DvdMenuXtractor/makefile.vc
Log:
temporarily write a fake timecode file

Modified: trunk/DvdMenuXtractor/VobParser.cpp
===================================================================
--- trunk/DvdMenuXtractor/VobParser.cpp	2004-10-25 21:22:18 UTC (rev 918)
+++ trunk/DvdMenuXtractor/VobParser.cpp	2004-10-26 12:32:19 UTC (rev 919)
@@ -623,7 +623,7 @@
 	if(m_demuxer)
 	{	
 		m_demuxer->ProcessVideoStream(&m_buff[m_index],
-			length - 3 - pes_header_data_content.PES_header_data_len);
+			length - 3 - pes_header_data_content.PES_header_data_len, (pktinfo.pts - m_startpts)/90);
 	}
 }
 

Modified: trunk/DvdMenuXtractor/VobParser.h
===================================================================
--- trunk/DvdMenuXtractor/VobParser.h	2004-10-25 21:22:18 UTC (rev 918)
+++ trunk/DvdMenuXtractor/VobParser.h	2004-10-26 12:32:19 UTC (rev 919)
@@ -159,7 +159,7 @@
 public:
 	Demuxer() : m_next(NULL) {}
 	virtual ~Demuxer() {}
-	virtual void ProcessVideoStream(uint8_t* buff, uint32_t size) {}
+	virtual void ProcessVideoStream(uint8_t* buff, uint32_t size, int32_t delay) {}
 	virtual void ProcessAudioStream(uint8_t* buff, uint32_t size, uint8_t streamID, int32_t delay) {}
 	virtual void ProcessVOBStream(uint8_t* buff, uint32_t size) {}
 	virtual void ProcessAC3Stream(uint8_t* buff, uint32_t size, uint8_t streamID, int32_t delay) {}
@@ -175,10 +175,11 @@
 {
 public:
 	Writer(const char* filenamePrefix, const char* extension)
+		:m_file(NULL)
+		,m_TimecodeFile(NULL)
 	{
-		m_fullFilename = filenamePrefix;
+		m_Filename = filenamePrefix;
 		m_fileExtension = extension;
-		m_file = NULL;
 	}
 
 	virtual ~Writer()
@@ -187,35 +188,37 @@
 		{
 			fclose(m_file);
 		}
+		if (m_TimecodeFile)
+			fclose(m_TimecodeFile);
 	}
 
-	void Write(uint8_t* buff, uint32_t size)
+	void Write(uint8_t* buff, uint32_t size, int32_t delay)
 	{
 		if(!m_file)
 		{
-			m_fullFilename += ".";
-			m_fullFilename += m_fileExtension;
-			m_file = fopen(m_fullFilename.c_str(),"wb");
+			wxString m_filename = m_Filename;
+//			if (delay != 0)
+//				m_filename += wxString::Format("_%dms",delay);
+			m_filename += ".";
+			m_filename +=  m_fileExtension;
+			m_file = fopen(m_filename.c_str(),"wb");
 		}
 		fwrite(buff, 1, size, m_file);
-	}
-
-	void Write(uint8_t* buff, uint32_t size, int32_t delay)
-	{
-		if(!m_file)
+		if (!m_TimecodeFile)
 		{
-			if (delay != 0)
-				m_fullFilename += wxString::Format("_%dms",delay);
-			m_fullFilename += ".";
-			m_fullFilename +=  m_fileExtension;
-			m_file = fopen(m_fullFilename.c_str(),"wb");
+			wxString m_filename = m_Filename;
+			m_filename += "_time.txt";
+			m_TimecodeFile = fopen(m_filename.c_str(),"w");
+			fwrite("# timecode format v2\n", 1, 21, m_TimecodeFile);
 		}
-		fwrite(buff, 1, size, m_file);
+		wxString _timecode = wxString::Format("%d\n", delay);
+		fwrite(_timecode.c_str(), 1, _timecode.length(), m_TimecodeFile);
 	}
 protected:
-	wxString m_fullFilename;
+	wxString m_Filename;
 	wxString m_fileExtension;
 	FILE* m_file;
+	FILE* m_TimecodeFile;
 };
 
 // ----------------------------------------------------------------------------
@@ -224,20 +227,11 @@
 {
 public:
 	VideoDemuxWriter(const char* filenamePrefix) : Writer(filenamePrefix,"m2v") {}
-	void ProcessVideoStream(uint8_t* buff, uint32_t size) { Write(buff, size); }
+	void ProcessVideoStream(uint8_t* buff, uint32_t size, int32_t delay) { Write(buff, size, delay); }
 };
 
 // ----------------------------------------------------------------------------
 
-class NoDemuxWriter : public Demuxer, public Writer
-{
-public:
-	NoDemuxWriter(const char* filenamePrefix) : Writer(filenamePrefix, "vob") {}
-	void ProcessVOBStream(uint8_t* buff, uint32_t size) { Write(buff,size); }
-};
-
-// ----------------------------------------------------------------------------
-
 class AC3DemuxWriter : public Demuxer, public Writer
 {
 public:
@@ -305,7 +299,7 @@
 	  Writer(filenamePrefix, "sub"), m_streamID(streamID) {}
 	void ProcessSubStream(uint8_t* buff, uint32_t size, uint8_t streamID, int32_t delay)
 	{
-		if(m_streamID == streamID) { Write(buff,size); }
+		if(m_streamID == streamID) { Write(buff,size, delay); }
 	}
 private:
 	uint8_t m_streamID;
@@ -345,12 +339,12 @@
 		m_demuxerRoot = NULL;
 	}
 
-	void ProcessVideoStream(uint8_t* buff, uint32_t size)
+	void ProcessVideoStream(uint8_t* buff, uint32_t size, int32_t delay)
 	{
 		Demuxer* demuxCursor = m_demuxerRoot;
 		while(demuxCursor)
 		{
-			demuxCursor->ProcessVideoStream(buff,size);
+			demuxCursor->ProcessVideoStream(buff,size, delay);
 			demuxCursor = demuxCursor->m_next;
 		}		
 	}
@@ -518,7 +512,7 @@
 public:
 	DemuxStreamMapper(cell_info_node* cid) : m_cid(cid) {}
 
-	void ProcessVideoStream(uint8_t* buff, uint32_t size)
+	void ProcessVideoStream(uint8_t* buff, uint32_t size, int32_t delay)
 	{
 		m_cid->hasVideo = true;
 	}

Modified: trunk/DvdMenuXtractor/makefile.vc
===================================================================
--- trunk/DvdMenuXtractor/makefile.vc	2004-10-25 21:22:18 UTC (rev 918)
+++ trunk/DvdMenuXtractor/makefile.vc	2004-10-26 12:32:19 UTC (rev 919)
@@ -155,7 +155,7 @@
 build\DvdMenuXtractor_A52Decoder.obj: .\A52Decoder.cpp
 	$(CXX) /c /nologo /TP /Fo$@ $(DVDMENUXTRACTOR_CXXFLAGS) $**
 
-build\DvdMenuXtractor_DvdMenuXtractor.obj: .\DvdMenuXtractor.cpp
+build\DvdMenuXtractor_DvdMenuXtractor.obj: .\DvdMenuXtractor.cpp .\VobParser.h
 	$(CXX) /c /nologo /TP /Fo$@ $(DVDMENUXTRACTOR_CXXFLAGS) $**
 
 build\DvdMenuXtractor_IFOFile.obj: .\IFOFile.cpp
@@ -170,7 +170,7 @@
 build\DvdMenuXtractor_SUBDecoder.obj: .\SUBDecoder.cpp
 	$(CXX) /c /nologo /TP /Fo$@ $(DVDMENUXTRACTOR_CXXFLAGS) $**
 
-build\DvdMenuXtractor_VobParser.obj: .\VobParser.cpp
+build\DvdMenuXtractor_VobParser.obj: .\VobParser.cpp .\VobParser.h
 	$(CXX) /c /nologo /TP /Fo$@ $(DVDMENUXTRACTOR_CXXFLAGS) $**
 
 build\DvdMenuXtractor_base64.obj: .\base64.cpp
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.