[xiph-commits] r8675 - in trunk/oggdsf/src/lib: codecs/cmml/libCMMLTagsDotNET codecs/theora/filters/dsfTheoraDecoder codecs/theora/filters/dsfTheoraEncoder codecs/theora/libs/libOOTheora core/directshow/dsfAnxDemux core/directshow/dsfAnxMux core/directshow/dsfOggDemux player/libDSPlayDotNET

illiminable at motherfish-iii.xiph.org illiminable at motherfish-iii.xiph.org
Sat Jan 8 06:22:26 PST 2005


Author: illiminable
Date: 2005-01-08 06:22:26 -0800 (Sat, 08 Jan 2005)
New Revision: 8675

Modified:
   trunk/oggdsf/src/lib/codecs/cmml/libCMMLTagsDotNET/libCMMLTagsDotNET.vcproj
   trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.cpp
   trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/TheoraEncodeInputPin.cpp
   trunk/oggdsf/src/lib/codecs/theora/libs/libOOTheora/TheoraDecoder.cpp
   trunk/oggdsf/src/lib/codecs/theora/libs/libOOTheora/TheoraEncoder.cpp
   trunk/oggdsf/src/lib/codecs/theora/libs/libOOTheora/TheoraEncoder.h
   trunk/oggdsf/src/lib/core/directshow/dsfAnxDemux/dsfAnxDemux.vcproj
   trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/dsfAnxMux.vcproj
   trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/stdafx.h
   trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPFileSource.cpp
   trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/RegWrap.cpp
   trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/oggdllstuff.h
   trunk/oggdsf/src/lib/player/libDSPlayDotNET/DSPlay.cpp
   trunk/oggdsf/src/lib/player/libDSPlayDotNET/DSPlay.h
Log:
* Killed a leak in the theora encoder.
* Added a repaint function to dsplay
* Killed a few warnings
* Removed an ignore warning pragma which actually generated even more warnings for some reason.
* Token tidy up and documentation in OOTheora.

Modified: trunk/oggdsf/src/lib/codecs/cmml/libCMMLTagsDotNET/libCMMLTagsDotNET.vcproj
===================================================================
--- trunk/oggdsf/src/lib/codecs/cmml/libCMMLTagsDotNET/libCMMLTagsDotNET.vcproj	2005-01-08 12:24:16 UTC (rev 8674)
+++ trunk/oggdsf/src/lib/codecs/cmml/libCMMLTagsDotNET/libCMMLTagsDotNET.vcproj	2005-01-08 14:22:26 UTC (rev 8675)
@@ -20,7 +20,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="..\..\..\helper\libiWrapper;.."
+				AdditionalIncludeDirectories="..\..\..\helper\libiWrapper;..;..\..\..\helper"
 				AdditionalUsingDirectories="..\..\..\helper\libiWrapper\Debug"
 				PreprocessorDefinitions="WIN32;_DEBUG"
 				MinimalRebuild="FALSE"
@@ -74,7 +74,7 @@
 				EnableIntrinsicFunctions="TRUE"
 				FavorSizeOrSpeed="1"
 				OptimizeForProcessor="3"
-				AdditionalIncludeDirectories="..\..\..\helper\libiWrapper;.."
+				AdditionalIncludeDirectories="..\..\..\helper\libiWrapper;..;..\..\..\helper"
 				AdditionalUsingDirectories="..\..\..\helper\libiWrapper\Release"
 				PreprocessorDefinitions="WIN32;NDEBUG"
 				MinimalRebuild="FALSE"
@@ -127,7 +127,7 @@
 				EnableIntrinsicFunctions="TRUE"
 				FavorSizeOrSpeed="1"
 				OptimizeForProcessor="3"
-				AdditionalIncludeDirectories="..\..\..\helper\libiWrapper;.."
+				AdditionalIncludeDirectories="..\..\..\helper\libiWrapper;..;..\..\..\helper"
 				AdditionalUsingDirectories="..\..\..\helper\libiWrapper\Release"
 				PreprocessorDefinitions="WIN32;NDEBUG"
 				MinimalRebuild="FALSE"
@@ -181,7 +181,7 @@
 				EnableIntrinsicFunctions="TRUE"
 				FavorSizeOrSpeed="1"
 				OptimizeForProcessor="3"
