[xiph-commits] r7275 -
illiminable at dactyl.lonelymoon.com
illiminable
Thu Jul 22 23:09:51 PDT 2004
trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder
Message-ID: <20040723060951.2ED019AAAB at dactyl.lonelymoon.com>
Author: illiminable
Date: Thu Jul 22 23:09:51 2004
New Revision: 7275
Modified:
trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/FLACEncodeInputPin.cpp
Log:
* Filled in the encoding prep code.
Modified: trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/FLACEncodeInputPin.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/FLACEncodeInputPin.cpp 2004-07-23 05:41:39 UTC (rev 7274)
+++ trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/FLACEncodeInputPin.cpp 2004-07-23 06:09:50 UTC (rev 7275)
@@ -49,7 +49,30 @@
//PURE VIRTUALS
long FLACEncodeInputPin::encodeData(unsigned char* inBuf, long inNumBytes) {
+ FLAC__int32* locFLACBuff = NULL;
+ unsigned long locFLACBuffSize = (inNumBytes * 8) / mWaveFormat->wBitsPerSample;
+ unsigned long locNumSamplesPerChannel = locFLACBuffSize / mWaveFormat->nChannels;
+ locFLACBuff = new FLAC__int32[locFLACBuffSize];
+
+ //QUERY::: Are the flac buffers supposed to stretch the data to 32 bits ?
+ //Assuming No for now, otherwise whats the point of set_sample_size.
+
+ //POTENTIAL BUG::: This assumes 16 bit samples !!
+
+ short locTempShort = 0;
+ for (int i = 0; i < inNumBytes; i += 2) {
+ locTempShort = *((short*)(inBuf + i));
+ locFLACBuff[i/2] = locTempShort;
+ }
+
+ bool locRetVal = process_interleaved(locFLACBuff, locNumSamplesPerChannel);
+
+ if (locRetVal == true) {
+ return 0;
+ } else {
+ return -1;
+ }
////debugLog << "encodeData receives : "<<inNumBytes<<" bytes"<<endl;
//
//float* locFloatBuf = new float[inNumBytes/2];
@@ -80,13 +103,17 @@
//
//}
//return locErr;
- return -1;
+
}
bool FLACEncodeInputPin::ConstructCodec() {
//mFishInfo.channels = mWaveFormat->nChannels;
//mFishInfo.format = FISH_SOUND_FLAC;
//mFishInfo.samplerate = mWaveFormat->nSamplesPerSec;
+ set_channels(mWaveFormat->nChannels);
+ set_sample_rate(mWaveFormat->nSamplesPerSec);
+ set_bits_per_sample(mWaveFormat->wBitsPerSample);
+ init();
//
//mFishSound = fish_sound_new (FISH_SOUND_ENCODE, &mFishInfo);
More information about the commits
mailing list