[matroska] r910 - trunk/DvdMenuXtractor

[email protected]
Newsgroups gmane.comp.multimedia.matroska.cvs
Message-ID <[email protected]>
Author: robux4
Date: 2004-10-24 14:13:14 +0400 (Sun, 24 Oct 2004)
New Revision: 910

Modified:
   trunk/DvdMenuXtractor/DvdMenuXtractor.cpp
   trunk/DvdMenuXtractor/VobParser.cpp
   trunk/DvdMenuXtractor/VobParser.h
Log:
support LPCM (raw big endian) and DTS extraction
includes the track number in the audio/sub filename to avoid collision

Modified: trunk/DvdMenuXtractor/DvdMenuXtractor.cpp
===================================================================
--- trunk/DvdMenuXtractor/DvdMenuXtractor.cpp	2004-10-23 21:50:14 UTC (rev 909)
+++ trunk/DvdMenuXtractor/DvdMenuXtractor.cpp	2004-10-24 10:13:14 UTC (rev 910)
@@ -547,6 +547,9 @@
 		uint32_t cell = 0;
 		const CellsListType *CellsList = IfoFile->GetCellsList(title, language);
 
+		if (!CellsList)
+			return;
+
 		aVobParser.Reset();
 		
         try
@@ -578,9 +581,9 @@
 								wxString _langName;
 								audio_attr_t * _attr = _audioTracks.Item(_stream)->GetData();
 								if (_attr->lang_code == 0)
-									_langName = "_un";
+									_langName = wxString::Format("_%d_un", _stream);
 								else
-									_langName = wxString::Format("_%c%c", _attr->lang_code >> 8, _attr->lang_code & 0xFF);
+									_langName = wxString::Format("_%d_%c%c", _stream, _attr->lang_code >> 8, _attr->lang_code & 0xFF);
 								switch (_audioTracks.Item(_stream)->GetData()->audio_format)
 								{
 								case 0:
@@ -600,7 +603,7 @@
 									break;
 
 								case 6:
-									myfprintf(stderr, "DTS audio not supported yet");
+									demuxer->AddDemuxer(new DTSDemuxWriter(ac3Directory+newFilename+_langName, 0x88 + _stream));
 									break;
 
 								default:
@@ -655,6 +658,9 @@
 		int i;			
 		wxFileConfig *pConfig = (wxFileConfig *)wxConfigBase::Get();
 
+		if (!CellsList)
+			return;
+
 		m_gaDemuxProgress->SetValue(0);
 		m_gaDemuxProgress->SetRange(CellsList->GetCount());
 		
@@ -688,6 +694,9 @@
 		int i;			
 		wxFileConfig *pConfig = (wxFileConfig *)wxConfigBase::Get();
 
+		if (!CellsList)
+			return;
+
 		m_gaDemuxProgress->SetValue(0);
 		m_gaDemuxProgress->SetRange(CellsList->GetCount());
 				
@@ -721,6 +730,9 @@
 		const CellsListType *CellsList = IfoFile->GetCellsList(title, language);
 		int i;			
 		wxFileConfig *pConfig = (wxFileConfig *)wxConfigBase::Get();
+
+		if (!CellsList)
+			return;
 		
 		m_gaDemuxProgress->SetValue(0);
 		m_gaDemuxProgress->SetRange(CellsList->GetCount());

Modified: trunk/DvdMenuXtractor/VobParser.cpp
===================================================================
--- trunk/DvdMenuXtractor/VobParser.cpp	2004-10-23 21:50:14 UTC (rev 909)
+++ trunk/DvdMenuXtractor/VobParser.cpp	2004-10-24 10:13:14 UTC (rev 910)
@@ -667,11 +667,7 @@
 	}
 	else if(substreamID >= SUBSTREAM_DTS_LOW && substreamID <= SUBSTREAM_DTS_HIGH)
 	{
-		DebugLog("DTS stream not supported yet\n");
-	}
-	else if(substreamID >= SUBSTREAM_PCM_LOW && substreamID <= SUBSTREAM_PCM_HIGH)
-	{
-		DebugLog("LPCM streamID = 0x%X\n", substreamID);
+		DebugLog("DTS streamID = 0x%X\n", substreamID);
 		// Skip frame header number
 		SkipNBytes(1);
 		// Skip first access unit pointer
@@ -679,6 +675,17 @@
 		if(m_demuxer)
 		{
 			uint16_t ac3DataLen = length - (m_index - dataStartIndex);
+			m_demuxer->ProcessDTSStream(&m_buff[m_index], ac3DataLen, substreamID);
+		}
+	}
+	else if(substreamID >= SUBSTREAM_PCM_LOW && substreamID <= SUBSTREAM_PCM_HIGH)
+	{
+		DebugLog("LPCM streamID = 0x%X\n", substreamID);
+		// Skip unknown data
+		SkipNBytes(6);
+		if(m_demuxer)
+		{
+			uint16_t ac3DataLen = length - (m_index - dataStartIndex);
 			m_demuxer->ProcessLPCMStream(&m_buff[m_index], ac3DataLen, substreamID);
 		}
 	}

Modified: trunk/DvdMenuXtractor/VobParser.h
===================================================================
--- trunk/DvdMenuXtractor/VobParser.h	2004-10-23 21:50:14 UTC (rev 909)
+++ trunk/DvdMenuXtractor/VobParser.h	2004-10-24 10:13:14 UTC (rev 910)
@@ -164,6 +164,7 @@
 	virtual void ProcessVOBStream(uint8_t* buff, uint32_t size) {}
 	virtual void ProcessAC3Stream(uint8_t* buff, uint32_t size, uint8_t streamID) {}
 	virtual void ProcessLPCMStream(uint8_t* buff, uint32_t size, uint8_t streamID) {}
+	virtual void ProcessDTSStream(uint8_t* buff, uint32_t size, uint8_t streamID) {}
 	virtual void ProcessSubStream(uint8_t* buff, uint32_t size, uint8_t streamID) {}
 	Demuxer* m_next; // used by the CompositeDemuxWriter (linked list of demuxer)
 };
@@ -235,6 +236,21 @@
 
 // ----------------------------------------------------------------------------
 
+class DTSDemuxWriter : public Demuxer, public Writer
+{
+public:
+	DTSDemuxWriter(const char* filenamePrefix, const uint8_t streamID) :
+	  Writer(filenamePrefix,"dts"), m_streamID(streamID) {}
+	void ProcessDTSStream(uint8_t* buff, uint32_t size, uint8_t streamID)
+	{
+		if(m_streamID == streamID) { Write(buff,size); }
+	}
+private:
+	uint8_t m_streamID;
+};
+
+// ----------------------------------------------------------------------------
+
 class LPCMDemuxWriter : public Demuxer, public Writer
 {
 public:
@@ -327,6 +343,16 @@
 		}		
 	}
 
+	void ProcessDTSStream(uint8_t* buff, uint32_t size, uint8_t streamID)
+	{
+		Demuxer* demuxCursor = m_demuxerRoot;
+		while(demuxCursor)
+		{
+			demuxCursor->ProcessDTSStream(buff,size,streamID);
+			demuxCursor = demuxCursor->m_next;
+		}		
+	}
+
 	void ProcessLPCMStream(uint8_t* buff, uint32_t size, uint8_t streamID)
 	{
 		Demuxer* demuxCursor = m_demuxerRoot;
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.