[xiph-commits] r10294 - in branches/oggdsf_new_demux/src/lib: codecs/vorbis/filters/dsfVorbisDecoder core/directshow/dsfOggDemux2 core/ogg/libOOOggSeek

illiminable at svn.xiph.org illiminable at svn.xiph.org
Mon Oct 24 09:51:03 PDT 2005


Author: illiminable
Date: 2005-10-24 09:50:53 -0700 (Mon, 24 Oct 2005)
New Revision: 10294

Modified:
   branches/oggdsf_new_demux/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeInputPin.cpp
   branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourceFilter.cpp
   branches/oggdsf_new_demux/src/lib/core/ogg/libOOOggSeek/AutoOggChainGranuleSeekTable.cpp
   branches/oggdsf_new_demux/src/lib/core/ogg/libOOOggSeek/AutoOggChainGranuleSeekTable.h
Log:
* Implement IMediaSeeking::SetPositions now seeking works again.
* Currently implemented as "near enough is good enough" like it was before, but by monitoring stamps at output pin and dropping -'ve adjusted times, we should be able to get perfect seek resolution, which prerolls and drops preceding data.

Modified: branches/oggdsf_new_demux/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeInputPin.cpp
===================================================================
--- branches/oggdsf_new_demux/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeInputPin.cpp	2005-10-24 16:30:39 UTC (rev 10293)
+++ branches/oggdsf_new_demux/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeInputPin.cpp	2005-10-24 16:50:53 UTC (rev 10294)
@@ -388,6 +388,9 @@
 
 					REFERENCE_TIME locAdjustedStart = (locStart * RATE_DENOMINATOR) / mRateNumerator;
 					REFERENCE_TIME locAdjustedEnd = (locEnd * RATE_DENOMINATOR) / mRateNumerator;
+
+					locAdjustedStart -= m_tStart;
+					locAdjustedEnd -= m_tStart;
 					locSample->SetTime(&locAdjustedStart, &locAdjustedEnd);
 					locSample->SetMediaTime(&locStart, &locEnd);
 					locSample->SetSyncPoint(TRUE);

Modified: branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourceFilter.cpp
===================================================================
--- branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourceFilter.cpp	2005-10-24 16:30:39 UTC (rev 10293)
+++ branches/oggdsf_new_demux/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourceFilter.cpp	2005-10-24 16:50:53 UTC (rev 10294)
@@ -611,65 +611,44 @@
 STDMETHODIMP OggDemuxPacketSourceFilter::SetPositions(LONGLONG *pCurrent,DWORD dwCurrentFlags,LONGLONG *pStop,DWORD dwStopFlags){
 
 
-	//CAutoLock locLock(m_pLock);
-	////debugLog<<"Set Positions "<<*pCurrent<<" to "<<*pStop<<" with flags "<<dwCurrentFlags<<" and "<<dwStopFlags<<endl;
-	//if (mSeekTable->enabled())  {
-	//	//debugLog<<"SetPos : Current = "<<*pCurrent<<" Flags = "<<dwCurrentFlags<<" Stop = "<<*pStop<<" dwStopFlags = "<<dwStopFlags<<endl;
-	//	//debugLog<<"       : Delivering begin flush..."<<endl;
+	CAutoLock locLock(m_pLock);
+	
+	if ((mSeekTable != NULL) && (mSeekTable->enabled()))  {
+	
+		CAutoLock locSourceLock(mSourceFileLock);
+		DeliverBeginFlush();
 
-	//
-	//	CAutoLock locSourceLock(mSourceFileLock);
-	//	mSetIgnorePackets = false;
-	//	DeliverBeginFlush();
-	//	//debugLog<<"       : Begin flush Delviered."<<endl;
+		//Find the byte position for this time.
+		if (*pCurrent > mSeekTable->fileDuration()) {
+			*pCurrent = mSeekTable->fileDuration();
+		} else if (*pCurrent < 0) {
+			*pCurrent = 0;
+		}
 
-	//	//Find the byte position for this time.
-	//	OggSeekTable::tSeekPair locStartPos = mSeekTable->getStartPos(*pCurrent);
-	//	bool locSendExcess = false;
+		OggGranuleSeekTable::tSeekPair locStartPos = mSeekTable->seekPos(*pCurrent);
+		
+		
+		//For now, seek to the position directly, later we will discard the preroll
+		*pCurrent = locStartPos.first;
 
-	//	//FIX::: This code needs to be removed, and handle start seek case.
-	//	//.second is the file position.
-	//	//.first is the time in DS units
-	//	if (locStartPos.second == mStreamMapper->startOfData()) {
-	//		locSendExcess = true;
-	//		//GGFF:::
-	//		//mStreamMapper->toStartOfData();
-	//		mSetIgnorePackets = true;
-	//	}
-	//	
-	//	
-	//	//We have to save this here now... since time can't be reverted to granule pos in all cases
-	//	// we have to use granule pos timestamps in order for downstream codecs to work.
-	//	// Because of this we can't factor time bases after seeking into the sample times.
-	//	*pCurrent	= mSeekTimeBase 
-	//				= locStartPos.first;		//Time from seek pair.
+		{
+			//debugLog<<"       : Delivering End Flush..."<<endl;
+			DeliverEndFlush();
+			//debugLog<<"       : End flush Delviered."<<endl;
+			DeliverNewSegment(*pCurrent, mSeekTable->fileDuration(), 1.0);
+		}
 
-	//	//debugLog<<"Corrected pCurrent : "<<mSeekTimeBase<<endl;
-	//	for (unsigned long i = 0; i < mStreamMapper->numStreams(); i++) {
-	//		mStreamMapper->getOggStream(i)->setSendExcess(locSendExcess);		//Not needed
-	//		mStreamMapper->getOggStream(i)->setLastEndGranPos(*pCurrent);
-	//	}
-	//	{
-	//		//debugLog<<"       : Delivering End Flush..."<<endl;
-	//		DeliverEndFlush();
-	//		//debugLog<<"       : End flush Delviered."<<endl;
-	//		DeliverNewSegment(*pCurrent, mSeekTable->fileDuration(), 1.0);
-	//	}
+		//.second is the file position.
+		mDataSource->seek(locStartPos.second.first);
+	
+		return S_OK;
+	} else {
+		//debugLog<<"Seek not IMPL"<<endl;
+		return E_NOTIMPL;
+	}
 
-	//	//.second is the file position.
-	//	mDataSource->seek(locStartPos.second);
-	//
-	//	//debugLog<<"       : Seek complete."<<endl;
-	//} else {
-	//	//debugLog<<"Seek not IMPL"<<endl;
-	//	return E_NOTIMPL;
-	//}
 
-	//return S_OK;
 
-	//TODO:::
-	return E_NOTIMPL;
-
 }
 STDMETHODIMP OggDemuxPacketSourceFilter::GetPositions(LONGLONG *pCurrent, LONGLONG *pStop)
 {

Modified: branches/oggdsf_new_demux/src/lib/core/ogg/libOOOggSeek/AutoOggChainGranuleSeekTable.cpp
===================================================================
--- branches/oggdsf_new_demux/src/lib/core/ogg/libOOOggSeek/AutoOggChainGranuleSeekTable.cpp	2005-10-24 16:30:39 UTC (rev 10293)
+++ branches/oggdsf_new_demux/src/lib/core/ogg/libOOOggSeek/AutoOggChainGranuleSeekTable.cpp	2005-10-24 16:50:53 UTC (rev 10294)
@@ -48,7 +48,7 @@
 	}
 	return true;
 }
