[xiph-commits] r10338 - in branches/oggdsf_new_demux/src/lib/codecs: speex/filters/dsfSpeexDecoder vorbis/filters/dsfVorbisDecoder

illiminable at svn.xiph.org illiminable at svn.xiph.org
Sat Nov 5 04:05:40 PST 2005


Author: illiminable
Date: 2005-11-05 04:05:31 -0800 (Sat, 05 Nov 2005)
New Revision: 10338

Modified:
   branches/oggdsf_new_demux/src/lib/codecs/speex/filters/dsfSpeexDecoder/SpeexDecodeInputPin.cpp
   branches/oggdsf_new_demux/src/lib/codecs/speex/filters/dsfSpeexDecoder/SpeexDecodeInputPin.h
   branches/oggdsf_new_demux/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeInputPin.cpp
   branches/oggdsf_new_demux/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeInputPin.h
Log:
* Add alocator requirement negotiation to speex decoder
* Add end flush to speex decoder
* Remove some dead code from vorbis decoder

Modified: branches/oggdsf_new_demux/src/lib/codecs/speex/filters/dsfSpeexDecoder/SpeexDecodeInputPin.cpp
===================================================================
--- branches/oggdsf_new_demux/src/lib/codecs/speex/filters/dsfSpeexDecoder/SpeexDecodeInputPin.cpp	2005-11-05 11:34:34 UTC (rev 10337)
+++ branches/oggdsf_new_demux/src/lib/codecs/speex/filters/dsfSpeexDecoder/SpeexDecodeInputPin.cpp	2005-11-05 12:05:31 UTC (rev 10338)
@@ -42,6 +42,8 @@
 	,	mSampleRate(0)
 	,	mUptoFrame(0)
 
+	,	mDecodedByteCount(0)
+
 	,	mBegun(false)
 {
 	ConstructCodec();
@@ -86,6 +88,23 @@
 	
 }
 
+STDMETHODIMP SpeexDecodeInputPin::EndFlush()
+{
+	CAutoLock locLock(m_pLock);
+	
+	HRESULT locHR = AbstractTransformInputPin::EndFlush();
+	mDecodedByteCount = 0;
+	return locHR;
+}
+HRESULT SpeexDecodeInputPin::GetAllocatorRequirements(ALLOCATOR_PROPERTIES *outRequestedProps)
+{
+	outRequestedProps->cbBuffer = SPEEX_BUFFER_SIZE;
+	outRequestedProps->cBuffers = SPEEX_NUM_BUFFERS;
+	outRequestedProps->cbAlign = 1;
+	outRequestedProps->cbPrefix = 0;
+
+	return S_OK;
+}
 int SpeexDecodeInputPin::SpeexDecoded (FishSound* inFishSound, float** inPCM, long inFrames, void* inThisPointer) 
 {
 	//Do we need to delete the pcm structure ???? 

Modified: branches/oggdsf_new_demux/src/lib/codecs/speex/filters/dsfSpeexDecoder/SpeexDecodeInputPin.h
===================================================================
--- branches/oggdsf_new_demux/src/lib/codecs/speex/filters/dsfSpeexDecoder/SpeexDecodeInputPin.h	2005-11-05 11:34:34 UTC (rev 10337)
+++ branches/oggdsf_new_demux/src/lib/codecs/speex/filters/dsfSpeexDecoder/SpeexDecodeInputPin.h	2005-11-05 12:05:31 UTC (rev 10338)
@@ -58,9 +58,14 @@
 	virtual HRESULT SetMediaType(const CMediaType* inMediaType);
 	virtual HRESULT CheckMediaType(const CMediaType *inMediaType);
 	virtual STDMETHODIMP NewSegment(REFERENCE_TIME inStartTime, REFERENCE_TIME inStopTime, double inRate);
+	virtual STDMETHODIMP EndFlush();
 
+	virtual STDMETHODIMP GetAllocatorRequirements(ALLOCATOR_PROPERTIES *outRequestedProps);
+
 protected:
 	static const unsigned long SPEEX_IDENT_HEADER_SIZE = 80;
+	static const unsigned long SPEEX_NUM_BUFFERS = 75;
+	static const unsigned long SPEEX_BUFFER_SIZE = 65536;
 
 	//Implementation of pure virtuals from AbstractTransformInputPin
 	virtual bool ConstructCodec();
@@ -77,4 +82,6 @@
 
 	bool mBegun;
 
+	unsigned long mDecodedByteCount;
+
 };

