[xiph-commits] r7732 - trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder

illiminable at motherfish-iii.xiph.org illiminable at motherfish-iii.xiph.org
Fri Sep 10 05:59:29 PDT 2004


Author: illiminable
Date: 2004-09-10 05:59:28 -0700 (Fri, 10 Sep 2004)
New Revision: 7732

Modified:
   trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.cpp
   trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeInputPin.cpp
   trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeInputPin.h
   trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeOutputPin.cpp
   trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeOutputPin.h
   trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/dsfTheoraDecoder.vcproj
Log:
* Comment out the old pin implementations ready for new ones.
* Added pin creation code to filter, via GetPin virtual method.

Modified: trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.cpp	2004-09-10 12:36:40 UTC (rev 7731)
+++ trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.cpp	2004-09-10 12:59:28 UTC (rev 7732)
@@ -677,6 +677,50 @@
 	mTheoraFormatInfo = new sTheoraFormatBlock;
 	*mTheoraFormatInfo = *inFormatBlock;
 }
+
+CBasePin* TheoraDecodeFilter::GetPin(int inPinNo)
+{
+    HRESULT hr = S_OK;
+
+    // Create an input pin if necessary
+
+    if (m_pInput == NULL) {
+
+        m_pInput = new TheoraDecodeInputPin(NAME("Theora Input Pin"),
+                                          this,              // Owner filter
+                                          &hr,               // Result code
+                                          L"Theora In");      // Pin name
+
+
+        //  Can't fail
+        ASSERT(SUCCEEDED(hr));
+        if (m_pInput == NULL) {
+            return NULL;
+        }
+        m_pOutput = new TheoraDecodeOutputPin(NAME("Theora Output Pin"),
+                                            this,            // Owner filter
+                                            &hr,             // Result code
+                                            L"YV12 Out");   // Pin name
+
+
+        // Can't fail
+        ASSERT(SUCCEEDED(hr));
+        if (m_pOutput == NULL) {
+            delete m_pInput;
+            m_pInput = NULL;
+        }
+    }
+
+    // Return the pin
+
+    if (n == 0) {
+        return m_pInput;
+    } else if (n == 1) {
+        return m_pOutput;
+    } else {
+        return NULL;
+    }
+}
 //---------------------------------------
 //OLD IMPLOEMENTATION....
 //---------------------------------------

Modified: trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeInputPin.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeInputPin.cpp	2004-09-10 12:36:40 UTC (rev 7731)
+++ trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeInputPin.cpp	2004-09-10 12:59:28 UTC (rev 7732)
@@ -33,364 +33,367 @@
 #include "theoradecodeinputpin.h"
 
 
