[xiph-commits] r7282 - in trunk/oggdsf/src/lib/codecs:

illiminable at dactyl.lonelymoon.com illiminable
Fri Jul 23 02:33:06 PDT 2004


flac/filters/dsfFLACEncoder speex/filters/dsfSpeexEncoder
Message-ID: <20040723093306.574989AAAB at dactyl.lonelymoon.com>

Author: illiminable
Date: Fri Jul 23 02:33:06 2004
New Revision: 7282

Modified:
trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/FLACEncodeInputPin.cpp
trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/FLACEncodeInputPin.h
trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexEncoder/SpeexEncodeInputPin.h
Log:
* More bug fixes for flac
* Also fixed a latent bug in speex, member variable declared in both base and derived class.
* Mainly moved the initialisation out of the constructcodec function because with flac it triggers callbacks, and the callbacks can't be processed until the filter is in a play state, so the init function is now done as the first piece of data arrives.

Modified: trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/FLACEncodeInputPin.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/FLACEncodeInputPin.cpp	2004-07-23 08:20:51 UTC (rev 7281)
+++ trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/FLACEncodeInputPin.cpp	2004-07-23 09:33:05 UTC (rev 7282)
@@ -49,6 +49,12 @@
//PURE VIRTUALS
long FLACEncodeInputPin::encodeData(unsigned char* inBuf, long inNumBytes) {

+	if (mBegun == false) {
+
+		//First bit of data, set up the encoder.
+		mBegun = true;
+		init();
+	}
FLAC__int32* locFLACBuff = NULL;
FLACEncodeFilter* locParentFilter = (FLACEncodeFilter*)mParentFilter;	//View only don't delete.
unsigned long locFLACBuffSize = (inNumBytes * 8) / locParentFilter->mFLACFormatBlock.numBitsPerSample;
@@ -119,18 +125,12 @@
locParentFilter->mFLACFormatBlock.numBitsPerSample = mWaveFormat->wBitsPerSample;
locParentFilter->mFLACFormatBlock.numChannels = mWaveFormat->nChannels;
locParentFilter->mFLACFormatBlock.sampleRate = mWaveFormat->nSamplesPerSec;
-	init();
+
+	//This can't be here, it causes callbacks to fire, and the data can't be delivered
+	// because the filter is not fully set up yet.
+	//init();

-	//
-	//mFishSound = fish_sound_new (FISH_SOUND_ENCODE, &mFishInfo);
-
-	//int i = 1;
-	////FIX::: Use new API for interleave setting
-	//fish_sound_command(mFishSound, FISH_SOUND_SET_INTERLEAVE, &i, sizeof(int));
-
-	//fish_sound_set_encoded_callback (mFishSound, SpeexEncodeInputPin::SpeexEncoded, this);
////FIX::: Proper return value
-	//return true;
return true;
}
void FLACEncodeInputPin::DestroyCodec() {
@@ -264,6 +264,11 @@
// because flac is unlikely to be streamed live.
}

+STDMETHODIMP FLACEncodeInputPin::EndOfStream(void) {
+	//Catch the end of stream so we can send a finish signal.
+	finish();			//Tell flac we are done so it can flush and send us the metadata.
+	return AbstractAudioEncodeInputPin::EndOfStream();		//Call the base class.
+}

HRESULT FLACEncodeInputPin::SetMediaType(const CMediaType* inMediaType) {
AbstractAudioEncodeInputPin::SetMediaType(inMediaType);

Modified: trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/FLACEncodeInputPin.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/FLACEncodeInputPin.h	2004-07-23 08:20:51 UTC (rev 7281)
+++ trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/FLACEncodeInputPin.h	2004-07-23 09:33:05 UTC (rev 7282)
@@ -66,6 +66,8 @@
virtual void DestroyCodec();
virtual HRESULT SetMediaType(const CMediaType* inMediaType);

+	//OVerrides
+	virtual STDMETHODIMP EndOfStream(void);
protected:
HRESULT mHR;
bool mBegun;

Modified: trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexEncoder/SpeexEncodeInputPin.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexEncoder/SpeexEncodeInputPin.h	2004-07-23 08:20:51 UTC (rev 7281)
+++ trunk/oggdsf/src/lib/codecs/speex/filters/dsfSpeexEncoder/SpeexEncodeInputPin.h	2004-07-23 09:33:05 UTC (rev 7282)
@@ -60,7 +60,7 @@

protected:
HRESULT mHR;
-	bool mBegun;
+	//bool mBegun;			//Already in base class stupid !
//SpeexDecodeOutputPin* mOutputPin;
//__int64 mUptoFrame;




More information about the commits mailing list