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

cristianadam at svn.xiph.org cristianadam at svn.xiph.org
Sat Nov 22 17:47:27 PST 2008


Author: cristianadam
Date: 2008-11-22 17:47:26 -0800 (Sat, 22 Nov 2008)
New Revision: 15528

Modified:
   trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.cpp
   trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.h
   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/stdafx.cpp
   trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/stdafx.h
   trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/theoradecoderdllstuff.h
Log:
Refactoring. All color space outputs (yuv2, yv12, rgb) produce the same output. Also tested with image sizes not divisible by 16. Cleared up the code a bit.

Modified: trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.cpp	2008-11-20 02:45:56 UTC (rev 15527)
+++ trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.cpp	2008-11-23 01:47:26 UTC (rev 15528)
@@ -35,11 +35,8 @@
 //===========================================================================
 
 #include "stdafx.h"
-
 #include "TheoraDecodeFilter.h"
 
-
-
 //COM Factory Template
 CFactoryTemplate g_Templates[] = 
 {
@@ -79,22 +76,21 @@
 
 TheoraDecodeFilter::TheoraDecodeFilter() 
 	:	CTransformFilter( NAME("Theora Decode Filter"), NULL, CLSID_TheoraDecodeFilter)
-	,	mPictureWidth(0)
-	,	mPictureHeight(0)
-	,	mBMIFrameSize(0)
-	,	mFrameCount(0)
-	,	mYOffset(0)
-	,	mXOffset(0)
-	,	mFrameDuration(0)
-	,	mBegun(false)
-	,	mSeekTimeBase(0)
-	,	mLastSeenStartGranPos(0)
+	,	m_pictureWidth(0)
+	,	m_pictureHeight(0)
+	,	m_bmiFrameSize(0)
+	,	m_frameCount(0)
+	,	m_yOffset(0)
+	,	m_xOffset(0)
+	,	m_frameDuration(0)
+	,	m_begun(false)
+	,	m_seekTimeBase(0)
+	,	m_lastSeenStartGranPos(0)
 
-	,	mSegStart(0)
-	,	mSegEnd(0)
-	,	mPlaybackRate(0.0)
-	,	mTheoraFormatInfo(NULL)
-	,	mScratchBuffer(NULL)
+	,	m_segStart(0)
+	,	m_segEnd(0)
+	,	m_playbackRate(0.0)
+	,	m_theoraFormatInfo(NULL)
 {
 #ifdef OGGCODECS_LOGGING
 	debugLog.open("G:\\logs\\newtheofilter.log", ios_base::out);
@@ -108,91 +104,89 @@
 
 #endif
 
-	mCurrentOutputSubType = MEDIASUBTYPE_None;
-	sOutputVideoParams locVideoParams;
+	m_currentOutputSubType = MEDIASUBTYPE_None;
+	sOutputVideoParams videoParams;
 
-	CMediaType* locAcceptMediaType = NULL;
+	CMediaType* acceptMediaType = NULL;
 
 	//YUY2 Media Type VideoInfo2
-	locAcceptMediaType = new CMediaType(&MEDIATYPE_Video);		//Deleted in pin destructor
-	locAcceptMediaType->subtype = MEDIASUBTYPE_YUY2;
-	locAcceptMediaType->formattype = FORMAT_VideoInfo2;
-	mOutputMediaTypes.push_back(locAcceptMediaType);
+	acceptMediaType = new CMediaType(&MEDIATYPE_Video);		//Deleted in pin destructor
+	acceptMediaType->subtype = MEDIASUBTYPE_YUY2;
+	acceptMediaType->formattype = FORMAT_VideoInfo2;
+	m_outputMediaTypes.push_back(acceptMediaType);
 
-	locVideoParams.bitsPerPixel = 16;
-	locVideoParams.fourCC = MAKEFOURCC('Y','U','Y','2');
-	mOutputVideoParams.push_back(locVideoParams);
+	videoParams.bitsPerPixel = 16;
+	videoParams.fourCC = MAKEFOURCC('Y','U','Y','2');
+	m_outputVideoParams.push_back(videoParams);
 
 	//YUY2 Media Type VideoInfo
-	locAcceptMediaType = new CMediaType(&MEDIATYPE_Video);		//Deleted in pin destructor
-	locAcceptMediaType->subtype = MEDIASUBTYPE_YUY2;
-	locAcceptMediaType->formattype = FORMAT_VideoInfo;
-	mOutputMediaTypes.push_back(locAcceptMediaType);
+	acceptMediaType = new CMediaType(&MEDIATYPE_Video);		//Deleted in pin destructor
+	acceptMediaType->subtype = MEDIASUBTYPE_YUY2;
+	acceptMediaType->formattype = FORMAT_VideoInfo;
+	m_outputMediaTypes.push_back(acceptMediaType);
 
-	locVideoParams.bitsPerPixel = 16;
-	locVideoParams.fourCC = MAKEFOURCC('Y','U','Y','2');
-	mOutputVideoParams.push_back(locVideoParams);
+	videoParams.bitsPerPixel = 16;
+	videoParams.fourCC = MAKEFOURCC('Y','U','Y','2');
+	m_outputVideoParams.push_back(videoParams);
 
 	//YV12 media type VideoInfo2
-	locAcceptMediaType = new CMediaType(&MEDIATYPE_Video);		//Deleted in pin destructor
-	locAcceptMediaType->subtype = MEDIASUBTYPE_YV12;
-	locAcceptMediaType->formattype = FORMAT_VideoInfo2;
-	mOutputMediaTypes.push_back(locAcceptMediaType);
+	acceptMediaType = new CMediaType(&MEDIATYPE_Video);		//Deleted in pin destructor
+	acceptMediaType->subtype = MEDIASUBTYPE_YV12;
+	acceptMediaType->formattype = FORMAT_VideoInfo2;
+	m_outputMediaTypes.push_back(acceptMediaType);
 
-	locVideoParams.bitsPerPixel = 12;
-	locVideoParams.fourCC = MAKEFOURCC('Y','V','1','2');
-	mOutputVideoParams.push_back(locVideoParams);
+	videoParams.bitsPerPixel = 12;
+	videoParams.fourCC = MAKEFOURCC('Y','V','1','2');
+	m_outputVideoParams.push_back(videoParams);
 
 	//YV12 media type VideoInfo
-	locAcceptMediaType = new CMediaType(&MEDIATYPE_Video);		//Deleted in pin destructor
-	locAcceptMediaType->subtype = MEDIASUBTYPE_YV12;
-	locAcceptMediaType->formattype = FORMAT_VideoInfo;
-	mOutputMediaTypes.push_back(locAcceptMediaType);
+	acceptMediaType = new CMediaType(&MEDIATYPE_Video);		//Deleted in pin destructor
+	acceptMediaType->subtype = MEDIASUBTYPE_YV12;
+	acceptMediaType->formattype = FORMAT_VideoInfo;
+	m_outputMediaTypes.push_back(acceptMediaType);
 
-	locVideoParams.bitsPerPixel = 12;
-	locVideoParams.fourCC = MAKEFOURCC('Y','V','1','2');
-	mOutputVideoParams.push_back(locVideoParams);
-  
+	videoParams.bitsPerPixel = 12;
+	videoParams.fourCC = MAKEFOURCC('Y','V','1','2');
+	m_outputVideoParams.push_back(videoParams);
+ 
 	//RGB32 Media Type
-	locAcceptMediaType = new CMediaType(&MEDIATYPE_Video);		//Deleted in pin destructor
-	locAcceptMediaType->subtype = MEDIASUBTYPE_RGB32;
-	locAcceptMediaType->formattype = FORMAT_VideoInfo;
-	mOutputMediaTypes.push_back(locAcceptMediaType);
+	acceptMediaType = new CMediaType(&MEDIATYPE_Video);		//Deleted in pin destructor
+	acceptMediaType->subtype = MEDIASUBTYPE_RGB32;
+	acceptMediaType->formattype = FORMAT_VideoInfo;
+	m_outputMediaTypes.push_back(acceptMediaType);
 
-	locVideoParams.bitsPerPixel = 32;
-	locVideoParams.fourCC = BI_RGB;
-	mOutputVideoParams.push_back(locVideoParams);
+	videoParams.bitsPerPixel = 32;
+	videoParams.fourCC = BI_RGB;
+	m_outputVideoParams.push_back(videoParams);
 
 	//RGB565 Media Type
-	locAcceptMediaType = new CMediaType(&MEDIATYPE_Video);		//Deleted in pin destructor
-	locAcceptMediaType->subtype = MEDIASUBTYPE_RGB565;
-	locAcceptMediaType->formattype = FORMAT_VideoInfo;
-	mOutputMediaTypes.push_back(locAcceptMediaType);
+	acceptMediaType = new CMediaType(&MEDIATYPE_Video);		//Deleted in pin destructor
+	acceptMediaType->subtype = MEDIASUBTYPE_RGB565;
+	acceptMediaType->formattype = FORMAT_VideoInfo;
+	m_outputMediaTypes.push_back(acceptMediaType);
 
-	locVideoParams.bitsPerPixel = 16;
-	locVideoParams.fourCC = BI_BITFIELDS;
-	mOutputVideoParams.push_back(locVideoParams);
+	videoParams.bitsPerPixel = 16;
+	videoParams.fourCC = BI_BITFIELDS;
+	m_outputVideoParams.push_back(videoParams);
 
-	mTheoraDecoder = new TheoraDecoder;
-	mTheoraDecoder->initCodec();
-
-	mScratchBuffer = new BYTE[1024*1024*2];
+	m_theoraDecoder = new TheoraDecoder;
+	m_theoraDecoder->initCodec();
 }
 
 TheoraDecodeFilter::~TheoraDecodeFilter() 
 {
-	delete[] mScratchBuffer;
-	for (size_t i = 0; i < mOutputMediaTypes.size(); i++) {
-		delete mOutputMediaTypes[i];
+	for (size_t i = 0; i < m_outputMediaTypes.size(); i++) 
+    {
+		delete m_outputMediaTypes[i];
 	}
 
-	delete mTheoraDecoder;
-	mTheoraDecoder = NULL;
+	delete m_theoraDecoder;
+	m_theoraDecoder = NULL;
 
-	delete mTheoraFormatInfo;
-	mTheoraFormatInfo = NULL;
-	debugLog.close();
+	delete m_theoraFormatInfo;
+	m_theoraFormatInfo = NULL;
 
+	debugLog.close();
 }
 
 
@@ -212,36 +206,35 @@
 {
 	//This routine is the COM implementation to create a new Filter
 	TheoraDecodeFilter *pNewObject = new TheoraDecodeFilter();
-    if (pNewObject == NULL) {
-        *pHr = E_OUTOFMEMORY;
-    }
-	return pNewObject;
-} 
+
+    return pNewObject;
+}
+
 void TheoraDecodeFilter::FillMediaType(int inPosition, CMediaType* outMediaType, unsigned long inSampleSize) 
 {
-	outMediaType->SetType(&(mOutputMediaTypes[inPosition]->majortype));
-	outMediaType->SetSubtype(&(mOutputMediaTypes[inPosition]->subtype));
-	outMediaType->SetFormatType(&(mOutputMediaTypes[inPosition]->formattype));
+	outMediaType->SetType(&m_outputMediaTypes[inPosition]->majortype);
+	outMediaType->SetSubtype(&m_outputMediaTypes[inPosition]->subtype);
+	outMediaType->SetFormatType(&m_outputMediaTypes[inPosition]->formattype);
 	outMediaType->SetTemporalCompression(FALSE);
-	outMediaType->SetSampleSize(inSampleSize);		
-
+	outMediaType->SetSampleSize(inSampleSize);
 }
+
 bool TheoraDecodeFilter::FillVideoInfoHeader(int inPosition, VIDEOINFOHEADER* inFormatBuffer) 
 {
 	//MTS::: Needs changes for alternate media types. FOURCC and bitCOunt
 	TheoraDecodeFilter* locFilter = this;
 
-	inFormatBuffer->AvgTimePerFrame = (UNITS * locFilter->mTheoraFormatInfo->frameRateDenominator) / locFilter->mTheoraFormatInfo->frameRateNumerator;
-	inFormatBuffer->dwBitRate = locFilter->mTheoraFormatInfo->targetBitrate;
+	inFormatBuffer->AvgTimePerFrame = (UNITS * locFilter->m_theoraFormatInfo->frameRateDenominator) / locFilter->m_theoraFormatInfo->frameRateNumerator;
+	inFormatBuffer->dwBitRate = locFilter->m_theoraFormatInfo->targetBitrate;
 	
-	inFormatBuffer->bmiHeader.biBitCount = mOutputVideoParams[inPosition].bitsPerPixel;  
+	inFormatBuffer->bmiHeader.biBitCount = m_outputVideoParams[inPosition].bitsPerPixel;  
 
 	inFormatBuffer->bmiHeader.biClrImportant = 0;   //All colours important
 	inFormatBuffer->bmiHeader.biClrUsed = 0;        //Use max colour depth
 
-	inFormatBuffer->bmiHeader.biCompression = mOutputVideoParams[inPosition].fourCC;
-	inFormatBuffer->bmiHeader.biWidth = locFilter->mTheoraFormatInfo->pictureWidth;
-	inFormatBuffer->bmiHeader.biHeight = locFilter->mTheoraFormatInfo->pictureHeight;   //Not sure
+	inFormatBuffer->bmiHeader.biCompression = m_outputVideoParams[inPosition].fourCC;
+	inFormatBuffer->bmiHeader.biWidth = locFilter->m_theoraFormatInfo->pictureWidth;
+	inFormatBuffer->bmiHeader.biHeight = 0 - locFilter->m_theoraFormatInfo->pictureHeight; 
 	inFormatBuffer->bmiHeader.biPlanes = 1;    //Must be 1
 	inFormatBuffer->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);   
 	inFormatBuffer->bmiHeader.biSizeImage = GetBitmapSize(&inFormatBuffer->bmiHeader);
@@ -249,14 +242,14 @@
 	inFormatBuffer->bmiHeader.biYPelsPerMeter = 0;   //" " " " " 
 	
 	inFormatBuffer->rcSource.top = 0;
-	inFormatBuffer->rcSource.bottom = locFilter->mTheoraFormatInfo->pictureHeight;
+	inFormatBuffer->rcSource.bottom = locFilter->m_theoraFormatInfo->pictureHeight;
 	inFormatBuffer->rcSource.left = 0;
-	inFormatBuffer->rcSource.right = locFilter->mTheoraFormatInfo->pictureWidth;
+	inFormatBuffer->rcSource.right = locFilter->m_theoraFormatInfo->pictureWidth;
 
 	inFormatBuffer->rcTarget.top = 0;
-	inFormatBuffer->rcTarget.bottom = locFilter->mTheoraFormatInfo->pictureHeight;
+	inFormatBuffer->rcTarget.bottom = locFilter->m_theoraFormatInfo->pictureHeight;
 	inFormatBuffer->rcTarget.left = 0;
-	inFormatBuffer->rcTarget.right = locFilter->mTheoraFormatInfo->pictureWidth;
+	inFormatBuffer->rcTarget.right = locFilter->m_theoraFormatInfo->pictureWidth;
 
 	inFormatBuffer->dwBitErrorRate=0;
 	return true;
@@ -267,32 +260,32 @@
 	//MTS::: Needs changes for alternate media types. FOURCC and bitCOunt
 	TheoraDecodeFilter* locFilter = this;
 
-	inFormatBuffer->AvgTimePerFrame = (UNITS * locFilter->mTheoraFormatInfo->frameRateDenominator) / locFilter->mTheoraFormatInfo->frameRateNumerator;
-	inFormatBuffer->dwBitRate = locFilter->mTheoraFormatInfo->targetBitrate;
+	inFormatBuffer->AvgTimePerFrame = (UNITS * locFilter->m_theoraFormatInfo->frameRateDenominator) / locFilter->m_theoraFormatInfo->frameRateNumerator;
+	inFormatBuffer->dwBitRate = locFilter->m_theoraFormatInfo->targetBitrate;
 	
-	inFormatBuffer->bmiHeader.biBitCount = mOutputVideoParams[inPosition].bitsPerPixel;  
+	inFormatBuffer->bmiHeader.biBitCount = m_outputVideoParams[inPosition].bitsPerPixel;  
 
 	inFormatBuffer->bmiHeader.biClrImportant = 0;   //All colours important
 	inFormatBuffer->bmiHeader.biClrUsed = 0;        //Use max colour depth
 
-	inFormatBuffer->bmiHeader.biCompression = mOutputVideoParams[inPosition].fourCC;
-	inFormatBuffer->bmiHeader.biHeight = locFilter->mTheoraFormatInfo->pictureHeight;   //Not sure
+	inFormatBuffer->bmiHeader.biCompression = m_outputVideoParams[inPosition].fourCC;
+	inFormatBuffer->bmiHeader.biHeight = 0 - locFilter->m_theoraFormatInfo->pictureHeight;
 	inFormatBuffer->bmiHeader.biPlanes = 1;    //Must be 1
 	inFormatBuffer->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
 	inFormatBuffer->bmiHeader.biSizeImage = GetBitmapSize(&inFormatBuffer->bmiHeader);
-	inFormatBuffer->bmiHeader.biWidth = locFilter->mTheoraFormatInfo->pictureWidth;
+	inFormatBuffer->bmiHeader.biWidth = locFilter->m_theoraFormatInfo->pictureWidth;
 	inFormatBuffer->bmiHeader.biXPelsPerMeter = 0;   //Fuck knows
 	inFormatBuffer->bmiHeader.biYPelsPerMeter = 0;   //" " " " " 
 	
 	inFormatBuffer->rcSource.top = 0;
-	inFormatBuffer->rcSource.bottom = locFilter->mTheoraFormatInfo->pictureHeight;
+	inFormatBuffer->rcSource.bottom = locFilter->m_theoraFormatInfo->pictureHeight;
 	inFormatBuffer->rcSource.left = 0;
-	inFormatBuffer->rcSource.right = locFilter->mTheoraFormatInfo->pictureWidth;
+	inFormatBuffer->rcSource.right = locFilter->m_theoraFormatInfo->pictureWidth;
 
 	inFormatBuffer->rcTarget.top = 0;
-	inFormatBuffer->rcTarget.bottom = locFilter->mTheoraFormatInfo->pictureHeight;
+	inFormatBuffer->rcTarget.bottom = locFilter->m_theoraFormatInfo->pictureHeight;
 	inFormatBuffer->rcTarget.left = 0;
-	inFormatBuffer->rcTarget.right = locFilter->mTheoraFormatInfo->pictureWidth;
+	inFormatBuffer->rcTarget.right = locFilter->m_theoraFormatInfo->pictureWidth;
 
 	inFormatBuffer->dwBitErrorRate=0;
 
@@ -300,17 +293,16 @@
     inFormatBuffer->dwInterlaceFlags = 0;
     inFormatBuffer->dwCopyProtectFlags = 0;
 
-
-    if ((mTheoraFormatInfo->aspectNumerator == 0) || (mTheoraFormatInfo->aspectDenominator == 0)) 
+    if (m_theoraFormatInfo->aspectNumerator == 0 || m_theoraFormatInfo->aspectDenominator == 0) 
 	{
         //Maybe setting to 0?
-        inFormatBuffer->dwPictAspectRatioX = mTheoraFormatInfo->pictureWidth;
-        inFormatBuffer->dwPictAspectRatioY = mTheoraFormatInfo->pictureHeight;
+        inFormatBuffer->dwPictAspectRatioX = m_theoraFormatInfo->pictureWidth;
+        inFormatBuffer->dwPictAspectRatioY = m_theoraFormatInfo->pictureHeight;
     } 
 	else 
 	{
-        inFormatBuffer->dwPictAspectRatioX = mTheoraFormatInfo->pictureWidth * mTheoraFormatInfo->aspectNumerator;
-        inFormatBuffer->dwPictAspectRatioY = mTheoraFormatInfo->pictureHeight * mTheoraFormatInfo->aspectDenominator;
+        inFormatBuffer->dwPictAspectRatioX = m_theoraFormatInfo->pictureWidth * m_theoraFormatInfo->aspectNumerator;
+        inFormatBuffer->dwPictAspectRatioY = m_theoraFormatInfo->pictureHeight * m_theoraFormatInfo->aspectDenominator;
     }
 	
     inFormatBuffer->dwControlFlags = 0;
@@ -320,28 +312,31 @@
 
 HRESULT TheoraDecodeFilter::CheckInputType(const CMediaType* inMediaType) 
 {
-	if	( (inMediaType->majortype == MEDIATYPE_OggPacketStream) &&
-			(inMediaType->subtype == MEDIASUBTYPE_None) && (inMediaType->formattype == FORMAT_OggIdentHeader)
-		)
+	if	( inMediaType->majortype == MEDIATYPE_OggPacketStream &&
+		  inMediaType->subtype == MEDIASUBTYPE_None && 
+          inMediaType->formattype == FORMAT_OggIdentHeader)
 	{
-		if (inMediaType->cbFormat == THEORA_IDENT_HEADER_SIZE) {
-			if (strncmp((char*)inMediaType->pbFormat, "\200theora", 7) == 0) {
+		if (inMediaType->cbFormat == THEORA_IDENT_HEADER_SIZE) 
+        {
+			if (strncmp((char*)inMediaType->pbFormat, "\200theora", 7) == 0) 
+            {
 				//TODO::: Possibly verify version
 				debugLog<<"Input type ok"<<endl;
 				return S_OK;
 			}
 		}
 	}
+
 	return S_FALSE;
 }
 
 HRESULT TheoraDecodeFilter::CheckOutputType(const CMediaType* inMediaType)
 {
-	for (size_t i = 0; i < mOutputMediaTypes.size(); i++) {
-		if	(		(inMediaType->majortype == mOutputMediaTypes[i]->majortype) 
-				&&	(inMediaType->subtype == mOutputMediaTypes[i]->subtype) 
-				&&	(inMediaType->formattype == mOutputMediaTypes[i]->formattype)
-			)
+	for (size_t i = 0; i < m_outputMediaTypes.size(); i++) 
+    {
+		if	(inMediaType->majortype == m_outputMediaTypes[i]->majortype &&
+			inMediaType->subtype == m_outputMediaTypes[i]->subtype &&
+			inMediaType->formattype == m_outputMediaTypes[i]->formattype)
 		{
 			debugLog<<"Output type ok"<<endl;
 			return S_OK;
@@ -349,51 +344,59 @@
 	}
 	debugLog<<"Output type no good"<<endl;
 
-	if (inMediaType->majortype == MEDIATYPE_Video) {
+	if (inMediaType->majortype == MEDIATYPE_Video) 
+    {
 		debugLog<<"Querying for video - FAIL"<<endl;
 		debugLog<<"Sub type = "<<inMediaType->subtype.Data1<<"-"<<inMediaType->subtype.Data2<<"-"<<inMediaType->subtype.Data3<<"-"<<endl;
 		debugLog<<"format type = "<<inMediaType->formattype.Data1<<"-"<<inMediaType->formattype.Data2<<"-"<<inMediaType->formattype.Data3<<"-"<<endl;
-	} else {
+	} 
+    else 
+    {
 		debugLog<<"Querying for non-video type"<<endl;
 	}
 
 	//If it matched none... return false.
 	return S_FALSE;
 }
-HRESULT TheoraDecodeFilter::CheckTransform(const CMediaType* inInputMediaType, const CMediaType* inOutputMediaType) {
+
+HRESULT TheoraDecodeFilter::CheckTransform(const CMediaType* inInputMediaType, const CMediaType* inOutputMediaType) 
+{
 	//MTS::: Needs multiple media types
-	if ((CheckInputType(inInputMediaType) == S_OK) && (CheckOutputType(inOutputMediaType) == S_OK)) 
+	if (CheckInputType(inInputMediaType) == S_OK && 
+        CheckOutputType(inOutputMediaType) == S_OK) 
 	{
 		if (inOutputMediaType->formattype == FORMAT_VideoInfo2)
 		{
 			VIDEOINFOHEADER2* locVideoHeader = (VIDEOINFOHEADER2*)inOutputMediaType->Format();
 
-			mBMIHeight = (unsigned long)abs(locVideoHeader->bmiHeader.biHeight);
-			mBMIWidth = (unsigned long)abs(locVideoHeader->bmiHeader.biWidth);
+			m_bmiHeight = (unsigned long)abs(locVideoHeader->bmiHeader.biHeight);
+			m_bmiWidth = (unsigned long)abs(locVideoHeader->bmiHeader.biWidth);
 
 
-			mBMIFrameSize = (mBMIHeight * mBMIWidth * locVideoHeader->bmiHeader.biBitCount) / 8;
+			m_bmiFrameSize = (m_bmiHeight * m_bmiWidth * locVideoHeader->bmiHeader.biBitCount) / 8;
 		}
 		else if (inOutputMediaType->formattype == FORMAT_VideoInfo)
 		{
 			VIDEOINFOHEADER* locVideoHeader = (VIDEOINFOHEADER*)inOutputMediaType->Format();
 
-			mBMIHeight = (unsigned long)abs(locVideoHeader->bmiHeader.biHeight);
-			mBMIWidth = (unsigned long)abs(locVideoHeader->bmiHeader.biWidth);
+			m_bmiHeight = (unsigned long)abs(locVideoHeader->bmiHeader.biHeight);
+			m_bmiWidth = (unsigned long)abs(locVideoHeader->bmiHeader.biWidth);
 
-			mBMIFrameSize = (mBMIHeight * mBMIWidth * locVideoHeader->bmiHeader.biBitCount) / 8;
+			m_bmiFrameSize = (m_bmiHeight * m_bmiWidth * locVideoHeader->bmiHeader.biBitCount) / 8;
 		}
 
 		debugLog<<"Check transform OK"<<endl;
 		return S_OK;
-	} else {
+	} 
+    else 
+    {
 		debugLog<<"Check transform FAILED"<<endl;
 		return S_FALSE;
 	}
 }
+
 HRESULT TheoraDecodeFilter::DecideBufferSize(IMemAllocator* inAllocator, ALLOCATOR_PROPERTIES* inPropertyRequest) 
 {
-
 	HRESULT locHR = S_OK;
 
 	//Create the structures for setproperties to use
@@ -413,7 +416,8 @@
 	if (inPropertyRequest->cbAlign <= 0) 
 	{
 		locReqAlloc.cbAlign = 1;
-	} else 
+	} 
+    else 
 	{
 		locReqAlloc.cbAlign = inPropertyRequest->cbAlign;
 	}
@@ -476,25 +480,26 @@
 
 	return S_OK;
 }
+
 HRESULT TheoraDecodeFilter::GetMediaType(int inPosition, CMediaType* outOutputMediaType) 
 {
 	if (inPosition < 0) 
 	{
 		return E_INVALIDARG;
 	} 
-	else if (inPosition < (int)mOutputMediaTypes.size()) 
+	
+    if (inPosition < (int)m_outputMediaTypes.size()) 
 	{	
-		if (mOutputMediaTypes[inPosition]->formattype == FORMAT_VideoInfo2)
+		if (m_outputMediaTypes[inPosition]->formattype == FORMAT_VideoInfo2)
 		{
 			VIDEOINFOHEADER2* locVideoFormat = (VIDEOINFOHEADER2*)outOutputMediaType->AllocFormatBuffer(sizeof(VIDEOINFOHEADER2));
 			FillVideoInfoHeader2(inPosition, locVideoFormat);
 			FillMediaType(inPosition, outOutputMediaType, locVideoFormat->bmiHeader.biSizeImage);
 		}
-		else 
-		if (mOutputMediaTypes[inPosition]->formattype == FORMAT_VideoInfo)
+		else if (m_outputMediaTypes[inPosition]->formattype == FORMAT_VideoInfo)
 		{
 			VIDEOINFOHEADER* locVideoFormat = 0;
-			if (mOutputMediaTypes[inPosition]->subtype == MEDIASUBTYPE_RGB565)
+			if (m_outputMediaTypes[inPosition]->subtype == MEDIASUBTYPE_RGB565)
 			{
 				VIDEOINFO *pvi = (VIDEOINFO *) outOutputMediaType->AllocFormatBuffer(sizeof(VIDEOINFO));
 				if(NULL == pvi)
@@ -526,19 +531,19 @@
 void TheoraDecodeFilter::ResetFrameCount() 
 {
 	//XTODO::: Maybe not needed
-	mFrameCount = 0;
-	
+	m_frameCount = 0;
 }
 
 HRESULT TheoraDecodeFilter::NewSegment(REFERENCE_TIME inStart, REFERENCE_TIME inEnd, double inRate) 
 {
 	debugLog<<"Resetting frame count"<<endl;
-	ResetFrameCount();
-	mSegStart = inStart;
-	mSegEnd = inEnd;
-	mPlaybackRate = inRate;
-	return CTransformFilter::NewSegment(inStart, inEnd, inRate);
+	
+    ResetFrameCount();
+	m_segStart = inStart;
+	m_segEnd = inEnd;
+	m_playbackRate = inRate;
 
+	return CTransformFilter::NewSegment(inStart, inEnd, inRate);
 }
 
 HRESULT TheoraDecodeFilter::Receive(IMediaSample* inInputSample)
@@ -547,146 +552,170 @@
 	//Get a source poitner into the input buffer
 	HRESULT locHR = inInputSample->GetPointer(&locBuff);
 
-	if (locHR != S_OK) {
+	if (locHR != S_OK) 
+    {
 		//debugLog<<"Receive : Get pointer failed..."<<locHR<<endl;	
 		return S_FALSE;
-	} else {
+	}
 
-		if ((inInputSample->GetActualDataLength() > 0) && ((locBuff[0] & 128) != 0)) {
-			//inInputSample->Release();
+	if (inInputSample->GetActualDataLength() > 0 && (locBuff[0] & 128) != 0) 
+    {
+		//inInputSample->Release();
 
-			//This is a header, so ignore it
-			return S_OK;
-		}
-		//Make a copy of the packet buffer
-		BYTE* locNewBuff = new unsigned char[inInputSample->GetActualDataLength()];		//This gets put into a packet.
-		memcpy((void*)locNewBuff, (const void*)locBuff, inInputSample->GetActualDataLength());
+		//This is a header, so ignore it
+		return S_OK;
+	}
+	
+    //Make a copy of the packet buffer
+	BYTE* locNewBuff = new unsigned char[inInputSample->GetActualDataLength()];		//This gets put into a packet.
+	memcpy((void*)locNewBuff, (const void*)locBuff, inInputSample->GetActualDataLength());
 
+	REFERENCE_TIME locStart = 0;
+	REFERENCE_TIME locEnd = 0;
+	inInputSample->GetTime(&locStart, &locEnd);
 
-		REFERENCE_TIME locStart = 0;
-		REFERENCE_TIME locEnd = 0;
-		inInputSample->GetTime(&locStart, &locEnd);
+	debugLog<<"Theora::Receive - Sample: Size = "<<inInputSample->GetActualDataLength()<<" Time: "<<locStart<<" - "<<locEnd<<endl;
 
-		debugLog<<"Theora::Receive - Sample: Size = "<<inInputSample->GetActualDataLength()<<" Time: "<<locStart<<" - "<<locEnd<<endl;
+	//This packet is given to the decoder or buffered for later
+	StampedOggPacket* locPacket = new StampedOggPacket(locNewBuff, inInputSample->GetActualDataLength(), false, false, locStart, locEnd, StampedOggPacket::OGG_END_ONLY);
 
-		//This packet is given to the decoder or buffered for later
-		StampedOggPacket* locPacket = new StampedOggPacket(locNewBuff, inInputSample->GetActualDataLength(), false, false, locStart, locEnd, StampedOggPacket::OGG_END_ONLY);
+	//Buffer all packets, even if we are about to send them anyway
+	m_bufferedPackets.push_back(locPacket);
 
-		//Buffer all packets, even if we are about to send them anyway
-		mBufferedPackets.push_back(locPacket);
+	if (locEnd < 0) 
+    {
+    	//The packet was ok, but we just aren't going to deliver it yet
+		return S_OK;
+	} 
 
-		if (locEnd < 0) {
+    //Now we have one with a stamp, we can send all the previous ones.
+	TheoraDecodeInputPin* locInputPin = (TheoraDecodeInputPin*)m_pInput;
+	REFERENCE_TIME locGlobalEnd = locInputPin->convertGranuleToTime(locEnd);
+	unsigned long locNumBufferedFrames = m_bufferedPackets.size();
+	REFERENCE_TIME locGlobalStart = locGlobalEnd - (locNumBufferedFrames * m_frameDuration);
 
-			//The packet was ok, but we just aren't going to deliver it yet
-			return S_OK;
-		} else {
-			//Now we have one with a stamp, we can send all the previous ones.
-			TheoraDecodeInputPin* locInputPin = (TheoraDecodeInputPin*)m_pInput;
-			REFERENCE_TIME locGlobalEnd = locInputPin->convertGranuleToTime(locEnd);
-			unsigned long locNumBufferedFrames = mBufferedPackets.size();
-			REFERENCE_TIME locGlobalStart = locGlobalEnd - (locNumBufferedFrames * mFrameDuration);
+	locStart = locGlobalStart;
 
-			locStart = locGlobalStart;
+	//Offsetting
+	REFERENCE_TIME locGlobalOffset = 0;
+	//Handle stream offsetting
+	if (!locInputPin->GetSentStreamOffset() && locInputPin->GetOutputPinInterface() != NULL) 
+    {
+		locInputPin->GetOutputPinInterface()->notifyStreamBaseTime(locStart);
+		locInputPin->SetSentStreamOffset(true);	
+	}
 
+	if (locInputPin->GetOutputPinInterface() != NULL) 
+    {
+		locGlobalOffset = locInputPin->GetOutputPinInterface()->getGlobalBaseTime();
+	}
+	
+	debugLog<<"Theora::Receive - "<<locNumBufferedFrames<<" frames buffered"<<endl;
 
-			//Offsetting
-			REFERENCE_TIME locGlobalOffset = 0;
-			//Handle stream offsetting
-			if (!locInputPin->getSentStreamOffset() && (locInputPin->getOutputPinInterface() != NULL)) {
-				locInputPin->getOutputPinInterface()->notifyStreamBaseTime(locStart);
-				locInputPin->setSentStreamOffset(true);
-				
-			}
+	for (unsigned long i = 0; i < locNumBufferedFrames; i++) 
+    {
+		debugLog<<"Theora::Receive - Processing buffered frame "<<i<<endl;
 
-			if (locInputPin->getOutputPinInterface() != NULL) {
-				locGlobalOffset = locInputPin->getOutputPinInterface()->getGlobalBaseTime();
-			}
-			
-			debugLog<<"Theora::Receive - "<<locNumBufferedFrames<<" frames buffered"<<endl;
-			for (unsigned long i = 0; i < locNumBufferedFrames; i++) {
-				debugLog<<"Theora::Receive - Processing buffered frame "<<i<<endl;
-				bool locIsKeyFrame = mTheoraDecoder->isKeyFrame(mBufferedPackets[i]);
-				debugLog<<"Pre theora decode"<<endl;
-				yuv_buffer* locYUV = mTheoraDecoder->decodeTheora(mBufferedPackets[i]);		//This accept the packet and deletes it
-				debugLog<<"Post theora decode"<<endl;
-				locEnd = locStart + mFrameDuration;
-				REFERENCE_TIME locAdjustedStart = locStart - mSegStart - locGlobalOffset;
-				REFERENCE_TIME locAdjustedEnd = locEnd - mSegStart - locGlobalOffset;
+		bool locIsKeyFrame = m_theoraDecoder->isKeyFrame(m_bufferedPackets[i]);
 
-				if (locAdjustedStart < 0) {
-					locAdjustedStart = 0;
-				}
+		debugLog<<"Pre theora decode"<<endl;
+		
+        yuv_buffer* locYUV = m_theoraDecoder->decodeTheora(m_bufferedPackets[i]);		//This accept the packet and deletes it
+		
+        debugLog<<"Post theora decode"<<endl;
+		
+        locEnd = locStart + m_frameDuration;
+		REFERENCE_TIME locAdjustedStart = locStart - m_segStart - locGlobalOffset;
+		REFERENCE_TIME locAdjustedEnd = locEnd - m_segStart - locGlobalOffset;
 
-				if (locAdjustedEnd >= 0) { 
-					if (locYUV != NULL) {
-						IMediaSample* locOutSample = NULL;
-						debugLog<<"Theora::Receive - Pre output sample initialisation"<<endl;
-						locHR = InitializeOutputSample(inInputSample, &locOutSample);
-						if (locHR != S_OK) {
-							//XTODO::: We need to trash our buffered packets
-							debugLog<<"Theora::Receive - Output sample initialisation failed"<<endl;
-							
-							deleteBufferedPacketsAfter(i);
-							
-							return S_FALSE;
-						}
-						debugLog<<"Theora::Receive - Output sample initialisation suceeded"<<endl;
+		if (locAdjustedStart < 0) 
+        {
+			locAdjustedStart = 0;
+		}
 
-						//REFERENCE_TIME locAdjustedStart = (locStart * RATE_DENOMINATOR) / mRateNumerator;
-						//REFERENCE_TIME locAdjustedEnd = (locEnd * RATE_DENOMINATOR) / mRateNumerator;
+		if (locAdjustedEnd >= 0) 
+        { 
+			if (locYUV != NULL) 
+            {
+				IMediaSample* locOutSample = NULL;
 
+				debugLog<<"Theora::Receive - Pre output sample initialisation"<<endl;
+				
+                locHR = InitializeOutputSample(inInputSample, &locOutSample);
+				if (locHR != S_OK) 
+                {
+					//XTODO::: We need to trash our buffered packets
+					debugLog<<"Theora::Receive - Output sample initialisation failed"<<endl;
+					
+					DeleteBufferedPacketsAfter(i);
+					
+					return S_FALSE;
+				}
+				
+                debugLog<<"Theora::Receive - Output sample initialisation suceeded"<<endl;
 
-						//Fill the sample info
-						if (TheoraDecoded(locYUV, locOutSample, locIsKeyFrame, locAdjustedStart, locAdjustedEnd) != S_OK) {
-							
-							//XTODO::: We need to trash our buffered packets
-							locOutSample->Release();
-							deleteBufferedPacketsAfter(i);
-							return S_FALSE;
-						} else {
-							//Deliver the sample
-							debugLog<<"Theora::Receive - Delivering: "<<locAdjustedStart<<" to "<<locAdjustedEnd<<(locIsKeyFrame ? "KEYFRAME": " ")<<endl;
-							
-							locHR = m_pOutput->Deliver(locOutSample);
-							ULONG locTempRefCount = locOutSample->Release();
-							debugLog<<"Theora::Receive - After deliver refcount = "<<locTempRefCount<<endl;
-							debugLog<<"Theora::Receive - Post delivery"<<endl;
-							if (locHR != S_OK) {
-								//XTODO::: We need to trash our buffered packets
-								debugLog<<"Theora::Receive - Delivery failed"<<endl;
-								debugLog<<"Theora::Receive - locHR = "<<locHR<<endl;
-								//locOutSample->Release();
-								deleteBufferedPacketsAfter(i);
-								return S_FALSE;
-							}
-							debugLog<<"Theora::Receive - Delivery Suceeded"<<endl;
+				//REFERENCE_TIME locAdjustedStart = (locStart * RATE_DENOMINATOR) / mRateNumerator;
+				//REFERENCE_TIME locAdjustedEnd = (locEnd * RATE_DENOMINATOR) / mRateNumerator;
 
-						}
-					} else {
+				//Fill the sample info
+				if (TheoraDecoded(locYUV, locOutSample, locIsKeyFrame, locAdjustedStart, locAdjustedEnd) != S_OK) 
+                {							
+					//XTODO::: We need to trash our buffered packets
+					locOutSample->Release();
+					DeleteBufferedPacketsAfter(i);
+					return S_FALSE;
+				} 
+                else 
+                {
+					//Deliver the sample
+					debugLog<<"Theora::Receive - Delivering: "<<locAdjustedStart<<" to "<<locAdjustedEnd<<(locIsKeyFrame ? "KEYFRAME": " ")<<endl;
+					
+					locHR = m_pOutput->Deliver(locOutSample);
+					ULONG locTempRefCount = locOutSample->Release();
+
+					debugLog<<"Theora::Receive - After deliver refcount = "<<locTempRefCount<<endl;
+					debugLog<<"Theora::Receive - Post delivery"<<endl;
+					
+                    if (locHR != S_OK) 
+                    {
 						//XTODO::: We need to trash our buffered packets
-						debugLog<<"locYUV == NULL"<<endl;
-						deleteBufferedPacketsAfter(i);
+						debugLog<<"Theora::Receive - Delivery failed"<<endl;
+						debugLog<<"Theora::Receive - locHR = "<<locHR<<endl;
+
+						//locOutSample->Release();
+						DeleteBufferedPacketsAfter(i);
 						return S_FALSE;
 					}
+					debugLog<<"Theora::Receive - Delivery Suceeded"<<endl;
 				}
-				locStart = locEnd;
-			}
+			} 
+            else 
+            {
+				//XTODO::: We need to trash our buffered packets
+				debugLog<<"locYUV == NULL"<<endl;
 
-			mBufferedPackets.clear();
-
-			debugLog<<"Leaving receive method with S_OK"<<endl;
-			return S_OK;
+				DeleteBufferedPacketsAfter(i);
+				return S_FALSE;
+			}
 		}
+		locStart = locEnd;
 	}
+
+	m_bufferedPackets.clear();
+
+	debugLog<<"Leaving receive method with S_OK"<<endl;
+
+	return S_OK;
 }
 
-void TheoraDecodeFilter::deleteBufferedPacketsAfter(unsigned long inPacketIndex)
+void TheoraDecodeFilter::DeleteBufferedPacketsAfter(unsigned long inPacketIndex)
 {
-	for (size_t i = inPacketIndex + 1; i < mBufferedPackets.size(); i++) {
-		delete mBufferedPackets[i];
+	for (size_t i = inPacketIndex + 1; i < m_bufferedPackets.size(); i++) 
+    {
+		delete m_bufferedPackets[i];
 	}
 
-	mBufferedPackets.clear();
+	m_bufferedPackets.clear();
 }
 HRESULT TheoraDecodeFilter::Transform(IMediaSample* inInputSample, IMediaSample* outOutputSample) 
 {
@@ -703,20 +732,18 @@
 	unsigned char * ptru = inYUVBuffer->u;
 	unsigned char * ptrv = inYUVBuffer->v;
 	unsigned char * ptro = locBuffer;
-	unsigned char * ptro2;
-	int i, j;
 
-	for (i = mYOffset; i < inYUVBuffer->y_height; i++) 
+	for (int i = m_yOffset; i < inYUVBuffer->y_height; ++i) 
 	{
-		ptro2 = ptro;
-		for (j = mXOffset; j < inYUVBuffer->y_width; j += 2) 
+		unsigned char* ptro2 = ptro;
+		for (int j = m_xOffset; j < inYUVBuffer->y_width; j += 2) 
 		{
 			short pr, pg, pb, y;
 			short r, g, b;
 
-			pr = (-56992 + ptrv[j/2] * 409) >> 8;
-			pg = (34784 - ptru[j/2] * 100 - ptrv[j/2] * 208) >> 8;
-			pb = (-70688 + ptru[j/2] * 516) >> 8;
+			pr = (-56992 + ptrv[j / 2] * 409) >> 8;
+			pg = (34784 - ptru[j / 2] * 100 - ptrv[j / 2] * 208) >> 8;
+			pb = (short)((-70688 + ptru[j / 2] * 516) >> 8);
 
 			y = 298*ptry[j] >> 8;
 			r = y + pr;
@@ -748,20 +775,11 @@
 			ptru += inYUVBuffer->uv_stride;
 			ptrv += inYUVBuffer->uv_stride;
 		}
-		ptro += mBMIWidth * 2;
+		ptro += m_bmiWidth * 2;
 	}
 
-	REFERENCE_TIME locStart = inStart;
-	REFERENCE_TIME locEnd = inEnd;
+    SetSampleParams(outSample, m_bmiFrameSize, &inStart, &inEnd, inIsKeyFrame ? TRUE : FALSE);
 
-	BOOL locIsKeyFrame = FALSE;
-	if (inIsKeyFrame) 
-	{
-		locIsKeyFrame = TRUE;
-	}
-
-	SetSampleParams(outSample, mBMIFrameSize, &locStart, &locEnd, locIsKeyFrame);
-
 	return S_OK;
 }
 
@@ -774,20 +792,18 @@
 	unsigned char * ptru = inYUVBuffer->u;
 	unsigned char * ptrv = inYUVBuffer->v;
 	unsigned char * ptro = locBuffer;
-	unsigned char * ptro2;
-	int i, j;
 
-	for (i = mYOffset; i < inYUVBuffer->y_height; i++) 
+	for (int i = m_yOffset; i < inYUVBuffer->y_height; i++) 
 	{
-		ptro2 = ptro;
-		for (j = mXOffset; j < inYUVBuffer->y_width; j += 2) 
+		unsigned char* ptro2 = ptro;
+		for (int j = m_xOffset; j < inYUVBuffer->y_width; j += 2) 
 		{
 			short pr, pg, pb, y;
 			short r, g, b;
 
-			pr = (-56992 + ptrv[j/2] * 409) >> 8;
-			pg = (34784 - ptru[j/2] * 100 - ptrv[j/2] * 208) >> 8;
-			pb = (-70688 + ptru[j/2] * 516) >> 8;
+			pr = (-56992 + ptrv[j / 2] * 409) >> 8;
+			pg = (34784 - ptru[j / 2] * 100 - ptrv[j / 2] * 208) >> 8;
+			pb = (short)((-70688 + ptru[j / 2] * 516) >> 8);
 
 			y = 298*ptry[j] >> 8;
 			r = y + pr;
@@ -815,87 +831,46 @@
 			ptru += inYUVBuffer->uv_stride;
 			ptrv += inYUVBuffer->uv_stride;
 		}
-		ptro += mBMIWidth * 4;
+		ptro += m_bmiWidth * 4;
 	}
 
-	REFERENCE_TIME locStart = inStart;
-	REFERENCE_TIME locEnd = inEnd;
+    SetSampleParams(outSample, m_bmiFrameSize, &inStart, &inEnd, inIsKeyFrame ? TRUE : FALSE);
 
-	BOOL locIsKeyFrame = FALSE;
-	if (inIsKeyFrame) 
-	{
-		locIsKeyFrame = TRUE;
-	}
-	SetSampleParams(outSample, mBMIFrameSize, &locStart, &locEnd, locIsKeyFrame);
-
 	return S_OK;
 }
 
 HRESULT TheoraDecodeFilter::DecodeToYUY2(yuv_buffer* inYUVBuffer, IMediaSample* outSample, bool inIsKeyFrame, REFERENCE_TIME inStart, REFERENCE_TIME inEnd) 
 {
-	BYTE* locBuffer = NULL;
-	outSample->GetPointer(&locBuffer);
+    unsigned char* locBuffer = NULL;
+    outSample->GetPointer(&locBuffer);
 
-	//Get the stride values and offsets
-	long locYStride = inYUVBuffer->y_stride;
-	long locUVStride = inYUVBuffer->uv_stride;
-	long locDestPad = (mBMIWidth - mPictureWidth) * 2;
-	long locSourceYPad = (locYStride - mPictureWidth);
-	long locSourceUVPad = (locUVStride - (mPictureWidth/2));//locSourceYPad>>1;
-	
-	//Setup the source pointers into the planar data
-	unsigned char* locSourceY = (unsigned char*)inYUVBuffer->y;
-	unsigned char* locSourceU = (unsigned char*)inYUVBuffer->u;
-	unsigned char* locSourceV = (unsigned char*)inYUVBuffer->v;
+    unsigned char * ptry = inYUVBuffer->y;
+    unsigned char * ptru = inYUVBuffer->u;
+    unsigned char * ptrv = inYUVBuffer->v;
+    unsigned char * ptro = locBuffer;
 
-	//Skip over the Y Offset at the top of the picture and the X offset into the line
-	locSourceY += (mYOffset * locYStride) + mXOffset;
-	locSourceU += ((mYOffset/2) * locUVStride) + mXOffset/2;
-	locSourceV += ((mYOffset/2) * locUVStride) + mXOffset/2;
+    for (int i = m_yOffset; i < inYUVBuffer->y_height; ++i) 
+    {
+        unsigned char* ptro2 = ptro;
+        for (int j = m_xOffset; j < inYUVBuffer->y_width; j += 2) 
+        {
+            *ptro2++ = ptry[j];
+            *ptro2++ = ptru[j / 2];
+            *ptro2++ = ptry[j + 1];
+            *ptro2++ = ptrv[j / 2];
+        }
 
-	unsigned char* locSecondLineBuffer;
+        ptry += inYUVBuffer->y_stride;
+        if (i & 1) 
+        {
+            ptru += inYUVBuffer->uv_stride;
+            ptrv += inYUVBuffer->uv_stride;
+        }
+        ptro += m_bmiWidth * 2;
+    }
 
-	for (unsigned int line = 0; line < mPictureHeight; line+= 2) {
-		locSecondLineBuffer = mScratchBuffer;
-		for (unsigned int col = 0; col < mPictureWidth; col+=2) {
-			//Line 1
-			*(locBuffer) = *(locSourceY);
-			*(locBuffer+1) = *(locSourceU);
-			*(locBuffer+2) = *(locSourceY+1);
-			*(locBuffer+3) = *(locSourceV);
+    SetSampleParams(outSample, m_bmiFrameSize, &inStart, &inEnd, inIsKeyFrame ? TRUE : FALSE);
 
-			//Line 2
-			*(locSecondLineBuffer) = *(locSourceY+locYStride);
-			*(locSecondLineBuffer+1) = *(locSourceU);
-			*(locSecondLineBuffer+2) = *(locSourceY+locYStride+1);
-			*(locSecondLineBuffer+3) = *(locSourceV);
-
-			//Advance the pointers for this chunk of columns
-			locBuffer += 4;
-			locSecondLineBuffer += 4;
-			locSourceY += 2;
-			locSourceU++;
-			locSourceV++;
-		}
-
-		//Advance the pointers for the line and copy the second line into the buffer
-		locBuffer += locDestPad;
-		memcpy((void*)locBuffer, (const void*)mScratchBuffer, mPictureWidth*2);
-		locBuffer += mBMIWidth*2;
-		locSourceY += locSourceYPad + locYStride;
-		locSourceU += locSourceUVPad; //+ locUVStride;
-		locSourceV += locSourceUVPad; //+ locUVStride;
-	}
-
-	REFERENCE_TIME locStart = inStart;
-	REFERENCE_TIME locEnd = inEnd;
-
-	BOOL locIsKeyFrame = FALSE;
-	if (inIsKeyFrame) {
-		locIsKeyFrame = TRUE;
-	};
-	SetSampleParams(outSample, mBMIFrameSize, &locStart, &locEnd, locIsKeyFrame);
-
 	return S_OK;
 }
 
@@ -904,139 +879,44 @@
 	BYTE* locBuffer = NULL;
 	outSample->GetPointer(&locBuffer);
 
-	//Set up the pointers
-	unsigned char* locDestUptoPtr = locBuffer;
-	unsigned char* locSourceUptoPtr = inYUVBuffer->y;
+    unsigned char * ptry = inYUVBuffer->y;
+    unsigned char * ptru = inYUVBuffer->u;
+    unsigned char * ptrv = inYUVBuffer->v;
+    unsigned char * ptro = locBuffer;
 
-	//Strides from theora are generally -'ve
-	long locYStride = inYUVBuffer->y_stride;
-	long locUVStride = inYUVBuffer->uv_stride;
+	for (unsigned long line = 0; line < m_pictureHeight; ++line) 
+    {
+		memcpy(ptro, ptry + m_xOffset, m_pictureWidth);
 
-
-
-	debugLog<<"Y Stride = "<<locYStride<<endl;
-	debugLog<<"UV Stride = "<<locUVStride<<endl;
-
-	debugLog<<"PictureHeight = "<<mPictureHeight<<endl;
-	debugLog<<"PictureWidth = "<<mPictureWidth<<endl;
-
-	debugLog<<"BMIHeight = "<<mBMIHeight<<endl;
-	debugLog<<"BMIWidth = "<<mBMIWidth<<endl;
-
-	//
-	//Y DATA
-	//
-
-	//Offsets Y Data
-	long locTopPad = inYUVBuffer->y_height - mPictureHeight - mYOffset;
-	debugLog<<"--------- TOP PAD = "<<locTopPad<<endl;
-
-
-	//ASSERT(locTopPad >= 0);
-	if (locTopPad < 0) {
-		locTopPad = 0;
-	} else {
-		
+		ptry += inYUVBuffer->y_stride;
+		ptro += m_bmiWidth;
 	}
-
-	//Skip the offset padding
-	locSourceUptoPtr += (mYOffset * locYStride);
-
-	for (unsigned long line = 0; line < mPictureHeight; line++) {
-		//Ignore the x offset, and copy mPictureWidth bytes onto the destination
-		memcpy((void*)(locDestUptoPtr), (const void*)(locSourceUptoPtr + mXOffset), mPictureWidth);
-
-		//Advance the source pointer by the stride
-		locSourceUptoPtr += locYStride;
-
-		//Advance the destination pointer by the BMI Width
-		locDestUptoPtr += mBMIWidth;
-	}
-
-	//Skip the other padding
-	locSourceUptoPtr += (locTopPad * locYStride);
-
-	//Advance the destination to pad to the size the video renderer wants
-	locDestUptoPtr += ((mBMIHeight - mPictureHeight) * mBMIWidth);
-
-	//debugLog<<"Dest Distance(y) = "<<(unsigned long)(locDestUptoPtr - locBuffer)<<endl;
-
-	//Source advances by (y_height * y_stride)
-	//Dest advances by (mHeight * mWidth)
-
-	//
-	//V DATA
-	//
-
-	//TODO::: May be issue here with odd numbers
-
-	//Half the padding for uv planes... is this correct ? 
-	locTopPad = locTopPad /2;
 	
-	locSourceUptoPtr = inYUVBuffer->v;
-
-	//Skip the top padding
-	locSourceUptoPtr += ((mYOffset/2) * locUVStride);
-
-	for (unsigned long line = 0; line < mPictureHeight / 2; line++) {
-		//Ignore the x offset and copy mPictureWidth/2 bytes to the destination
-		memcpy((void*)(locDestUptoPtr), (const void*)(locSourceUptoPtr + (mXOffset / 2)), mPictureWidth / 2);
-		locSourceUptoPtr += locUVStride;
-		locDestUptoPtr += (mBMIWidth / 2);
+	for (unsigned long line = 0; line < m_pictureHeight / 2; ++line) 
+    {
+		memcpy(ptro, ptrv + m_xOffset / 2, m_pictureWidth / 2);
+		ptrv += inYUVBuffer->uv_stride;
+		ptro += m_bmiWidth / 2;
 	}
-	locSourceUptoPtr += (locTopPad * locUVStride);
-	locDestUptoPtr += (((mBMIHeight/2) - (mPictureHeight/2)) * (mBMIWidth/2));
 
-	//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
+    for (unsigned long line = 0; line < m_pictureHeight / 2; ++line) 
+    {
+        memcpy(ptro, ptru + m_xOffset / 2, m_pictureWidth / 2);
+        ptru += inYUVBuffer->uv_stride;
+        ptro += m_bmiWidth / 2;
+    }
 
-
-	//debugLog<<"Dest Distance(V) = "<<(unsigned long)(locDestUptoPtr - locBuffer)<<endl;
-	//
-	//U DATA
-	//
-
-	locSourceUptoPtr = inYUVBuffer->u;
-
-	//Skip the top padding
-	locSourceUptoPtr += ((mYOffset/2) * locUVStride);
-
-	for (unsigned long line = 0; line < mPictureHeight / 2; line++) {
-		memcpy((void*)(locDestUptoPtr), (const void*)(locSourceUptoPtr + (mXOffset / 2)), mPictureWidth / 2);
-		locSourceUptoPtr += locUVStride;
-		locDestUptoPtr += (mBMIWidth / 2);
-	}
-
-	//Redundant
-	locSourceUptoPtr += (locTopPad * locUVStride);
-	locDestUptoPtr += (((mBMIHeight/2) - (mPictureHeight/2)) * (mBMIWidth/2));
-
-	//debugLog<<"Dest Distance(U) = "<<(unsigned long)(locDestUptoPtr - locBuffer)<<endl;
-	//debugLog<<"Frame Size = "<<mFrameSize<<endl;
-
-	//Set the sample parameters.
-	//BOOL locIsKeyFrame = (locInterFrameNo == 0);
-	BOOL locIsKeyFrame = FALSE;
-	if (inIsKeyFrame) {
-		locIsKeyFrame = TRUE;
-	};
-
-	REFERENCE_TIME locStart = inStart;
-	REFERENCE_TIME locEnd = inEnd;
-
-	SetSampleParams(outSample, mBMIFrameSize, &locStart, &locEnd, locIsKeyFrame);
+    SetSampleParams(outSample, m_bmiFrameSize, &inStart, &inEnd, inIsKeyFrame ? TRUE : FALSE);
 	
 	return S_OK;
 }
+
 HRESULT TheoraDecodeFilter::TheoraDecoded (yuv_buffer* inYUVBuffer, IMediaSample* outSample, bool inIsKeyFrame, REFERENCE_TIME inStart, REFERENCE_TIME inEnd) 
 {	
 	AM_MEDIA_TYPE* sampleMediaType;
 	outSample->GetMediaType(&sampleMediaType);
 
-	static GUID sampleMediaSubType = mCurrentOutputSubType;
+	static GUID sampleMediaSubType = m_currentOutputSubType;
 		
 	if (sampleMediaType != NULL)
 	{
@@ -1070,39 +950,45 @@
 		debugLog<<"Decoding to unknown type - failure"<<endl;
 		return E_FAIL;
 	}
-
 }
 
-
 HRESULT TheoraDecodeFilter::SetMediaType(PIN_DIRECTION inDirection, const CMediaType* inMediaType) 
 {
-	if (inDirection == PINDIR_INPUT) {
-		if (CheckInputType(inMediaType) == S_OK) {
+	if (inDirection == PINDIR_INPUT) 
+    {
+		if (CheckInputType(inMediaType) == S_OK) 
+        {
 			//debugLog<<"Setting format block"<<endl;
-			setTheoraFormat(inMediaType->pbFormat);
+			SetTheoraFormat(inMediaType->pbFormat);
 			
 			//Set some other stuff here too...
-			mXOffset = mTheoraFormatInfo->xOffset;
-			mYOffset = mTheoraFormatInfo->yOffset;
+			m_xOffset = m_theoraFormatInfo->xOffset;
+			m_yOffset = m_theoraFormatInfo->yOffset;
 
-			mPictureWidth = mTheoraFormatInfo->pictureWidth;
-			mPictureHeight = mTheoraFormatInfo->pictureHeight;
+			m_pictureWidth = m_theoraFormatInfo->pictureWidth;
+			m_pictureHeight = m_theoraFormatInfo->pictureHeight;
 
 			//How many UNITS does one frame take.
-			mFrameDuration = (UNITS * mTheoraFormatInfo->frameRateDenominator) / (mTheoraFormatInfo->frameRateNumerator);
+			m_frameDuration = (UNITS * m_theoraFormatInfo->frameRateDenominator) / (m_theoraFormatInfo->frameRateNumerator);
 
-			mFrameCount = 0;
-		} else {
+			m_frameCount = 0;
+		} 
+        else 
+        {
 			//Failed... should never be here !
 			throw 0;
 		}
 		debugLog<<"SETTING input type"<<endl;
-		return CTransformFilter::SetMediaType(PINDIR_INPUT, inMediaType);//CVideoTransformFilter::SetMediaType(PINDIR_INPUT, inMediaType);
-	} else {
 
-		mCurrentOutputSubType = inMediaType->subtype;
-		debugLog<<"SETTING output type"<<endl;
-		return CTransformFilter::SetMediaType(PINDIR_OUTPUT, inMediaType);//CVideoTransformFilter::SetMediaType(PINDIR_OUTPUT, inMediaType);
+		return CTransformFilter::SetMediaType(PINDIR_INPUT, inMediaType);//CVideoTransformFilter::SetMediaType(PINDIR_INPUT, inMediaType);
+	} 
+    else 
+    {
+		m_currentOutputSubType = inMediaType->subtype;
+		
+        debugLog<<"SETTING output type"<<endl;
+		
+        return CTransformFilter::SetMediaType(PINDIR_OUTPUT, inMediaType);//CVideoTransformFilter::SetMediaType(PINDIR_OUTPUT, inMediaType);
 	}
 }
 
@@ -1115,24 +1001,27 @@
 	outMediaSample->SetPreroll(FALSE);
 	outMediaSample->SetDiscontinuity(FALSE);
 	outMediaSample->SetSyncPoint(inIsSync);
+
 	return true;
 }
-//BOOL TheoraDecodeFilter::ShouldSkipFrame(IMediaSample* inSample) {
+
+//BOOL TheoraDecodeFilter::ShouldSkipFrame(IMediaSample* inSample) 
+//{
 //	//m_bSkipping = FALSE;
 //	debugLog<<"Don't skip"<<endl;
 //	return FALSE;
 //}
 
-sTheoraFormatBlock* TheoraDecodeFilter::getTheoraFormatBlock() 
+sTheoraFormatBlock* TheoraDecodeFilter::GetTheoraFormatBlock() 
 {
-	return mTheoraFormatInfo;
+	return m_theoraFormatInfo;
 }
-void TheoraDecodeFilter::setTheoraFormat(BYTE* inFormatBlock) 
+
+void TheoraDecodeFilter::SetTheoraFormat(BYTE* inFormatBlock) 
 {
+	delete m_theoraFormatInfo;
+	m_theoraFormatInfo = new sTheoraFormatBlock;			//Deelted in destructor.
 
-	delete mTheoraFormatInfo;
-	mTheoraFormatInfo = new sTheoraFormatBlock;			//Deelted in destructor.
-
 	//0		-	55			theora ident						0	-	6
 	//56	-	63			ver major							7	-	7
 	//64	-	71			ver minor							8	-	8
@@ -1153,22 +1042,22 @@
 	//326	-	330			keyframintlog						40.75-  41.375
 
 	unsigned char* locIdentHeader = inFormatBlock;
-	mTheoraFormatInfo->theoraVersion = (iBE_Math::charArrToULong(locIdentHeader + 7)) >>8;
-	mTheoraFormatInfo->outerFrameWidth = (iBE_Math::charArrToUShort(locIdentHeader + 10)) * 16;
-	mTheoraFormatInfo->outerFrameHeight = (iBE_Math::charArrToUShort(locIdentHeader + 12)) * 16;
-	mTheoraFormatInfo->pictureWidth = (iBE_Math::charArrToULong(locIdentHeader + 14)) >>8;
-	mTheoraFormatInfo->pictureHeight = (iBE_Math::charArrToULong(locIdentHeader + 17)) >>8;
-	mTheoraFormatInfo->xOffset = locIdentHeader[20];
-	mTheoraFormatInfo->yOffset = locIdentHeader[21];
-	mTheoraFormatInfo->frameRateNumerator = iBE_Math::charArrToULong(locIdentHeader + 22);
-	mTheoraFormatInfo->frameRateDenominator = iBE_Math::charArrToULong(locIdentHeader + 26);
-	mTheoraFormatInfo->aspectNumerator = (iBE_Math::charArrToULong(locIdentHeader + 30)) >>8;
-	mTheoraFormatInfo->aspectDenominator = (iBE_Math::charArrToULong(locIdentHeader + 33)) >>8;
-	mTheoraFormatInfo->colourSpace = locIdentHeader[36];
-	mTheoraFormatInfo->targetBitrate = (iBE_Math::charArrToULong(locIdentHeader + 37)) >>8;
-	mTheoraFormatInfo->targetQuality = (locIdentHeader[40]) >> 2;
+	m_theoraFormatInfo->theoraVersion = (iBE_Math::charArrToULong(locIdentHeader + 7)) >>8;
+	m_theoraFormatInfo->outerFrameWidth = (iBE_Math::charArrToUShort(locIdentHeader + 10)) * 16;
+	m_theoraFormatInfo->outerFrameHeight = (iBE_Math::charArrToUShort(locIdentHeader + 12)) * 16;
+	m_theoraFormatInfo->pictureWidth = (iBE_Math::charArrToULong(locIdentHeader + 14)) >>8;
+	m_theoraFormatInfo->pictureHeight = (iBE_Math::charArrToULong(locIdentHeader + 17)) >>8;
+	m_theoraFormatInfo->xOffset = locIdentHeader[20];
+	m_theoraFormatInfo->yOffset = locIdentHeader[21];
+	m_theoraFormatInfo->frameRateNumerator = iBE_Math::charArrToULong(locIdentHeader + 22);
+	m_theoraFormatInfo->frameRateDenominator = iBE_Math::charArrToULong(locIdentHeader + 26);
+	m_theoraFormatInfo->aspectNumerator = (iBE_Math::charArrToULong(locIdentHeader + 30)) >>8;
+	m_theoraFormatInfo->aspectDenominator = (iBE_Math::charArrToULong(locIdentHeader + 33)) >>8;
+	m_theoraFormatInfo->colourSpace = locIdentHeader[36];
+	m_theoraFormatInfo->targetBitrate = (iBE_Math::charArrToULong(locIdentHeader + 37)) >>8;
+	m_theoraFormatInfo->targetQuality = (locIdentHeader[40]) >> 2;
 
-	mTheoraFormatInfo->maxKeyframeInterval= (((locIdentHeader[40]) % 4) << 3) + (locIdentHeader[41] >> 5);
+	m_theoraFormatInfo->maxKeyframeInterval= (((locIdentHeader[40]) % 4) << 3) + (locIdentHeader[41] >> 5);
 }
 
 CBasePin* TheoraDecodeFilter::GetPin(int inPinNo)
@@ -1176,31 +1065,23 @@
     HRESULT locHR = S_OK;
 
     // Create an input pin if necessary
-
-    if (m_pInput == NULL) {
-
-        m_pInput = new TheoraDecodeInputPin(this, &locHR);		//Deleted in base destructor
-
-        
-        if (m_pInput == NULL) {
-            return NULL;
-        }
+    if (m_pInput == NULL) 
+    {
+        m_pInput = new TheoraDecodeInputPin(this, &locHR);		//Deleted in base destructor    
         m_pOutput = new TheoraDecodeOutputPin(this, &locHR);	//Deleted in base destructor
-			
-
-        if (m_pOutput == NULL) {
-            delete m_pInput;
-            m_pInput = NULL;
-        }
     }
 
     // Return the pin
-
-    if (inPinNo == 0) {
+    if (inPinNo == 0) 
+    {
         return m_pInput;
-    } else if (inPinNo == 1) {
+    } 
+    else if (inPinNo == 1) 
+    {
         return m_pOutput;
-    } else {
+    } 
+    else 
+    {
         return NULL;
     }
 }

Modified: trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.h	2008-11-20 02:45:56 UTC (rev 15527)
+++ trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.h	2008-11-23 01:47:26 UTC (rev 15528)
@@ -1,6 +1,8 @@
 //===========================================================================
 //Copyright (C) 2003-2006 Zentaro Kavanagh
 //
+//Copyright (C) 2008 Cristian Adam
+//
 //Redistribution and use in source and binary forms, with or without
 //modification, are permitted provided that the following conditions
 //are met:
@@ -38,20 +40,15 @@
 #include "theoradecodeinputpin.h"
 
 #include <libilliCore/iBE_Math.h>
-#include <math.h>
-//#include "DSStringer.h"
 #include "TheoraDecoder.h"
-#include <fstream>
-using namespace std;
-class TheoraDecodeFilter 
-	//:	public CVideoTransformFilter
-	:	public CTransformFilter
 
+class TheoraDecodeFilter: public CTransformFilter
 {
 public:
 	friend class TheoraDecodeInputPin;
-	TheoraDecodeFilter(void);
-	virtual ~TheoraDecodeFilter(void);
+	
+    TheoraDecodeFilter();
+	virtual ~TheoraDecodeFilter();
 
 	//COM Creator Function
 	static CUnknown* WINAPI CreateInstance(LPUNKNOWN pUnk, HRESULT *pHr);
@@ -70,73 +67,73 @@
 	virtual HRESULT NewSegment(REFERENCE_TIME inStart, REFERENCE_TIME inEnd, double inRate);
 	//virtual BOOL ShouldSkipFrame(IMediaSample* inSample);
 	virtual CBasePin* TheoraDecodeFilter::GetPin(int inPinNo);
-	//Helpers
-	sTheoraFormatBlock* getTheoraFormatBlock();
-	void setTheoraFormat(BYTE* inFormatBlock);
-
+	
 #ifdef WINCE
 	virtual LPAMOVIESETUP_FILTER GetSetupData();
 	virtual HRESULT Register();
 #endif
 
-
 protected:
 
-	static const unsigned long THEORA_IDENT_HEADER_SIZE = 42;
 	virtual void ResetFrameCount();
 
+    //Helpers
+    sTheoraFormatBlock* GetTheoraFormatBlock();
+    void SetTheoraFormat(BYTE* inFormatBlock);
+
 	HRESULT CheckOutputType(const CMediaType* inMediaType);
-	void deleteBufferedPacketsAfter(unsigned long inPacketIndex);
+	void DeleteBufferedPacketsAfter(unsigned long inPacketIndex);
 	void FillMediaType(int inPosition, CMediaType* outMediaType, unsigned long inSampleSize);
 	bool FillVideoInfoHeader(int inPosition, VIDEOINFOHEADER* inFormatBuffer);
     bool FillVideoInfoHeader2(int inPosition, VIDEOINFOHEADER2* inFormatBuffer);
 	bool SetSampleParams(IMediaSample* outMediaSample, unsigned long inDataSize, REFERENCE_TIME* inStartTime, REFERENCE_TIME* inEndTime, BOOL inIsSync);
-	
-	unsigned long mBMIHeight;
-	unsigned long mBMIWidth;
-	unsigned long mBMIFrameSize;
 
-	unsigned long mPictureHeight;
-	unsigned long mPictureWidth;
+    HRESULT TheoraDecoded (yuv_buffer* inYUVBuffer, IMediaSample* outSample, bool inIsKeyFrame, REFERENCE_TIME inStart, REFERENCE_TIME inEnd);
+    HRESULT DecodeToYUY2(yuv_buffer* inYUVBuffer, IMediaSample* outSample, bool inIsKeyFrame, REFERENCE_TIME inStart, REFERENCE_TIME inEnd) ;
+    HRESULT DecodeToYV12(yuv_buffer* inYUVBuffer, IMediaSample* outSample, bool inIsKeyFrame, REFERENCE_TIME inStart, REFERENCE_TIME inEnd) ;
+    HRESULT DecodeToRGB565(yuv_buffer* inYUVBuffer, IMediaSample* outSample, bool inIsKeyFrame, REFERENCE_TIME inStart, REFERENCE_TIME inEnd) ;
+    HRESULT DecodeToRGB32(yuv_buffer* inYUVBuffer, IMediaSample* outSample, bool inIsKeyFrame, REFERENCE_TIME inStart, REFERENCE_TIME inEnd) ;
 
-	
-	unsigned long mFrameCount;
-	unsigned long mYOffset;
-	unsigned long mXOffset;
-	__int64 mFrameDuration;
-	bool mBegun;
-	TheoraDecoder* mTheoraDecoder;
-	
-	vector<StampedOggPacket*> mBufferedPackets;
+protected:
+    static const unsigned long THEORA_IDENT_HEADER_SIZE = 42;
 
-	HRESULT TheoraDecoded (yuv_buffer* inYUVBuffer, IMediaSample* outSample, bool inIsKeyFrame, REFERENCE_TIME inStart, REFERENCE_TIME inEnd);
-	HRESULT DecodeToYUY2(yuv_buffer* inYUVBuffer, IMediaSample* outSample, bool inIsKeyFrame, REFERENCE_TIME inStart, REFERENCE_TIME inEnd) ;
-	HRESULT DecodeToYV12(yuv_buffer* inYUVBuffer, IMediaSample* outSample, bool inIsKeyFrame, REFERENCE_TIME inStart, REFERENCE_TIME inEnd) ;
-	HRESULT DecodeToRGB565(yuv_buffer* inYUVBuffer, IMediaSample* outSample, bool inIsKeyFrame, REFERENCE_TIME inStart, REFERENCE_TIME inEnd) ;
-	HRESULT DecodeToRGB32(yuv_buffer* inYUVBuffer, IMediaSample* outSample, bool inIsKeyFrame, REFERENCE_TIME inStart, REFERENCE_TIME inEnd) ;
+    unsigned long m_bmiHeight;
+	unsigned long m_bmiWidth;
+	unsigned long m_bmiFrameSize;
 
+	unsigned long m_pictureHeight;
+	unsigned long m_pictureWidth;
 
+	unsigned long m_frameCount;
+	unsigned long m_yOffset;
+	unsigned long m_xOffset;
+	
+    __int64 m_frameDuration;
+	bool m_begun;
+	
+    TheoraDecoder* m_theoraDecoder;
+	
+    std::vector<StampedOggPacket*> m_bufferedPackets;
 
-
-	vector<CMediaType*> mOutputMediaTypes;
-	struct sOutputVideoParams {
+    std::vector<CMediaType*> m_outputMediaTypes;
+	struct sOutputVideoParams 
+    {
 		WORD bitsPerPixel;
 		DWORD fourCC;
 	};
 
-	HRESULT YV12ToYUY2(IMediaSample* inoutSample);
-	BYTE* mScratchBuffer;
-	GUID mCurrentOutputSubType;
+	GUID m_currentOutputSubType;
 
-	vector<sOutputVideoParams> mOutputVideoParams;
+    std::vector<sOutputVideoParams> m_outputVideoParams;
 
-	REFERENCE_TIME mSegStart;
-	REFERENCE_TIME mSegEnd;
-	double mPlaybackRate;
+	REFERENCE_TIME m_segStart;
+	REFERENCE_TIME m_segEnd;
+	double m_playbackRate;
 
-	__int64 mSeekTimeBase;
-	__int64 mLastSeenStartGranPos;
+	__int64 m_seekTimeBase;
+	__int64 m_lastSeenStartGranPos;
+
 	//Format Block
-	sTheoraFormatBlock* mTheoraFormatInfo;
-	fstream debugLog;
+	sTheoraFormatBlock* m_theoraFormatInfo;
+    std::fstream debugLog;
 };

Modified: trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeInputPin.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeInputPin.cpp	2008-11-20 02:45:56 UTC (rev 15527)
+++ trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeInputPin.cpp	2008-11-23 01:47:26 UTC (rev 15528)
@@ -35,52 +35,55 @@
 
 TheoraDecodeInputPin::TheoraDecodeInputPin(CTransformFilter* inParentFilter, HRESULT* outHR) 
 	:	CTransformInputPin(NAME("Theora Input Pin"), inParentFilter, outHR, L"Theora In")
-	,	mSetupState(VSS_SEEN_NOTHING)
-	,	mOggOutputPinInterface(NULL)
-	,	mSentStreamOffset(false)
+	,	m_setupState(VSS_SEEN_NOTHING)
+	,	m_oggOutputPinInterface(NULL)
+	,	m_sentStreamOffset(false)
 {
 	debugLog.open("\\Storage Card\\theoinput.txt", ios_base::out|ios_base::app);
 }
-TheoraDecodeInputPin::~TheoraDecodeInputPin() {
+
+TheoraDecodeInputPin::~TheoraDecodeInputPin() 
+{
 	debugLog.close();
 }
 
 STDMETHODIMP TheoraDecodeInputPin::NonDelegatingQueryInterface(REFIID riid, void **ppv) 
 {
-
-
-
-	if (riid == IID_IMediaSeeking) {
-		//debugLog<<"Got Seeker"<<endl;
-		*ppv = (IMediaSeeking*)this;
-		((IUnknown*)*ppv)->AddRef();
-		
-		return NOERROR;
-	} else if (riid == IID_IOggDecoder) {
-		*ppv = (IOggDecoder*)this;
-		//((IUnknown*)*ppv)->AddRef();
-		return NOERROR;
-
+	if (riid == IID_IMediaSeeking) 
+    {
+        return GetInterface((IMediaSeeking*) this, ppv);
+	} 
+    else if (riid == IID_IOggDecoder) 
+    {
+        // TODO: Change IOggDecoder into a proper interface
+        *ppv = (IOggDecoder*)this;
+        return NOERROR;
 	}
 
 	return CBaseInputPin::NonDelegatingQueryInterface(riid, ppv); 
 }
+
 HRESULT TheoraDecodeInputPin::GetAllocatorRequirements(ALLOCATOR_PROPERTIES *outRequestedProps)
 {
 	TheoraDecodeFilter* locParent = (TheoraDecodeFilter*)m_pFilter;
-	unsigned long locBuffSize = ((unsigned long)locParent->mTheoraFormatInfo->outerFrameHeight * (unsigned long)locParent->mTheoraFormatInfo->outerFrameWidth * 3) >> 3;
-	debugLog<<"Un adjusted Buffer size = "<<locBuffSize<<endl;
+	unsigned long locBuffSize = (locParent->m_theoraFormatInfo->outerFrameHeight * locParent->m_theoraFormatInfo->outerFrameWidth * 3) >> 3;
+
+    debugLog<<"Un adjusted Buffer size = "<<locBuffSize<<endl;
+
 #ifdef WINCE
-	if (locBuffSize < 4096) {
+	if (locBuffSize < 4096) 
+    {
 		locBuffSize = 4096;
 	}
 #else
-	if (locBuffSize < 65536) {
+	if (locBuffSize < 65536) 
+    {
 		locBuffSize = 65536;
 	}
 #endif
 
 	debugLog<<"Buffer size = "<<locBuffSize<<endl;
+
 	outRequestedProps->cbBuffer =  locBuffSize;
 	outRequestedProps->cBuffers = THEORA_NUM_BUFFERS;
 	outRequestedProps->cbAlign = 1;
@@ -88,37 +91,46 @@
 
 	return S_OK;
 }
-HRESULT TheoraDecodeInputPin::BreakConnect() {
+
+HRESULT TheoraDecodeInputPin::BreakConnect() 
+{
 	CAutoLock locLock(m_pLock);
 	debugLog<<"Break conenct"<<endl;
-	//Need a lock ??
+
+    //Need a lock ??
 	ReleaseDelegate();
 	return CTransformInputPin::BreakConnect();
 }
-HRESULT TheoraDecodeInputPin::CompleteConnect (IPin *inReceivePin) {
+
+HRESULT TheoraDecodeInputPin::CompleteConnect (IPin *inReceivePin) 
+{
 	CAutoLock locLock(m_pLock);
 
 	//Offsets
 	IOggOutputPin* locOggOutput = NULL;
-	mSentStreamOffset = false;
+	m_sentStreamOffset = false;
 	HRESULT locHR = inReceivePin->QueryInterface(IID_IOggOutputPin, (void**)&locOggOutput);
-	if (locHR == S_OK) {
-		mOggOutputPinInterface = locOggOutput;
-		
-	} else {
-		mOggOutputPinInterface = NULL;
+	if (locHR == S_OK) 
+    {
+		m_oggOutputPinInterface = locOggOutput;	
+	} 
+    else 
+    {
+		m_oggOutputPinInterface = NULL;
 	}
 
-
 	debugLog<<"Attempt Complete conenct"<<endl;
 	IMediaSeeking* locSeeker = NULL;
 	inReceivePin->QueryInterface(IID_IMediaSeeking, (void**)&locSeeker);
-	if (locSeeker == NULL) {
+
+	if (locSeeker == NULL) 
+    {
 		//debugLog<<"Seeker is null"<<endl;
 	}
 	SetDelegate(locSeeker);
 	locHR = CTransformInputPin::CompleteConnect(inReceivePin);
 	debugLog<<"Complete connect returns "<<locHR<<endl;
+
 	return locHR;
 }
 
@@ -131,31 +143,32 @@
 	//}
 	TheoraDecodeFilter* locParent = (TheoraDecodeFilter*)m_pFilter;
 
-
-	LOOG_INT64 locMod = ((LOOG_INT64)1)<<locParent->getTheoraFormatBlock()->maxKeyframeInterval; //(unsigned long)pow((double) 2, (double) mGranulePosShift);
+	LOOG_INT64 locMod = ((LOOG_INT64)1)<<locParent->GetTheoraFormatBlock()->maxKeyframeInterval; //(unsigned long)pow((double) 2, (double) mGranulePosShift);
 	LOOG_INT64 locInterFrameNo = (LOOG_INT64) ( inGranule % locMod );
 			
-
 	//LOOG_INT64 retTime ((((inGranule >> locParent->getTheoraFormatBlock()->maxKeyframeInterval) + locInterFrameNo) * UNITS) * locParent->getTheoraFormatBlock()->frameRateDenominator) / locParent->getTheoraFormatBlock()->frameRateNumerator;
 
-	LOOG_INT64 retTime = inGranule >> locParent->getTheoraFormatBlock()->maxKeyframeInterval;
+	LOOG_INT64 retTime = inGranule >> locParent->GetTheoraFormatBlock()->maxKeyframeInterval;
 	retTime += locInterFrameNo + 1;
 	retTime *= UNITS;
-	retTime *= locParent->getTheoraFormatBlock()->frameRateDenominator;
-	retTime /= locParent->getTheoraFormatBlock()->frameRateNumerator;
+	retTime *= locParent->GetTheoraFormatBlock()->frameRateDenominator;
+	retTime /= locParent->GetTheoraFormatBlock()->frameRateNumerator;
+
 	return retTime;
-
 }
 
 LOOG_INT64 TheoraDecodeInputPin::mustSeekBefore(LOOG_INT64 inGranule)
 {
 	TheoraDecodeFilter* locParent = (TheoraDecodeFilter*)m_pFilter;
-	LOOG_INT64 locShift = locParent->getTheoraFormatBlock()->maxKeyframeInterval;
+	LOOG_INT64 locShift = locParent->GetTheoraFormatBlock()->maxKeyframeInterval;
+
 	return (inGranule >> locShift) << locShift;
 }
+
 IOggDecoder::eAcceptHeaderResult TheoraDecodeInputPin::showHeaderPacket(OggPacket* inCodecHeaderPacket)
 {
 	debugLog<<"Show header packet..."<<endl;
+
 	unsigned char* locPacketData = new unsigned char[inCodecHeaderPacket->packetSize()];
 	memcpy((void*)locPacketData, (const void**)inCodecHeaderPacket->packetData(), inCodecHeaderPacket->packetSize());
 	StampedOggPacket* locStamped = new StampedOggPacket(locPacketData, inCodecHeaderPacket->packetSize(), false, false, 0,0, StampedOggPacket::NONE);
@@ -163,38 +176,42 @@
 	TheoraDecodeFilter* locParent = (TheoraDecodeFilter*)m_pFilter;
 
 	IOggDecoder::eAcceptHeaderResult retResult = IOggDecoder::AHR_INVALID_HEADER;
-	switch (mSetupState) {
+	switch (m_setupState) 
+    {
 		case VSS_SEEN_NOTHING:
-			if (strncmp((char*)inCodecHeaderPacket->packetData(), "\200theora", 7) == 0) {
+			if (strncmp((char*)inCodecHeaderPacket->packetData(), "\200theora", 7) == 0) 
+            {
 				//TODO::: Possibly verify version
-				if (locParent->mTheoraDecoder->decodeTheora(locStamped) == NULL) {
-					mSetupState = VSS_SEEN_BOS;
+				if (locParent->m_theoraDecoder->decodeTheora(locStamped) == NULL) 
+                {
+					m_setupState = VSS_SEEN_BOS;
 					retResult = IOggDecoder::AHR_MORE_HEADERS_TO_COME;
+
 					debugLog<<"Seen ident header 1"<<endl;
 				}
 			}
 			//return IOggDecoder::AHR_INVALID_HEADER;
 			break;
 			
-			
 		case VSS_SEEN_BOS:
-			if (strncmp((char*)inCodecHeaderPacket->packetData(), "\201theora", 7) == 0) {
-				if (locParent->mTheoraDecoder->decodeTheora(locStamped) == NULL) {
-					mSetupState = VSS_SEEN_COMMENT;
+			if (strncmp((char*)inCodecHeaderPacket->packetData(), "\201theora", 7) == 0) 
+            {
+				if (locParent->m_theoraDecoder->decodeTheora(locStamped) == NULL) 
+                {
+					m_setupState = VSS_SEEN_COMMENT;
 					retResult = IOggDecoder::AHR_MORE_HEADERS_TO_COME;
+
 					debugLog<<"Seen comment header 2"<<endl;
-				}
-				
-				
+                }
 			}
 			//return IOggDecoder::AHR_INVALID_HEADER;
 			break;
 			
-			
 		case VSS_SEEN_COMMENT:
-			if (strncmp((char*)inCodecHeaderPacket->packetData(), "\202theora", 7) == 0) {
-				if (locParent->mTheoraDecoder->decodeTheora(locStamped) == NULL) {
-		
+			if (strncmp((char*)inCodecHeaderPacket->packetData(), "\202theora", 7) == 0) 
+            {
+				if (locParent->m_theoraDecoder->decodeTheora(locStamped) == NULL) 
+                {
 					//fish_sound_command (mFishSound, FISH_SOUND_GET_INFO, &(mFishInfo), sizeof (FishSoundInfo)); 
 					//Is mBegun useful ?
 					//mBegun = true;
@@ -204,8 +221,9 @@
 					//mSampleRate = mFishInfo.samplerate;
 
 		
-					mSetupState = VSS_ALL_HEADERS_SEEN;
+					m_setupState = VSS_ALL_HEADERS_SEEN;
 					retResult = IOggDecoder::AHR_ALL_HEADERS_RECEIVED;
+
 					debugLog<<"Seen code book header 3"<<endl;
 				}
 				
@@ -217,20 +235,39 @@
 		case VSS_ERROR:
 		default:
 			debugLog<<"Discarding header packet... bad state"<<endl;
-			delete locStamped;
+			
+            delete locStamped;
 			retResult = IOggDecoder::AHR_UNEXPECTED;
 			break;
 	}
 	
 	debugLog<<"Unexpected header packet..."<<endl;
-	return retResult;
+	
+    return retResult;
 }
-string TheoraDecodeInputPin::getCodecShortName()
+
+std::string TheoraDecodeInputPin::getCodecShortName()
 {
 	return "theora";
 }
-string TheoraDecodeInputPin::getCodecIdentString()
+
+std::string TheoraDecodeInputPin::getCodecIdentString()
 {
 	//TODO:::
 	return "theora";
-}
\ No newline at end of file
+}
+
+IOggOutputPin* TheoraDecodeInputPin::GetOutputPinInterface()
+{
+    return m_oggOutputPinInterface;
+}
+
+bool TheoraDecodeInputPin::GetSentStreamOffset()
+{
+    return m_sentStreamOffset;
+}
+
+void TheoraDecodeInputPin::SetSentStreamOffset(bool inSentStreamOffset)
+{
+    m_sentStreamOffset = inSentStreamOffset;
+}

Modified: trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeInputPin.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeInputPin.h	2008-11-20 02:45:56 UTC (rev 15527)
+++ trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeInputPin.h	2008-11-23 01:47:26 UTC (rev 15528)
@@ -37,12 +37,8 @@
 
 #include "TheoraDecodeFilter.h"
 
-#include <fstream>
-using namespace std;
-class TheoraDecodeInputPin 
-	:	public CTransformInputPin
-	,	public BasicSeekPassThrough
-	,	public IOggDecoder
+class TheoraDecodeInputPin : public CTransformInputPin,	
+    public BasicSeekPassThrough, public IOggDecoder
 {
 public:
 
@@ -67,18 +63,21 @@
 	virtual IOggDecoder::eAcceptHeaderResult __stdcall showHeaderPacket(OggPacket* inCodecHeaderPacket);
 	virtual string __stdcall getCodecShortName();
 	virtual string __stdcall getCodecIdentString();
-	fstream debugLog;
 
-	virtual IOggOutputPin* getOutputPinInterface()		{		return mOggOutputPinInterface;	}
-	virtual bool getSentStreamOffset()					{		return mSentStreamOffset;		}
-	virtual void setSentStreamOffset(bool inSentStreamOffset)	{	mSentStreamOffset = inSentStreamOffset;	}
+	virtual IOggOutputPin* GetOutputPinInterface();
+	virtual bool GetSentStreamOffset();
+	virtual void SetSentStreamOffset(bool inSentStreamOffset);
+
 protected:
+
 #ifdef WINCE
 	static const unsigned long THEORA_NUM_BUFFERS = 20;
 #else
 	static const unsigned long THEORA_NUM_BUFFERS = 50;
 #endif
-	enum eTheoraSetupState {
+
+	enum eTheoraSetupState 
+    {
 		VSS_SEEN_NOTHING,
 		VSS_SEEN_BOS,
 		VSS_SEEN_COMMENT,
@@ -86,9 +85,10 @@
 		VSS_ERROR
 	};
 
-	eTheoraSetupState mSetupState;
+	eTheoraSetupState m_setupState;
 
+    std::fstream debugLog;
 
-	IOggOutputPin* mOggOutputPinInterface;
-	bool mSentStreamOffset;
+	IOggOutputPin* m_oggOutputPinInterface;
+	bool m_sentStreamOffset;
 };

Modified: trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeOutputPin.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeOutputPin.cpp	2008-11-20 02:45:56 UTC (rev 15527)
+++ trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeOutputPin.cpp	2008-11-23 01:47:26 UTC (rev 15528)
@@ -34,51 +34,60 @@
 
 
 
-TheoraDecodeOutputPin::TheoraDecodeOutputPin(CTransformFilter* inParentFilter, HRESULT* outHR) 
-	:	CTransformOutputPin(NAME("Theora Output Pin"), inParentFilter, outHR, L"Theora Out")
+TheoraDecodeOutputPin::TheoraDecodeOutputPin(CTransformFilter* inParentFilter, HRESULT* outHR) :	
+CTransformOutputPin(NAME("Theora Output Pin"), inParentFilter, outHR, L"Theora Out")
 {
 	//debugLog.open("G:\\logs\\theooutput.log", ios_base::out);
 }
-TheoraDecodeOutputPin::~TheoraDecodeOutputPin() {
+TheoraDecodeOutputPin::~TheoraDecodeOutputPin() 
+{
 	//debugLog.close();
 }
 
-STDMETHODIMP TheoraDecodeOutputPin::NonDelegatingQueryInterface(REFIID riid, void **ppv) {
+STDMETHODIMP TheoraDecodeOutputPin::NonDelegatingQueryInterface(REFIID riid, void **ppv) 
+{
 	//debugLog<<"Querying interface"<<endl;
-	if (riid == IID_IMediaSeeking) {
-		//debugLog<<"Got seekeer"<<endl;
-		*ppv = (IMediaSeeking*)this;
-		((IUnknown*)*ppv)->AddRef();
-		
-		return NOERROR;
-	} else if (riid == IID_IMediaPosition) {
+	if (riid == IID_IMediaSeeking) 
+    {
+        return GetInterface((IMediaSeeking*)this, ppv);
+	} 
+    else if (riid == IID_IMediaPosition) 
+    {
 		//debugLog<<"Asking for OLD SEEKER"<<endl;
 	}
-	//debugLog<<"Trying base output pin"<<endl;
+	
+    //debugLog<<"Trying base output pin"<<endl;
 	return CBaseOutputPin::NonDelegatingQueryInterface(riid, ppv); 
 }
 
-HRESULT TheoraDecodeOutputPin::BreakConnect() {
+HRESULT TheoraDecodeOutputPin::BreakConnect() 
+{
 	CAutoLock locLock(m_pLock);
 	//Need a lock ??
 	ReleaseDelegate();
 	//debugLog<<"Break connect"<<endl;
 	return CTransformOutputPin::BreakConnect();
 }
-HRESULT TheoraDecodeOutputPin::CompleteConnect (IPin *inReceivePin) {
+
+HRESULT TheoraDecodeOutputPin::CompleteConnect (IPin *inReceivePin) 
+{
 	CAutoLock locLock(m_pLock);
 	//debugLog<<"Complete connect"<<endl;
 	IMediaSeeking* locSeeker = NULL;
 
 	m_pFilter->GetPin(0)->QueryInterface(IID_IMediaSeeking, (void**)&locSeeker);
 
-	if (locSeeker == NULL) {
+	if (locSeeker == NULL) 
+    {
 		//debugLog<<"Seeker was NULL"<<endl;
 	}
+
 	SetDelegate(locSeeker);
-	return CTransformOutputPin::CompleteConnect(inReceivePin);
+	
+    return CTransformOutputPin::CompleteConnect(inReceivePin);
 }
 
-STDMETHODIMP TheoraDecodeOutputPin::Notify(IBaseFilter* inMessageSource, Quality inQuality) {
+STDMETHODIMP TheoraDecodeOutputPin::Notify(IBaseFilter* inMessageSource, Quality inQuality) 
+{
 	return E_NOTIMPL;
 }

Modified: trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeOutputPin.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeOutputPin.h	2008-11-20 02:45:56 UTC (rev 15527)
+++ trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeOutputPin.h	2008-11-23 01:47:26 UTC (rev 15528)
@@ -33,14 +33,10 @@
 #include "Theoradecoderdllstuff.h"
 #include "BasicSeekPassThrough.h"
 
-#include <fstream>
-using namespace std;
-class TheoraDecodeOutputPin 
-	:	public CTransformOutputPin
-	,	public BasicSeekPassThrough
+class TheoraDecodeOutputPin : public CTransformOutputPin, public BasicSeekPassThrough
 {
 public:
-	//COnstructors
+	
 	TheoraDecodeOutputPin(CTransformFilter* inParentFilter, HRESULT* outHR);
 	virtual ~TheoraDecodeOutputPin();
 
@@ -55,7 +51,6 @@
 	//Quality control
 	virtual STDMETHODIMP Notify(IBaseFilter* inMessageSource, Quality inQuality);
 
-	//virtual HRESULT Deliver(IMediaSample* inSample)	{	return m_pInputPin->Receive(inSample);	}
 
-	//fstream debugLog;
+	//std::fstream debugLog;
 };

Modified: trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/stdafx.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/stdafx.cpp	2008-11-20 02:45:56 UTC (rev 15527)
+++ trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/stdafx.cpp	2008-11-23 01:47:26 UTC (rev 15528)
@@ -34,6 +34,3 @@
 // stdafx.obj will contain the pre-compiled type information
 
 #include "stdafx.h"
-
-// TODO: reference any additional headers you need in STDAFX.H
-// and not in this file

Modified: trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/stdafx.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/stdafx.h	2008-11-20 02:45:56 UTC (rev 15527)
+++ trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/stdafx.h	2008-11-23 01:47:26 UTC (rev 15528)
@@ -40,4 +40,6 @@
 // Windows Header Files:
 #include <windows.h>
 
-
+#include <fstream>
+#include <vector>
+#include <string>
\ No newline at end of file

Modified: trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/theoradecoderdllstuff.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/theoradecoderdllstuff.h	2008-11-20 02:45:56 UTC (rev 15527)
+++ trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/theoradecoderdllstuff.h	2008-11-23 01:47:26 UTC (rev 15528)
@@ -30,126 +30,42 @@
 //===========================================================================
 
 #pragma once
+
 #include <streams.h>
 #include <pullpin.h>
 #include <initguid.h>
 #include <dvdmedia.h>
 
-//#ifdef DSFABSTRACTOGGVIDEODECODER_EXPORTS
-//#pragma message("----> Exporting from Abstract Video Library...")
-//#define ABS_VIDEO_DEC_API __declspec(dllexport)
-//#else
-//#pragma message("<---- Importing from Abstract Video Library...")
-//#define ABS_VIDEO_DEC_API __declspec(dllimport)
-//#endif
-
 #ifdef LIBOOOGG_EXPORTS
 #define LIBOOOGG_API __declspec(dllexport)
 #else
 #define LIBOOOGG_API __declspec(dllimport)
 #endif
 
-// {05187161-5C36-4324-A734-22BF37509F2D}
-//DEFINE_GUID(CLSID_TheoraDecodeFilter, 
-//0x5187161, 0x5c36, 0x4324, 0xa7, 0x34, 0x22, 0xbf, 0x37, 0x50, 0x9f, 0x2d);
+// TheoraDecodeFilter {05187161-5C36-4324-A734-22BF37509F2D}
 static const GUID  CLSID_TheoraDecodeFilter =
 { 0x5187161, 0x5c36, 0x4324, { 0xa7, 0x34, 0x22, 0xbf, 0x37, 0x50, 0x9f, 0x2d } };
 
-// {60891713-C24F-4767-B6C9-6CA05B3338FC}
-//DEFINE_GUID(MEDIATYPE_OggPacketStream, 
-//0x60891713, 0xc24f, 0x4767, 0xb6, 0xc9, 0x6c, 0xa0, 0x5b, 0x33, 0x38, 0xfc);
+// OggPacketStream {60891713-C24F-4767-B6C9-6CA05B3338FC}
 static const GUID MEDIATYPE_OggPacketStream =
 { 0x60891713, 0xc24f, 0x4767, { 0xb6, 0xc9, 0x6c, 0xa0, 0x5b, 0x33, 0x38, 0xfc } };
 
-// {95388704-162C-42a9-8149-C3577C12AAF9}
-//DEFINE_GUID(FORMAT_OggIdentHeader, 
-//0x95388704, 0x162c, 0x42a9, 0x81, 0x49, 0xc3, 0x57, 0x7c, 0x12, 0xaa, 0xf9);
+// OggIdentHeader {95388704-162C-42a9-8149-C3577C12AAF9}
 static const GUID FORMAT_OggIdentHeader =
 { 0x95388704, 0x162c, 0x42a9, { 0x81, 0x49, 0xc3, 0x57, 0x7c, 0x12, 0xaa, 0xf9 } };
 
-// {43F0F818-10B0-4c86-B9F1-F6B6E2D33462}
-//DEFINE_GUID(IID_IOggDecoder, 
-//0x43f0f818, 0x10b0, 0x4c86, 0xb9, 0xf1, 0xf6, 0xb6, 0xe2, 0xd3, 0x34, 0x62);
+// IOggDecoder {43F0F818-10B0-4c86-B9F1-F6B6E2D33462}
 static const GUID IID_IOggDecoder =
 { 0x43f0f818, 0x10b0, 0x4c86, { 0xb9, 0xf1, 0xf6, 0xb6, 0xe2, 0xd3, 0x34, 0x62 } };
 
-
-// {83D7F506-53ED-4f15-B6D8-7D8E9E72A918}
-//DEFINE_GUID(IID_IOggOutputPin, 
-//0x83d7f506, 0x53ed, 0x4f15, 0xb6, 0xd8, 0x7d, 0x8e, 0x9e, 0x72, 0xa9, 0x18);
+// IOggOutputPin {83D7F506-53ED-4f15-B6D8-7D8E9E72A918}
 static const GUID IID_IOggOutputPin =
 { 0x83d7f506, 0x53ed, 0x4f15, { 0xb6, 0xd8, 0x7d, 0x8e, 0x9e, 0x72, 0xa9, 0x18 } };
 
-
-//// {D124B2B1-8968-4ae8-B288-FE16EA34B0CE}
-//DEFINE_GUID(MEDIASUBTYPE_Theora, 
-//0xd124b2b1, 0x8968, 0x4ae8, 0xb2, 0x88, 0xfe, 0x16, 0xea, 0x34, 0xb0, 0xce);
-//
-//// {A99F116C-DFFA-412c-95DE-725F99874826}
-//DEFINE_GUID(FORMAT_Theora, 
-//0xa99f116c, 0xdffa, 0x412c, 0x95, 0xde, 0x72, 0x5f, 0x99, 0x87, 0x48, 0x26);
-
-
-//// {60891713-C24F-4767-B6C9-6CA05B3338FC}
-//DEFINE_GUID(MEDIATYPE_OggPacketStream, 
-//0x60891713, 0xc24f, 0x4767, 0xb6, 0xc9, 0x6c, 0xa0, 0x5b, 0x33, 0x38, 0xfc);
-//
-//// {95388704-162C-42a9-8149-C3577C12AAF9}
-//DEFINE_GUID(FORMAT_OggIdentHeader, 
-//0x95388704, 0x162c, 0x42a9, 0x81, 0x49, 0xc3, 0x57, 0x7c, 0x12, 0xaa, 0xf9);
-//
-//// {43F0F818-10B0-4c86-B9F1-F6B6E2D33462}
-//DEFINE_GUID(IID_IOggDecoder, 
-//0x43f0f818, 0x10b0, 0x4c86, 0xb9, 0xf1, 0xf6, 0xb6, 0xe2, 0xd3, 0x34, 0x62);
-//
-//// {83D7F506-53ED-4f15-B6D8-7D8E9E72A918}
-//DEFINE_GUID(IID_IOggOutputPin, 
-//0x83d7f506, 0x53ed, 0x4f15, 0xb6, 0xd8, 0x7d, 0x8e, 0x9e, 0x72, 0xa9, 0x18);
-
-
-////MTS::: Need multiple types
-//const REGPINTYPES TheoraDecodeOutputTypes = {
-//    &MEDIATYPE_Video,
-//	&MEDIASUBTYPE_YV12
-//};
-//
-//const REGPINTYPES TheoraDecodeInputTypes = {
-//	&MEDIATYPE_OggPacketStream,
-//	&MEDIASUBTYPE_None
-//};
-//const REGFILTERPINS TheoraDecodePinReg[] = {
-//	{
-//    L"Theora Input",						//Name (obsoleted)
-//	FALSE,								//Renders from this pin ?? Not sure about this.
-//	FALSE,								//Not an output pin
-//	FALSE,								//Cannot have zero instances of this pin
-//	FALSE,								//Cannot have more than one instance of this pin
-//	NULL,								//Connects to filter (obsoleted)
-//	NULL,								//Connects to pin (obsoleted)
-//	1,									//upport two media type
-//	&TheoraDecodeInputTypes				//Pointer to media type (Video/Theora)
-//	} ,
-//
-//	//MTS::: Needs better name
-//	{
-//	L"YV12 Output",						//Name (obsoleted)
-//	FALSE,								//Renders from this pin ?? Not sure about this.
-//	TRUE,								//Is an output pin
-//	FALSE,								//Cannot have zero instances of this pin
-//	FALSE,								//Cannot have more than one instance of this pin
-//	NULL,								//Connects to filter (obsoleted)
-//	NULL,								//Connects to pin (obsoleted)
-//	1,									//Only support one media type
-//	&TheoraDecodeOutputTypes					//Pointer to media type (YV12)
-//
-//	}
-//};
-
-
 #ifndef WINCE
 
-
-const REGPINTYPES TheoraDecodeOutputTypes[] = {
+const REGPINTYPES TheoraDecodeOutputTypes[] = 
+{
 	{
 		&MEDIATYPE_Video,
 		&MEDIASUBTYPE_YV12
@@ -160,13 +76,16 @@
 	}
 };
 
-const REGPINTYPES TheoraDecodeInputTypes = {
+const REGPINTYPES TheoraDecodeInputTypes = 
+{
 	&MEDIATYPE_OggPacketStream,
 	&MEDIASUBTYPE_None
 };
-const REGFILTERPINS TheoraDecodePinReg[] = {
+
+const REGFILTERPINS TheoraDecodePinReg[] = 
+{
 	{
-    L"Theora Input",						//Name (obsoleted)
+    L"Theora Input",					//Name (obsoleted)
 	FALSE,								//Renders from this pin ?? Not sure about this.
 	FALSE,								//Not an output pin
 	FALSE,								//Cannot have zero instances of this pin
@@ -177,9 +96,8 @@
 	&TheoraDecodeInputTypes				//Pointer to media type (Video/Theora)
 	} ,
 
-	//MTS::: Needs better name
 	{
-	L"YV12 Output",						//Name (obsoleted)
+	L"Theora Output",					//Name (obsoleted)
 	FALSE,								//Renders from this pin ?? Not sure about this.
 	TRUE,								//Is an output pin
 	FALSE,								//Cannot have zero instances of this pin
@@ -187,22 +105,20 @@
 	NULL,								//Connects to filter (obsoleted)
 	NULL,								//Connects to pin (obsoleted)
 	2,									//Only support one media type
-	TheoraDecodeOutputTypes					//Pointer to media types (YV12)
-
+	TheoraDecodeOutputTypes				//Pointer to media types (YV12)
 	}
 };
 
-const REGFILTER2 TheoraDecodeFilterReg = {
+const REGFILTER2 TheoraDecodeFilterReg = 
+{
 		1,
 		MERIT_NORMAL,
 		2,
-        TheoraDecodePinReg
-		
+        TheoraDecodePinReg		
 };
 	   
 #else
 
-
 const AMOVIESETUP_MEDIATYPE TheoraDecodeOutputTypes[] = {
 	{
 		&MEDIATYPE_Video,
@@ -223,13 +139,16 @@
 	}
 };
 
-const AMOVIESETUP_MEDIATYPE TheoraDecodeInputTypes = {
+const AMOVIESETUP_MEDIATYPE TheoraDecodeInputTypes = 
+{
 	&MEDIATYPE_OggPacketStream,
 	&MEDIASUBTYPE_None
 };
-const AMOVIESETUP_PIN TheoraDecodePinReg[] = {
+
+const AMOVIESETUP_PIN TheoraDecodePinReg[] = 
+{
 	{
-    L"Theora Input",						//Name (obsoleted)
+    L"Theora Input",					//Name (obsoleted)
 	FALSE,								//Renders from this pin ?? Not sure about this.
 	FALSE,								//Not an output pin
 	FALSE,								//Cannot have zero instances of this pin
@@ -240,14 +159,13 @@
 	&TheoraDecodeInputTypes				//Pointer to media type (Video/Theora)
 	} ,
 
-	//MTS::: Needs better name
 	{
-	L"YV12 Output",						//Name (obsoleted)
+	L"Theora Output",					//Name (obsoleted)
 	FALSE,								//Renders from this pin ?? Not sure about this.
 	TRUE,								//Is an output pin
 	FALSE,								//Cannot have zero instances of this pin
 	FALSE,								//Cannot have more than one instance of this pin
-	&GUID_NULL,								//Connects to filter (obsoleted)
+	&GUID_NULL,							//Connects to filter (obsoleted)
 	NULL,								//Connects to pin (obsoleted)
 	2,									//Supports two types
 	TheoraDecodeOutputTypes					//Pointer to media type (YV12)
@@ -255,17 +173,19 @@
 	}
 };
 
-const AMOVIESETUP_FILTER TheoraDecodeFilterReg = {
+const AMOVIESETUP_FILTER TheoraDecodeFilterReg = 
+{
 		&CLSID_TheoraDecodeFilter,
 		L"Theora Decode Fiter",
 		MERIT_NORMAL,
 		2,
-        TheoraDecodePinReg
-		
+        TheoraDecodePinReg		
 };
 
 #endif
-struct sTheoraFormatBlock {
+
+struct sTheoraFormatBlock 
+{
 	unsigned long theoraVersion;
 	unsigned long outerFrameWidth;
 	unsigned long outerFrameHeight;
@@ -281,4 +201,4 @@
 	unsigned char xOffset;
 	unsigned char yOffset;
 	unsigned char colourSpace;
-};
\ No newline at end of file
+};



More information about the commits mailing list