[xiph-commits] r7272 -

illiminable at dactyl.lonelymoon.com illiminable
Thu Jul 22 21:56:07 PDT 2004


trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder
Message-ID: <20040723045607.A41129AAAB at dactyl.lonelymoon.com>

Author: illiminable
Date: Thu Jul 22 21:56:07 2004
New Revision: 7272

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/flac/filters/dsfFLACEncoder/flacencoderdllstuff.h
Log:
* Cleaned out some unnecessary code for the flac encoder.

Modified: trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/FLACEncodeInputPin.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/FLACEncodeInputPin.cpp	2004-07-23 04:45:27 UTC (rev 7271)
+++ trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/FLACEncodeInputPin.cpp	2004-07-23 04:56:06 UTC (rev 7272)
@@ -34,7 +34,7 @@

FLACEncodeInputPin::FLACEncodeInputPin(AbstractAudioEncodeFilter* inParentFilter, CCritSec* inFilterLock, AbstractAudioEncodeOutputPin* inOutputPin)
:	AbstractAudioEncodeInputPin(inParentFilter, inFilterLock, inOutputPin, NAME("FLACEncodeInputPin"), L"PCM In")
-	,	mFishSound(NULL)
+
{
//debugLog.open("C:\\temp\\FLACenc.log", ios_base::out);
}
@@ -50,36 +50,36 @@
long FLACEncodeInputPin::encodeData(unsigned char* inBuf, long inNumBytes) {


-	//debugLog << "encodeData receives : "<<inNumBytes<<" bytes"<<endl;
-
-	float* locFloatBuf = new float[inNumBytes/2];
-	short locTempShort = 0;
-	float locTempFloat = 0;
+	////debugLog << "encodeData receives : "<<inNumBytes<<" bytes"<<endl;
+	//
+	//float* locFloatBuf = new float[inNumBytes/2];
+	//short locTempShort = 0;
+	//float locTempFloat = 0;

-	//__int64 locGranPos = 0;
-	//Removed hack for gran pos
-	//fish_sound_command(mFishSound, 8, &locGranPos, sizeof(__int64));
+	////__int64 locGranPos = 0;
+	////Removed hack for gran pos
+	////fish_sound_command(mFishSound, 8, &locGranPos, sizeof(__int64));
+	////
+	////locGranPos = fish_sound_get_frameno(mFishSound);
+	////mUptoFrame = locGranPos;
+	////__int64 locTemp = ((FishSoundFLACInfo*)mFishSound->codec_data)->vd.pcm_returned;
+	//for (int i = 0; i < inNumBytes; i += 2) {
+	//	locTempShort = *((short*)(inBuf + i));
+	//	locTempFloat = (float)locTempShort;
+	//	locTempFloat /= 32767.0;
+	//	locFloatBuf[i/2] = locTempFloat;;
+	//}
+	////debugLog<<"Calling encode"<<endl;
+	////FIX::: The 2 is the size of a sample ie 16 bits
+	//long locErr = fish_sound_encode(mFishSound, (float**)locFloatBuf, inNumBytes/(mFishInfo.channels*2));
+	//delete locFloatBuf;
+	////FIX::: Do something here ?
+	//if (locErr < 0) {
+	//	//debugLog<<"Fishsound reports error"<<endl;
+	//} else {
//
-	//locGranPos = fish_sound_get_frameno(mFishSound);
-	//mUptoFrame = locGranPos;
-	//__int64 locTemp = ((FishSoundFLACInfo*)mFishSound->codec_data)->vd.pcm_returned;
-	for (int i = 0; i < inNumBytes; i += 2) {
-		locTempShort = *((short*)(inBuf + i));
-		locTempFloat = (float)locTempShort;
-		locTempFloat /= 32767.0;
-		locFloatBuf[i/2] = locTempFloat;;
-	}
-	//debugLog<<"Calling encode"<<endl;
-	//FIX::: The 2 is the size of a sample ie 16 bits
-	long locErr = fish_sound_encode(mFishSound, (float**)locFloatBuf, inNumBytes/(mFishInfo.channels*2));
-	delete locFloatBuf;
-	//FIX::: Do something here ?
-	if (locErr < 0) {
-		//debugLog<<"Fishsound reports error"<<endl;
-	} else {
-
-	}
-	return locErr;
+	//}
+	//return locErr;
}
bool FLACEncodeInputPin::ConstructCodec() {
//mFishInfo.channels = mWaveFormat->nChannels;
@@ -106,66 +106,66 @@


//Encoded callback
-int FLACEncodeInputPin::FLACEncoded (FishSound* inFishSound, unsigned char* inPacketData, long inNumBytes, void* inThisPointer)
-{
+//int FLACEncodeInputPin::FLACEncoded (FishSound* inFishSound, unsigned char* inPacketData, long inNumBytes, void* inThisPointer)
+//{
+//
+//	//For convenience we do all these cast once and for all here.
+//	FLACEncodeInputPin* locThis = reinterpret_cast<FLACEncodeInputPin*> (inThisPointer);
+//	FLACEncodeFilter* locFilter = reinterpret_cast<FLACEncodeFilter*>(locThis->m_pFilter);
+//	//locThis->debugLog << "FLACEncoded called with "<<inNumBytes<< " byte of data"<<endl;
+//
+//	//Time stamps are granule pos not directshow times
+//	LONGLONG locFrameStart = locThis->mUptoFrame;
+//	LONGLONG locFrameEnd	= locThis->mUptoFrame
+//							= fish_sound_get_frameno(locThis->mFishSound);
+//
+//
+//	//locThis->debugLog << "Stamping packet "<<locFrameStart<< " to "<<locFrameEnd<<endl;
+//	//Get a pointer to a new sample stamped with our time
+//	IMediaSample* locSample;
+//	HRESULT locHR = locThis->mOutputPin->GetDeliveryBuffer(&locSample, &locFrameStart, &locFrameEnd, NULL);
+//
+//	if (FAILED(locHR)) {
+//		//We get here when the application goes into stop mode usually.
+//		//locThis->debugLog<<"Getting buffer failed"<<endl;
+//		return locHR;
+//	}
+//
+//	BYTE* locBuffer = NULL;
+//
+//
+//	//Make our pointers set to point to the samples buffer
+//	locSample->GetPointer(&locBuffer);
+//
+//
+//
+//	if (locSample->GetSize() >= inNumBytes) {
+//
+//		memcpy((void*)locBuffer, (const void*)inPacketData, inNumBytes);
+//
+//		//Set the sample parameters.
+//		locThis->SetSampleParams(locSample, inNumBytes, &locFrameStart, &locFrameEnd);
+//
+//		{
+//			CAutoLock locLock(locThis->m_pLock);
+//
+//			//Add a reference so it isn't deleted en route.
+//			//locSample->AddRef();
+//			HRESULT locHR = locThis->mOutputPin->mDataQueue->Receive(locSample);						//->DownstreamFilter()->Receive(locSample);
+//			if (locHR != S_OK) {
+//				//locThis->debugLog<<"Sample rejected"<<endl;
+//			} else {
+//				//locThis->debugLog<<"Sample Delivered"<<endl;
+//			}
+//		}
+//
+//		return 0;
+//	} else {
+//		throw 0;
+//	}
+//}

-	//For convenience we do all these cast once and for all here.
-	FLACEncodeInputPin* locThis = reinterpret_cast<FLACEncodeInputPin*> (inThisPointer);
-	FLACEncodeFilter* locFilter = reinterpret_cast<FLACEncodeFilter*>(locThis->m_pFilter);
-	//locThis->debugLog << "FLACEncoded called with "<<inNumBytes<< " byte of data"<<endl;

-	//Time stamps are granule pos not directshow times
-	LONGLONG locFrameStart = locThis->mUptoFrame;
-	LONGLONG locFrameEnd	= locThis->mUptoFrame
-							= fish_sound_get_frameno(locThis->mFishSound);
-
-
-	//locThis->debugLog << "Stamping packet "<<locFrameStart<< " to "<<locFrameEnd<<endl;
-	//Get a pointer to a new sample stamped with our time
-	IMediaSample* locSample;
-	HRESULT locHR = locThis->mOutputPin->GetDeliveryBuffer(&locSample, &locFrameStart, &locFrameEnd, NULL);
-
-	if (FAILED(locHR)) {
-		//We get here when the application goes into stop mode usually.
-		//locThis->debugLog<<"Getting buffer failed"<<endl;
-		return locHR;
-	}
-
-	BYTE* locBuffer = NULL;
-
-
-	//Make our pointers set to point to the samples buffer
-	locSample->GetPointer(&locBuffer);
-
-
-
-	if (locSample->GetSize() >= inNumBytes) {
-
-		memcpy((void*)locBuffer, (const void*)inPacketData, inNumBytes);
-
-		//Set the sample parameters.
-		locThis->SetSampleParams(locSample, inNumBytes, &locFrameStart, &locFrameEnd);
-
-		{
-			CAutoLock locLock(locThis->m_pLock);
-
-			//Add a reference so it isn't deleted en route.
-			//locSample->AddRef();
-			HRESULT locHR = locThis->mOutputPin->mDataQueue->Receive(locSample);						//->DownstreamFilter()->Receive(locSample);
-			if (locHR != S_OK) {
-				//locThis->debugLog<<"Sample rejected"<<endl;
-			} else {
-				//locThis->debugLog<<"Sample Delivered"<<endl;
-			}
-		}
-
-		return 0;
-	} else {
-		throw 0;
-	}
-}
-
-
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 04:45:27 UTC (rev 7271)
+++ trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/FLACEncodeInputPin.h	2004-07-23 04:56:06 UTC (rev 7272)
@@ -44,14 +44,18 @@

//#include <fstream>
//using namespace std;
+
+using namespace FLAC::Encoder;
+
class FLACEncodeInputPin
:	public AbstractAudioEncodeInputPin
+	,	public Stream
{
public:
FLACEncodeInputPin(AbstractAudioEncodeFilter* inFilter, CCritSec* inFilterLock, AbstractAudioEncodeOutputPin* inOutputPin);
virtual ~FLACEncodeInputPin(void);

-	static int FLACEncodeInputPin::FLACEncoded (FishSound* inFishSound, unsigned char* inPacketData, long inNumBytes, void* inThisPointer) ;
+	//static int FLACEncodeInputPin::FLACEncoded (FishSound* inFishSound, unsigned char* inPacketData, long inNumBytes, void* inThisPointer) ;
//PURE VIRTUALS
virtual long encodeData(unsigned char* inBuf, long inNumBytes);
virtual bool ConstructCodec();

Modified: trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/flacencoderdllstuff.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/flacencoderdllstuff.h	2004-07-23 04:45:27 UTC (rev 7271)
+++ trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/flacencoderdllstuff.h	2004-07-23 04:56:06 UTC (rev 7272)
@@ -63,10 +63,21 @@
#endif


+// {3913F0AB-E7ED-41c4-979B-1D1FDD983C07}
+DEFINE_GUID(MEDIASUBTYPE_FLAC,
+0x3913f0ab, 0xe7ed, 0x41c4, 0x97, 0x9b, 0x1d, 0x1f, 0xdd, 0x98, 0x3c, 0x7);

+// {77E3A6A3-2A24-43fa-B929-00747E4B560B}
+DEFINE_GUID(CLSID_FLACEncodeFilter,
+0x77e3a6a3, 0x2a24, 0x43fa, 0xb9, 0x29, 0x0, 0x74, 0x7e, 0x4b, 0x56, 0xb);


+// {1CDC48AC-4C24-4b8b-982B-7007A29D83C4}
+DEFINE_GUID(FORMAT_FLAC,
+0x1cdc48ac, 0x4c24, 0x4b8b, 0x98, 0x2b, 0x70, 0x7, 0xa2, 0x9d, 0x83, 0xc4);

+
+
const REGPINTYPES FLACEncodeInputTypes = {
&MEDIATYPE_Audio,
&MEDIASUBTYPE_PCM



More information about the commits mailing list