[xiph-commits] r8657 - in trunk/oggdsf/src:
lib/codecs/cmml/libCMMLTags lib/codecs/flac/filters/dsfFLACDecoder
lib/codecs/flac/filters/dsfFLACEncoder
lib/codecs/flac/filters/dsfNativeFLACSource
lib/codecs/flac/libs/libFLACHelper tests/testCMMLParser
illiminable at motherfish-iii.xiph.org
illiminable at motherfish-iii.xiph.org
Fri Jan 7 07:24:47 PST 2005
Author: illiminable
Date: 2005-01-07 07:24:46 -0800 (Fri, 07 Jan 2005)
New Revision: 8657
Modified:
trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_CMMLDoc.cpp
trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_CMMLRootTag.cpp
trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACDecoder/FLACDecodeInputPin.cpp
trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACDecoder/FLACDecodeOutputPin.cpp
trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/FLACEncodeInputPin.cpp
trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourcePin.cpp
trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/FLACHeaderTweaker.cpp
trunk/oggdsf/src/tests/testCMMLParser/testCMMLParser.cpp
Log:
* Add the missing clone function to C_CMMLDoc
* Remove some warnings in my flac helper libraries
* Use some size_t 's where appropriate.
* Added a test to the CMML test app for the clone function.
Modified: trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_CMMLDoc.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_CMMLDoc.cpp 2005-01-07 14:23:32 UTC (rev 8656)
+++ trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_CMMLDoc.cpp 2005-01-07 15:24:46 UTC (rev 8657)
@@ -47,6 +47,14 @@
delete mRoot;
}
+C_CMMLDoc* C_CMMLDoc::clone()
+{
+ C_CMMLDoc* retDoc = new C_CMMLDoc();
+ retDoc->mPreamble = mPreamble;
+ retDoc->mRoot = mRoot->clone();
+
+ return retDoc;
+}
C_CMMLPreamble* C_CMMLDoc::preamble() {
return mPreamble;
}
Modified: trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_CMMLRootTag.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_CMMLRootTag.cpp 2005-01-07 14:23:32 UTC (rev 8656)
+++ trunk/oggdsf/src/lib/codecs/cmml/libCMMLTags/C_CMMLRootTag.cpp 2005-01-07 15:24:46 UTC (rev 8657)
@@ -79,6 +79,7 @@
void C_CMMLRootTag::privateClone(C_CMMLTag* outTag) {
C_HumReadCMMLTag::privateClone(outTag);
C_CMMLRootTag* locTag = reinterpret_cast<C_CMMLRootTag*>(outTag);
+
if (mStream != NULL) {
locTag->setStream(mStream->clone());
}
Modified: trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACDecoder/FLACDecodeInputPin.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACDecoder/FLACDecodeInputPin.cpp 2005-01-07 14:23:32 UTC (rev 8656)
+++ trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACDecoder/FLACDecodeInputPin.cpp 2005-01-07 15:24:46 UTC (rev 8657)
@@ -124,11 +124,13 @@
locSample->GetPointer(&locBuffer);
+ //*** WARNING 4018: Leave this.
if (locSample->GetSize() >= locStamped->packetSize()) {
REFERENCE_TIME locFrameStart = (((__int64)(mUptoFrame * UNITS)) / mFLACDecoder.mSampleRate);
- //Increment the frame counter - note the returned packet is stamped 0-numSamples
- mUptoFrame += locStamped->endTime();
+ //Increment the frame counter
+ //NOTE::: The returned packet is stamped 0-numSamples so endTime will be in long range.
+ mUptoFrame += (unsigned long)locStamped->endTime();
// //Make the end frame counter
@@ -153,7 +155,6 @@
} else {
return S_FALSE;
}
-
} else {
{
CAutoLock locCodecLock(mCodecLock);
@@ -164,14 +165,8 @@
} else {
return S_FALSE;
}
-
-
-
}
- //debugLog<<"decodeData : Successful return."<<endl;
- //Should be impossible to get here.
- return S_OK;
} else {
//debugLog<<"decodeData : Filter flushing... bad things !!!"<<endl;
return S_FALSE;
Modified: trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACDecoder/FLACDecodeOutputPin.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACDecoder/FLACDecodeOutputPin.cpp 2005-01-07 14:23:32 UTC (rev 8656)
+++ trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACDecoder/FLACDecodeOutputPin.cpp 2005-01-07 15:24:46 UTC (rev 8657)
@@ -61,7 +61,7 @@
locWaveFormat->wFormatTag = WAVE_FORMAT_PCM;
locWaveFormat->nChannels = locFilter->getFLACFormatBlock()->numChannels;
locWaveFormat->nSamplesPerSec = locFilter->getFLACFormatBlock()->samplesPerSec;
- locWaveFormat->wBitsPerSample = locFilter->getFLACFormatBlock()->numBitsPerSample;
+ locWaveFormat->wBitsPerSample = (WORD)locFilter->getFLACFormatBlock()->numBitsPerSample;
locWaveFormat->nBlockAlign = (locWaveFormat->nChannels) * (locWaveFormat->wBitsPerSample >> 3);
locWaveFormat->nAvgBytesPerSec = ((locWaveFormat->nChannels) * (locWaveFormat->wBitsPerSample >> 3)) * locWaveFormat->nSamplesPerSec;
locWaveFormat->cbSize = 0;
Modified: trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/FLACEncodeInputPin.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/FLACEncodeInputPin.cpp 2005-01-07 14:23:32 UTC (rev 8656)
+++ trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/FLACEncodeInputPin.cpp 2005-01-07 15:24:46 UTC (rev 8657)
@@ -139,7 +139,7 @@
//Send all the headers
mTweakedHeaders = true;
- for (int i = 0; i < mHeaderTweaker.numNewHeaders(); i++) {
+ for (unsigned long i = 0; i < mHeaderTweaker.numNewHeaders(); i++) {
//Loop through firing out all the headers.
//debugLog<<"Sending new header "<<i<<endl;
@@ -214,6 +214,7 @@
//Make our pointers set to point to the samples buffer
locSample->GetPointer(&locBuffer);
+ //**** WARNING 4018::: Leave this alone.
if (locSample->GetSize() >= inNumBytes) {
memcpy((void*)locBuffer, (const void*)inBuffer, inNumBytes);
Modified: trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourcePin.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourcePin.cpp 2005-01-07 14:23:32 UTC (rev 8656)
+++ trunk/oggdsf/src/lib/codecs/flac/filters/dsfNativeFLACSource/NativeFLACSourcePin.cpp 2005-01-07 15:24:46 UTC (rev 8657)
@@ -116,10 +116,10 @@
WAVEFORMATEX* locFormat = (WAVEFORMATEX*)outMediaType->AllocFormatBuffer(sizeof(WAVEFORMATEX));
locFormat->wFormatTag = WAVE_FORMAT_PCM;
- locFormat->nChannels = mParentFilter->mNumChannels;
+ locFormat->nChannels = (WORD)mParentFilter->mNumChannels;
locFormat->nSamplesPerSec = mParentFilter->mSampleRate;
- locFormat->wBitsPerSample = mParentFilter->mBitsPerSample;
- locFormat->nBlockAlign = (mParentFilter->mNumChannels) * (mParentFilter->mBitsPerSample >> 3);
+ locFormat->wBitsPerSample = (WORD)mParentFilter->mBitsPerSample;
+ locFormat->nBlockAlign = (WORD)((mParentFilter->mNumChannels) * (mParentFilter->mBitsPerSample >> 3));
locFormat->nAvgBytesPerSec = ((mParentFilter->mNumChannels) * (mParentFilter->mBitsPerSample >> 3)) * mParentFilter->mSampleRate;
locFormat->cbSize = 0;
@@ -181,6 +181,7 @@
BYTE* locBuffer = NULL;
locSample->GetPointer(&locBuffer);
+ //*** WARNING 4018 ::: leave this.
if (locSample->GetSize() >= inBuffSize) {
memcpy((void*)locBuffer, (const void*)inBuff, inBuffSize);
locSample->SetActualDataLength(inBuffSize);
Modified: trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/FLACHeaderTweaker.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/FLACHeaderTweaker.cpp 2005-01-07 14:23:32 UTC (rev 8656)
+++ trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/FLACHeaderTweaker.cpp 2005-01-07 15:24:46 UTC (rev 8657)
@@ -97,6 +97,8 @@
locFirstPackBuff[5] = 1;
locFirstPackBuff[6] = 0;
locFirstPackBuff[7] = 0; //Num header HIGH BYTE
+
+ //*** VERIFY ::: Is this even safe ????
locFirstPackBuff[8] = mOldHeaderList.size() - 2; //Num headers LOW BYTE
locFirstPackBuff[9] = 'f';
locFirstPackBuff[10] = 'L';
@@ -116,7 +118,7 @@
int locCommentNo = -1;
//Start at 2, 0 is just fLaC, 1 is the stream info
- for (int i = 2; i < mOldHeaderList.size(); i++) {
+ for (size_t i = 2; i < mOldHeaderList.size(); i++) {
//Loop through to find the comment packet...
//debugLog<<"Scanning old header "<<i<<endl;
if ( ((mOldHeaderList[i]->packetData()[0]) & 127) == 4) {
@@ -134,7 +136,7 @@
throw 0;
}
- for (int i = 2; i < mOldHeaderList.size(); i++) {
+ for (size_t i = 2; i < mOldHeaderList.size(); i++) {
if (i != locCommentNo) {
//debugLog<<"Adding another ehader..."<<endl;
@@ -143,7 +145,7 @@
}
}
- for (int i = 1; i < mNewHeaderList.size(); i++) {
+ for (size_t i = 1; i < mNewHeaderList.size(); i++) {
//Loop through the new headers and make sure the flags are set right.
if (i != mNewHeaderList.size() -1) {
//Clear the first bit
@@ -165,9 +167,9 @@
}
void FLACHeaderTweaker::deleteOldHeaders() {
- int locSize = mOldHeaderList.size();
+ size_t locSize = mOldHeaderList.size();
//debugLog<<"Num old headers... = "<<locSize<<endl;
- for (int i = 0; i < locSize; i++) {
+ for (size_t i = 0; i < locSize; i++) {
delete mOldHeaderList[i];
}
//debugLog<<"Post old delete loop..."<<endl;
@@ -176,9 +178,9 @@
}
void FLACHeaderTweaker::deleteNewHeaders() {
- int locSize = mNewHeaderList.size();
+ size_t locSize = mNewHeaderList.size();
//debugLog<<"Num new headers... = "<<locSize<<endl;
- for (int i = 0; i < locSize; i++) {
+ for (size_t i = 0; i < locSize; i++) {
delete mNewHeaderList[i];
}
//debugLog<<"Post new delete loop"<<endl;
@@ -187,7 +189,7 @@
}
unsigned long FLACHeaderTweaker::numNewHeaders() {
- return mNewHeaderList.size();
+ return (unsigned long)mNewHeaderList.size();
}
OggPacket* FLACHeaderTweaker::getHeader(unsigned long inHeaderNo) {
if (inHeaderNo < mNewHeaderList.size() ) {
Modified: trunk/oggdsf/src/tests/testCMMLParser/testCMMLParser.cpp
===================================================================
--- trunk/oggdsf/src/tests/testCMMLParser/testCMMLParser.cpp 2005-01-07 14:23:32 UTC (rev 8656)
+++ trunk/oggdsf/src/tests/testCMMLParser/testCMMLParser.cpp 2005-01-07 15:24:46 UTC (rev 8657)
@@ -82,6 +82,45 @@
}
+bool testCMMLClone(wstring inFilename)
+{
+ CMMLParser locParser;
+
+ C_CMMLDoc locDoc;
+ bool locWasOK = locParser.parseDocFromFile(inFilename, &locDoc);
+
+ wcout<<L"Trying to parse "<<inFilename<<endl;
+
+
+ if (locWasOK) {
+ wstring locDocStr = locDoc.toString();
+
+ wcout<<endl<<L"Original doc to string..."<<endl;
+ wcout<<locDocStr<<endl;
+
+ C_CMMLDoc* clonedDoc = locDoc.clone();
+
+ wcout<<endl<<endl<<L"Cloned version of doc to string"<<endl;
+
+ wstring locCloneDocStr = clonedDoc->toString();
+
+ wcout<<locCloneDocStr<<endl<<endl;
+
+ if (locCloneDocStr == locDocStr) {
+ wcout<<L"Output matches... SUCESS"<<endl;
+
+ } else {
+ wcout<<L"FAILED CLONE TEST !!"<<endl;
+
+ }
+ } else {
+ wcout<<"*** PARSE FAILED ***"<<endl;
+ }
+
+ return locWasOK;
+
+}
+
int __cdecl _tmain(int argc, _TCHAR* argv[])
{
//Valid minimal
@@ -154,13 +193,14 @@
wstring cmml_5 = L"<blue><red>random stuff</red><green>But still valid XML</green></blue>";
testCMMLRootParse(cmml_5);
- int x;
- cin>>x;
wstring file_1 = L"G:\\Media\\Music Vid\\guru.cmml";
testCMMLFileParse(file_1);
+ cout<<"---------------------------------------------------"<<endl;
+ wstring file_2 = L"G:\\Media\\Music Vid\\guru.cmml";
+ testCMMLClone(file_2);
return 0;
More information about the commits
mailing list