-TheoraDecodeInputPin::TheoraDecodeInputPin(AbstractVideoDecodeFilter* inFilter, CCritSec* inFilterLock, AbstractVideoDecodeOutputPin* inOutputPin, CMediaType* inAcceptMediaType)
-	:	AbstractVideoDecodeInputPin(inFilter, inFilterLock, inOutputPin, NAME("TheoraDecodeInputPin"), L"Theora In", inAcceptMediaType)
-	,	mXOffset(0)
-	,	mYOffset(0)
-
-{
-	debugLog.open("G:\\logs\\theoInputPin.log", ios_base::out);
-	ConstructCodec();
-}
-
-STDMETHODIMP TheoraDecodeInputPin::NonDelegatingQueryInterface(REFIID riid, void **ppv)
-{
-	if (riid == IID_IMediaSeeking) {
-		*ppv = (IMediaSeeking*)this;
-		((IUnknown*)*ppv)->AddRef();
-		return NOERROR;
-	}
-
-	return CBaseInputPin::NonDelegatingQueryInterface(riid, ppv); 
-}
-bool TheoraDecodeInputPin::ConstructCodec() {
-
-
-	mTheoraDecoder = new TheoraDecoder;
-	mTheoraDecoder->initCodec();
-	return true;
-}
-void TheoraDecodeInputPin::DestroyCodec() {
-	delete mTheoraDecoder;
-}
-TheoraDecodeInputPin::~TheoraDecodeInputPin(void)
-{
-	debugLog.close();
-	DestroyCodec();
-	
-}
-
-
-
-int TheoraDecodeInputPin::TheoraDecoded (yuv_buffer* inYUVBuffer) 
-{
-	DbgLog((LOG_TRACE,1,TEXT("Decoded... Sending...")));
-	
-	debugLog<<"TheoraDecoded... "<<endl;
-	
-	TheoraDecodeFilter* locFilter = reinterpret_cast<TheoraDecodeFilter*>(m_pFilter);
-	//
-	if (!mBegun) {
-	
-	
-	
-		mBegun = true;
-		
-		//How many UNITS does one frame take.
-		mFrameDuration = (UNITS * locFilter->mTheoraFormatInfo->frameRateDenominator) / (locFilter->mTheoraFormatInfo->frameRateNumerator);
-		mFrameSize = (mHeight * mWidth * 3) / 2;
-		mFrameCount = 0;
-	}
-
-
-
-	////FIX::: Most of this will be obselete... the demux does it all.
-	//
-
-	////TO DO::: Fix this up... needs to move around order and some only needs to be done once, move it into the block aboce and use member data
-
-	////Make the start timestamp
-	////FIX:::Abstract this calculation
-	DbgLog((LOG_TRACE,1,TEXT("Frame Count = %d"), mFrameCount));
-	//REFERENCE_TIME locFrameStart = CurrentStartTime() + (mFrameCount * mFrameDuration);
-
-	//Timestamp hacks start here...
-	unsigned long locMod = (unsigned long)pow(2, locFilter->mTheoraFormatInfo->maxKeyframeInterval);
-	DbgLog((LOG_TRACE,1,TEXT("locSeenGranPos = %d"), mLastSeenStartGranPos));
-	DbgLog((LOG_TRACE,1,TEXT("locMod = %d"), locMod));
-	unsigned long locInterFrameNo = (mLastSeenStartGranPos) % locMod;
-	DbgLog((LOG_TRACE,1,TEXT("InterFrameNo = %d"), locInterFrameNo));
-	LONGLONG locAbsFramePos = ((mLastSeenStartGranPos >> locFilter->mTheoraFormatInfo->maxKeyframeInterval)) + locInterFrameNo;
-	DbgLog((LOG_TRACE,1,TEXT("AbsFrameNo = %d"), locAbsFramePos));
-	DbgLog((LOG_TRACE,1,TEXT("mSeekTimeBase = %d"), mSeekTimeBase));
-	REFERENCE_TIME locTimeBase = (locAbsFramePos * mFrameDuration) - mSeekTimeBase;
-	DbgLog((LOG_TRACE,1,TEXT("locTimeBase = %d"), locTimeBase));
-	//
-	//
-
-	REFERENCE_TIME locFrameStart = locTimeBase + (mFrameCount * mFrameDuration);
-	//Increment the frame counter
-	mFrameCount++;
-	
-	//Make the end frame counter
-	//REFERENCE_TIME locFrameEnd = CurrentStartTime() + (mFrameCount * mFrameDuration);
-	REFERENCE_TIME locFrameEnd = locTimeBase + (mFrameCount * mFrameDuration);
-
-	DbgLog((LOG_TRACE,1,TEXT("Frame Runs From %d"), locFrameStart));
-	DbgLog((LOG_TRACE,1,TEXT("Frame Runs To %d"), locFrameEnd));
-
-	IMediaSample* locSample = NULL;
-	debugLog<<"Sample times = "<<locFrameStart<<" to "<<locFrameEnd<<endl;
-	DWORD locFlags = 0;//AM_GBF_PREVFRAMESKIPPED | AM_GBF_NOTASYNCPOINT;
-
-	FILTER_STATE locFS;
-	mParentFilter->GetState(0, &locFS);
-	debugLog<<"State Before = "<<locFS<<endl;
-	HRESULT locHR = mOutputPin->GetDeliveryBuffer(&locSample, &locFrameStart, &locFrameEnd, locFlags);
-	mParentFilter->GetState(0, &locFS);
-	debugLog<<"State After = "<<locFS<<endl;
-	if (locHR != S_OK) {
-		debugLog<<"Get DeliveryBuffer FAILED with "<<locHR<<endl;
-		debugLog<<"locSample is "<<(unsigned long)locSample<<endl;
-		//We get here when the application goes into stop mode usually.
-
-		switch (locHR) {
-			case VFW_E_SIZENOTSET:
-				debugLog<<"SIZE NOT SET"<<endl;
-				break;
-			case VFW_E_NOT_COMMITTED:
-				debugLog<<"NOT COMMITTED"<<endl;
-				break;
-			case VFW_E_TIMEOUT:
-				debugLog<<"TIMEOUT"<<endl;
-				break;
-			case VFW_E_STATE_CHANGED:
-				debugLog<<"STATE CHANGED"<<endl;
-				return S_OK;
-			default:
-				debugLog<<"SOMETHING ELSE !!!"<<endl;
-				break;
-		}
-		return locHR;
-	}	
-	
-	debugLog<<"GetDeliveryBuffer &** SUCCEEDED **"<<endl;
-
-	//Debuggin code
-	AM_MEDIA_TYPE* locMediaType = NULL;
-	locSample->GetMediaType(&locMediaType);
-	if (locMediaType == NULL) {
-		debugLog<<"No dynamic change..."<<endl;
-	} else {
-		debugLog<<"Attempting dynamic change..."<<endl;
-		if (locMediaType->majortype == MEDIATYPE_Video) {
-			debugLog<<"Still MEDIATYPE_Video"<<endl;
-		}
-
-		if (locMediaType->subtype == MEDIASUBTYPE_YV12) {
-			debugLog<<"Still MEDIASUBTYPE_YV12"<<endl;
-		}
-
-		if (locMediaType->formattype == FORMAT_VideoInfo) {
-			debugLog<<"Still FORMAT_VideoInfo"<<endl;
-			VIDEOINFOHEADER* locVF = (VIDEOINFOHEADER*)locMediaType->pbFormat;
-			debugLog<<"Size = "<<locVF->bmiHeader.biSizeImage<<endl;
-			debugLog<<"Dim   = "<<locVF->bmiHeader.biWidth<<" x " <<locVF->bmiHeader.biHeight<<endl;
-		}
-
-		debugLog<<"Major  : "<<DSStringer::GUID2String(&locMediaType->majortype);
-		debugLog<<"Minor  : "<<DSStringer::GUID2String(&locMediaType->subtype);
-		debugLog<<"Format : "<<DSStringer::GUID2String(&locMediaType->formattype);
-		debugLog<<"Form Sz: "<<locMediaType->cbFormat;
-
-
-	}
-	//
-
-	////Create pointers for the samples buffer to be assigned to
-	BYTE* locBuffer = NULL;
-	
-	//
-	////Make our pointers set to point to the samples buffer
-	locSample->GetPointer(&locBuffer);
-	
-
-
-	//Fill the buffer with yuv data...
-	//	
-
-
-
-	//Set up the pointers
-	unsigned char* locDestUptoPtr = locBuffer;
-	char* locSourceUptoPtr = inYUVBuffer->y;
-
-	//
-	//Y DATA
-	//
-
-	//NEW WAY with offsets Y Data
-	long locTopPad = inYUVBuffer->y_height - mHeight - mYOffset;
-	ASSERT(locTopPad >= 0);
-	if (locTopPad < 0) {
-		locTopPad = 0;
-	}
-
-	//Skip the top padding
-	locSourceUptoPtr += (locTopPad * inYUVBuffer->y_stride);
-
-	for (long line = 0; line < mHeight; line++) {
-		memcpy((void*)(locDestUptoPtr), (const void*)(locSourceUptoPtr + mXOffset), mWidth);
-		locSourceUptoPtr += inYUVBuffer->y_stride;
-		locDestUptoPtr += mWidth;
-	}
-
-	locSourceUptoPtr += (mYOffset * inYUVBuffer->y_stride);
-
-	//Source advances by (y_height * y_stride)
-	//Dest advances by (mHeight * mWidth)
-
-	//
-	//V DATA
-	//
-
-	//Half the padding for uv planes... is this correct ? 
-	locTopPad = locTopPad /2;
-	
-	locSourceUptoPtr = inYUVBuffer->v;
-
-	//Skip the top padding
-	locSourceUptoPtr += (locTopPad * inYUVBuffer->y_stride);
-
-	for (long line = 0; line < mHeight / 2; line++) {
-		memcpy((void*)(locDestUptoPtr), (const void*)(locSourceUptoPtr + (mXOffset / 2)), mWidth / 2);
-		locSourceUptoPtr += inYUVBuffer->uv_stride;
-		locDestUptoPtr += (mWidth / 2);
-	}
-	locSourceUptoPtr += ((mYOffset/2) * inYUVBuffer->uv_stride);
-
-	//Source advances by (locTopPad + mYOffset/2 + mHeight /2) * uv_stride
-	//where locTopPad for uv = (inYUVBuffer->y_height - mHeight - mYOffset) / 2
-	//						=	(inYUVBuffer->yheight/2 - mHeight/2 - mYOffset/2)
-	// so source advances by (y_height/2) * uv_stride
-	//Dest advances by (mHeight * mWidth) /4
-
-
-	//
-	//U DATA
-	//
-
-	locSourceUptoPtr = inYUVBuffer->u;
-
-	//Skip the top padding
-	locSourceUptoPtr += (locTopPad * inYUVBuffer->y_stride);
-
-	for (long line = 0; line < mHeight / 2; line++) {
-		memcpy((void*)(locDestUptoPtr), (const void*)(locSourceUptoPtr + (mXOffset / 2)), mWidth / 2);
-		locSourceUptoPtr += inYUVBuffer->uv_stride;
-		locDestUptoPtr += (mWidth / 2);
-	}
-	locSourceUptoPtr += ((mYOffset/2) * inYUVBuffer->uv_stride);
-
-
-	////Y Data.
-	//for ( long line = 0; line < inYUVBuffer->y_height; line++) {
-	//	memcpy((void*)locBuffer, (const void*)(inYUVBuffer->y + (inYUVBuffer->y_stride * (line))), inYUVBuffer->y_width);
-	//	locBuffer += inYUVBuffer->y_width;
-
-	//	if (mWidth > inYUVBuffer->y_width) {
-	//		memset((void*)locBuffer, 0, mWidth - inYUVBuffer->y_width);
-	//	}
-	//	locBuffer += mWidth - inYUVBuffer->y_width;
-	//}
-
-	////Pad height...
-	//for ( long line = 0; line < mHeight - inYUVBuffer->y_height; line++) {
-	//	memset((void*)locBuffer, 0, mWidth);
-	//	locBuffer += mWidth;
-	//}
-
-	////V Data
-	//for ( long line = 0; line < inYUVBuffer->uv_height; line++) {
-	//	memcpy((void*)locBuffer, (const void*)(inYUVBuffer->v + (inYUVBuffer->uv_stride * (line))), inYUVBuffer->uv_width);
-	//	locBuffer += inYUVBuffer->uv_width;
-
-	//	if (mWidth/2 > inYUVBuffer->uv_width) {
-	//		memset((void*)locBuffer, 0, (mWidth/2) - inYUVBuffer->uv_width);
-	//	}
-	//	locBuffer += (mWidth/2) - inYUVBuffer->uv_width;
-	//}
-
-	////Pad height...
-	//for ( long line = 0; line < (mHeight/2) - inYUVBuffer->uv_height; line++) {
-	//	memset((void*)locBuffer, 0, mWidth/2);
-	//	locBuffer += mWidth/2;
-	//}
-
-	////U Data
-	//for (long line = 0; line < inYUVBuffer->uv_height; line++) {
-	//	memcpy((void*)locBuffer, (const void*)(inYUVBuffer->u + (inYUVBuffer->uv_stride * (line))), inYUVBuffer->uv_width);
-	//	locBuffer += inYUVBuffer->uv_width;
-
-	//	if (mWidth/2 > inYUVBuffer->uv_width) {
-	//		memset((void*)locBuffer, 0, (mWidth/2) - inYUVBuffer->uv_width);
-	//	}
-	//	locBuffer += (mWidth/2) - inYUVBuffer->uv_width;
-	//}
-
-	////Pad height...
-	//for ( long line = 0; line < (mHeight/2) - inYUVBuffer->uv_height; line++) {
-	//	memset((void*)locBuffer, 0, mWidth/2);
-	//	locBuffer += mWidth/2;
-	//}
-
-
-
-
-
-	//Set the sample parameters.
-	SetSampleParams(locSample, mFrameSize, &locFrameStart, &locFrameEnd);
-
-	{
-
-		//Add a reerence to the sample so it isn't deleted in the queue.
-		//locSample->AddRef();
-		HRESULT locHR = mOutputPin->mDataQueue->Receive(locSample);						//->DownstreamFilter()->Receive(locSample);
-		if (locHR != S_OK) {
-			debugLog<<"Data Q rejects sample... with "<<locHR<<endl;
-			return -1;
-
-		}
-	}
-
-	
-	return 0;
-
-
-}
-
-
-
-long TheoraDecodeInputPin::decodeData(BYTE* inBuf, long inNumBytes, LONGLONG inStart, LONGLONG inEnd) 
-{
-	DbgLog((LOG_TRACE,1,TEXT("decodeData")));
-																	//Not truncated or continued... it's a full packet
-	StampedOggPacket* locPacket = new StampedOggPacket(inBuf, inNumBytes, false, false, inStart, inEnd, StampedOggPacket::OGG_END_ONLY);
-	yuv_buffer* locYUV = mTheoraDecoder->decodeTheora(locPacket);
-	if (locYUV != NULL) {
-		if (TheoraDecoded(locYUV) != 0) {
-			return -1;
-		}
-	}
-
-	return 0;
-}
-
-
-
-HRESULT TheoraDecodeInputPin::SetMediaType(const CMediaType* inMediaType) {
-
-	if (inMediaType->subtype == MEDIASUBTYPE_Theora) {
-		((TheoraDecodeFilter*)mParentFilter)->setTheoraFormat((sTheoraFormatBlock*)inMediaType->pbFormat);
-		mParentFilter->mVideoFormat = AbstractVideoDecodeFilter::THEORA;
-		//Set some other stuff here too...
-		mXOffset = ((sTheoraFormatBlock*)inMediaType->pbFormat)->xOffset;
-		mYOffset = ((sTheoraFormatBlock*)inMediaType->pbFormat)->yOffset;
-
-	} else {
-		//Failed... should never be here !
-		throw 0;
-	}
-	return CBaseInputPin::SetMediaType(inMediaType);
-}
-
+//----------------------
+//OLD IMPLEMENTATION
+//----------------------
+//TheoraDecodeInputPin::TheoraDecodeInputPin(AbstractVideoDecodeFilter* inFilter, CCritSec* inFilterLock, AbstractVideoDecodeOutputPin* inOutputPin, CMediaType* inAcceptMediaType)
+//	:	AbstractVideoDecodeInputPin(inFilter, inFilterLock, inOutputPin, NAME("TheoraDecodeInputPin"), L"Theora In", inAcceptMediaType)
+//	,	mXOffset(0)
+//	,	mYOffset(0)
+//
+//{
+//	debugLog.open("G:\\logs\\theoInputPin.log", ios_base::out);
+//	ConstructCodec();
+//}
+//
+//STDMETHODIMP TheoraDecodeInputPin::NonDelegatingQueryInterface(REFIID riid, void **ppv)
+//{
+//	if (riid == IID_IMediaSeeking) {
+//		*ppv = (IMediaSeeking*)this;
+//		((IUnknown*)*ppv)->AddRef();
+//		return NOERROR;
+//	}
+//
+//	return CBaseInputPin::NonDelegatingQueryInterface(riid, ppv); 
+//}
+//bool TheoraDecodeInputPin::ConstructCodec() {
+//
+//
+//	mTheoraDecoder = new TheoraDecoder;
+//	mTheoraDecoder->initCodec();
+//	return true;
+//}
+//void TheoraDecodeInputPin::DestroyCodec() {
+//	delete mTheoraDecoder;
+//}
+//TheoraDecodeInputPin::~TheoraDecodeInputPin(void)
+//{
+//	debugLog.close();
+//	DestroyCodec();
+//	
+//}
+//
+//
+//
+//int TheoraDecodeInputPin::TheoraDecoded (yuv_buffer* inYUVBuffer) 
+//{
+//	DbgLog((LOG_TRACE,1,TEXT("Decoded... Sending...")));
+//	
+//	debugLog<<"TheoraDecoded... "<<endl;
+//	
+//	TheoraDecodeFilter* locFilter = reinterpret_cast<TheoraDecodeFilter*>(m_pFilter);
+//	//
+//	if (!mBegun) {
+//	
+//	
+//	
+//		mBegun = true;
+//		
+//		//How many UNITS does one frame take.
+//		mFrameDuration = (UNITS * locFilter->mTheoraFormatInfo->frameRateDenominator) / (locFilter->mTheoraFormatInfo->frameRateNumerator);
+//		mFrameSize = (mHeight * mWidth * 3) / 2;
+//		mFrameCount = 0;
+//	}
+//
+//
+//
+//	////FIX::: Most of this will be obselete... the demux does it all.
+//	//
+//
+//	////TO DO::: Fix this up... needs to move around order and some only needs to be done once, move it into the block aboce and use member data
+//
+//	////Make the start timestamp
+//	////FIX:::Abstract this calculation
+//	DbgLog((LOG_TRACE,1,TEXT("Frame Count = %d"), mFrameCount));
+//	//REFERENCE_TIME locFrameStart = CurrentStartTime() + (mFrameCount * mFrameDuration);
+//
+//	//Timestamp hacks start here...
+//	unsigned long locMod = (unsigned long)pow(2, locFilter->mTheoraFormatInfo->maxKeyframeInterval);
+//	DbgLog((LOG_TRACE,1,TEXT("locSeenGranPos = %d"), mLastSeenStartGranPos));
+//	DbgLog((LOG_TRACE,1,TEXT("locMod = %d"), locMod));
+//	unsigned long locInterFrameNo = (mLastSeenStartGranPos) % locMod;
+//	DbgLog((LOG_TRACE,1,TEXT("InterFrameNo = %d"), locInterFrameNo));
+//	LONGLONG locAbsFramePos = ((mLastSeenStartGranPos >> locFilter->mTheoraFormatInfo->maxKeyframeInterval)) + locInterFrameNo;
+//	DbgLog((LOG_TRACE,1,TEXT("AbsFrameNo = %d"), locAbsFramePos));
+//	DbgLog((LOG_TRACE,1,TEXT("mSeekTimeBase = %d"), mSeekTimeBase));
+//	REFERENCE_TIME locTimeBase = (locAbsFramePos * mFrameDuration) - mSeekTimeBase;
+//	DbgLog((LOG_TRACE,1,TEXT("locTimeBase = %d"), locTimeBase));
+//	//
+//	//
+//
+//	REFERENCE_TIME locFrameStart = locTimeBase + (mFrameCount * mFrameDuration);
+//	//Increment the frame counter
+//	mFrameCount++;
+//	
+//	//Make the end frame counter
+//	//REFERENCE_TIME locFrameEnd = CurrentStartTime() + (mFrameCount * mFrameDuration);
+//	REFERENCE_TIME locFrameEnd = locTimeBase + (mFrameCount * mFrameDuration);
+//
+//	DbgLog((LOG_TRACE,1,TEXT("Frame Runs From %d"), locFrameStart));
+//	DbgLog((LOG_TRACE,1,TEXT("Frame Runs To %d"), locFrameEnd));
+//
+//	IMediaSample* locSample = NULL;
+//	debugLog<<"Sample times = "<<locFrameStart<<" to "<<locFrameEnd<<endl;
+//	DWORD locFlags = 0;//AM_GBF_PREVFRAMESKIPPED | AM_GBF_NOTASYNCPOINT;
+//
+//	FILTER_STATE locFS;
+//	mParentFilter->GetState(0, &locFS);
+//	debugLog<<"State Before = "<<locFS<<endl;
+//	HRESULT locHR = mOutputPin->GetDeliveryBuffer(&locSample, &locFrameStart, &locFrameEnd, locFlags);
+//	mParentFilter->GetState(0, &locFS);
+//	debugLog<<"State After = "<<locFS<<endl;
+//	if (locHR != S_OK) {
+//		debugLog<<"Get DeliveryBuffer FAILED with "<<locHR<<endl;
+//		debugLog<<"locSample is "<<(unsigned long)locSample<<endl;
+//		//We get here when the application goes into stop mode usually.
+//
+//		switch (locHR) {
+//			case VFW_E_SIZENOTSET:
+//				debugLog<<"SIZE NOT SET"<<endl;
+//				break;
+//			case VFW_E_NOT_COMMITTED:
+//				debugLog<<"NOT COMMITTED"<<endl;
+//				break;
+//			case VFW_E_TIMEOUT:
+//				debugLog<<"TIMEOUT"<<endl;
+//				break;
+//			case VFW_E_STATE_CHANGED:
+//				debugLog<<"STATE CHANGED"<<endl;
+//				return S_OK;
+//			default:
+//				debugLog<<"SOMETHING ELSE !!!"<<endl;
+//				break;
+//		}
+//		return locHR;
+//	}	
+//	
+//	debugLog<<"GetDeliveryBuffer &** SUCCEEDED **"<<endl;
+//
+//	//Debuggin code
+//	AM_MEDIA_TYPE* locMediaType = NULL;
+//	locSample->GetMediaType(&locMediaType);
+//	if (locMediaType == NULL) {
+//		debugLog<<"No dynamic change..."<<endl;
+//	} else {
+//		debugLog<<"Attempting dynamic change..."<<endl;
+//		if (locMediaType->majortype == MEDIATYPE_Video) {
+//			debugLog<<"Still MEDIATYPE_Video"<<endl;
+//		}
+//
+//		if (locMediaType->subtype == MEDIASUBTYPE_YV12) {
+//			debugLog<<"Still MEDIASUBTYPE_YV12"<<endl;
+//		}
+//
+//		if (locMediaType->formattype == FORMAT_VideoInfo) {
+//			debugLog<<"Still FORMAT_VideoInfo"<<endl;
+//			VIDEOINFOHEADER* locVF = (VIDEOINFOHEADER*)locMediaType->pbFormat;
+//			debugLog<<"Size = "<<locVF->bmiHeader.biSizeImage<<endl;
+//			debugLog<<"Dim   = "<<locVF->bmiHeader.biWidth<<" x " <<locVF->bmiHeader.biHeight<<endl;
+//		}
+//
+//		debugLog<<"Major  : "<<DSStringer::GUID2String(&locMediaType->majortype);
+//		debugLog<<"Minor  : "<<DSStringer::GUID2String(&locMediaType->subtype);
+//		debugLog<<"Format : "<<DSStringer::GUID2String(&locMediaType->formattype);
+//		debugLog<<"Form Sz: "<<locMediaType->cbFormat;
+//
+//
+//	}
+//	//
+//
+//	////Create pointers for the samples buffer to be assigned to
+//	BYTE* locBuffer = NULL;
+//	
+//	//
+//	////Make our pointers set to point to the samples buffer
+//	locSample->GetPointer(&locBuffer);
+//	
+//
+//
+//	//Fill the buffer with yuv data...
+//	//	
+//
+//
+//
+//	//Set up the pointers
+//	unsigned char* locDestUptoPtr = locBuffer;
+//	char* locSourceUptoPtr = inYUVBuffer->y;
+//
+//	//
+//	//Y DATA
+//	//
+//
+//	//NEW WAY with offsets Y Data
+//	long locTopPad = inYUVBuffer->y_height - mHeight - mYOffset;
+//	ASSERT(locTopPad >= 0);
+//	if (locTopPad < 0) {
+//		locTopPad = 0;
+//	}
+//
+//	//Skip the top padding
+//	locSourceUptoPtr += (locTopPad * inYUVBuffer->y_stride);
+//
+//	for (long line = 0; line < mHeight; line++) {
+//		memcpy((void*)(locDestUptoPtr), (const void*)(locSourceUptoPtr + mXOffset), mWidth);
+//		locSourceUptoPtr += inYUVBuffer->y_stride;
+//		locDestUptoPtr += mWidth;
+//	}
+//
+//	locSourceUptoPtr += (mYOffset * inYUVBuffer->y_stride);
+//
+//	//Source advances by (y_height * y_stride)
+//	//Dest advances by (mHeight * mWidth)
+//
+//	//
+//	//V DATA
+//	//
+//
+//	//Half the padding for uv planes... is this correct ? 
+//	locTopPad = locTopPad /2;
+//	
+//	locSourceUptoPtr = inYUVBuffer->v;
+//
+//	//Skip the top padding
+//	locSourceUptoPtr += (locTopPad * inYUVBuffer->y_stride);
+//
+//	for (long line = 0; line < mHeight / 2; line++) {
+//		memcpy((void*)(locDestUptoPtr), (const void*)(locSourceUptoPtr + (mXOffset / 2)), mWidth / 2);
+//		locSourceUptoPtr += inYUVBuffer->uv_stride;
+//		locDestUptoPtr += (mWidth / 2);
+//	}
+//	locSourceUptoPtr += ((mYOffset/2) * inYUVBuffer->uv_stride);
+//
+//	//Source advances by (locTopPad + mYOffset/2 + mHeight /2) * uv_stride
+//	//where locTopPad for uv = (inYUVBuffer->y_height - mHeight - mYOffset) / 2
+//	//						=	(inYUVBuffer->yheight/2 - mHeight/2 - mYOffset/2)
+//	// so source advances by (y_height/2) * uv_stride
+//	//Dest advances by (mHeight * mWidth) /4
+//
+//
+//	//
+//	//U DATA
+//	//
+//
+//	locSourceUptoPtr = inYUVBuffer->u;
+//
+//	//Skip the top padding
+//	locSourceUptoPtr += (locTopPad * inYUVBuffer->y_stride);
+//
+//	for (long line = 0; line < mHeight / 2; line++) {
+//		memcpy((void*)(locDestUptoPtr), (const void*)(locSourceUptoPtr + (mXOffset / 2)), mWidth / 2);
+//		locSourceUptoPtr += inYUVBuffer->uv_stride;
+//		locDestUptoPtr += (mWidth / 2);
+//	}
+//	locSourceUptoPtr += ((mYOffset/2) * inYUVBuffer->uv_stride);
+//
+//
+//	////Y Data.
+//	//for ( long line = 0; line < inYUVBuffer->y_height; line++) {
+//	//	memcpy((void*)locBuffer, (const void*)(inYUVBuffer->y + (inYUVBuffer->y_stride * (line))), inYUVBuffer->y_width);
+//	//	locBuffer += inYUVBuffer->y_width;
+//
+//	//	if (mWidth > inYUVBuffer->y_width) {
+//	//		memset((void*)locBuffer, 0, mWidth - inYUVBuffer->y_width);
+//	//	}
+//	//	locBuffer += mWidth - inYUVBuffer->y_width;
+//	//}
+//
+//	////Pad height...
+//	//for ( long line = 0; line < mHeight - inYUVBuffer->y_height; line++) {
+//	//	memset((void*)locBuffer, 0, mWidth);
+//	//	locBuffer += mWidth;
+//	//}
+//
+//	////V Data
+//	//for ( long line = 0; line < inYUVBuffer->uv_height; line++) {
+//	//	memcpy((void*)locBuffer, (const void*)(inYUVBuffer->v + (inYUVBuffer->uv_stride * (line))), inYUVBuffer->uv_width);
+//	//	locBuffer += inYUVBuffer->uv_width;
+//
+//	//	if (mWidth/2 > inYUVBuffer->uv_width) {
+//	//		memset((void*)locBuffer, 0, (mWidth/2) - inYUVBuffer->uv_width);
+//	//	}
+//	//	locBuffer += (mWidth/2) - inYUVBuffer->uv_width;
+//	//}
+//
+//	////Pad height...
+//	//for ( long line = 0; line < (mHeight/2) - inYUVBuffer->uv_height; line++) {
+//	//	memset((void*)locBuffer, 0, mWidth/2);
+//	//	locBuffer += mWidth/2;
+//	//}
+//
+//	////U Data
+//	//for (long line = 0; line < inYUVBuffer->uv_height; line++) {
+//	//	memcpy((void*)locBuffer, (const void*)(inYUVBuffer->u + (inYUVBuffer->uv_stride * (line))), inYUVBuffer->uv_width);
+//	//	locBuffer += inYUVBuffer->uv_width;
+//
+//	//	if (mWidth/2 > inYUVBuffer->uv_width) {
+//	//		memset((void*)locBuffer, 0, (mWidth/2) - inYUVBuffer->uv_width);
+//	//	}
+//	//	locBuffer += (mWidth/2) - inYUVBuffer->uv_width;
+//	//}
+//
+//	////Pad height...
+//	//for ( long line = 0; line < (mHeight/2) - inYUVBuffer->uv_height; line++) {
+//	//	memset((void*)locBuffer, 0, mWidth/2);
+//	//	locBuffer += mWidth/2;
+//	//}
+//
+//
+//
+//
+//
+//	//Set the sample parameters.
+//	SetSampleParams(locSample, mFrameSize, &locFrameStart, &locFrameEnd);
+//
+//	{
+//
+//		//Add a reerence to the sample so it isn't deleted in the queue.
+//		//locSample->AddRef();
+//		HRESULT locHR = mOutputPin->mDataQueue->Receive(locSample);						//->DownstreamFilter()->Receive(locSample);
+//		if (locHR != S_OK) {
+//			debugLog<<"Data Q rejects sample... with "<<locHR<<endl;
+//			return -1;
+//
+//		}
+//	}
+//
+//	
+//	return 0;
+//
+//
+//}
+//
+//
+//
+//long TheoraDecodeInputPin::decodeData(BYTE* inBuf, long inNumBytes, LONGLONG inStart, LONGLONG inEnd) 
+//{
+//	DbgLog((LOG_TRACE,1,TEXT("decodeData")));
+//																	//Not truncated or continued... it's a full packet
+//	StampedOggPacket* locPacket = new StampedOggPacket(inBuf, inNumBytes, false, false, inStart, inEnd, StampedOggPacket::OGG_END_ONLY);
+//	yuv_buffer* locYUV = mTheoraDecoder->decodeTheora(locPacket);
+//	if (locYUV != NULL) {
+//		if (TheoraDecoded(locYUV) != 0) {
+//			return -1;
+//		}
+//	}
+//
+//	return 0;
+//}
+//
+//
+//
+//HRESULT TheoraDecodeInputPin::SetMediaType(const CMediaType* inMediaType) {
+//
+//	if (inMediaType->subtype == MEDIASUBTYPE_Theora) {
+//		((TheoraDecodeFilter*)mParentFilter)->setTheoraFormat((sTheoraFormatBlock*)inMediaType->pbFormat);
+//		mParentFilter->mVideoFormat = AbstractVideoDecodeFilter::THEORA;
+//		//Set some other stuff here too...
+//		mXOffset = ((sTheoraFormatBlock*)inMediaType->pbFormat)->xOffset;
+//		mYOffset = ((sTheoraFormatBlock*)inMediaType->pbFormat)->yOffset;
+//
+//	} else {
+//		//Failed... should never be here !
+//		throw 0;
+//	}
+//	return CBaseInputPin::SetMediaType(inMediaType);
+//}
+//

