[xiph-commits] r8267 - trunk/oggdsf/src/lib/core/directshow/libDirectshowAbstracts

illiminable at motherfish-iii.xiph.org illiminable at motherfish-iii.xiph.org
Tue Nov 23 03:07:40 PST 2004


Author: illiminable
Date: 2004-11-23 03:07:39 -0800 (Tue, 23 Nov 2004)
New Revision: 8267

Modified:
   trunk/oggdsf/src/lib/core/directshow/libDirectshowAbstracts/AbstractTransformFilter.h
   trunk/oggdsf/src/lib/core/directshow/libDirectshowAbstracts/AbstractTransformInputPin.cpp
   trunk/oggdsf/src/lib/core/directshow/libDirectshowAbstracts/AbstractTransformInputPin.h
   trunk/oggdsf/src/lib/core/directshow/libDirectshowAbstracts/AbstractTransformOutputPin.cpp
Log:
* Tidy the new tranform class up a bit.

Modified: trunk/oggdsf/src/lib/core/directshow/libDirectshowAbstracts/AbstractTransformFilter.h
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/libDirectshowAbstracts/AbstractTransformFilter.h	2004-11-23 10:48:12 UTC (rev 8266)
+++ trunk/oggdsf/src/lib/core/directshow/libDirectshowAbstracts/AbstractTransformFilter.h	2004-11-23 11:07:39 UTC (rev 8267)
@@ -53,10 +53,9 @@
 	friend class AbstractTransformInputPin;
 	friend class AbstractTransformOutputPin;
 
-	//COM Setup
+	//COM Initialisation
 	DECLARE_IUNKNOWN
 	STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv);
-	
 
 	//Constructors
 	AbstractTransformFilter(TCHAR* inFilterName, REFCLSID inFilterGUID);

Modified: trunk/oggdsf/src/lib/core/directshow/libDirectshowAbstracts/AbstractTransformInputPin.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/libDirectshowAbstracts/AbstractTransformInputPin.cpp	2004-11-23 10:48:12 UTC (rev 8266)
+++ trunk/oggdsf/src/lib/core/directshow/libDirectshowAbstracts/AbstractTransformInputPin.cpp	2004-11-23 11:07:39 UTC (rev 8267)
@@ -33,23 +33,18 @@
 #include "AbstractTransformInputPin.h"
 
 
-AbstractTransformInputPin::AbstractTransformInputPin (AbstractTransformFilter* inParentFilter, CCritSec* inFilterLock, AbstractTransformOutputPin* inOutputPin, CHAR* inObjectName, LPCWSTR inPinDisplayName, vector<CMediaType*> inAcceptMediaTypes)
+AbstractTransformInputPin::AbstractTransformInputPin (AbstractTransformFilter* inParentFilter, CCritSec* inFilterLock, AbstractTransformOutputPin* inOutputPin, CHAR* inObjectName, LPCWSTR inPinDisplayName, vector<CMediaType*> inAcceptableMediaTypes)
 	:	CBaseInputPin (inObjectName, inParentFilter, inFilterLock, &mHR, inPinDisplayName)
 	,	mOutputPin (inOutputPin)
 	,	mParentFilter (inParentFilter)
 	
 	,	mBegun (false)
 
+	,	mAcceptableMediaTypes(inAcceptableMediaTypes)
 
-{
-	
-	//ConstructCodec();
-	//debugLog.open("g:\\logs\\aad.log", ios_base::out);
 
-	//TODO::: Put in init list.
-	mAcceptableMediaTypes = inAcceptMediaTypes;
+{
 	mStreamLock = new CCritSec;			//Deleted in destructor.
-
 }
 
 STDMETHODIMP AbstractTransformInputPin::NonDelegatingQueryInterface(REFIID riid, void **ppv)
@@ -82,22 +77,11 @@
 }
 AbstractTransformInputPin::~AbstractTransformInputPin(void)
 {
-	//DestroyCodec();
-	//debugLog.close();
-	delete mStreamLock;
 
+	delete mStreamLock;
 }
 
 
