[xiph-commits] r11885 - in trunk/oggdsf/src/lib/codecs/flac:
filters/dsfFLACEncoder libs/libFLACHelper
illiminable at svn.xiph.org
illiminable at svn.xiph.org
Thu Oct 5 06:06:02 PDT 2006
Author: illiminable
Date: 2006-10-05 06:05:11 -0700 (Thu, 05 Oct 2006)
New Revision: 11885
Modified:
trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/FLACEncodeFilter.cpp
trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/FLACEncodeFilter.h
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/FLACEncodeOutputPin.cpp
trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/FLACEncodeOutputPin.h
trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/flacencoderdllstuff.cpp
trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/flacencoderdllstuff.h
trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/FLACHeaderTweaker.cpp
trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/FLACHeaderTweaker.h
trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/FLACMetadataSplitter.cpp
trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/FLACMetadataSplitter.h
trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/FLACPushDecoder.cpp
trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/FLACPushDecoder.h
Log:
* Tidy up in flac encoder
Modified: trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/FLACEncodeFilter.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/FLACEncodeFilter.cpp 2006-10-05 05:19:58 UTC (rev 11884)
+++ trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/FLACEncodeFilter.cpp 2006-10-05 13:05:11 UTC (rev 11885)
@@ -1,5 +1,5 @@
//===========================================================================
-//Copyright (C) 2003, 2004 Zentaro Kavanagh
+//Copyright (C) 2003-2006 Zentaro Kavanagh
//
//Redistribution and use in source and binary forms, with or without
//modification, are permitted provided that the following conditions
Modified: trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/FLACEncodeFilter.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/FLACEncodeFilter.h 2006-10-05 05:19:58 UTC (rev 11884)
+++ trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/FLACEncodeFilter.h 2006-10-05 13:05:11 UTC (rev 11885)
@@ -1,5 +1,5 @@
//===========================================================================
-//Copyright (C) 2003, 2004 Zentaro Kavanagh
+//Copyright (C) 2003-2006 Zentaro Kavanagh
//
//Redistribution and use in source and binary forms, with or without
//modification, are permitted provided that the following conditions
@@ -59,11 +59,9 @@
static CUnknown* WINAPI FLACEncodeFilter::CreateInstance(LPUNKNOWN pUnk, HRESULT *pHr);
protected:
- //PURE VIRTUAL IMPLEMENTATION
+ //Implementation from AbstractTransformFilter
virtual bool ConstructPins();
- //TODO::: This shouldn'y be here... use the getter setters.
sFLACFormatBlock mFLACFormatBlock;
-
};
Modified: trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/FLACEncodeInputPin.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/FLACEncodeInputPin.cpp 2006-10-05 05:19:58 UTC (rev 11884)
+++ trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/FLACEncodeInputPin.cpp 2006-10-05 13:05:11 UTC (rev 11885)
@@ -1,5 +1,5 @@
//===========================================================================
-//Copyright (C) 2003, 2004 Zentaro Kavanagh
+//Copyright (C) 2003-2006 Zentaro Kavanagh
//
//Redistribution and use in source and binary forms, with or without
//modification, are permitted provided that the following conditions
@@ -32,8 +32,16 @@
#include "stdafx.h"
#include "FLACencodeinputpin.h"
-FLACEncodeInputPin::FLACEncodeInputPin(AbstractTransformFilter* inParentFilter, CCritSec* inFilterLock, AbstractTransformOutputPin* inOutputPin, vector<CMediaType*> inAcceptableMediaTypes)
- : AbstractTransformInputPin(inParentFilter, inFilterLock, inOutputPin, NAME("FLACEncodeInputPin"), L"PCM In", inAcceptableMediaTypes)
+FLACEncodeInputPin::FLACEncodeInputPin( AbstractTransformFilter* inParentFilter
+ , CCritSec* inFilterLock
+ , AbstractTransformOutputPin* inOutputPin
+ , vector<CMediaType*> inAcceptableMediaTypes)
+ : AbstractTransformInputPin( inParentFilter
+ , inFilterLock
+ , inOutputPin
+ , NAME("FLACEncodeInputPin")
+ , L"PCM In"
+ , inAcceptableMediaTypes)
, mTweakedHeaders(false)
, mBegun(false)
, mWaveFormat(NULL)
@@ -52,7 +60,8 @@
//PURE VIRTUALS
-HRESULT FLACEncodeInputPin::TransformData(unsigned char* inBuf, long inNumBytes) {
+HRESULT FLACEncodeInputPin::TransformData(unsigned char* inBuf, long inNumBytes)
+{
if (mBegun == false) {
@@ -116,7 +125,11 @@
-::FLAC__StreamEncoderWriteStatus FLACEncodeInputPin::write_callback(const FLAC__byte inBuffer[], unsigned inNumBytes, unsigned inNumSamples, unsigned inCurrentFrame) {
+::FLAC__StreamEncoderWriteStatus FLACEncodeInputPin::write_callback( const FLAC__byte inBuffer[]
+ , unsigned inNumBytes
+ , unsigned inNumSamples
+ , unsigned inCurrentFrame)
+{
//This is called back with encoded data after raw data is fed in by stream_encoder_process or
// stream_encoder_process_interleaved.
@@ -128,15 +141,14 @@
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;
@@ -165,6 +177,7 @@
SetSampleParams(locSample, mHeaderTweaker.getHeader(i)->packetSize(), &locFrameStart, &locFrameEnd);
{
+ //Is this right? Shouldn't it be the stream lock?
CAutoLock locLock(m_pLock);
@@ -194,6 +207,8 @@
}
locFrameStart = mUptoFrame;
+
+ //TODO::: Redunant?
if (inNumSamples != 0) {
mUptoFrame += inNumSamples;
}
@@ -248,7 +263,8 @@
//Ignore it.
}
-STDMETHODIMP FLACEncodeInputPin::EndOfStream(void) {
+STDMETHODIMP FLACEncodeInputPin::EndOfStream(void)
+{
//Catch the end of stream so we can send a finish signal.
finish(); //Tell flac we are done so it can flush
return AbstractTransformInputPin::EndOfStream(); //Call the base class.
Modified: trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/FLACEncodeInputPin.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/FLACEncodeInputPin.h 2006-10-05 05:19:58 UTC (rev 11884)
+++ trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/FLACEncodeInputPin.h 2006-10-05 13:05:11 UTC (rev 11885)
@@ -1,5 +1,5 @@
//===========================================================================
-//Copyright (C) 2003, 2004 Zentaro Kavanagh
+//Copyright (C) 2003-2006 Zentaro Kavanagh
//
//Redistribution and use in source and binary forms, with or without
//modification, are permitted provided that the following conditions
@@ -49,14 +49,18 @@
, public Stream
{
public:
- FLACEncodeInputPin(AbstractTransformFilter* inParentFilter, CCritSec* inFilterLock, AbstractTransformOutputPin* inOutputPin, vector<CMediaType*> inAcceptableMediaTypes);
+ FLACEncodeInputPin( AbstractTransformFilter* inParentFilter
+ , CCritSec* inFilterLock
+ , AbstractTransformOutputPin* inOutputPin
+ , vector<CMediaType*> inAcceptableMediaTypes);
virtual ~FLACEncodeInputPin(void);
- //static int FLACEncodeInputPin::FLACEncoded (FishSound* inFishSound, unsigned char* inPacketData, long inNumBytes, void* inThisPointer) ;
//PURE VIRTUALS from Flac Encoder
- virtual ::FLAC__StreamEncoderWriteStatus write_callback(const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame);
+ virtual ::FLAC__StreamEncoderWriteStatus write_callback( const FLAC__byte buffer[]
+ , unsigned bytes
+ , unsigned samples
+ , unsigned current_frame);
virtual void metadata_callback(const ::FLAC__StreamMetadata *metadata);
-
virtual HRESULT SetMediaType(const CMediaType* inMediaType);
@@ -78,6 +82,4 @@
__int64 mUptoFrame;
- //fstream debugLog;
-
};
Modified: trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/FLACEncodeOutputPin.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/FLACEncodeOutputPin.cpp 2006-10-05 05:19:58 UTC (rev 11884)
+++ trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/FLACEncodeOutputPin.cpp 2006-10-05 13:05:11 UTC (rev 11885)
@@ -1,5 +1,5 @@
//===========================================================================
-//Copyright (C) 2003, 2004 Zentaro Kavanagh
+//Copyright (C) 2003-2006 Zentaro Kavanagh
//
//Redistribution and use in source and binary forms, with or without
//modification, are permitted provided that the following conditions
Modified: trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/FLACEncodeOutputPin.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/FLACEncodeOutputPin.h 2006-10-05 05:19:58 UTC (rev 11884)
+++ trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/FLACEncodeOutputPin.h 2006-10-05 13:05:11 UTC (rev 11885)
@@ -1,5 +1,5 @@
//===========================================================================
-//Copyright (C) 2003, 2004 Zentaro Kavanagh
+//Copyright (C) 2003-2006 Zentaro Kavanagh
//
//Redistribution and use in source and binary forms, with or without
//modification, are permitted provided that the following conditions
@@ -43,14 +43,11 @@
public:
friend class FLACEncodeInputPin;
- FLACEncodeOutputPin(FLACEncodeFilter* inParentFilter, CCritSec* inFilterLock, vector<CMediaType*> inAcceptableMediaTypes);
+ FLACEncodeOutputPin( FLACEncodeFilter* inParentFilter
+ , CCritSec* inFilterLock
+ , vector<CMediaType*> inAcceptableMediaTypes);
virtual ~FLACEncodeOutputPin(void);
- ////PURE VIRTUAL IMPLEMENTATION
- //virtual bool FillFormatBuffer(BYTE* inFormatBuffer);
- //virtual unsigned long FormatBufferSize();
-
-
protected:
virtual HRESULT CreateAndFillFormatBuffer(CMediaType* outMediaType, int inPosition);
};
Modified: trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/flacencoderdllstuff.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/flacencoderdllstuff.cpp 2006-10-05 05:19:58 UTC (rev 11884)
+++ trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/flacencoderdllstuff.cpp 2006-10-05 13:05:11 UTC (rev 11885)
@@ -1,5 +1,5 @@
//===========================================================================
-//Copyright (C) 2003, 2004 Zentaro Kavanagh
+//Copyright (C) 2003-2006 Zentaro Kavanagh
//
//Redistribution and use in source and binary forms, with or without
//modification, are permitted provided that the following conditions
Modified: trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/flacencoderdllstuff.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/flacencoderdllstuff.h 2006-10-05 05:19:58 UTC (rev 11884)
+++ trunk/oggdsf/src/lib/codecs/flac/filters/dsfFLACEncoder/flacencoderdllstuff.h 2006-10-05 13:05:11 UTC (rev 11885)
@@ -1,5 +1,5 @@
//===========================================================================
-//Copyright (C) 2003, 2004 Zentaro Kavanagh
+//Copyright (C) 2003-2006 Zentaro Kavanagh
//
//Redistribution and use in source and binary forms, with or without
//modification, are permitted provided that the following conditions
Modified: trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/FLACHeaderTweaker.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/FLACHeaderTweaker.cpp 2006-10-05 05:19:58 UTC (rev 11884)
+++ trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/FLACHeaderTweaker.cpp 2006-10-05 13:05:11 UTC (rev 11885)
@@ -1,5 +1,5 @@
//===========================================================================
-//Copyright (C) 2004 Zentaro Kavanagh
+//Copyright (C) 2004-2006 Zentaro Kavanagh
//
//Redistribution and use in source and binary forms, with or without
//modification, are permitted provided that the following conditions
@@ -51,44 +51,31 @@
//debugLog.close();
}
-FLACHeaderTweaker::eFLACAcceptHeaderResult FLACHeaderTweaker::acceptHeader(OggPacket* inHeader) {
- //debugLog<<endl<<"Accepting header.."<<endl;
- //debugLog<<inHeader->toPackDumpString()<<endl;
+FLACHeaderTweaker::eFLACAcceptHeaderResult FLACHeaderTweaker::acceptHeader(OggPacket* inHeader)
+{
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 OK"<<endl;
return LAST_HEADER_ACCEPTED;
} else {
- //debugLog<<"Create new headers FAILED"<<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;
}
-
}
bool FLACHeaderTweaker::createNewHeaderList()
{
- //debugLog<<"Create new header list method"<<endl;
- //debugLog<<"Filling first pack"<<endl;
-
unsigned char* locFirstPacketBuffur = new unsigned char[51];
locFirstPacketBuffur[0] = '\177';
locFirstPacketBuffur[1] = 'F';
@@ -106,12 +93,10 @@
locFirstPacketBuffur[11] = 'a';
locFirstPacketBuffur[12] = 'C';
- //debugLog<<"Copying in packet data"<<endl;
memcpy((void*)(locFirstPacketBuffur + 13), (const void*) mOldHeaderList[1]->packetData(), 38);
mNewHeaderList.empty();
mNewHeaderList.clear();
- //debugLog<<"Putting first header into new list"<<endl;
mNewHeaderList.push_back(new OggPacket(locFirstPacketBuffur, 51, false, false));
locFirstPacketBuffur = NULL;
@@ -121,10 +106,8 @@
//Start at 2, 0 is just fLaC, 1 is the stream info
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) {
//It's the comment packet.
- //debugLog<<"Found a comment packet..."<<endl;
locFoundComment = true;
locCommentNo = (int)i;
mNewHeaderList.push_back(mOldHeaderList[i]->clone());
@@ -141,7 +124,6 @@
//**** WARNING ::: Leave this unless you check it !
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());
}
@@ -151,49 +133,45 @@
//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;
-
}
-void FLACHeaderTweaker::deleteOldHeaders() {
+void FLACHeaderTweaker::deleteOldHeaders()
+{
size_t locSize = mOldHeaderList.size();
- //debugLog<<"Num old headers... = "<<locSize<<endl;
for (size_t i = 0; i < locSize; i++) {
delete mOldHeaderList[i];
}
- //debugLog<<"Post old delete loop..."<<endl;
mOldHeaderList.clear();
-
}
-void FLACHeaderTweaker::deleteNewHeaders() {
+void FLACHeaderTweaker::deleteNewHeaders()
+{
size_t locSize = mNewHeaderList.size();
- //debugLog<<"Num new headers... = "<<locSize<<endl;
for (size_t i = 0; i < locSize; i++) {
delete mNewHeaderList[i];
}
- //debugLog<<"Post new delete loop"<<endl;
mNewHeaderList.clear();
}
-unsigned long FLACHeaderTweaker::numNewHeaders() {
+unsigned long FLACHeaderTweaker::numNewHeaders()
+{
return (unsigned long)mNewHeaderList.size();
}
-OggPacket* FLACHeaderTweaker::getHeader(unsigned long inHeaderNo) {
+
+OggPacket* FLACHeaderTweaker::getHeader(unsigned long inHeaderNo)
+{
if (inHeaderNo < mNewHeaderList.size() ) {
return mNewHeaderList[inHeaderNo]->clone();
} else {
Modified: trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/FLACHeaderTweaker.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/FLACHeaderTweaker.h 2006-10-05 05:19:58 UTC (rev 11884)
+++ trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/FLACHeaderTweaker.h 2006-10-05 13:05:11 UTC (rev 11885)
@@ -1,5 +1,5 @@
//===========================================================================
-//Copyright (C) 2004 Zentaro Kavanagh
+//Copyright (C) 2004-2006 Zentaro Kavanagh
//
//Redistribution and use in source and binary forms, with or without
//modification, are permitted provided that the following conditions
Modified: trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/FLACMetadataSplitter.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/FLACMetadataSplitter.cpp 2006-10-05 05:19:58 UTC (rev 11884)
+++ trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/FLACMetadataSplitter.cpp 2006-10-05 13:05:11 UTC (rev 11885)
@@ -1,5 +1,5 @@
//===========================================================================
-//Copyright (C) 2004 Zentaro Kavanagh
+//Copyright (C) 2004-2006 Zentaro Kavanagh
//
//Redistribution and use in source and binary forms, with or without
//modification, are permitted provided that the following conditions
@@ -35,30 +35,27 @@
FLACMetadataSplitter::FLACMetadataSplitter(void)
: mMetadataBlock(NULL)
{
- //debugLog.open("G:\\logs\\flacsplitter.log", ios_base::out);
}
FLACMetadataSplitter::~FLACMetadataSplitter(void)
{
delete mMetadataBlock;
//Delete stuff !!
- //debugLog.close();
}
-StampedOggPacket* FLACMetadataSplitter::convertToStampedPacket(OggPacket* inPacket) {
+StampedOggPacket* FLACMetadataSplitter::convertToStampedPacket(OggPacket* inPacket)
+{
//Convert the old packet to the new one.
//This function deletes the incoming packet... and transfers the buffer directly into
// the stamped packet without a memcpy
- //debugLog<<"Convert packet..."<<endl;
StampedOggPacket* locStamped = new StampedOggPacket(inPacket->packetData(), inPacket->packetSize(), false, false, 0,0,StampedOggPacket::OGG_END_ONLY);
//Ensure when we delete the old packet, it doesn't delete it's buffer
inPacket->setPacketData(NULL);
delete inPacket;
- //debugLog<<"Post delete..."<<endl;
return locStamped;
}
-bool FLACMetadataSplitter::loadMetadata(OggPacket* inMetadata) {
- //debugLog<<"Load Metadata"<<endl;
+bool FLACMetadataSplitter::loadMetadata(OggPacket* inMetadata)
+{
delete mMetadataBlock;
mMetadataBlock = inMetadata;
return splitMetadata();
@@ -66,7 +63,8 @@
unsigned long FLACMetadataSplitter::numHeaders() {
return mHeaderTweaker.numNewHeaders();
}
-StampedOggPacket* FLACMetadataSplitter::getHeader(unsigned long inIndex) {
+StampedOggPacket* FLACMetadataSplitter::getHeader(unsigned long inIndex)
+{
if (inIndex < mHeaderTweaker.numNewHeaders()) {
return (FLACMetadataSplitter::convertToStampedPacket(mHeaderTweaker.getHeader(inIndex)));
} else {
@@ -74,36 +72,31 @@
}
}
-void FLACMetadataSplitter::emptyList() {
+void FLACMetadataSplitter::emptyList()
+{
}
-bool FLACMetadataSplitter::splitMetadata() {
- //debugLog<<"Splitmetadata"<<endl;
- //emptyList();
- //OggPacket* locPacket = NULL;
- //unsigned char* locBuff = NULL;
+bool FLACMetadataSplitter::splitMetadata()
+{
if (mMetadataBlock == NULL) {
return false;
} else {
if (verifyCodecID()) {
- //debugLog<<"Start adding packets..."<<endl;
addCodecIdent();
addStreamInfo();
addOtherHeaders();
- //debugLog<<"Done adding packets..."<<endl;
//TODO::: Should really verify this !
return true;
} else {
return false;
}
-
}
-
}
-bool FLACMetadataSplitter::addOtherHeaders() {
+bool FLACMetadataSplitter::addOtherHeaders()
+{
//debugLog<<"Add other headers..."<<endl;
unsigned long locUpto = 42;
unsigned long locMetaSize = mMetadataBlock->packetSize();
@@ -112,9 +105,7 @@
unsigned long locPacketSize = 0;
OggPacket* locPacket = NULL;
- //debugLog<<"Metadata size = "<<locMetaSize<<endl;
while ( locUpto < locMetaSize) {
- //debugLog<<"Add others loop... upto = "<<locUpto<<endl;
for (int i = 1; i < 4; i++) {
locPacketSize <<=8;
locPacketSize += locSourceBuff[locUpto+i];
@@ -127,8 +118,6 @@
memcpy((void*)locNewBuff, (const void*)(locSourceBuff + locUpto), locPacketSize);
locPacket = new OggPacket(locNewBuff, locPacketSize, false, false);
- //debugLog<<"Adding other packet..."<<endl;
- //debugLog<<locPacket->toPackDumpString()<<endl;
mHeaderTweaker.acceptHeader(locPacket);
locPacket = NULL;
@@ -139,20 +128,18 @@
return true;
}
-bool FLACMetadataSplitter::addStreamInfo() {
- //debugLog<<"addstreaminfo..."<<endl;
+bool FLACMetadataSplitter::addStreamInfo()
+{
OggPacket* locPacket = NULL;
unsigned char* locBuff = new unsigned char[38];
memcpy((void*)locBuff, (const void*)(mMetadataBlock->packetData()+4), 38);
locPacket = new OggPacket(locBuff, 38, false, false); //No need to delete
- //debugLog<<"Adding stream info packet..."<<endl;
- //debugLog<<locPacket->toPackDumpString()<<endl;
mHeaderTweaker.acceptHeader(locPacket);
return true;
}
-bool FLACMetadataSplitter::addCodecIdent() {
- //debugLog<<"Add codec ident"<<endl;
+bool FLACMetadataSplitter::addCodecIdent()
+{
OggPacket* locPacket = NULL;
unsigned char* locBuff = new unsigned char[4];
locBuff[0] = 'f';
@@ -164,7 +151,8 @@
return true;
}
-bool FLACMetadataSplitter::verifyCodecID() {
+bool FLACMetadataSplitter::verifyCodecID()
+{
if ((strncmp((char*)mMetadataBlock->packetData(), "fLaC\000\000\000\042", 8)) == 0) {
//debugLog<<"Codec verified"<<endl;
return true;
Modified: trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/FLACMetadataSplitter.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/FLACMetadataSplitter.h 2006-10-05 05:19:58 UTC (rev 11884)
+++ trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/FLACMetadataSplitter.h 2006-10-05 13:05:11 UTC (rev 11885)
@@ -1,5 +1,5 @@
//===========================================================================
-//Copyright (C) 2004 Zentaro Kavanagh
+//Copyright (C) 2004-2006 Zentaro Kavanagh
//
//Redistribution and use in source and binary forms, with or without
//modification, are permitted provided that the following conditions
Modified: trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/FLACPushDecoder.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/FLACPushDecoder.cpp 2006-10-05 05:19:58 UTC (rev 11884)
+++ trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/FLACPushDecoder.cpp 2006-10-05 13:05:11 UTC (rev 11885)
@@ -1,3 +1,33 @@
+//===========================================================================
+//Copyright (C) 2004-2006 Zentaro Kavanagh
+//
+//Redistribution and use in source and binary forms, with or without
+//modification, are permitted provided that the following conditions
+//are met:
+//
+//- Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+//- Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+//- Neither the name of Zentaro Kavanagh nor the names of contributors
+// may be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+//``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+//PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ORGANISATION OR
+//CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+//EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+//PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+//LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+//NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+//SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//===========================================================================
#include "stdafx.h"
#include ".\flacpushdecoder.h"
@@ -113,15 +143,8 @@
//Must interleave and convert sample size.
for(unsigned long i = 0; i < locNumFrames; i++) {
for (unsigned long j = 0; j < mNumChannels; j++) {
-
-
- //No clipping required for ints
- //FIX:::Take out the unnescessary variable.
+
tempLong = inBuffer[j][i];
- //Convert 32 bit to 16 bit
-
- //FIX::: Why on earth are you dividing by 2 ? It does not make sense !
- //tempInt = (signed short)(tempLong/2);
tempInt = (signed short)(tempLong);
Modified: trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/FLACPushDecoder.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/FLACPushDecoder.h 2006-10-05 05:19:58 UTC (rev 11884)
+++ trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/FLACPushDecoder.h 2006-10-05 13:05:11 UTC (rev 11885)
@@ -1,3 +1,33 @@
+//===========================================================================
+//Copyright (C) 2004-2006 Zentaro Kavanagh
+//
+//Redistribution and use in source and binary forms, with or without
+//modification, are permitted provided that the following conditions
+//are met:
+//
+//- Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+//- Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+//- Neither the name of Zentaro Kavanagh nor the names of contributors
+// may be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+//``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+//LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+//PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ORGANISATION OR
+//CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+//EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+//PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+//LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+//NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+//SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//===========================================================================
#pragma once
#include <libOOOgg/dllstuff.h>
#include <libOOOgg/StampedOggPacket.h>
More information about the commits
mailing list