[xiph-commits] r8156 - in trunk/oggdsf: sln/oggdsf_all src/tools src/tools/oggChainSplitter website

illiminable at motherfish-iii.xiph.org illiminable at motherfish-iii.xiph.org
Tue Nov 2 03:04:36 PST 2004


Author: illiminable
Date: 2004-11-02 03:04:35 -0800 (Tue, 02 Nov 2004)
New Revision: 8156

Added:
   trunk/oggdsf/src/tools/oggChainSplitter/
   trunk/oggdsf/src/tools/oggChainSplitter/ReadMe.txt
   trunk/oggdsf/src/tools/oggChainSplitter/oggChainSplitter.cpp
   trunk/oggdsf/src/tools/oggChainSplitter/oggChainSplitter.vcproj
   trunk/oggdsf/src/tools/oggChainSplitter/stdafx.cpp
   trunk/oggdsf/src/tools/oggChainSplitter/stdafx.h
Modified:
   trunk/oggdsf/sln/oggdsf_all/oggdsf_all.sln
   trunk/oggdsf/website/index.html
Log:
* Crude and simlpe utility for breaking up chained files and renaming the parts to an artist_title format.

Modified: trunk/oggdsf/sln/oggdsf_all/oggdsf_all.sln
===================================================================
--- trunk/oggdsf/sln/oggdsf_all/oggdsf_all.sln	2004-11-02 01:49:58 UTC (rev 8155)
+++ trunk/oggdsf/sln/oggdsf_all/oggdsf_all.sln	2004-11-02 11:04:35 UTC (rev 8156)
@@ -1218,6 +1218,13 @@
 		{2DA569EC-3E22-4BC9-A242-C7A56EB9C6F4} = {2DA569EC-3E22-4BC9-A242-C7A56EB9C6F4}
 	EndProjectSection
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "oggChainSplitter", "..\..\src\tools\oggChainSplitter\oggChainSplitter.vcproj", "{F3ECBC6B-ED14-4E76-8513-1BCDCF8F412E}"
+	ProjectSection(ProjectDependencies) = postProject
+		{223ACC19-608E-4E1B-A054-067F0CACB272} = {223ACC19-608E-4E1B-A054-067F0CACB272}
+		{DC4D86E2-72C1-4995-8FB1-0F08655E620A} = {DC4D86E2-72C1-4995-8FB1-0F08655E620A}
+		{2DA569EC-3E22-4BC9-A242-C7A56EB9C6F4} = {2DA569EC-3E22-4BC9-A242-C7A56EB9C6F4}
+	EndProjectSection
+EndProject
 Global
 	GlobalSection(SolutionConfiguration) = preSolution
 		Debug = Debug
@@ -2417,6 +2424,22 @@
 		{43DEE58F-CEC6-49B4-BC06-3D28978BAB63}.Release_SSE.Build.0 = Release|Win32
 		{43DEE58F-CEC6-49B4-BC06-3D28978BAB63}.Release_SSE2.ActiveCfg = Release|Win32
 		{43DEE58F-CEC6-49B4-BC06-3D28978BAB63}.Release_SSE2.Build.0 = Release|Win32
+		{F3ECBC6B-ED14-4E76-8513-1BCDCF8F412E}.Debug.ActiveCfg = Debug|Win32
+		{F3ECBC6B-ED14-4E76-8513-1BCDCF8F412E}.Debug.Build.0 = Debug|Win32
+		{F3ECBC6B-ED14-4E76-8513-1BCDCF8F412E}.Debug Unicode.ActiveCfg = Debug|Win32
+		{F3ECBC6B-ED14-4E76-8513-1BCDCF8F412E}.Debug Unicode.Build.0 = Debug|Win32
+		{F3ECBC6B-ED14-4E76-8513-1BCDCF8F412E}.MakeFile.ActiveCfg = Release|Win32
+		{F3ECBC6B-ED14-4E76-8513-1BCDCF8F412E}.MakeFile.Build.0 = Release|Win32
+		{F3ECBC6B-ED14-4E76-8513-1BCDCF8F412E}.Release.ActiveCfg = Release|Win32
+		{F3ECBC6B-ED14-4E76-8513-1BCDCF8F412E}.Release.Build.0 = Release|Win32
+		{F3ECBC6B-ED14-4E76-8513-1BCDCF8F412E}.Release Unicode.ActiveCfg = Release|Win32
+		{F3ECBC6B-ED14-4E76-8513-1BCDCF8F412E}.Release Unicode.Build.0 = Release|Win32
+		{F3ECBC6B-ED14-4E76-8513-1BCDCF8F412E}.Release_NoDotNET.ActiveCfg = Release|Win32
+		{F3ECBC6B-ED14-4E76-8513-1BCDCF8F412E}.Release_NoDotNET.Build.0 = Release|Win32
+		{F3ECBC6B-ED14-4E76-8513-1BCDCF8F412E}.Release_SSE.ActiveCfg = Release|Win32
+		{F3ECBC6B-ED14-4E76-8513-1BCDCF8F412E}.Release_SSE.Build.0 = Release|Win32
+		{F3ECBC6B-ED14-4E76-8513-1BCDCF8F412E}.Release_SSE2.ActiveCfg = Release|Win32
+		{F3ECBC6B-ED14-4E76-8513-1BCDCF8F412E}.Release_SSE2.Build.0 = Release|Win32
 	EndGlobalSection
 	GlobalSection(SolutionItems) = postSolution
 	EndGlobalSection

