[xiph-commits] r7622 - in trunk/oggdsf/src/lib: codecs/vorbis/filters/dsfVorbisDecoder core/directshow/dsfAbstractAudioDecoder core/directshow/dsfOggDemux

illiminable at motherfish-iii.xiph.org illiminable at motherfish-iii.xiph.org
Tue Aug 24 07:30:33 PDT 2004


Author: illiminable
Date: 2004-08-24 07:30:33 -0700 (Tue, 24 Aug 2004)
New Revision: 7622

Added:
   trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPSocket.cpp
   trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPSocket.h
Modified:
   trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeFilter.cpp
   trunk/oggdsf/src/lib/core/directshow/dsfAbstractAudioDecoder/AbstractAudioDecodeFilter.cpp
   trunk/oggdsf/src/lib/core/directshow/dsfAbstractAudioDecoder/AbstractAudioDecodeOutputPin.cpp
   trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPFileSource.cpp
   trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPFileSource.h
   trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggDemuxSourcePin.cpp
Log:
* Make consistent... starting to refactor network support.

Modified: trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeFilter.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeFilter.cpp	2004-08-24 00:13:47 UTC (rev 7621)
+++ trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeFilter.cpp	2004-08-24 14:30:33 UTC (rev 7622)
@@ -65,6 +65,7 @@
 
 bool VorbisDecodeFilter::ConstructPins() 
 {
+	DbgLog((LOG_TRACE,1,TEXT("Vorbis Constructor...")));
 	//Output pin must be done first because it's passed to the input pin.
 	mOutputPin = new VorbisDecodeOutputPin(this, m_pLock);
 
@@ -77,6 +78,7 @@
 
 VorbisDecodeFilter::~VorbisDecodeFilter(void)
 {
+	DbgLog((LOG_TRACE,1,TEXT("Vorbis Destructor...")));
 	//DestroyPins();
 	delete mVorbisFormatInfo;
 }

Modified: trunk/oggdsf/src/lib/core/directshow/dsfAbstractAudioDecoder/AbstractAudioDecodeFilter.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfAbstractAudioDecoder/AbstractAudioDecodeFilter.cpp	2004-08-24 00:13:47 UTC (rev 7621)
+++ trunk/oggdsf/src/lib/core/directshow/dsfAbstractAudioDecoder/AbstractAudioDecodeFilter.cpp	2004-08-24 14:30:33 UTC (rev 7622)
@@ -42,8 +42,9 @@
 
 AbstractAudioDecodeFilter::~AbstractAudioDecodeFilter(void)
 {
+	DestroyPins();
 	delete m_pLock;
-	DestroyPins();
+	
 }
 
 void AbstractAudioDecodeFilter::DestroyPins() {

Modified: trunk/oggdsf/src/lib/core/directshow/dsfAbstractAudioDecoder/AbstractAudioDecodeOutputPin.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfAbstractAudioDecoder/AbstractAudioDecodeOutputPin.cpp	2004-08-24 00:13:47 UTC (rev 7621)
+++ trunk/oggdsf/src/lib/core/directshow/dsfAbstractAudioDecoder/AbstractAudioDecodeOutputPin.cpp	2004-08-24 14:30:33 UTC (rev 7622)
@@ -44,6 +44,7 @@
 {	
 
 	delete mDataQueue;
+	mDataQueue = NULL;
 }
 
 STDMETHODIMP AbstractAudioDecodeOutputPin::NonDelegatingQueryInterface(REFIID riid, void **ppv) {
@@ -180,7 +181,8 @@
 }
 
 HRESULT AbstractAudioDecodeOutputPin::BreakConnect(void) {
+	HRESULT locHR = CBaseOutputPin::BreakConnect();
 	delete mDataQueue;
 	mDataQueue = NULL;
-	return CBaseOutputPin::BreakConnect();
+	return locHR;
 }
\ 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	2004-08-24 00:13:47 UTC (rev 7621)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPFileSource.cpp	2004-08-24 14:30:33 UTC (rev 7622)
@@ -39,7 +39,7 @@
 	,	mBufferLock(NULL)
 {
 	mBufferLock = new CCritSec;
-	//debugLog.open("G:\\httpdebug.log", ios_base::out);
+	debugLog.open("G:\\logs\\httpdebug.log", ios_base::out);
 	//fileDump.open("G:\\filedump.ogg", ios_base::out|ios_base::binary);
 	WORD locWinsockVersion = MAKEWORD(1,1);
 	WSADATA locWinsockData;
@@ -48,12 +48,12 @@
 	locRet = WSAStartup(locWinsockVersion, &locWinsockData);
 	if ((locRet != 0) || (locWinsockData.wVersion != locWinsockVersion)) {
 		//Failed to setup.
-		//debugLog<<"Failed to start winsock V "<<locWinsockData.wVersion<<endl;
+		debugLog<<"Failed to start winsock V "<<locWinsockData.wVersion<<endl;
 		WSACleanup();
 		throw 0;
 	}
 
-	//debugLog<<"Winsock started"<<endl;
+	debugLog<<"Winsock started"<<endl;
 
 
 
@@ -61,15 +61,15 @@
 
 HTTPFileSource::~HTTPFileSource(void)
 {
-	//debugLog<<"Winsock ended"<<endl;
-	//debugLog.close();
+	debugLog<<"Winsock ended"<<endl;
+	debugLog.close();
 	//fileDump.close();
 	delete mBufferLock;
 	WSACleanup();
 }
 
 void HTTPFileSource::DataProcessLoop() {
-	//debugLog<<"DataProcessLoop: "<<endl;
+	debugLog<<"DataProcessLoop: "<<endl;
 	int locNumRead = 0;
 	char* locBuff = NULL;
 	const unsigned long RECV_BUFF_SIZE = 1024;
@@ -79,24 +79,24 @@
 		locNumRead = recv(mSocket, locBuff, RECV_BUFF_SIZE, 0);
 		if (locNumRead == SOCKET_ERROR) {
 			int locErr = WSAGetLastError();
-			//debugLog<<"Socket error receiving - Err No = "<<locErr<<endl;
+			debugLog<<"Socket error receiving - Err No = "<<locErr<<endl;
 			mWasError = true;
 			break;
 		}
 
 		if (locNumRead == 0) {
-			//debugLog<<"Read last bytes..."<<endl;
+			debugLog<<"Read last bytes..."<<endl;
 			mIsEOF = true;
 			break;
 		}
 
 		{//CRITICAL SECTION - PROTECTING BUFFER STATE
 			CAutoLock locLock(mBufferLock);
-			//debugLog <<"Num Read = "<<locNumRead<<endl;
+			debugLog <<"Num Read = "<<locNumRead<<endl;
 			if (mSeenResponse) {
 				//Add to buffer
 				mStreamBuffer.write(locBuff, locNumRead);
-				//debugLog<<"Added to buffer "<<locNumRead<<" bytes."<<endl;
+				debugLog<<"Added to buffer "<<locNumRead<<" bytes."<<endl;
 				//Dump to file
 				//fileDump.write(locBuff, locNumRead);
 			} else {
@@ -105,7 +105,7 @@
 				size_t locPos = locTemp.find("\r\n\r\n");
 				if (locPos != string::npos) {
 					//Found the break
-					//debugLog<<"locPos = "<<locPos<<endl;
+					debugLog<<"locPos = "<<locPos<<endl;
 					mSeenResponse = true;
 					mLastResponse = locTemp.substr(0, locPos);
 					char* locBuff2 = locBuff + locPos + 4;  //View only - don't delete.
@@ -117,15 +117,15 @@
 					
 
 					if(mStreamBuffer.fail()) {
-						//debugLog<<"Buffering failure..."<<endl;
+						debugLog<<"Buffering failure..."<<endl;
 					}
 
 					size_t locG, locP;
 					locG = mStreamBuffer.tellg();
 					locP = mStreamBuffer.tellp();
 
-					//debugLog << "Get : "<<locG<<" ---- Put : "<<locP<<endl;
-					//debugLog<<"Added to Buffer "<<locNumRead - (locPos+4)<<" bytes... first after response."<<endl;
+					debugLog << "Get : "<<locG<<" ---- Put : "<<locP<<endl;
+					debugLog<<"Added to Buffer "<<locNumRead - (locPos+4)<<" bytes... first after response."<<endl;
 				}
 			}
 		} //END CRITICAL SECTION
@@ -138,7 +138,7 @@
 
 bool HTTPFileSource::setupSocket(string inSourceLocation) {
 	
-	//debugLog<<"Setup Socket:"<<endl;
+	debugLog<<"Setup Socket:"<<endl;
 	IN_ADDR locAddress;  //iaHost
 	LPHOSTENT locHostData;;  //lpHost
 
@@ -156,14 +156,14 @@
 
 
 	if (locHostData == NULL) {
-		//debugLog<<"LocHostData is NULL"<<endl;
+		debugLog<<"LocHostData is NULL"<<endl;
 		//Failed
 		return false;
 	}
 
 	mSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
 	if (mSocket == INVALID_SOCKET) {
-		//debugLog<<"Socket Invalid"<<endl;
+		debugLog<<"Socket Invalid"<<endl;
 		//Failed
 		return false;
 	}
@@ -193,7 +193,7 @@
 	int locRetVal = 0;
 	locRetVal = connect(mSocket, (LPSOCKADDR)&locServiceSocketAddr, sizeof(SOCKADDR_IN));
 	if (locRetVal == SOCKET_ERROR) {
-		//debugLog<<"Failed to connect..."<<endl;
+		debugLog<<"Failed to connect..."<<endl;
 		closesocket(mSocket);
 		return false;
 	}
@@ -206,16 +206,16 @@
 string HTTPFileSource::assembleRequest(string inFilePath) {
 	string retRequest;
 	retRequest = "GET " + inFilePath+ " HTTP/1.1\n" + "Host: " + mServerName+ "\n\n";
-	//debugLog<<"Assembled Req : "<<endl<<retRequest<<endl;
+	debugLog<<"Assembled Req : "<<endl<<retRequest<<endl;
 	return retRequest;
 }
 
 bool HTTPFileSource::httpRequest(string inRequest) {
-	//debugLog<<"Http Request:"<<endl;
+	debugLog<<"Http Request:"<<endl;
 	int locRetVal = send(mSocket, inRequest.c_str(), (int)inRequest.length(), 0);
 
 	if (locRetVal == SOCKET_ERROR) {
-		//debugLog<<"Socket error on send"<<endl;
+		debugLog<<"Socket error on send"<<endl;
 		closesocket(mSocket);
 		return false;
 	}
@@ -249,12 +249,12 @@
 	//Close the socket down
 	//Open up a new one to the same place.
 	//Make the partial content request.
-	//debugLog<<"Seek ::::: EOROR NOT IMPL"<<endl;
+	debugLog<<"Seek ::::: EOROR NOT IMPL"<<endl;
 	return 0;
 }
 
 bool HTTPFileSource::splitURL(string inURL) {
-	//debugLog<<"Split url:"<<endl;
+	debugLog<<"Split url:"<<endl;
 	string locProtocol;
 	string locServerName;
 	string locPath;
@@ -301,12 +301,12 @@
 	} else {
 		mPort = 0;
 	}
-	//debugLog<<"Proto : "<<locProtocol<<endl<<"Server : "<<locServerName<<endl<<" Path : "<<mFileName<<" Port : "<<mPort<<endl;
+	debugLog<<"Proto : "<<locProtocol<<endl<<"Server : "<<locServerName<<endl<<" Path : "<<mFileName<<" Port : "<<mPort<<endl;
 	return true;
 
 }
 void HTTPFileSource::closeSocket() {
-	//debugLog<<"Close Socket:"<<endl;
+	debugLog<<"Close Socket:"<<endl;
 	closesocket(mSocket);
 }
 void HTTPFileSource::close() {
@@ -326,7 +326,7 @@
 	//
 	mSeenResponse = false;
 	mLastResponse = "";
-	//debugLog<<"Open:"<<endl;
+	debugLog<<"Open:"<<endl;
 	{ //CRITICAL SECTION - PROTECTING STREAM BUFFER
 		CAutoLock locLock(mBufferLock);
 		mStreamBuffer.flush();
@@ -334,21 +334,21 @@
 		mStreamBuffer.seekg(0, ios_base::beg);
 		mStreamBuffer.seekp(0, ios_base::beg);
 		if(mStreamBuffer.fail()) {
-			//debugLog<<"OPEN : Stream buffer already fucked"<<endl;
+			debugLog<<"OPEN : Stream buffer already fucked"<<endl;
 		}
 	} //END CRITICAL SECTION
 
 	bool locIsOK = setupSocket(inSourceLocation);
 
 	if (!locIsOK) {
-		//debugLog<<"Setup socket FAILED"<<endl;
+		debugLog<<"Setup socket FAILED"<<endl;
 		closeSocket();
 		return false;
 	}
 
-	//debugLog<<"Sending request..."<<endl;
+	debugLog<<"Sending request..."<<endl;
 	httpRequest(assembleRequest(mFileName));
-	//debugLog<<"Socket ok... starting thread"<<endl;
+	debugLog<<"Socket ok... starting thread"<<endl;
 	locIsOK = startThread();
 
 
@@ -365,12 +365,12 @@
 		unsigned long locSizeBuffed = mStreamBuffer.tellp() - mStreamBuffer.tellg();
 	
 
-		//debugLog<<"Amount Buffered = "<<locSizeBuffed<<endl;
+		debugLog<<"isEOF : Amount Buffered = "<<locSizeBuffed<<endl;
 		if ((locSizeBuffed == 0) && mIsEOF) {
-			//debugLog<<"It is EOF"<<endl;
+			debugLog<<"isEOF : It is EOF"<<endl;
 			return true;
 		} else {
-			//debugLog<<"It's not EOF"<<endl;
+			debugLog<<"isEOF : It's not EOF"<<endl;
 			return false;
 		}
 	} //END CRITICAL SECTION
@@ -383,9 +383,9 @@
 	{ //CRITICAL SECTION - PROTECTING STREAM BUFFER
 		CAutoLock locLock(mBufferLock);
 		
-		//debugLog<<"Read:"<<endl;
+		debugLog<<"Read:"<<endl;
 		if(isEOF() || mWasError) {
-			//debugLog<<"Can't read is error or eof"<<endl;
+			debugLog<<"read : Can't read is error or eof"<<endl;
 			return 0;
 		} else {
 			//debugLog<<"Reading from buffer"<<endl;
@@ -395,7 +395,7 @@
 				mStreamBuffer.clear();
 			}
 
-			//debugLog<<locNumRead<<" bytes read from buffer"<<endl;
+			debugLog<<locNumRead<<" bytes read from buffer"<<endl;
 			return locNumRead;
 		}
 	} //END CRITICAL SECTION

Modified: trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPFileSource.h
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPFileSource.h	2004-08-24 00:13:47 UTC (rev 7621)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPFileSource.h	2004-08-24 14:30:33 UTC (rev 7622)
@@ -34,7 +34,7 @@
 //#include <stdlib.h>
 #include <string>
 #include <sstream>
-//#include <fstream>
+#include <fstream>
 using namespace std;
 class OGG_DEMUX_API HTTPFileSource
 	:	public IFilterDataSource
@@ -78,7 +78,7 @@
 	SOCKET mSocket;
 	stringstream mStreamBuffer;
 
-	//fstream debugLog;
+	fstream debugLog;
 	//fstream fileDump;
 	bool mIsEOF;
 	bool mWasError;

Added: trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPSocket.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPSocket.cpp	2004-08-24 00:13:47 UTC (rev 7621)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPSocket.cpp	2004-08-24 14:30:33 UTC (rev 7622)
@@ -0,0 +1,10 @@
+#include "StdAfx.h"
+#include ".\httpsocket.h"
+
+HTTPSocket::HTTPSocket(void)
+{
+}
+
+HTTPSocket::~HTTPSocket(void)
+{
+}

Added: trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPSocket.h
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPSocket.h	2004-08-24 00:13:47 UTC (rev 7621)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/HTTPSocket.h	2004-08-24 14:30:33 UTC (rev 7622)
@@ -0,0 +1,8 @@
+#pragma once
+
+class HTTPSocket
+{
+public:
+	HTTPSocket(void);
+	~HTTPSocket(void);
+};

Modified: trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggDemuxSourcePin.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggDemuxSourcePin.cpp	2004-08-24 00:13:47 UTC (rev 7621)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggDemux/OggDemuxSourcePin.cpp	2004-08-24 14:30:33 UTC (rev 7622)
@@ -70,6 +70,7 @@
 	//debugLog.close();
 	
 	delete mDataQueue;
+	mDataQueue = NULL;
 }
 
 STDMETHODIMP OggDemuxSourcePin::NonDelegatingQueryInterface(REFIID riid, void **ppv)



More information about the commits mailing list