Modified: trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeInputPin.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeInputPin.h	2004-09-10 12:36:40 UTC (rev 7731)
+++ trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeInputPin.h	2004-09-10 12:59:28 UTC (rev 7732)
@@ -31,48 +31,53 @@
 
 #pragma once
 
-#include "Theoradecoderdllstuff.h"
-//#include "AbstractVideoDecodeInputPin.h"
-//#include "TheoraDecodeInputPin.h"
 
-//#include "TheoraDecodeFilter.h"
-#include "DSStringer.h"
-#include "TheoraDecoder.h"
-#include <math.h>
-#include <fstream>
-using namespace std;
-
-
-class TheoraDecodeOutputPin;
-
-class TheoraDecodeInputPin 
-	:	public AbstractVideoDecodeInputPin
-{
-public:
-	TheoraDecodeInputPin(AbstractVideoDecodeFilter* inFilter, CCritSec* inFilterLock, AbstractVideoDecodeOutputPin* inOutputPin, CMediaType* inAcceptMediaType);
-	virtual ~TheoraDecodeInputPin(void);
-	int TheoraDecoded (yuv_buffer* inYUVBuffer);
-
-		DECLARE_IUNKNOWN
-	STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv);
-
-	HRESULT SetMediaType(const CMediaType* inMediaType);
-
-	//VIRTUAL FUNCTIONS - AbstractAudioDecodeInputPin
-	//FIX:::These should be protected.
-	virtual bool ConstructCodec();
-	virtual void DestroyCodec();
-
-	long decodeData(BYTE* inBuf, long inNumBytes, LONGLONG inStart, LONGLONG inEnd) ;
-
-protected:
-	fstream debugLog;
-	//FishSound* mFishSound;
-	//FishSoundInfo mFishInfo; 
-	TheoraDecoder* mTheoraDecoder;
-	unsigned long mXOffset;
-	unsigned long mYOffset;
-	
-
-
-};
+//----------------------
+//OLD IMPLEMENTATION
+//----------------------
+//
+//#include "Theoradecoderdllstuff.h"
+////#include "AbstractVideoDecodeInputPin.h"
+////#include "TheoraDecodeInputPin.h"
+//
+////#include "TheoraDecodeFilter.h"
+//#include "DSStringer.h"
+//#include "TheoraDecoder.h"
+//#include <math.h>
+//#include <fstream>
+//using namespace std;
+//
+//
+//class TheoraDecodeOutputPin;
+//
+//class TheoraDecodeInputPin 
+//	:	public AbstractVideoDecodeInputPin
+//{
+//public:
+//	TheoraDecodeInputPin(AbstractVideoDecodeFilter* inFilter, CCritSec* inFilterLock, AbstractVideoDecodeOutputPin* inOutputPin, CMediaType* inAcceptMediaType);
+//	virtual ~TheoraDecodeInputPin(void);
+//	int TheoraDecoded (yuv_buffer* inYUVBuffer);
+//
+//		DECLARE_IUNKNOWN
+//	STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv);
+//
+//	HRESULT SetMediaType(const CMediaType* inMediaType);
+//
+//	//VIRTUAL FUNCTIONS - AbstractAudioDecodeInputPin
+//	//FIX:::These should be protected.
+//	virtual bool ConstructCodec();
+//	virtual void DestroyCodec();
+//
+//	long decodeData(BYTE* inBuf, long inNumBytes, LONGLONG inStart, LONGLONG inEnd) ;
+//
+//protected:
+//	fstream debugLog;
+//	//FishSound* mFishSound;
+//	//FishSoundInfo mFishInfo; 
+//	TheoraDecoder* mTheoraDecoder;
+//	unsigned long mXOffset;
+//	unsigned long mYOffset;
+//	
+//
+//
+//};