-unsigned long AutoOggChainGranuleSeekTable::seekPos(LOOG_INT64 inTime)
+OggGranuleSeekTable::tSeekPair AutoOggChainGranuleSeekTable::seekPos(LOOG_INT64 inTime)
 {
 	unsigned long retEarliestPos = 4294967295UL;
 
@@ -57,6 +57,7 @@
 
 
 	OggGranuleSeekTable::tSeekPair locSeekInfo;
+	OggGranuleSeekTable::tSeekPair retBestSeekInfo;
 	for (size_t i = 0; i < mStreamMaps.size(); i++) {
 
 		if ((mStreamMaps[i].mSeekTable != NULL) && (mStreamMaps[i].mSeekInterface != NULL)) {
@@ -73,12 +74,13 @@
 			if (retEarliestPos >= locSeekInfo.second.first) {
 				//Update the earliest position
 				retEarliestPos = locSeekInfo.second.first;
+				retBestSeekInfo = locSeekInfo;
 				locGotAValidPos = true;
 			}
 		}
 	}	
 
-	return retEarliestPos;
+	return retBestSeekInfo;//retEarliestPos;
 
 }
 LOOG_INT64 AutoOggChainGranuleSeekTable::fileDuration()

Modified: branches/oggdsf_new_demux/src/lib/core/ogg/libOOOggSeek/AutoOggChainGranuleSeekTable.h
===================================================================
--- branches/oggdsf_new_demux/src/lib/core/ogg/libOOOggSeek/AutoOggChainGranuleSeekTable.h	2005-10-24 16:30:39 UTC (rev 10293)
+++ branches/oggdsf_new_demux/src/lib/core/ogg/libOOOggSeek/AutoOggChainGranuleSeekTable.h	2005-10-24 16:50:53 UTC (rev 10294)
@@ -25,7 +25,7 @@
 
 	bool addStream(unsigned long inSerialNo, IOggDecoderSeek* inSeekInterface);
 
-	unsigned long seekPos(LOOG_INT64 inTime);
+	OggGranuleSeekTable::tSeekPair seekPos(LOOG_INT64 inTime);
 protected:
 
 	struct sStreamMapping {



More information about the commits mailing list