-//void AbstractTransformInputPin::ResetFrameCount() 
-//{
-//	mUptoFrame = 0;
-//	
-//}
-//void AbstractTransformInputPin::ResetTimeBases() 
-//{
-//	mLastSeenStartGranPos = 0;
-//}
 bool AbstractTransformInputPin::SetSampleParams(IMediaSample* outMediaSample, unsigned long inDataSize, REFERENCE_TIME* inStartTime, REFERENCE_TIME* inEndTime) 
 {
 	outMediaSample->SetTime(inStartTime, inEndTime);
@@ -124,57 +108,21 @@
 			//TODO::: Do a debug dump or something here with specific error info.
 			return locHR;
 		} else {
-
-
-			////Is any of this needed ???
-			////New start time hacks
-			//REFERENCE_TIME locStart = 0;
-			//REFERENCE_TIME locEnd = 0;
-
-			////More work arounds for that stupid granule pos scheme in theora!
-			//REFERENCE_TIME locTimeBase = 0;
-			//REFERENCE_TIME locDummy = 0;
-			//inSample->GetMediaTime(&locTimeBase, &locDummy);
-			//mSeekTimeBase = locTimeBase;
-			////
-
-			//inSample->GetTime(&locStart, &locEnd);
-			////Error chacks needed here
-			////debugLog<<"Receive : Start    = "<<locStart<<endl;
-			////debugLog<<"Receive : End      = "<<locEnd<<endl;
-			////debugLog<<"Receive : Timebase = "<<locTimeBase<<endl;
-			//
-			////QUERY::: Why are we doing this ???
-			////			Wouldn't it be better to only resset the frame count when we seek (ie in NewSegment)
-			////			then we just use m_tStart as the time base until another seek.
-			//if ((mLastSeenStartGranPos != locStart) && (locStart != -1)) {
-			//	//debugLog<<"Receive : RESETTING FRAME COUNT !!"<<endl;
-			//	ResetFrameCount();
-			//}
-			////debugLog<<endl;
-			//mLastSeenStartGranPos = locStart;
-			////End of additions
-			
-			//TODO::: Why using this convention... why not use HRESULT ???
 			HRESULT locResult = TransformData(locBuff, inSample->GetActualDataLength());
 			if (locResult == S_OK) {
-
-				//aadDebug<<"Receive Decode : OK"<<endl;
 				return S_OK;
 			} else {
-				//aadDebug<<"Receive Decode : *** FAILED *** "<<locResult<<endl;
 				return S_FALSE;
 			}
 		}
 	} else {
-		//debugLog<<"NOT STREAMING.... "<<endl;
+		//Not streaming - Bail out.
 		return locHR;
 	}
-	
-	return S_OK;
 }
 