Modified: branches/oggdsf_new_demux/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeInputPin.cpp
===================================================================
--- branches/oggdsf_new_demux/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeInputPin.cpp	2005-11-05 11:34:34 UTC (rev 10337)
+++ branches/oggdsf_new_demux/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeInputPin.cpp	2005-11-05 12:05:31 UTC (rev 10338)
@@ -136,20 +136,7 @@
 	VorbisDecodeFilter* locFilter = reinterpret_cast<VorbisDecodeFilter*>(locThis->m_pFilter);
 
 	if (locThis->CheckStreaming() == S_OK) {
-		//if (! locThis->mBegun) {
-		//	//locThis->debugLog<<"First Time"<<endl;
-		//	//Set up fishsound		
-		//	fish_sound_command (locThis->mFishSound, FISH_SOUND_GET_INFO, &(locThis->mFishInfo), sizeof (FishSoundInfo)); 
-		//	locThis->mBegun = true;
-		//	
-		//	locThis->mNumChannels = locThis->mFishInfo.channels;
-		//	locThis->mFrameSize = locThis->mNumChannels * SIZE_16_BITS;
-		//	locThis->mSampleRate = locThis->mFishInfo.samplerate;
 
-		//}
-
-
-
 		unsigned long locActualSize = inFrames * locThis->mFrameSize;
 		unsigned long locTotalFrameCount = inFrames * locThis->mNumChannels;
 		unsigned long locBufferRemaining = DECODED_BUFFER_SIZE - locThis->mDecodedByteCount;
@@ -197,126 +184,6 @@
 		return -1;
 	}
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-		//unsigned long locActualSize = inFrames * locThis->mFrameSize;
-		//unsigned long locTotalFrameCount = inFrames * locThis->mNumChannels;
-		//
-		////locThis->debugLog<<"m_tStart = "<<locThis->m_tStart<<endl;
-		////locThis->debugLog<<"mUptoFrame = "<<locThis->mUptoFrame<<endl;
-		////Make the start presentation time
-		//REFERENCE_TIME locFrameStart = (((__int64)(locThis->mUptoFrame * UNITS)) / locThis->mSampleRate);
-
-		////Increment the frame counter
-		//locThis->mUptoFrame += inFrames;
-
-		////Make the end presentation time
-		//REFERENCE_TIME locFrameEnd = (((__int64)(locThis->mUptoFrame * UNITS)) / locThis->mSampleRate);
-
-		////locThis->debugLog<<"Sample time = "<<locFrameStart<<" - "<<locFrameEnd<<endl;
-		//IMediaSample* locSample;
-		//HRESULT locHR = locThis->mOutputPin->GetDeliveryBuffer(&locSample, &locFrameStart, &locFrameEnd, NULL);
-
-		//if (locHR != S_OK) {
-		//	return -1;
-		//}	
-		//
-
-		////Create pointers for the samples buffer to be assigned to
-		//BYTE* locBuffer = NULL;
-		//signed short* locShortBuffer = NULL;
-		//
-		//locSample->GetPointer(&locBuffer);
-		//locShortBuffer = (short *) locBuffer;
-		//
-		//signed short tempInt = 0;
-		//float tempFloat = 0;
-		//
-		////FIX:::Move the clipping to the abstract function
-
-		//if (locSample->GetSize() >= locActualSize) {
-		//	//Do float to int conversion with clipping
-		//	const float SINT_MAX_AS_FLOAT = 32767.0f;
-		//	for (unsigned long i = 0; i < locTotalFrameCount; i++) {
-		//		//Clipping because vorbis puts out floats out of range -1 to 1
-		//		if (((float*)inPCM)[i] <= -1.0f) {
-		//			tempInt = SINT_MIN;	
-		//		} else if (((float*)inPCM)[i] >= 1.0f) {
-		//			tempInt = SINT_MAX;
-		//		} else {
-		//			//FIX:::Take out the unnescessary variable.
-		//			tempFloat = ((( (float*) inPCM )[i]) * SINT_MAX_AS_FLOAT);
-		//			//ASSERT((tempFloat <= 32767.0f) && (tempFloat >= -32786.0f));
-		//			tempInt = (signed short)(tempFloat);
-		//			//tempInt = (signed short) ((( (float*) inPCM )[i]) * SINT_MAX_AS_FLOAT);
-		//		}
-		//		
-		//		*locShortBuffer = tempInt;
-		//		locShortBuffer++;
-		//	}
-		//	
-		//	//Set the sample parameters.
-		//	locThis->SetSampleParams(locSample, locActualSize, &locFrameStart, &locFrameEnd);
-
-		//	{
-		//
-		//		CAutoLock locLock(locThis->m_pLock);
-
-		//		//TODO::: Explain why we don't addref or release.
-		//		HRESULT locHR = ((VorbisDecodeOutputPin*)(locThis->mOutputPin))->mDataQueue->Receive(locSample);
-		//		if (locHR != S_OK) {
-		//			DbgLog((LOG_TRACE,1,TEXT("Queue rejected us...")));
-		//			return -1;
-		//		}
-		//	}
-
-		//	
-		//	return 0;
-		//} else {
-		//	throw 0;
-		//}
-
-
 }
 
 STDMETHODIMP VorbisDecodeInputPin::Receive(IMediaSample* inSample) 