-				AdditionalIncludeDirectories="..\..\..\helper\libiWrapper;.."
+				AdditionalIncludeDirectories="..\..\..\helper\libiWrapper;..;..\..\..\helper"
 				AdditionalUsingDirectories="..\..\..\helper\libiWrapper\Release"
 				PreprocessorDefinitions="WIN32;NDEBUG"
 				MinimalRebuild="FALSE"

Modified: trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.cpp	2005-01-08 12:24:16 UTC (rev 8674)
+++ trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraDecoder/TheoraDecodeFilter.cpp	2005-01-08 14:22:26 UTC (rev 8675)
@@ -334,7 +334,7 @@
 	locHR = inInputSample->GetPointer(&locBuff);
 
 	//TODO::: This should be after the return value check !!
-	BYTE* locNewBuff = new unsigned char[inInputSample->GetActualDataLength()];
+	BYTE* locNewBuff = new unsigned char[inInputSample->GetActualDataLength()];		//This gets put into a packet.
 	memcpy((void*)locNewBuff, (const void*)locBuff, inInputSample->GetActualDataLength());
 
 
@@ -386,7 +386,7 @@
 		StampedOggPacket* locPacket = new StampedOggPacket(locNewBuff, inInputSample->GetActualDataLength(), false, false, locStart, locEnd, StampedOggPacket::OGG_END_ONLY);
 
 		bool locIsKeyFrame = mTheoraDecoder->isKeyFrame(locPacket);