Added: trunk/oggdsf/src/tools/oggChainSplitter/ReadMe.txt
===================================================================
--- trunk/oggdsf/src/tools/oggChainSplitter/ReadMe.txt	2004-11-02 01:49:58 UTC (rev 8155)
+++ trunk/oggdsf/src/tools/oggChainSplitter/ReadMe.txt	2004-11-02 11:04:35 UTC (rev 8156)
@@ -0,0 +1,32 @@
+========================================================================
+    CONSOLE APPLICATION : oggChainSplitter Project Overview
+========================================================================
+
+AppWizard has created this oggChainSplitter application for you.  
+This file contains a summary of what you will find in each of the files that
+make up your oggChainSplitter application.
+
+
+oggChainSplitter.vcproj
+    This is the main project file for VC++ projects generated using an Application Wizard. 
+    It contains information about the version of Visual C++ that generated the file, and 
+    information about the platforms, configurations, and project features selected with the
+    Application Wizard.
+
+oggChainSplitter.cpp
+    This is the main application source file.
+
+/////////////////////////////////////////////////////////////////////////////
+Other standard files:
+
+StdAfx.h, StdAfx.cpp
+    These files are used to build a precompiled header (PCH) file
+    named oggChainSplitter.pch and a precompiled types file named StdAfx.obj.
+
+/////////////////////////////////////////////////////////////////////////////
+Other notes:
+
+AppWizard uses "TODO:" comments to indicate parts of the source code you
+should add to or customize.
+
+/////////////////////////////////////////////////////////////////////////////

