PDA

View Full Version : Creation of a Codec DLL that drives other codec DLL's



daren
04-05-2004, 06:22 AM
Hi Spoon (and others),

I'm trying to create a codec which behaves a little like the Audio CD "codec"
and sends data to be converted through to the chosen "sub-codec".

I've created a C++ header file to declare the "sub-codec" DLL functions and
added code to open the "sub-codec" DLL. Creating the codec object seems
to work with this piece of code (a converted file gets created on the hard
disk with file header):

CLWAVEOUT::CLWAVEOUT (char *Filename, ENCompressionOpenResult &ReturnError, WAVEFORMATEX *WFXOutputFormat)
{

if (!LoadCodecDll())
{
ReturnError = CORCodecError;
return;
}

extCreateNewCompressionObject(Filename,ReturnError ,WFXOutputFormat);
}

But, the following piece of code is stumping me:

//---------------------------------------------------------------------------
// A new data block has arrived (pData is a pointer to a buffer passed
// out from the call Service)
//---------------------------------------------------------------------------
void CLWAVEOUT::ANewDataBlockArrived (char *pData, DWORD DataLength, bool IsEOF, ENCompressBlockResult &Result)
{
extANewDataBlockArrived (????,pData,DataLength,IsEOF,Result);
}

The function extANewDataBlockArrived expects a "void *Output" where I
placed "????". Anyone know how to deal with this?

Best regards,
Daren.

Spoon
04-05-2004, 07:13 AM
????? is the compression object, it is the (void *) returned by CreateACompressionObject - you need to pass it to NewDataBlock... and DeleteCompressionObject

daren
04-05-2004, 07:09 PM
A-ha,

So do I need to create the compression object like this?

CLWAVEOUT *pOutput = new extCreateNewCompressionObject(Filename,ReturnError ,WFXOutputFormat);

And then call ANewDataBlockArrived like this?

extANewDataBlockArrived (pOutput,pData,DataLength,IsEOF,Result);

Best regards,
Daren.

Spoon
04-06-2004, 03:05 AM
Yes