[xiph-commits] r10784 - branches/oggdsf_new_demux/src/lib/codecs/ogm/filters/dsfOGMDecoder

illiminable at svn.xiph.org illiminable at svn.xiph.org
Sun Feb 5 14:36:57 PST 2006


Author: illiminable
Date: 2006-02-05 14:36:51 -0800 (Sun, 05 Feb 2006)
New Revision: 10784

Modified:
   branches/oggdsf_new_demux/src/lib/codecs/ogm/filters/dsfOGMDecoder/OGMDecodeInputPin.cpp
   branches/oggdsf_new_demux/src/lib/codecs/ogm/filters/dsfOGMDecoder/OGMDecodeInputPin.h
Log:
* Grab the timing information for ogm text tracks

Modified: branches/oggdsf_new_demux/src/lib/codecs/ogm/filters/dsfOGMDecoder/OGMDecodeInputPin.cpp
===================================================================
--- branches/oggdsf_new_demux/src/lib/codecs/ogm/filters/dsfOGMDecoder/OGMDecodeInputPin.cpp	2006-02-03 23:12:56 UTC (rev 10783)
+++ branches/oggdsf_new_demux/src/lib/codecs/ogm/filters/dsfOGMDecoder/OGMDecodeInputPin.cpp	2006-02-05 22:36:51 UTC (rev 10784)
@@ -35,8 +35,11 @@
 OGMDecodeInputPin::OGMDecodeInputPin(OGMDecodeFilter* inParentFilter, HRESULT* outHR)
 	:	CTransformInputPin(NAME("OGMDecodeInputPin"), inParentFilter, outHR, L"OGM In")
 	,	mVideoFormatBlock(NULL)
+	,	mAudioFormatBlock(NULL)
 	,	mSetupState(VSS_SEEN_NOTHING)
 	,	mOGMMediaType(OGM_UNKNOWN_TYPE)
+	,	mGranuleRateNumerator(1)
+	,	mGranuleRateDenominator(0)
 {
 
 }
@@ -113,7 +116,17 @@
 }
 LOOG_INT64 OGMDecodeInputPin::convertGranuleToTime(LOOG_INT64 inGranule)
 {
-	return inGranule * mVideoFormatBlock->AvgTimePerFrame;
+	switch (mOGMMediaType) {
+		case OGM_VIDEO_TYPE:
+			return inGranule * mVideoFormatBlock->AvgTimePerFrame;
+		case OGM_AUDIO_TYPE:
+			return (inGranule * UNITS) / mAudioFormatBlock->nSamplesPerSec;
+		case OGM_TEXT_TYPE:
+			return (inGranule * UNITS * mGranuleRateDenominator) / mGranuleRateNumerator;
+		default:
+			return 0;
+	};
+	
 }
 
 LOOG_INT64 OGMDecodeInputPin::mustSeekBefore(LOOG_INT64 inGranule)
@@ -181,8 +194,11 @@
 
 bool OGMDecodeInputPin::handleTextHeaderPacket(OggPacket* inHeaderPack)
 {
+	mGranuleRateNumerator = iLE_Math::CharArrToInt64(inHeaderPack->packetData() + 17);
+	mGranuleRateDenominator = iLE_Math::CharArrToInt64(inHeaderPack->packetData() + 25);
+	
 	//TODO:::
-	return false;
+	return true;
 }
 bool OGMDecodeInputPin::handleAudioHeaderPacket(OggPacket* inHeaderPack)
 {

Modified: branches/oggdsf_new_demux/src/lib/codecs/ogm/filters/dsfOGMDecoder/OGMDecodeInputPin.h
===================================================================
--- branches/oggdsf_new_demux/src/lib/codecs/ogm/filters/dsfOGMDecoder/OGMDecodeInputPin.h	2006-02-03 23:12:56 UTC (rev 10783)
+++ branches/oggdsf_new_demux/src/lib/codecs/ogm/filters/dsfOGMDecoder/OGMDecodeInputPin.h	2006-02-05 22:36:51 UTC (rev 10784)
@@ -85,6 +85,8 @@
 
 	VIDEOINFOHEADER* mVideoFormatBlock;
 	WAVEFORMATEX* mAudioFormatBlock;
+	__int64 mGranuleRateNumerator;
+	__int64 mGranuleRateDenominator;
 
 	static const unsigned long OGM_IDENT_HEADER_SIZE = 57;
 	static const unsigned long OGM_NUM_BUFFERS = 50;



More information about the commits mailing list