[xiph-commits] r8097 - trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource

illiminable at motherfish-iii.xiph.org illiminable at motherfish-iii.xiph.org
Mon Oct 25 09:27:16 PDT 2004


Author: illiminable
Date: 2004-10-25 09:27:16 -0700 (Mon, 25 Oct 2004)
New Revision: 8097

Modified:
   trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourceFilter.cpp
   trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourceFilter.h
   trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourcePin.cpp
   trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourcePin.h
Log:
* Native FLAC Filter, plays, pauses, stops.. no seeking.

Modified: trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourceFilter.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourceFilter.cpp	2004-10-25 15:51:50 UTC (rev 8096)
+++ trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourceFilter.cpp	2004-10-25 16:27:16 UTC (rev 8097)
@@ -63,6 +63,7 @@
 	,	mBitsPerSample(0)
 	,	mBegun(false)
 	,	mUpto(0)
+	,	mJustStopped(true)
 	
 	//,	mDecoder(NULL)
 {
@@ -181,6 +182,7 @@
 
 //IMEdiaStreaming
 STDMETHODIMP NativeFLACSourceFilter::Run(REFERENCE_TIME tStart) {
+	debugLog<<"RUN @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"<<endl;
 	const REFERENCE_TIME A_LONG_TIME = UNITS * 1000;
 	CAutoLock locLock(m_pLock);
 	//debugLog<<"Run  :  time = "<<tStart<<endl;
@@ -192,6 +194,7 @@
 STDMETHODIMP NativeFLACSourceFilter::Pause(void) {
 	CAutoLock locLock(m_pLock);
 	//debugLog << "** Pause called **"<<endl;
+	debugLog<<"PAUSE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"<<endl;
 	if (m_State == State_Stopped) {
 		//debugLog << "Was in stopped state... starting thread"<<endl;
 		if (ThreadExists() == FALSE) {
@@ -211,25 +214,45 @@
 	//debugLog<<"** Stop Called ** "<<endl;
 	CallWorker(THREAD_EXIT);
 	Close();
-	//DeliverBeginFlush();
-	//DeliverEndFlush();
+	debugLog<<"Stop ##################################################################"<<endl;
+	debugLog<<"Pre seek to 0"<<endl;
+	mJustStopped = true;
+	mUpto = 0;
+	debugLog<<"Post seek to 0"<<endl;
+	mFLACSourcePin->DeliverBeginFlush();
+	mFLACSourcePin->DeliverEndFlush();
 	return CBaseFilter::Stop();
 }
 
 HRESULT NativeFLACSourceFilter::DataProcessLoop() {
 
-	debugLog<<"Starting loop"<<endl;
+	debugLog<<"Starting loop ***********************************************"<<endl;
 	DWORD locCommand = 0;
+	bool res = false;
 	while (true) {
 		if(CheckRequest(&locCommand) == TRUE) {
 			debugLog<<"DataProcessLoop : Thread Command issued... leaving loop."<<endl;
 			
 			return S_OK;
 		}
+		if (mJustStopped) {
+			mJustStopped = false;
+			debugLog<<"!!!!!!!!!!!!!!!!!!!!!!! SEEK ABSOLUTE 0"<<endl;
+			bool res2 = seek_absolute(0);
+			if (res2) {
+				debugLog<<"Seek absolute success"<<endl;
+			}
+		}
 		debugLog<<"Process it"<<endl;
-		process_single();
+		res = process_single();
+		if (res) {
+			debugLog<<"Process OK"<<endl;
+		} else {
+			debugLog<<"Process FAILED"<<endl;
+		}
 	}
 
+	mFLACSourcePin->DeliverEndOfStream();
 	return S_OK;
 }
 
@@ -296,6 +319,7 @@
 		mSampleRate = inFrame->header.sample_rate;
 		
 	}
+	debugLog<<"Write callback"<<endl;
 	unsigned long locNumFrames = inFrame->header.blocksize;
 	unsigned long locActualSize = locNumFrames * mFrameSize;
 	unsigned long locTotalFrameCount = locNumFrames * mNumChannels;
@@ -335,7 +359,7 @@
 	}
 
 
-
+	debugLog<<"Size = "<<locActualSize<<"Frames from "<<mUpto<<" for "<<locNumFrames<<endl;
 	
 	mFLACSourcePin->deliverData(locBuff, locActualSize, (mUpto*UNITS) / mSampleRate, ((mUpto+locNumFrames)*UNITS) / mSampleRate);
 	mUpto += locNumFrames;

Modified: trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourceFilter.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourceFilter.h	2004-10-25 15:51:50 UTC (rev 8096)
+++ trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourceFilter.h	2004-10-25 16:27:16 UTC (rev 8097)
@@ -112,6 +112,7 @@
 	fstream debugLog;
 
 	bool mBegun;
+	bool mJustStopped;
 
 	unsigned long mUpto;
 

Modified: trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourcePin.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourcePin.cpp	2004-10-25 15:51:50 UTC (rev 8096)
+++ trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourcePin.cpp	2004-10-25 16:27:16 UTC (rev 8097)
@@ -37,10 +37,13 @@
 	,	mDataQueue(NULL)
 
 {
+
+	debugLog.open("G:\\logs\\flacsourcepin_.log", ios_base::out);
 }
 
 NativeFLACSourcePin::~NativeFLACSourcePin(void)
 {
+	debugLog.close();
 }
 
 STDMETHODIMP NativeFLACSourcePin::NonDelegatingQueryInterface(REFIID riid, void **ppv)
@@ -51,27 +54,28 @@
 
 HRESULT NativeFLACSourcePin::DeliverNewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
 {
-	
+	debugLog<<"New seg "<<tStart<<" - "<<tStop<<endl;
 	mDataQueue->NewSegment(tStart, tStop, dRate);
 
 	return S_OK;
 }
 HRESULT NativeFLACSourcePin::DeliverEndOfStream(void)
 {
-	
+	debugLog<<"EOS"<<endl;
 	mDataQueue->EOS();
     return S_OK;
 }
 
 HRESULT NativeFLACSourcePin::DeliverEndFlush(void)
 {
+	debugLog<<"End flush"<<endl;
 	mDataQueue->EndFlush();
     return S_OK;
 }
 
 HRESULT NativeFLACSourcePin::DeliverBeginFlush(void)
 {
-	
+	debugLog<<"Begin flush"<<endl;
 	mDataQueue->BeginFlush();
     return S_OK;
 }
@@ -162,10 +166,11 @@
 
 HRESULT NativeFLACSourcePin::deliverData(unsigned char* inBuff, unsigned long inBuffSize, __int64 inStart, __int64 inEnd) {
 	//Locks !!
-	
+	debugLog<<"Deliver data..."<<endl;
 	IMediaSample* locSample = NULL;
 	REFERENCE_TIME locStart = inStart;
 	REFERENCE_TIME locStop = inEnd;
+	debugLog<<"Times = "<<inStart<<" - "<<inEnd<<endl;
 	//debugLog<<"Start   : "<<locStart<<endl;
 	//debugLog<<"End     : "<<locStop<<endl;
 	DbgLog((LOG_TRACE, 2, "Getting Buffer in Source Pin..."));
@@ -173,6 +178,7 @@
 	DbgLog((LOG_TRACE, 2, "* After get Buffer in Source Pin..."));
 	//Error checks
 	if (locHR != S_OK) {
+		debugLog<<"********************************************** FAILED !!"<<endl;
 		//Stopping, fluching or error
 		//debugLog<<"Failure... No buffer"<<endl;
 		return locHR;
@@ -207,9 +213,11 @@
 		if (locHR != S_OK) {
 			//debugLog << "Failure... Queue rejected sample..."<<endl;
 			//Stopping ??
+			debugLog<<"FAILED TO RECEIVE !!!"<<endl;
 			return locHR;
 			
 		} else {
+			debugLog<<" $$$$$ Everythings sweet"<<endl;
 			return S_OK;
 		}
 	} else {

Modified: trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourcePin.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourcePin.h	2004-10-25 15:51:50 UTC (rev 8096)
+++ trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourcePin.h	2004-10-25 16:27:16 UTC (rev 8097)
@@ -73,5 +73,7 @@
 	COutputQueue* mDataQueue;
 
 	NativeFLACSourceFilter* mParentFilter;
+
+	fstream debugLog;
 	
 };



More information about the commits mailing list