[matroska] r1123 - trunk/DvdMenuXtractor

[email protected]
Newsgroups gmane.comp.multimedia.matroska.cvs
Message-ID <[email protected]>
Author: robux4
Date: 2005-04-10 17:36:44 +0400 (Sun, 10 Apr 2005)
New Revision: 1123

Modified:
   trunk/DvdMenuXtractor/VobParser.cpp
Log:
DMX: using the mpegparser almost works

Modified: trunk/DvdMenuXtractor/VobParser.cpp
===================================================================
--- trunk/DvdMenuXtractor/VobParser.cpp	2005-04-10 12:55:15 UTC (rev 1122)
+++ trunk/DvdMenuXtractor/VobParser.cpp	2005-04-10 13:36:44 UTC (rev 1123)
@@ -921,42 +921,31 @@
 
 void VideoDemuxWriter::WriteTimecodeInfo(uint32_t start_time, uint32_t end_time, uint64_t filepos, const wxString & debug)
 {
-	if (end_time > m_last_end_timecode)
-		m_last_end_timecode = end_time;
+	// TODO detect gaps in the stream
 }
 
 // ============================================================================
 
 void VideoDemuxWriter::ProcessStream(uint8_t* buff, uint32_t size, uint32_t start_time, uint32_t end_time, const wxString & debug)
 {
-  int bytes_probed = 0;
+	m_parser.WriteData(buff, size);
 
-  while (true) {
-    MPEG2ParserState state;
+	MPEG2ParserState state = m_parser.GetState();
 
-	state = m_parser.GetState();
-
-    if (state == MPV_PARSER_STATE_NEED_DATA) {
-      int bytes_to_read;
-
-      if (bytes_probed >= size)
-        break;
-
-      bytes_to_read = (m_parser.GetFreeBufferSpace() < size) ? m_parser.GetFreeBufferSpace() : size;
-      bytes_probed += bytes_to_read;
-
-      m_parser.WriteData(buff, bytes_to_read);
-
-    } else if (state == MPV_PARSER_STATE_FRAME) {
+	while (state == MPV_PARSER_STATE_FRAME) 
+	{
 		MPEGFrame* current_frame = m_parser.ReadFrame();
+		if ((current_frame->timecode + current_frame->duration) / 1000000 > m_last_end_timecode)
+		{
+			m_last_start_timecode = current_frame->timecode / 1000000;
+			m_last_end_timecode = (current_frame->timecode + current_frame->duration) / 1000000;
+		}
+		delete current_frame;
+
+		state = m_parser.GetState();
 	}
 
-    else if ((state == MPV_PARSER_STATE_EOS) ||
-             (state == MPV_PARSER_STATE_ERROR))
-      break;
-  }
-
-  Write(buff, size, start_time, end_time, debug); 
+	Write(buff, size, start_time, end_time, debug); 
 }
 
 void VideoDemuxWriter::SetBoundary(uint32_t start_timecode, uint32_t duration, const CellListElem *cell)
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.