Modified: trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeOutputPin.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeOutputPin.cpp	2004-09-10 12:36:40 UTC (rev 7731)
+++ trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeOutputPin.cpp	2004-09-10 12:59:28 UTC (rev 7732)
@@ -32,173 +32,180 @@
 #include "StdAfx.h"
 #include "theoradecodeoutputpin.h"
 
-TheoraDecodeOutputPin::TheoraDecodeOutputPin(TheoraDecodeFilter* inParentFilter, CCritSec* inFilterLock)
-	: AbstractVideoDecodeOutputPin(inParentFilter, inFilterLock,NAME("TheoraDecodeOutputPin"), L"YV12 Out")
-{
 
-		
-}
-TheoraDecodeOutputPin::~TheoraDecodeOutputPin(void)
-{
-	
-	
-}
-STDMETHODIMP TheoraDecodeOutputPin::NonDelegatingQueryInterface(REFIID riid, void **ppv)
-{
-	if (riid == IID_IMediaSeeking) {
-		*ppv = (IMediaSeeking*)this;
-		((IUnknown*)*ppv)->AddRef();
-		return NOERROR;
-	//} else if (riid == IID_IStreamBuilder) {
-	//	*ppv = (IStreamBuilder*)this;
-	//	((IUnknown*)*ppv)->AddRef();
-	//	return NOERROR;
-	}
 
-	return CBaseOutputPin::NonDelegatingQueryInterface(riid, ppv); 
-}
 
 
-STDMETHODIMP TheoraDecodeOutputPin::Notify(IBaseFilter *pSelf, Quality q) {
-	return S_OK;
-
-}
-
-bool TheoraDecodeOutputPin::FillVideoInfoHeader(VIDEOINFOHEADER* inFormatBuffer) {
-	TheoraDecodeFilter* locFilter = ((TheoraDecodeFilter*)m_pFilter);
-
-	inFormatBuffer->AvgTimePerFrame = (UNITS * locFilter->mTheoraFormatInfo->frameRateDenominator) / locFilter->mTheoraFormatInfo->frameRateNumerator;
-	inFormatBuffer->dwBitRate = locFilter->mTheoraFormatInfo->targetBitrate;
-	
-	inFormatBuffer->bmiHeader.biBitCount = 12;   //12 bits per pixel
-	inFormatBuffer->bmiHeader.biClrImportant = 0;   //All colours important
-	inFormatBuffer->bmiHeader.biClrUsed = 0;        //Use max colour depth
-	inFormatBuffer->bmiHeader.biCompression = MAKEFOURCC('Y','V','1','2');
-	inFormatBuffer->bmiHeader.biHeight = locFilter->mTheoraFormatInfo->frameHeight;   //Not sure
-	inFormatBuffer->bmiHeader.biPlanes = 1;    //Must be 1
-	inFormatBuffer->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);    //????? Size of what ?
-	inFormatBuffer->bmiHeader.biSizeImage = ((locFilter->mTheoraFormatInfo->frameHeight * locFilter->mTheoraFormatInfo->frameWidth) * 3)/2;    //Size in bytes of image ??
-	inFormatBuffer->bmiHeader.biWidth = locFilter->mTheoraFormatInfo->frameWidth;
-	inFormatBuffer->bmiHeader.biXPelsPerMeter = 2000;   //Fuck knows
-	inFormatBuffer->bmiHeader.biYPelsPerMeter = 2000;   //" " " " " 
-	
-	inFormatBuffer->rcSource.top = 0;
-	inFormatBuffer->rcSource.bottom = locFilter->mTheoraFormatInfo->frameHeight;
-	inFormatBuffer->rcSource.left = 0;
-	inFormatBuffer->rcSource.right = locFilter->mTheoraFormatInfo->frameWidth;
-
-	inFormatBuffer->rcTarget.top = 0;
-	inFormatBuffer->rcTarget.bottom = locFilter->mTheoraFormatInfo->frameHeight;
-	inFormatBuffer->rcTarget.left = 0;
-	inFormatBuffer->rcTarget.right = locFilter->mTheoraFormatInfo->frameWidth;
-
-	inFormatBuffer->dwBitErrorRate=0;
-	return true;
-}
-
-//STDMETHODIMP TheoraDecodeOutputPin::Render(IPin* inOutputPin, IGraphBuilder* inGraphBuilder) {
-//	if (inOutputPin == NULL || inGraphBuilder == NULL) {
-//		return E_POINTER;
-//	}
+//----------------------
+//OLD IMPLEMENTATION
+//----------------------
+//TheoraDecodeOutputPin::TheoraDecodeOutputPin(TheoraDecodeFilter* inParentFilter, CCritSec* inFilterLock)
+//	: AbstractVideoDecodeOutputPin(inParentFilter, inFilterLock,NAME("TheoraDecodeOutputPin"), L"YV12 Out")
+//{
 //