@@ -326,19 +193,8 @@
 	HRESULT locHR = CheckStreaming();
 
 	if (locHR == S_OK) {
-		//if (!mBegun) {
-		//	//locThis->debugLog<<"First Time"<<endl;
-		//	//Set up fishsound		
-		//	fish_sound_command (mFishSound, FISH_SOUND_GET_INFO, &(mFishInfo), sizeof (FishSoundInfo)); 
-		//	mBegun = true;
-		//	
-		//	mNumChannels = mFishInfo.channels;
-		//	mFrameSize = mNumChannels * SIZE_16_BITS;
-		//	mSampleRate = mFishInfo.samplerate;
 
-		//}
 
-
 		BYTE* locBuff = NULL;
 		locHR = inSample->GetPointer(&locBuff);
 
@@ -423,10 +279,6 @@
 
 				mDecodedByteCount = 0;
 				
-
-
-
-
 			}
 			return S_OK;
 

Modified: branches/oggdsf_new_demux/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeInputPin.h
===================================================================
--- branches/oggdsf_new_demux/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeInputPin.h	2005-11-05 11:34:34 UTC (rev 10337)
+++ branches/oggdsf_new_demux/src/lib/codecs/vorbis/filters/dsfVorbisDecoder/VorbisDecodeInputPin.h	2005-11-05 12:05:31 UTC (rev 10338)
@@ -70,7 +70,7 @@
 	virtual STDMETHODIMP GetAllocatorRequirements(ALLOCATOR_PROPERTIES *outRequestedProps);
 
 	//Overriden from AbstractTransform input pin
-	STDMETHODIMP VorbisDecodeInputPin::Receive(IMediaSample* inSample);
+	virtual STDMETHODIMP Receive(IMediaSample* inSample);
 
 	//IOggDecoder Interface
 	virtual LOOG_INT64 convertGranuleToTime(LOOG_INT64 inGranule);



More information about the commits mailing list