-HRESULT AbstractTransformInputPin::CheckMediaType(const CMediaType *inMediaType) {
+HRESULT AbstractTransformInputPin::CheckMediaType(const CMediaType *inMediaType) 
+{
 	//TO DO::: Neaten this up.
 	for (int i = 0; i < mAcceptableMediaTypes.size(); i++) {
 		if	(		(inMediaType->majortype == mAcceptableMediaTypes[i]->majortype) 
@@ -210,7 +158,6 @@
 
 STDMETHODIMP AbstractTransformInputPin::NewSegment(REFERENCE_TIME inStartTime, REFERENCE_TIME inStopTime, double inRate) {
 	CAutoLock locLock(mStreamLock);
-	//ResetFrameCount();
 
 	//This is called on BasePin and not BaseInputPin because the implementation is not overriden in BaseOutputPin.
 	CBasePin::NewSegment(inStartTime, inStopTime, inRate);

Modified: trunk/oggdsf/src/lib/core/directshow/libDirectshowAbstracts/AbstractTransformInputPin.h
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/libDirectshowAbstracts/AbstractTransformInputPin.h	2004-11-23 10:48:12 UTC (rev 8266)
+++ trunk/oggdsf/src/lib/core/directshow/libDirectshowAbstracts/AbstractTransformInputPin.h	2004-11-23 11:07:39 UTC (rev 8267)
@@ -65,7 +65,7 @@
 	STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv);
 		
 	//Constructors	
-	AbstractTransformInputPin(AbstractTransformFilter* inParentFilter, CCritSec* inFilterLock, AbstractTransformOutputPin* inOutputPin, CHAR* inObjectName, LPCWSTR inPinDisplayName, vector<CMediaType*> inAcceptMediaType);
+	AbstractTransformInputPin(AbstractTransformFilter* inParentFilter, CCritSec* inFilterLock, AbstractTransformOutputPin* inOutputPin, CHAR* inObjectName, LPCWSTR inPinDisplayName, vector<CMediaType*> inAcceptableMediaTypes);
 	virtual ~AbstractTransformInputPin(void);
 
 	//Pure Virtuals for codec specific methods
@@ -83,7 +83,7 @@
 	virtual HRESULT SetMediaType(const CMediaType* inMediaType) = 0;
 
 	//TODO::: Should be virtual ??
-	STDMETHODIMP Receive(IMediaSample *pSample);
+	virtual STDMETHODIMP Receive(IMediaSample *pSample);
 
 	//Stream Messaging methods
 	virtual STDMETHODIMP EndOfStream(void);

Modified: trunk/oggdsf/src/lib/core/directshow/libDirectshowAbstracts/AbstractTransformOutputPin.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/libDirectshowAbstracts/AbstractTransformOutputPin.cpp	2004-11-23 10:48:12 UTC (rev 8266)
+++ trunk/oggdsf/src/lib/core/directshow/libDirectshowAbstracts/AbstractTransformOutputPin.cpp	2004-11-23 11:07:39 UTC (rev 8267)
@@ -33,7 +33,7 @@
 #include "AbstractTransformOutputPin.h"
 
 
-AbstractTransformOutputPin::AbstractTransformOutputPin(AbstractTransformFilter* inParentFilter, CCritSec* inFilterLock, CHAR* inObjectName, LPCWSTR inPinDisplayName, int inBuffSize, int inNumBuffs, vector<CMediaType*> mAcceptableMediaTypes)
+AbstractTransformOutputPin::AbstractTransformOutputPin(AbstractTransformFilter* inParentFilter, CCritSec* inFilterLock, CHAR* inObjectName, LPCWSTR inPinDisplayName, int inBuffSize, int inNumBuffs, vector<CMediaType*> inAcceptableMediaTypes)
 	//Base Classes
 	:	CBaseOutputPin(inObjectName, inParentFilter, inFilterLock, &mHR, inPinDisplayName)
 
@@ -47,6 +47,8 @@
 	,	mActualBufferSize(0)
 	,	mActualBufferCount(0)
 
+	,	mAcceptableMediaTypes(inAcceptableMediaTypes)
+
 {
 
 }
@@ -57,7 +59,8 @@
 	mDataQueue = NULL;
 }
 
-STDMETHODIMP AbstractTransformOutputPin::NonDelegatingQueryInterface(REFIID riid, void **ppv) {
+STDMETHODIMP AbstractTransformOutputPin::NonDelegatingQueryInterface(REFIID riid, void **ppv) 
+{
 	if (riid == IID_IMediaSeeking) {
 		*ppv = (IMediaSeeking*)this;
 		((IUnknown*)*ppv)->AddRef();
@@ -119,7 +122,6 @@
 }
 HRESULT AbstractTransformOutputPin::CheckMediaType(const CMediaType *inMediaType) 
 {
-
 	for (int i = 0;  i < mAcceptableMediaTypes.size(); i++) {
 		if	(		(inMediaType->majortype == mAcceptableMediaTypes[i]->majortype) 
 				&& 	(inMediaType->subtype == mAcceptableMediaTypes[i]->subtype) 
@@ -133,16 +135,6 @@
 
 	//If it was none of them return false.
 	return S_FALSE;
-
-
-	//if (	(inMediaType->majortype == MEDIATYPE_Audio) && 
-	//		(inMediaType->subtype == MEDIASUBTYPE_PCM) && 
-	//		(inMediaType->formattype == FORMAT_WaveFormatEx)) {
-	//	return S_OK;
-	//} else {
-	//	return S_FALSE;
-	//}
-	
 }
 
 void AbstractTransformOutputPin::FillMediaType(CMediaType* outMediaType, int inPosition) 
@@ -158,13 +150,10 @@
 	// Sample size of 0 means variable size... so that is almost always acceptable.
 	outMediaType->SetTemporalCompression(FALSE);
 	outMediaType->SetSampleSize(0);
-
 }
 
-
 HRESULT AbstractTransformOutputPin::GetMediaType(int inPosition, CMediaType *outMediaType) 
 {
-
 	if (inPosition < 0) {
 		return E_INVALIDARG;
 	}
@@ -176,16 +165,6 @@
 	} else {
 		return VFW_S_NO_MORE_ITEMS;
 	}
-
-
-	//if (inPosition == 0) {
-	//	FillMediaType(outMediaType);
-	//	WAVEFORMATEX* locWaveFormat = (WAVEFORMATEX*)outMediaType->AllocFormatBuffer(sizeof(WAVEFORMATEX));
-	//	FillWaveFormatExBuffer(locWaveFormat);
-	//	return S_OK;
-	//} else {
-	//	return VFW_S_NO_MORE_ITEMS;
-	//}
 }
 
 HRESULT AbstractTransformOutputPin::DeliverNewSegment(REFERENCE_TIME inStartTime, REFERENCE_TIME inStopTime, double inRate) 



More information about the commits mailing list