Added: trunk/oggdsf/src/tools/oggChainSplitter/oggChainSplitter.cpp
===================================================================
--- trunk/oggdsf/src/tools/oggChainSplitter/oggChainSplitter.cpp	2004-11-02 01:49:58 UTC (rev 8155)
+++ trunk/oggdsf/src/tools/oggChainSplitter/oggChainSplitter.cpp	2004-11-02 11:04:35 UTC (rev 8156)
@@ -0,0 +1,186 @@
+//===========================================================================
+//Copyright (C) 2003, 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.
+//===========================================================================
+
+// oggChainSplitter.cpp : Defines the entry point for the console application.
+//
+
+#include "stdafx.h"
+
+#include <libOOOgg.h>
+#include <dllstuff.h>
+#include "VorbisComments.h"
+#include <iostream>
+#include <fstream>
+#include <vector>
+
+unsigned long bytePos = 0;
+bool needComments = false;
+bool inStream = false;
+fstream outFile;
+string inFileName;
+string outFileName;
+VorbisComments currentComment;
+unsigned long chainCount = 0;
+bool isOK = true;
+
+bool renameCurrentFile() {
+	cout<<"Renaming File..."<<endl;
+	if ((currentComment.numUserComments() > 0)) {
+		vector<SingleVorbisComment*> locArtists = currentComment.getCommentsByKey("artist");
+		vector<SingleVorbisComment*> locTitles = currentComment.getCommentsByKey("title");
+		string locArtist = "Unknown_Artist";
+		string locTitle = "Unknown_Title";
+
+		cout<<"Basics done..."<<endl;
+		if (locArtists.size() > 0) {
+			locArtist = locArtists[0]->value();
+		}
+
+		if (locTitles.size() > 0) {
+			locTitle = locTitles[0]->value();
+		}
+
+		string locPartialName = locArtist+"_"+locTitle;
+
+		size_t locSlashPos = outFileName.find_last_of('\\');
+		if (locSlashPos == string::npos) {
+			locSlashPos == -1;
+		}
+		size_t locDotPos = outFileName.find_last_of('.');
+
+		cout<<"Before substitution..."<<endl;
+		string locNewName = outFileName.substr(0,locSlashPos + 1) + locPartialName + outFileName.substr(locDotPos);
+		cout<<"After subst."<<endl;
+		cout<<"Renaming "<<outFileName<<" to "<<locNewName<<endl;
+		MoveFile(outFileName.c_str(), locNewName.c_str());
+	}
+
+	return true;
+
+}
+bool writePage(OggPage* inOggPage) {
+	//cout << "Writing page "<<endl;
+	unsigned char* pageBuff = inOggPage->createRawPageData();
+	//cout <<pageBuff<<endl;
+	outFile.write((char*)pageBuff, inOggPage->pageSize());
+	//cout<<"Written..."<<endl;
+	delete[] pageBuff;
+	//cout<<"After delete"<<endl;
+	return true;
+}
+//This will be called by the callback
+bool pageCB(OggPage* inOggPage) {
+	bool retVal = false;
+	if (inStream == false) {
+		//Not in the middle of a stream
+		if (inOggPage->header()->isBOS()) {
+			//Case 1 : Not in the middle of a stream and we found a BOS... start a new file.
+			char* locNum = new char[32];
+			itoa(chainCount, locNum, 10);
+			outFileName = inFileName + "__" + locNum + ".ogg";
+			cout<<"New output file "<<outFileName<<endl;
+		
+			delete locNum;
+			locNum = NULL;
+			outFile.open(outFileName.c_str(), ios_base::out | ios_base::binary);
+			retVal = writePage(inOggPage);
+			inStream = retVal;
+			needComments = true;
+			
+		} else {
+			//Case 2 : Not in middle of stream and not BOS - ERROR
+			cout << "BOS Page expected at "<<bytePos<<endl;
+			retVal = false;
+		}
+
+	} else {
+		//In the middle of a stream
+		if (inOggPage->header()->isEOS()) {
+			//Case 3 : It's the last page of the current stream... write it out and switch state.
+			retVal = writePage(inOggPage);
+			outFile.close();
+			renameCurrentFile();
+			cout<<"Closing file number "<<chainCount<<endl;
+			chainCount++;
+			inStream = false;
+			
+		} else {
+			//Case 4 : It's just a normal page write it out.
+			if (needComments) {
+				currentComment.parseOggPacket(inOggPage->getPacket(0), 7);
+			}
+			retVal = writePage(inOggPage);
+		}
+	}
+
+	isOK = retVal;
+	delete inOggPage;
+	return retVal;
+
+}
+
+
+int __cdecl _tmain(int argc, _TCHAR* argv[])
+{
+	//This program just dumps the pages out of a file in ogg format.
+	// Currently does not error checking. Check your command line carefully !
+	// USAGE :: oggChainSplitter <OggFile>
+	//
+
+	bytePos = 0;
+
+	if (argc < 2) {
+		cout<<"Usage : oggChainSplitter <filename>"<<endl;
+		cout<<"Only splits vorbis chained streams... careful with command line... no error checks"<<endl;
+	} else {
+		cout << "Starting..."<<endl;
+		OggDataBuffer testOggBuff;
+		
+		testOggBuff.registerStaticCallback(&pageCB);
+
+		fstream testFile;
+		inFileName = argv[1];
+		testFile.open(argv[1], ios_base::in | ios_base::binary);
+		
+		const unsigned short BUFF_SIZE = 8092;
+		char* locBuff = new char[BUFF_SIZE];
+		while ((!testFile.eof()) && (isOK)) {
+			testFile.read(locBuff, BUFF_SIZE);
+			unsigned long locBytesRead = testFile.gcount();
+    		testOggBuff.feed((const unsigned char*)locBuff, locBytesRead);
+		}
+
+		delete[] locBuff;
+	}
+
+	return 0;
+}
+

