[xiph-commits] r8007 - in trunk/oggdsf:
src/lib/codecs/flac/libs/libFLACHelper website
illiminable at motherfish-iii.xiph.org
illiminable at motherfish-iii.xiph.org
Fri Oct 15 02:23:40 PDT 2004
Author: illiminable
Date: 2004-10-15 02:23:39 -0700 (Fri, 15 Oct 2004)
New Revision: 8007
Added:
trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/FLACMetadataSplitter.cpp
trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/FLACMetadataSplitter.h
Modified:
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/libFLACHelper.vcproj
trunk/oggdsf/website/index.html
Log:
* Added a new class to parse a flac metadata block into it's component parts and transform it to the new format.
Modified: trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/FLACHeaderTweaker.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/FLACHeaderTweaker.cpp 2004-10-15 06:58:04 UTC (rev 8006)
+++ trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/FLACHeaderTweaker.cpp 2004-10-15 09:23:39 UTC (rev 8007)
@@ -1,3 +1,34 @@
+//===========================================================================
+//Copyright (C) 2004 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 ".\flacheadertweaker.h"
Modified: trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/FLACHeaderTweaker.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/FLACHeaderTweaker.h 2004-10-15 06:58:04 UTC (rev 8006)
+++ trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/FLACHeaderTweaker.h 2004-10-15 09:23:39 UTC (rev 8007)
@@ -1,3 +1,34 @@
+//===========================================================================
+//Copyright (C) 2004 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 "dllstuff.h"
#include "OggPacket.h"
Added: trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/FLACMetadataSplitter.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/FLACMetadataSplitter.cpp 2004-10-15 06:58:04 UTC (rev 8006)
+++ trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/FLACMetadataSplitter.cpp 2004-10-15 09:23:39 UTC (rev 8007)
@@ -0,0 +1,143 @@
+//===========================================================================
+//Copyright (C) 2004 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 ".\flacmetadatasplitter.h"
+
+FLACMetadataSplitter::FLACMetadataSplitter(void)
+ : mMetadataBlock(NULL)
+{
+}
+
+FLACMetadataSplitter::~FLACMetadataSplitter(void)
+{
+}
+
+
+bool FLACMetadataSplitter::loadMetadata(OggPacket* inMetadata) {
+ delete mMetadataBlock;
+ mMetadataBlock = inMetadata;
+ return splitMetadata();
+}
+unsigned long FLACMetadataSplitter::numHeaders() {
+ return mHeaderTweaker.numNewHeaders();
+}
+StampedOggPacket* FLACMetadataSplitter::getHeader(unsigned long inIndex) {
+ if (inIndex < mHeaderTweaker.numNewHeaders()) {
+ return reinterpret_cast<StampedOggPacket*>(mHeaderTweaker.getHeader(inIndex));
+ } else {
+ return NULL;
+ }
+}
+
+void FLACMetadataSplitter::emptyList() {
+
+
+}
+bool FLACMetadataSplitter::splitMetadata() {
+ //emptyList();
+ //OggPacket* locPacket = NULL;
+ unsigned char* locBuff = NULL;
+ if (mMetadataBlock == NULL) {
+ return false;
+ } else {
+ if (verifyCodecID()) {
+ addCodecIdent();
+ addStreamInfo();
+ addOtherHeaders();
+ } else {
+ return false;
+ }
+
+ }
+
+}
+
+bool FLACMetadataSplitter::addOtherHeaders() {
+ unsigned long locUpto = 42;
+ unsigned long locMetaSize = mMetadataBlock->packetSize();
+ unsigned char* locSourceBuff = mMetadataBlock->packetData(); //Don't delete !
+ unsigned char* locNewBuff = NULL;
+ unsigned long locPacketSize = 0;
+ StampedOggPacket* locPacket = NULL;
+
+ while ( locUpto < locMetaSize) {
+ for (int i = 0; i < 3; i++) {
+ locPacketSize <<=8;
+ locPacketSize += locSourceBuff[locUpto+i];
+ }
+
+ locUpto += 4;
+
+ locNewBuff = new unsigned char[locPacketSize];
+ memcpy((void*)locNewBuff, (const void*)locSourceBuff, locPacketSize);
+
+ locPacket = new StampedOggPacket(locNewBuff, locPacketSize, false, false, 0, 0, StampedOggPacket::OGG_END_ONLY);
+
+ mHeaderTweaker.acceptHeader(locPacket);
+ locPacket = NULL;
+
+ locUpto += locPacketSize;
+
+
+ }
+
+ return true;
+}
+bool FLACMetadataSplitter::addStreamInfo() {
+ StampedOggPacket* locPacket = NULL;
+ unsigned char* locBuff = new unsigned char[38];
+
+ memcpy((void*)locBuff, (const void*)(mMetadataBlock->packetData()+4), 38);
+ locPacket = new StampedOggPacket(locBuff, 38, false, false, 0, 0, StampedOggPacket::OGG_END_ONLY);
+ mHeaderTweaker.acceptHeader(locPacket);
+ return true;
+}
+bool FLACMetadataSplitter::addCodecIdent() {
+ StampedOggPacket* locPacket = NULL;
+ unsigned char* locBuff = new unsigned char[4];
+ locBuff[0] = 'f';
+ locBuff[1] = 'L';
+ locBuff[2] = 'a';
+ locBuff[3] = 'C';
+ locPacket = new StampedOggPacket(locBuff, 4, false, false, 0, 0, StampedOggPacket::OGG_END_ONLY);
+ mHeaderTweaker.acceptHeader(locPacket);
+ return true;
+}
+
+bool FLACMetadataSplitter::verifyCodecID() {
+ if ((strncmp((char*)mMetadataBlock->packetData(), "fLaC\000\000\000\042", 8)) == 0) {
+ return true;
+ } else {
+ return false;
+ }
+
+}
\ No newline at end of file
Added: trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/FLACMetadataSplitter.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/FLACMetadataSplitter.h 2004-10-15 06:58:04 UTC (rev 8006)
+++ trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/FLACMetadataSplitter.h 2004-10-15 09:23:39 UTC (rev 8007)
@@ -0,0 +1,55 @@
+//===========================================================================
+//Copyright (C) 2004 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 "dllstuff.h"
+#include "StampedOggPacket.h"
+#include "FLACHeaderTweaker.h"
+class FLACMetadataSplitter
+{
+public:
+ FLACMetadataSplitter(void);
+ ~FLACMetadataSplitter(void);
+
+ bool loadMetadata(OggPacket* inMetadata);
+ unsigned long numHeaders();
+ StampedOggPacket* getHeader(unsigned long inIndex);
+protected:
+ OggPacket* mMetadataBlock;
+ FLACHeaderTweaker mHeaderTweaker;
+
+ void emptyList();
+ bool addOtherHeaders();
+ bool addStreamInfo();
+ bool verifyCodecID();
+ bool addCodecIdent();
+
+ bool splitMetadata();
+};
Modified: trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/libFLACHelper.vcproj
===================================================================
--- trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/libFLACHelper.vcproj 2004-10-15 06:58:04 UTC (rev 8006)
+++ trunk/oggdsf/src/lib/codecs/flac/libs/libFLACHelper/libFLACHelper.vcproj 2004-10-15 09:23:39 UTC (rev 8007)
@@ -105,6 +105,9 @@
RelativePath=".\FLACHeaderTweaker.cpp">
</File>
<File
+ RelativePath=".\FLACMetadataSplitter.cpp">
+ </File>
+ <File
RelativePath=".\stdafx.cpp">
<FileConfiguration
Name="Debug|Win32">
@@ -128,6 +131,9 @@
RelativePath=".\FLACHeaderTweaker.h">
</File>
<File
+ RelativePath=".\FLACMetadataSplitter.h">
+ </File>
+ <File
RelativePath=".\stdafx.h">
</File>
</Filter>
Modified: trunk/oggdsf/website/index.html
===================================================================
--- trunk/oggdsf/website/index.html 2004-10-15 06:58:04 UTC (rev 8006)
+++ trunk/oggdsf/website/index.html 2004-10-15 09:23:39 UTC (rev 8007)
@@ -236,7 +236,7 @@
</FONT>
<li>Can't seek in WMP 6.4 (Thanks RadicalEd)</li>
<li>You can't delete .ogg files in explorer because they are locked/in use. To fix this until the next version, run regedit and go to the registry key [HKEY_CLASSES_ROOT\.OGG\ShellEx]
- and delete it. This is left over from the Tobis filters, if you ever reinstall them, even if you uninstall, you'll have to do this again. (Thanks RadicalEd for reporting this)</li>
+ and delete it. This is left over from the Tobias filters, if you ever reinstall them, even if you uninstall, you'll have to do this again. (Thanks RadicalEd for reporting this)</li>
<li>Video files encoded with non-integral framerates (ie 29.97) lose sync, due to rounding bug (Thanks RadicalEd)</li>
<li>Doesn't play the new ogg flac files produced by FLAC 1.1.1</li>
<li>FLAC can't be muxed in a multi-stream file sucessfully (Thanks Bond)</li>
More information about the commits
mailing list