-		yuv_buffer* locYUV = mTheoraDecoder->decodeTheora(locPacket);
+		yuv_buffer* locYUV = mTheoraDecoder->decodeTheora(locPacket);		//This accept the packet and deletes it
 		if (locYUV != NULL) {
 			if (TheoraDecoded(locYUV, outOutputSample, locIsKeyFrame) != 0) {
 				//debugLog<<"Decoded *** FALSE ***"<<endl;

Modified: trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/TheoraEncodeInputPin.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/TheoraEncodeInputPin.cpp	2005-01-08 12:24:16 UTC (rev 8674)
+++ trunk/oggdsf/src/lib/codecs/theora/filters/dsfTheoraEncoder/TheoraEncodeInputPin.cpp	2005-01-08 14:22:26 UTC (rev 8675)
@@ -1169,12 +1169,16 @@
 
 		for (int i = 0; i < 3; i++) {
 			locHR = deliverData(0,0,locHeaders[i]->packetData(), locHeaders[i]->packetSize());
+			delete locHeaders[i];
 			if (locHR != S_OK) {
 				return locHR;
 			}
 		}
 	}
 
+
+	//This big if block merely takes the buffer and copies it into the yuv_buffer structure which
+	// is used below to encode.
 	if (mPinInputType.subtype == MEDIASUBTYPE_YUY2) {
 		//debugLog<<"About to encode YUY2 to YV12"<<endl;
 		encodeYUY2ToYV12(inBuf, inNumBytes);
@@ -1222,8 +1226,12 @@
 	locFrameEnd		= mUptoFrame 
 					= locPacket->endTime();
 	//debugLog<<"Delivering..."<<endl;
-	return deliverData(locFrameStart, locFrameEnd, locPacket->packetData(), locPacket->packetSize());
 
+	//We still own the packet after this, we have to delete it.
+	locHR = deliverData(locFrameStart, locFrameEnd, locPacket->packetData(), locPacket->packetSize());
+	delete locPacket;
+	return locHR;
+
 }
 bool TheoraEncodeInputPin::ConstructCodec() {
 

Modified: trunk/oggdsf/src/lib/codecs/theora/libs/libOOTheora/TheoraDecoder.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/libs/libOOTheora/TheoraDecoder.cpp	2005-01-08 12:24:16 UTC (rev 8674)
+++ trunk/oggdsf/src/lib/codecs/theora/libs/libOOTheora/TheoraDecoder.cpp	2005-01-08 14:22:26 UTC (rev 8675)
@@ -33,9 +33,9 @@
 #include "theoradecoder.h"
 
 TheoraDecoder::TheoraDecoder(void)
-: mFirstPacket(true)
-, mFirstHeader(true)
-, mPacketCount(0)
+	: mFirstPacket(true)
+	, mFirstHeader(true)
+	, mPacketCount(0)
 {
 }
 
@@ -43,15 +43,16 @@
 {
 }
 
-bool TheoraDecoder::initCodec() {
+bool TheoraDecoder::initCodec() 
+{
 	theora_comment_init(&mTheoraComment);
 	theora_info_init(&mTheoraInfo);
 	
 	return true;
  }
 
-//This is temporary... get it out of here after testing
 
+
 yuv_buffer* TheoraDecoder::decodeTheora(StampedOggPacket* inPacket) {		//Accepts packet and deletes it.
 
 	if (mPacketCount < 3) {

Modified: trunk/oggdsf/src/lib/codecs/theora/libs/libOOTheora/TheoraEncoder.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/libs/libOOTheora/TheoraEncoder.cpp	2005-01-08 12:24:16 UTC (rev 8674)
+++ trunk/oggdsf/src/lib/codecs/theora/libs/libOOTheora/TheoraEncoder.cpp	2005-01-08 14:22:26 UTC (rev 8675)
@@ -40,8 +40,10 @@
 {
 }
 
-//Not happy about exposing this here... should abstract it later.
-StampedOggPacket** TheoraEncoder::initCodec(theora_info inTheoraInfo) {
+/** Returns three header packets which you must delete when done. Give it a theora_info.
+ */
+StampedOggPacket** TheoraEncoder::initCodec(theora_info inTheoraInfo)
+{
 	mTheoraInfo = inTheoraInfo;
 	theora_encode_init(&mTheoraState,&mTheoraInfo);
 
@@ -61,29 +63,16 @@
 	
 	locHeaders[2] = oldToNewPacket(&locOldPacket);
 
+	//This should really have some error checking ! And trash packets if faild.
 	return locHeaders;
 }
 
 
-
-//ogg_packet* TheoraDecoder::simulateOldOggPacket(StampedOggPacket* inPacket) {
-//	const unsigned char NOT_USED = 0;
-//	ogg_packet* locOldPacket = new ogg_packet;
-//	if (mFirstHeader) {
-//		locOldPacket->b_o_s = 1;
-//		mFirstHeader = false;
-//	} else {
-//		locOldPacket->b_o_s = NOT_USED;
-//	}
-//	locOldPacket->e_o_s = NOT_USED;
-//	locOldPacket->bytes = inPacket->packetSize();
-//	locOldPacket->granulepos = inPacket->endTime();
-//	locOldPacket->packet = inPacket->packetData();
-//	locOldPacket->packetno = NOT_USED;
-//	return locOldPacket;
-//}
-
-StampedOggPacket* TheoraEncoder::oldToNewPacket(ogg_packet* inOldPacket) {
+/** Converts our StampedOggPacket into a packet that the theora library will accept.
+	You still own the old packet. But you must delete the returned packet.
+ */
+StampedOggPacket* TheoraEncoder::oldToNewPacket(ogg_packet* inOldPacket)
+{
 	const unsigned char NOT_USED = 0;
 
 	//Need to clone the packet data
@@ -94,11 +83,16 @@
 	return locOggPacket;
 
 }
-StampedOggPacket* TheoraEncoder::encodeTheora(yuv_buffer* inYUVBuffer) {
+
+/** Returns a packet you must delete, otherwise returns NULL if it fails. Pass it a yuv frame buffer which you own.
+ */
+StampedOggPacket* TheoraEncoder::encodeTheora(yuv_buffer* inYUVBuffer) 
+{
 	const int NOT_LAST_FRAME = 0;
 	//const int IS_LAST_FRAME = 1;
 	int retVal = 0;
 
+
 	ogg_packet locOldOggPacket;
 	retVal = theora_encode_YUVin(&mTheoraState, inYUVBuffer);
 	
@@ -107,7 +101,9 @@
 		return NULL;
 	}
 
+	//We don't delete the buffer we get back in the old ogg packet, it's owned by libtheora
 	retVal = theora_encode_packetout(&mTheoraState, NOT_LAST_FRAME, &locOldOggPacket);
+	
 	if (retVal != 1) {
 		//Weird return convention.
 		return NULL;

Modified: trunk/oggdsf/src/lib/codecs/theora/libs/libOOTheora/TheoraEncoder.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/libs/libOOTheora/TheoraEncoder.h	2005-01-08 12:24:16 UTC (rev 8674)
+++ trunk/oggdsf/src/lib/codecs/theora/libs/libOOTheora/TheoraEncoder.h	2005-01-08 14:22:26 UTC (rev 8675)
@@ -43,28 +43,29 @@
 	~TheoraEncoder(void);
 
 
+	/// Initialise the code, We get back three packets we must delete.
+	StampedOggPacket** initCodec(theora_info inTheoraInfo);
 
-	StampedOggPacket** initCodec(theora_info inTheoraInfo);
-	//bool resetPackCount();
-	//bool clearAll();
+	/// Encode the frame buffer. We get back a packet to delete or NULL.
 	StampedOggPacket* encodeTheora(yuv_buffer* inYUVBuffer);
 	
+	
 
+	//bool resetPackCount();
+	//bool clearAll();
+protected:
+
+	/// Converts an xiph like ogg packet into a StampedOggPacket.
 	StampedOggPacket* oldToNewPacket(ogg_packet* inPacket);
+	//bool encodeHeader();
 
-
-	
-	//unsigned char* convertYUV(yuv_buffer* inBuffer, unsigned long inFormat);
-protected:
-	bool encodeHeader();
-
 	theora_info mTheoraInfo;
 	theora_comment mTheoraComment;
 	theora_state mTheoraState;
 	
-	yuv_buffer mYUVBuffer;		//Needed ??
+	//yuv_buffer mYUVBuffer;		//Needed ??
 
-	StampedOggPacket* mPartialPacket; //TEMP !!
+	//StampedOggPacket* mPartialPacket; //TEMP !!
 
 	unsigned long mHeadersSeen;
 	bool mFirstPacket;

Modified: trunk/oggdsf/src/lib/core/directshow/dsfAnxDemux/dsfAnxDemux.vcproj
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfAnxDemux/dsfAnxDemux.vcproj	2005-01-08 12:24:16 UTC (rev 8674)
+++ trunk/oggdsf/src/lib/core/directshow/dsfAnxDemux/dsfAnxDemux.vcproj	2005-01-08 14:22:26 UTC (rev 8675)
@@ -28,7 +28,8 @@
 				WarningLevel="4"
 				Detect64BitPortabilityProblems="TRUE"
 				DebugInformationFormat="4"
-				CallingConvention="2"/>
+				CallingConvention="2"
+				DisableSpecificWarnings="4275"/>
 			<Tool
 				Name="VCCustomBuildTool"/>
 			<Tool
@@ -89,7 +90,8 @@
 				WarningLevel="4"
 				Detect64BitPortabilityProblems="TRUE"
 				DebugInformationFormat="3"
-				CallingConvention="2"/>
+				CallingConvention="2"
+				DisableSpecificWarnings="4275"/>
 			<Tool
 				Name="VCCustomBuildTool"/>
 			<Tool
@@ -153,7 +155,8 @@
 				WarningLevel="4"
 				Detect64BitPortabilityProblems="TRUE"
 				DebugInformationFormat="3"
-				CallingConvention="2"/>
+				CallingConvention="2"
+				DisableSpecificWarnings="4275"/>
 			<Tool
 				Name="VCCustomBuildTool"/>
 			<Tool
@@ -217,7 +220,8 @@
 				WarningLevel="4"
 				Detect64BitPortabilityProblems="TRUE"
 				DebugInformationFormat="3"
-				CallingConvention="2"/>
+				CallingConvention="2"
+				DisableSpecificWarnings="4275"/>
 			<Tool
 				Name="VCCustomBuildTool"/>
 			<Tool

Modified: trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/dsfAnxMux.vcproj
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/dsfAnxMux.vcproj	2005-01-08 12:24:16 UTC (rev 8674)
+++ trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/dsfAnxMux.vcproj	2005-01-08 14:22:26 UTC (rev 8675)
@@ -28,7 +28,8 @@
 				WarningLevel="4"
 				Detect64BitPortabilityProblems="TRUE"
 				DebugInformationFormat="4"
-				CallingConvention="2"/>
+				CallingConvention="2"
+				DisableSpecificWarnings="4275"/>
 			<Tool
 				Name="VCCustomBuildTool"/>
 			<Tool
@@ -79,7 +80,8 @@
 				WarningLevel="3"
 				Detect64BitPortabilityProblems="TRUE"
 				DebugInformationFormat="3"
-				CallingConvention="2"/>
+				CallingConvention="2"
+				DisableSpecificWarnings="4275"/>
 			<Tool
 				Name="VCCustomBuildTool"/>
 			<Tool

Modified: trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/stdafx.h
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/stdafx.h	2005-01-08 12:24:16 UTC (rev 8674)
+++ trunk/oggdsf/src/lib/core/directshow/dsfAnxMux/stdafx.h	2005-01-08 14:22:26 UTC (rev 8675)
@@ -43,9 +43,15 @@
 // Windows Header Files:
 #include <windows.h>
 
+//Ignore the wanrings in the directshow base classses
+//#pragma warning( push )
+//#pragma warning( disable : 4312 )
+
 #include <streams.h>
 #include <initguid.h>
 
+//#pragma warning( pop )
+
 // TODO: reference additional headers your program requires here
 #include <libOOOgg/libOOOgg.h>
 #include "anxmuxdllstuff.h"
\ No newline at end of file

Modified: trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPFileSource.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPFileSource.cpp	2005-01-08 12:24:16 UTC (rev 8674)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPFileSource.cpp	2005-01-08 14:22:26 UTC (rev 8675)
@@ -120,7 +120,7 @@
 
 				debugLog<<"Chunk reamining "<<mChunkRemains<<endl;
 				//The size of the crlf 's and the chunk size value
-				unsigned long locGuffSize = (locChunkSizeStr.size() + 2);
+				unsigned long locGuffSize = (unsigned long)(locChunkSizeStr.size() + 2);
 				locWorkingBuffPtr +=  locGuffSize;
 				locNumBytesLeft -= locGuffSize;
 			} else {

Modified: trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/RegWrap.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/RegWrap.cpp	2005-01-08 12:24:16 UTC (rev 8674)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/RegWrap.cpp	2005-01-08 14:22:26 UTC (rev 8675)
@@ -61,7 +61,7 @@
 								NULL,
 								REG_SZ,
 								(const BYTE*)inValue.c_str(),
-								inValue.length()+1);
+								(DWORD)(inValue.length()+1));
 
 	if (retVal != ERROR_SUCCESS) {
 		//debugLog<<"Set Value Failed"<<endl;

Modified: trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/oggdllstuff.h
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/oggdllstuff.h	2005-01-08 12:24:16 UTC (rev 8674)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/oggdllstuff.h	2005-01-08 14:22:26 UTC (rev 8675)
@@ -32,11 +32,21 @@
 
 #ifndef INC_OGGDLLSTUFF
 #define INC_OGGDLLSTUFF
+
+
+
+////Ignore the wanrings in the directshow base classses
+//#pragma warning( push )
+//#pragma warning( disable : 4312 )
+
+
 #include <streams.h>
 #include <pullpin.h>
 #include <initguid.h>
 
+//#pragma warning( pop )
 
+
 #ifdef LIBOOOGG_EXPORTS
 #define LIBOOOGG_API __declspec(dllexport)
 #else

Modified: trunk/oggdsf/src/lib/player/libDSPlayDotNET/DSPlay.cpp
===================================================================
--- trunk/oggdsf/src/lib/player/libDSPlayDotNET/DSPlay.cpp	2005-01-08 12:24:16 UTC (rev 8674)
+++ trunk/oggdsf/src/lib/player/libDSPlayDotNET/DSPlay.cpp	2005-01-08 14:22:26 UTC (rev 8675)
@@ -136,6 +136,19 @@
 	CoUninitialize();
 }
 
+
+void DSPlay::repaint() 
+{
+	if ((mVideoRenderType == VR_VMR9) && (mVMR9Window != NULL)) {
+		HDC locHDC = GetDC(NULL);
+
+		mVMR9Window->RepaintVideo((HWND)((int)mWindowHandle), locHDC);
+
+
+	}
+
+
+}
 void DSPlay::releaseInterfaces() {
 	*debugLog<<"Releasing interfaces"<<endl;
 	ULONG numRef = 0;

Modified: trunk/oggdsf/src/lib/player/libDSPlayDotNET/DSPlay.h
===================================================================
--- trunk/oggdsf/src/lib/player/libDSPlayDotNET/DSPlay.h	2005-01-08 12:24:16 UTC (rev 8674)
+++ trunk/oggdsf/src/lib/player/libDSPlayDotNET/DSPlay.h	2005-01-08 14:22:26 UTC (rev 8675)
@@ -82,6 +82,8 @@
 		Int64 seekStart();
 		Int64 queryPosition();
 
+		void repaint();
+
 		bool isLoaded();
 		Int64 fileSize();
 		Int64 fileDuration();



More information about the commits mailing list