+//		
+//}
+//TheoraDecodeOutputPin::~TheoraDecodeOutputPin(void)
+//{
 //	
-//    IBaseFilter* locRenderer = NULL;
+//	
+//}
+//STDMETHODIMP TheoraDecodeOutputPin::NonDelegatingQueryInterface(REFIID riid, void **ppv)
+//{
+//	if (riid == IID_IMediaSeeking) {
+//		*ppv = (IMediaSeeking*)this;
+//		((IUnknown*)*ppv)->AddRef();
+//		return NOERROR;
+//	//} else if (riid == IID_IStreamBuilder) {
+//	//	*ppv = (IStreamBuilder*)this;
+//	//	((IUnknown*)*ppv)->AddRef();
+//	//	return NOERROR;
+//	}
 //
-//    // Create the VMR9
-//	//FIX::: Probably should check if it's already in the graph.
-//	//  Also should let it connect to other VMR's
+//	return CBaseOutputPin::NonDelegatingQueryInterface(riid, ppv); 
+//}
 //
 //
-//    HRESULT locHR = S_OK;
-//	locHR = inGraphBuilder->FindFilterByName(L"Video Mixing Renderer", &locRenderer);
-//	/*IEnumFilters* locEnumFilters = NULL;
-//	locHR = S_OK;
-//	locHR = inGraphBuilder->EnumFilters(&locEnumFilters);
-//	IBaseFilter* locFilter = NULL;
-//	CLSID locCLSID;
-//	while (locHR ==S_OK) {
-//	locHR = locEnumFilters->Next(1, &locFilter, 0);
-//			locFilter->GetClassID(&locCLSID);
-//			if (locCLSID == CLSID_VideoMixingRenderer9) {
-//				locHR=locHR;
-//			}
-//	}*/
+//STDMETHODIMP TheoraDecodeOutputPin::Notify(IBaseFilter *pSelf, Quality q) {
+//	return S_OK;
 //