Added: trunk/oggdsf/src/tools/oggChainSplitter/oggChainSplitter.vcproj
===================================================================
--- trunk/oggdsf/src/tools/oggChainSplitter/oggChainSplitter.vcproj	2004-11-02 01:49:58 UTC (rev 8155)
+++ trunk/oggdsf/src/tools/oggChainSplitter/oggChainSplitter.vcproj	2004-11-02 11:04:35 UTC (rev 8156)
@@ -0,0 +1,157 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="7.10"
+	Name="oggChainSplitter"
+	ProjectGUID="{F3ECBC6B-ED14-4E76-8513-1BCDCF8F412E}"
+	Keyword="Win32Proj">
+	<Platforms>
+		<Platform
+			Name="Win32"/>
+	</Platforms>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="Debug"
+			IntermediateDirectory="Debug"
+			ConfigurationType="1"
+			CharacterSet="2">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\lib\core\ogg\libOOOgg;..\..\lib\helper\libilliCore;..\..\lib\core\ogg\libVorbisComment"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+				MinimalRebuild="TRUE"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="3"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="4"
+				CallingConvention="2"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(OutDir)/oggChainSplitter.exe"
+				LinkIncremental="2"
+				GenerateDebugInformation="TRUE"
+				ProgramDatabaseFile="$(OutDir)/oggChainSplitter.pdb"
+				SubSystem="1"
+				TargetMachine="1"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="Release"
+			IntermediateDirectory="Release"
+			ConfigurationType="1"
+			CharacterSet="2">
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="..\..\lib\core\ogg\libOOOgg;..\..\lib\helper\libilliCore;..\..\lib\core\ogg\libVorbisComment"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+				RuntimeLibrary="4"
+				UsePrecompiledHeader="3"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="3"
+				CallingConvention="2"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(OutDir)/oggChainSplitter.exe"
+				LinkIncremental="1"
+				GenerateDebugInformation="TRUE"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
+			<File
+				RelativePath=".\oggChainSplitter.cpp">
+			</File>
+			<File
+				RelativePath=".\stdafx.cpp">
+				<FileConfiguration
+					Name="Debug|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="1"/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="1"/>
+				</FileConfiguration>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
+			<File
+				RelativePath=".\stdafx.h">
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
+		</Filter>
+		<File
+			RelativePath=".\ReadMe.txt">
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Added: trunk/oggdsf/src/tools/oggChainSplitter/stdafx.cpp
===================================================================
--- trunk/oggdsf/src/tools/oggChainSplitter/stdafx.cpp	2004-11-02 01:49:58 UTC (rev 8155)
+++ trunk/oggdsf/src/tools/oggChainSplitter/stdafx.cpp	2004-11-02 11:04:35 UTC (rev 8156)
@@ -0,0 +1,8 @@
+// stdafx.cpp : source file that includes just the standard includes
+// oggChainSplitter.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file

Added: trunk/oggdsf/src/tools/oggChainSplitter/stdafx.h
===================================================================
--- trunk/oggdsf/src/tools/oggChainSplitter/stdafx.h	2004-11-02 01:49:58 UTC (rev 8155)
+++ trunk/oggdsf/src/tools/oggChainSplitter/stdafx.h	2004-11-02 11:04:35 UTC (rev 8156)
@@ -0,0 +1,13 @@
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+
+#include <iostream>
+#include <tchar.h>
+
+// TODO: reference additional headers your program requires here
+#include "windows.h"
\ No newline at end of file

Modified: trunk/oggdsf/website/index.html
===================================================================
--- trunk/oggdsf/website/index.html	2004-11-02 01:49:58 UTC (rev 8155)
+++ trunk/oggdsf/website/index.html	2004-11-02 11:04:35 UTC (rev 8156)
@@ -231,6 +231,7 @@
 </TABLE>
 </DIV>
 </FONT>
+	<li>Can't play file with names that use extended character sets (ie Japanese) (Thanks Liisachan)</li>
 	<li>Core Media Player stalls if you add more than 510 ogg files (Not sure if this is a bug with my codecs or not, as it has a problem trying to add my large mp3 directory too) (Thanks OpenSource 4ever)</li>
 	<li>Can't play files from a Windows network share drive (Thanks Hannes Kaesermann and Frazer McCormack)</li>
 	<li>Can't seek in WMP 6.4 (Thanks RadicalEd)</li>



More information about the commits mailing list