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

illiminable at motherfish-iii.xiph.org illiminable at motherfish-iii.xiph.org
Wed Oct 27 00:07:21 PDT 2004


Author: illiminable
Date: 2004-10-27 00:07:20 -0700 (Wed, 27 Oct 2004)
New Revision: 8115

Modified:
   trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourceFilter.cpp
   trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourceFilter.h
Log:
* Handles end of stream correctly now in Native FLAC filter.

Modified: trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourceFilter.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourceFilter.cpp	2004-10-27 06:34:42 UTC (rev 8114)
+++ trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourceFilter.cpp	2004-10-27 07:07:20 UTC (rev 8115)
@@ -66,6 +66,7 @@
 	,	mJustSeeked(true)
 	,	mSeekRequest(0)
 	,	mTotalNumSamples(0)
+	,	mWasEOF(false)
 	
 	//,	mDecoder(NULL)
 {
@@ -261,15 +262,21 @@
 			
 			debugLog<<"Process it"<<endl;
 			res = process_single();
-			
 			if (res) {
 				debugLog<<"Process OK"<<endl;
 			} else {
 				debugLog<<"Process FAILED"<<endl;
 			}
+			if (mWasEOF) {
+				break;
+			}
+			
 		}
 	}
 
+	mInputFile.clear();
+	mInputFile.seekg(0);
+	mWasEOF = false;
 	mFLACSourcePin->DeliverEndOfStream();
 	return S_OK;
 }
@@ -309,6 +316,11 @@
 	mInputFile.read((char*)outBuffer, BUFF_SIZE);
 	*outNumBytes = mInputFile.gcount();
 	debugLog<<"Read num bytes = "<<*outNumBytes<<endl;
+	if (mInputFile.eof()) {
+		mWasEOF = true;
+	} else {
+		mWasEOF=false;
+	}
 	return FLAC__SEEKABLE_STREAM_DECODER_READ_STATUS_OK;
 }
 ::FLAC__SeekableStreamDecoderSeekStatus NativeFLACSourceFilter::seek_callback(FLAC__uint64 inSeekPos) {

Modified: trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourceFilter.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourceFilter.h	2004-10-27 06:34:42 UTC (rev 8114)
+++ trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourceFilter.h	2004-10-27 07:07:20 UTC (rev 8115)
@@ -134,6 +134,7 @@
 	bool mBegun;
 	bool mJustSeeked;
 	__int64 mSeekRequest;
+	bool mWasEOF;
 
 	unsigned long mUpto;
 



More information about the commits mailing list