-//	if (locRenderer == NULL) {
-//		locHR= CoCreateInstance(CLSID_VideoMixingRenderer9, NULL, CLSCTX_INPROC, IID_IBaseFilter, (void **)&locRenderer);
-//		if (locHR != S_OK) {
-//	        return locHR;
-//	    }
-//    
-//	    //Add the VMR9 to the graph
-//	    locHR = inGraphBuilder->AddFilter(locRenderer, L"Video Mixing Renderer");
-//	    if (locHR != S_OK) {
-//			locRenderer->Release();
-//			return locHR;
-//		}
-//		IVMRFilterConfig9* locVMRConfig = NULL;
-//		locHR = locRenderer->QueryInterface(IID_IVMRFilterConfig9, (void**)&locVMRConfig);
-//		if(locHR == S_OK) {
-//			//locHR = locVMRConfig->SetRenderingMode(VMR9Mode_Renderless);
-//		}
-//	}
+//}
 //
-//	IEnumPins* locEnumPins;
-//	IPin* locRendererInputPin = NULL;
-//	locHR = locRenderer->EnumPins(&locEnumPins);
+//bool TheoraDecodeOutputPin::FillVideoInfoHeader(VIDEOINFOHEADER* inFormatBuffer) {
+//	TheoraDecodeFilter* locFilter = ((TheoraDecodeFilter*)m_pFilter);
 //
