[xiph-commits] r7949 - in trunk/oggdsf/src/lib/codecs/flac:
filters/dsfFLACEncoder libs/libFLACHelper
illiminable at motherfish-iii.xiph.org
illiminable at motherfish-iii.xiph.org
Sat Oct 9 08:36:56 PDT 2004
Author: illiminable
Date: 2004-10-09 08:36:55 -0700 (Sat, 09 Oct 2004)
New Revision: 7949
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/libs/libFLACHelper/FLACHeaderTweaker.cpp
trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/FLACHeaderTweaker.h
Log:
* More bug fixes to conversion from FLAC classic to new FLAC.
Modified: trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/FLACEncodeInputPin.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/FLACEncodeInputPin.cpp 2004-10-09 14:55:12 UTC (rev 7948)
+++ trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/FLACEncodeInputPin.cpp 2004-10-09 15:36:55 UTC (rev 7949)
@@ -38,12 +38,12 @@
{
- //debugLog.open("C:\\temp\\FLACenc.log", ios_base::out);
+ debugLog.open("G:\\logs\\FLACenc.log", ios_base::out);
}
FLACEncodeInputPin::~FLACEncodeInputPin(void)
{
- //debugLog.close();
+ debugLog.close();
DestroyCodec();
}
@@ -181,23 +181,28 @@
// locBuffer[5] = 1;
// locBuffer[6] = 0;
+ debugLog<<"Write CAllback.."<<endl;
LONGLONG locFrameStart = 0;
LONGLONG locFrameEnd = 0;
if (!mTweakedHeaders) {
+ debugLog<<"Still tweaking headers..."<<endl;
//Still handling headers...
unsigned char* locBuf = new unsigned char[inNumBytes];
memcpy((void*)locBuf, (const void*) inBuffer, inNumBytes);
+ debugLog<<"Sending header to tweaker..."<<endl;
FLACHeaderTweaker::eFLACAcceptHeaderResult locResult = mHeaderTweaker.acceptHeader(new OggPacket(locBuf, inNumBytes, false, false));
+ debugLog<<"Tweaker returned... "<<(int)locResult<<endl;
if (locResult == FLACHeaderTweaker::LAST_HEADER_ACCEPTED) {
+ debugLog<<"Last Header accepted..."<<endl;
//Send all the headers
mTweakedHeaders = true;
for (int i = 0; i < mHeaderTweaker.numNewHeaders(); i++) {
//Loop through firing out all the headers.
+ debugLog<<"Sending new header "<<i<<endl;
-
//Get a pointer to a new sample stamped with our time
IMediaSample* locSample;
HRESULT locHR = mOutputPin->GetDeliveryBuffer(&locSample, NULL, NULL, NULL);
@@ -238,8 +243,10 @@
return FLAC__STREAM_ENCODER_WRITE_STATUS_OK;
} else if (locResult == FLACHeaderTweaker::HEADER_ACCEPTED) {
//Another header added.
+ debugLog<<"Header accepted"<<endl;
return FLAC__STREAM_ENCODER_WRITE_STATUS_OK;
} else {
+ debugLog<<"Header failed..."<<endl;
return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR;
}
Modified: trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/FLACEncodeInputPin.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/FLACEncodeInputPin.h 2004-10-09 14:55:12 UTC (rev 7948)
+++ trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/FLACEncodeInputPin.h 2004-10-09 15:36:55 UTC (rev 7949)
@@ -79,7 +79,7 @@
//SpeexDecodeOutputPin* mOutputPin;
//__int64 mUptoFrame;
- //fstream debugLog;
+ fstream debugLog;
/* FishSound* mFishSound;
FishSoundInfo mFishInfo;*/
Modified: trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/FLACHeaderTweaker.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/FLACHeaderTweaker.cpp 2004-10-09 14:55:12 UTC (rev 7948)
+++ trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/FLACHeaderTweaker.cpp 2004-10-09 15:36:55 UTC (rev 7949)
@@ -5,32 +5,45 @@
: mSeenAllHeaders(false)
{
+ debugLog.open("G:\\logs\\flactweaker.log", ios_base::out);
+
}
FLACHeaderTweaker::~FLACHeaderTweaker(void)
{
+ debugLog.close();
+
deleteOldHeaders();
deleteNewHeaders();
}
FLACHeaderTweaker::eFLACAcceptHeaderResult FLACHeaderTweaker::acceptHeader(OggPacket* inHeader) {
+ debugLog<<endl<<"Accepting header.."<<endl;
+ debugLog<<inHeader->toPackDumpString()<<endl;
const unsigned char MORE_HEADERS_MASK = 128;
if (!mSeenAllHeaders) {
+ debugLog<<"Still tweaking... adding to old list..."<<endl;
+
mOldHeaderList.push_back(inHeader);
if ((inHeader->packetData()[0] & MORE_HEADERS_MASK) != 0) {
+ debugLog<<"This is the last header..."<<endl;
//Last header
mSeenAllHeaders = true;
if (createNewHeaderList()) {
+ debugLog<<"Create new headers FAILED"<<endl;
return LAST_HEADER_ACCEPTED;
} else {
+ debugLog<<"Create new headers OK"<<endl;
return HEADER_ERROR;
}
} else {
+ debugLog<<"Still need more ehaders..."<<endl;
//Still more headers to come...
return HEADER_ACCEPTED;
}
} else {
+ debugLog<<"All headers already seen"<<endl;
return ALL_HEADERS_ALREADY_SEEN;
}
@@ -38,8 +51,9 @@
bool FLACHeaderTweaker::createNewHeaderList() {
+ debugLog<<"Create new header list method"<<endl;
-
+ debugLog<<"Filling first pack"<<endl;
unsigned char* locFirstPackBuff = new unsigned char[51];
locFirstPackBuff[0] = '\177';
locFirstPackBuff[1] = 'F';
@@ -55,10 +69,12 @@
locFirstPackBuff[11] = 'a';
locFirstPackBuff[12] = 'C';
+ debugLog<<"Copying in packet data"<<endl;
memcpy((void*)(locFirstPackBuff + 13), (const void*) mOldHeaderList[1]->packetData(), 38);
mNewHeaderList.empty();
mNewHeaderList.clear();
+ debugLog<<"Putting first header into new list"<<endl;
mNewHeaderList.push_back(new OggPacket(locFirstPackBuff, 51, false, false));
locFirstPackBuff = NULL;
@@ -68,8 +84,10 @@
//Start at 2, 0 is just fLaC, 1 is the stream info
for (int i = 2; i < mOldHeaderList.size(); i++) {
//Loop through to find the comment packet...
- if ( (( (mOldHeaderList[i]->packetData()[0]) << 1) >> 1) == 4) {
+ debugLog<<"Scanning old header "<<i<<endl;
+ if ( ((mOldHeaderList[i]->packetData()[0]) & 127) == 4) {
//It's the comment packet.
+ debugLog<<"Found a comment packet..."<<endl;
locFoundComment = true;
locCommentNo = i;
mNewHeaderList.push_back(mOldHeaderList[i]->clone());
@@ -77,12 +95,15 @@
}
if (locFoundComment != true) {
+ debugLog<<"No comments present... FATALITY !"<<endl;
//Maybe make one... for now bail out !
throw 0;
}
for (int i = 2; i < mOldHeaderList.size(); i++) {
- if (i != locFoundComment) {
+
+ if (i != locCommentNo) {
+ debugLog<<"Adding another ehader..."<<endl;
//If it's not the comment packet we already added, put it in the list.
mNewHeaderList.push_back(mOldHeaderList[i]->clone());
}
@@ -92,13 +113,16 @@
//Loop through the new headers and make sure the flags are set right.
if (i != mNewHeaderList.size() -1) {
//Clear the first bit
+ debugLog<<"Clearing header bit "<<i<<endl;
mNewHeaderList[i]->packetData()[0] = mNewHeaderList[i]->packetData()[0] & 127;
} else {
+ debugLog<<"Setting header bit "<<i<<endl;
//Set the first bit on the last header
mNewHeaderList[i]->packetData()[0] = mNewHeaderList[i]->packetData()[0] | 128;
}
}
+ debugLog<<"Deleting old headers..."<<endl;
deleteOldHeaders();
return true;
Modified: trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/FLACHeaderTweaker.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/FLACHeaderTweaker.h 2004-10-09 14:55:12 UTC (rev 7948)
+++ trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/FLACHeaderTweaker.h 2004-10-09 15:36:55 UTC (rev 7949)
@@ -2,6 +2,7 @@
#include "dllstuff.h"
#include "OggPacket.h"
#include <vector>
+#include <fstream>
using namespace std;
class FLACHeaderTweaker
{
@@ -30,5 +31,6 @@
vector<OggPacket*> mNewHeaderList;
+ fstream debugLog;
bool mSeenAllHeaders;
};
More information about the commits
mailing list