-//	if (SUCCEEDED(locHR)) {
-//		if (S_OK != locEnumPins->Next(1, &locRendererInputPin, 0)) {
-//			locHR = E_UNEXPECTED;
-//		}
-//	}
-//
-//	if (SUCCEEDED(locHR)) {
-//		// CConnect VMR9 to the output of the theora decoder
-//		CMediaType* locMediaType = new CMediaType;
-//		
-//		FillMediaType(locMediaType);
-//		//Fixes the null format block error
-//		VIDEOINFOHEADER* locVideoFormat = (VIDEOINFOHEADER*)locMediaType->AllocFormatBuffer(sizeof(VIDEOINFOHEADER));
-//		FillVideoInfoHeader(locVideoFormat);
-//		locHR = inGraphBuilder->ConnectDirect(inOutputPin, locRendererInputPin, locMediaType);
-//		locRendererInputPin->Release();
-//	}
-//	if (FAILED(locHR)) 
-//	{
-//		// Could not connect to the VMR9 renderer. Remove it from the graph.
-//		inGraphBuilder->RemoveFilter(locRenderer);
-//	}
-//	locRenderer->Release();
+//	inFormatBuffer->AvgTimePerFrame = (UNITS * locFilter->mTheoraFormatInfo->frameRateDenominator) / locFilter->mTheoraFormatInfo->frameRateNumerator;
+//	inFormatBuffer->dwBitRate = locFilter->mTheoraFormatInfo->targetBitrate;
 //	
-//    return locHR;
+//	inFormatBuffer->bmiHeader.biBitCount = 12;   //12 bits per pixel
+//	inFormatBuffer->bmiHeader.biClrImportant = 0;   //All colours important
+//	inFormatBuffer->bmiHeader.biClrUsed = 0;        //Use max colour depth
+//	inFormatBuffer->bmiHeader.biCompression = MAKEFOURCC('Y','V','1','2');
+//	inFormatBuffer->bmiHeader.biHeight = locFilter->mTheoraFormatInfo->frameHeight;   //Not sure
+//	inFormatBuffer->bmiHeader.biPlanes = 1;    //Must be 1
+//	inFormatBuffer->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);    //????? Size of what ?
+//	inFormatBuffer->bmiHeader.biSizeImage = ((locFilter->mTheoraFormatInfo->frameHeight * locFilter->mTheoraFormatInfo->frameWidth) * 3)/2;    //Size in bytes of image ??
+//	inFormatBuffer->bmiHeader.biWidth = locFilter->mTheoraFormatInfo->frameWidth;
+//	inFormatBuffer->bmiHeader.biXPelsPerMeter = 2000;   //Fuck knows
+//	inFormatBuffer->bmiHeader.biYPelsPerMeter = 2000;   //" " " " " 
+//	
+//	inFormatBuffer->rcSource.top = 0;
+//	inFormatBuffer->rcSource.bottom = locFilter->mTheoraFormatInfo->frameHeight;
+//	inFormatBuffer->rcSource.left = 0;
+//	inFormatBuffer->rcSource.right = locFilter->mTheoraFormatInfo->frameWidth;
 //
+//	inFormatBuffer->rcTarget.top = 0;
+//	inFormatBuffer->rcTarget.bottom = locFilter->mTheoraFormatInfo->frameHeight;
+//	inFormatBuffer->rcTarget.left = 0;
+//	inFormatBuffer->rcTarget.right = locFilter->mTheoraFormatInfo->frameWidth;
 //
+//	inFormatBuffer->dwBitErrorRate=0;
+//	return true;
 //}
-//STDMETHODIMP TheoraDecodeOutputPin::Backout(IPin* inOutputPin, IGraphBuilder* inGraphBuilder) {
-//   //HRESULT locHR = S_OK;
-//   // if (m_Connected != NULL) // Pointer to the pin we're connected to.
-//   // {
-//   //     // Find the filter that owns the pin connected to us.
-//   //     FILTER_INFO fi;
-//   //     hr = m_Connected->QueryFilterInfo(&fi);
-//   //     if (SUCCEEDED(hr)) 
-//   //     {
-//   //         if (fi.pFilter != NULL) 
-//   //         {
-//   //             //  Disconnect the pins.
-//   //             pGraph->Disconnect(m_Connected);
-//   //             pGraph->Disconnect(pPin);
-//   //             // Remove the filter from the graph.
-//   //             pGraph->RemoveFilter(fi.pFilter);
-//   //             fi.pFilter->Release();
-//   //         } 
-//   //         else 
-//   //         {
-//   //             hr = E_UNEXPECTED;
-//   //         }
-//   //     }
-//   // }
-//   // return hr;
-//	return S_OK;
-//}
\ No newline at end of file
+//
+////STDMETHODIMP TheoraDecodeOutputPin::Render(IPin* inOutputPin, IGraphBuilder* inGraphBuilder) {
+////	if (inOutputPin == NULL || inGraphBuilder == NULL) {
+////		return E_POINTER;
+////	}
+////
+////	
+////    IBaseFilter* locRenderer = NULL;
+////
+////    // Create the VMR9
+////	//FIX::: Probably should check if it's already in the graph.
+////	//  Also should let it connect to other VMR's
+////
+////
+////    HRESULT locHR = S_OK;
+////	locHR = inGraphBuilder->FindFilterByName(L"Video Mixing Renderer", &locRenderer);
+////	/*IEnumFilters* locEnumFilters = NULL;
+////	locHR = S_OK;
+////	locHR = inGraphBuilder->EnumFilters(&locEnumFilters);
+////	IBaseFilter* locFilter = NULL;
+////	CLSID locCLSID;
+////	while (locHR ==S_OK) {
+////	locHR = locEnumFilters->Next(1, &locFilter, 0);
+////			locFilter->GetClassID(&locCLSID);
+////			if (locCLSID == CLSID_VideoMixingRenderer9) {
+////				locHR=locHR;
+////			}
+////	}*/
+////
+////	if (locRenderer == NULL) {
+////		locHR= CoCreateInstance(CLSID_VideoMixingRenderer9, NULL, CLSCTX_INPROC, IID_IBaseFilter, (void **)&locRenderer);
+////		if (locHR != S_OK) {
+////	        return locHR;
+////	    }
+////    
+////	    //Add the VMR9 to the graph
+////	    locHR = inGraphBuilder->AddFilter(locRenderer, L"Video Mixing Renderer");
+////	    if (locHR != S_OK) {
+////			locRenderer->Release();
+////			return locHR;
+////		}
+////		IVMRFilterConfig9* locVMRConfig = NULL;
+////		locHR = locRenderer->QueryInterface(IID_IVMRFilterConfig9, (void**)&locVMRConfig);
+////		if(locHR == S_OK) {
+////			//locHR = locVMRConfig->SetRenderingMode(VMR9Mode_Renderless);
+////		}
+////	}
+////
+////	IEnumPins* locEnumPins;
+////	IPin* locRendererInputPin = NULL;
+////	locHR = locRenderer->EnumPins(&locEnumPins);
+////
+////	if (SUCCEEDED(locHR)) {
+////		if (S_OK != locEnumPins->Next(1, &locRendererInputPin, 0)) {
+////			locHR = E_UNEXPECTED;
+////		}
+////	}
+////
+////	if (SUCCEEDED(locHR)) {
+////		// CConnect VMR9 to the output of the theora decoder
+////		CMediaType* locMediaType = new CMediaType;
+////		
+////		FillMediaType(locMediaType);
+////		//Fixes the null format block error
+////		VIDEOINFOHEADER* locVideoFormat = (VIDEOINFOHEADER*)locMediaType->AllocFormatBuffer(sizeof(VIDEOINFOHEADER));
+////		FillVideoInfoHeader(locVideoFormat);
+////		locHR = inGraphBuilder->ConnectDirect(inOutputPin, locRendererInputPin, locMediaType);
+////		locRendererInputPin->Release();
+////	}
+////	if (FAILED(locHR)) 
+////	{
+////		// Could not connect to the VMR9 renderer. Remove it from the graph.
+////		inGraphBuilder->RemoveFilter(locRenderer);
+////	}
+////	locRenderer->Release();
+////	
+////    return locHR;
+////
+////
+////}
+////STDMETHODIMP TheoraDecodeOutputPin::Backout(IPin* inOutputPin, IGraphBuilder* inGraphBuilder) {
+////   //HRESULT locHR = S_OK;
+////   // if (m_Connected != NULL) // Pointer to the pin we're connected to.
+////   // {
+////   //     // Find the filter that owns the pin connected to us.
+////   //     FILTER_INFO fi;
+////   //     hr = m_Connected->QueryFilterInfo(&fi);
+////   //     if (SUCCEEDED(hr)) 
+////   //     {
+////   //         if (fi.pFilter != NULL) 
+////   //         {
+////   //             //  Disconnect the pins.
+////   //             pGraph->Disconnect(m_Connected);
+////   //             pGraph->Disconnect(pPin);
+////   //             // Remove the filter from the graph.
+////   //             pGraph->RemoveFilter(fi.pFilter);
+////   //             fi.pFilter->Release();
+////   //         } 
+////   //         else 
+////   //         {
+////   //             hr = E_UNEXPECTED;
+////   //         }
+////   //     }
+////   // }
+////   // return hr;
+////	return S_OK;
+////}
\ No newline at end of file

Modified: trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeOutputPin.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeOutputPin.h	2004-09-10 12:36:40 UTC (rev 7731)
+++ trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeOutputPin.h	2004-09-10 12:59:28 UTC (rev 7732)
@@ -30,41 +30,45 @@
 //===========================================================================
 
 #pragma once
-#include <d3d9.h>
-#include <vmr9.h>
-#include "Theoradecoderdllstuff.h"
-#include "AbstractVideoDecodeOutputPin.h"
 
-
-class TheoraDecodeFilter;
-class TheoraDecodeOutputPin 
-	:	public AbstractVideoDecodeOutputPin
-	//,	public IStreamBuilder
-{
-public:
-	friend class TheoraDecodeInputPin;
-
-		DECLARE_IUNKNOWN
-	STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv);
-	TheoraDecodeOutputPin(TheoraDecodeFilter* inParentFilter,CCritSec* inFilterLock);
-	virtual ~TheoraDecodeOutputPin(void);
-
-	STDMETHODIMP Notify(IBaseFilter *pSelf, Quality q);
-
-	//Implements IStreamBuilder to force the pin to connect to VMR9
-	//STDMETHODIMP Render(IPin* inOutputPin, IGraphBuilder* inGraphBuilder);
-	//STDMETHODIMP Backout(IPin* inOutputPin, IGraphBuilder* inGraphBuilder);
-
-
-
-
-	
-
-
-	//virtual bool FillWaveFormatExBuffer(WAVEFORMATEX* inFormatBuffer);
-	virtual bool FillVideoInfoHeader(VIDEOINFOHEADER* inFormatBuffer);
-	
-
-};
-
-
+//----------------------
+//OLD IMPLEMENTATION
+//----------------------
+//#include <d3d9.h>
+//#include <vmr9.h>
+//#include "Theoradecoderdllstuff.h"
+//#include "AbstractVideoDecodeOutputPin.h"
+//
+//
+//class TheoraDecodeFilter;
+//class TheoraDecodeOutputPin 
+//	:	public AbstractVideoDecodeOutputPin
+//	//,	public IStreamBuilder
+//{
+//public:
+//	friend class TheoraDecodeInputPin;
+//
+//		DECLARE_IUNKNOWN
+//	STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void **ppv);
+//	TheoraDecodeOutputPin(TheoraDecodeFilter* inParentFilter,CCritSec* inFilterLock);
+//	virtual ~TheoraDecodeOutputPin(void);
+//
+//	STDMETHODIMP Notify(IBaseFilter *pSelf, Quality q);
+//
+//	//Implements IStreamBuilder to force the pin to connect to VMR9
+//	//STDMETHODIMP Render(IPin* inOutputPin, IGraphBuilder* inGraphBuilder);
+//	//STDMETHODIMP Backout(IPin* inOutputPin, IGraphBuilder* inGraphBuilder);
+//
+//
+//
+//
+//	
+//
+//
+//	//virtual bool FillWaveFormatExBuffer(WAVEFORMATEX* inFormatBuffer);
+//	virtual bool FillVideoInfoHeader(VIDEOINFOHEADER* inFormatBuffer);
+//	
+//
+//};
+//
+//

Modified: trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/dsfTheoraDecoder.vcproj
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/dsfTheoraDecoder.vcproj	2004-09-10 12:36:40 UTC (rev 7731)
+++ trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/dsfTheoraDecoder.vcproj	2004-09-10 12:59:28 UTC (rev 7732)
@@ -296,6 +296,12 @@
 				RelativePath="TheoraDecodeFilter.cpp">
 			</File>
 			<File
+				RelativePath=".\TheoraDecodeInputPin.cpp">
+			</File>
+			<File
+				RelativePath=".\TheoraDecodeOutputPin.cpp">
+			</File>
+			<File
 				RelativePath="theoradecoder.def">
 			</File>
 		</Filter>
@@ -309,6 +315,12 @@
 				RelativePath="TheoraDecodeFilter.h">
 			</File>
 			<File
+				RelativePath=".\TheoraDecodeInputPin.h">
+			</File>
+			<File
+				RelativePath=".\TheoraDecodeOutputPin.h">
+			</File>
+			<File
 				RelativePath="theoradecoderdllstuff.h">
 			</File>
 		</Filter>



More information about the commits mailing list