Skip to content

Commit

Permalink
Merge branch 'zcaliptium-vorbis-replace'
Browse files Browse the repository at this point in the history
  • Loading branch information
SLAwww committed Apr 3, 2016
2 parents e07e08d + f697fcc commit 5b4c0ab
Show file tree
Hide file tree
Showing 97 changed files with 66,468 additions and 63 deletions.
27 changes: 27 additions & 0 deletions Sources/All.sln
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,15 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WorldEditor", "WorldEditor\
{AC040397-6FEA-E9B2-2B28-5BB08E1607A1} = {AC040397-6FEA-E9B2-2B28-5BB08E1607A1}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libogg", "libogg\libogg_dynamic.vcxproj", "{15CBFEFF-7965-41F5-B4E2-21E8795C9159}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libvorbisfile", "libvorbis\libvorbisfile_dynamic.vcxproj", "{CEBDE98B-A6AA-46E6-BC79-FAAF823DB9EC}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libvorbis", "libvorbis\libvorbis_dynamic.vcxproj", "{3A214E06-B95E-4D61-A291-1F8DF2EC10FD}"
ProjectSection(ProjectDependencies) = postProject
{15CBFEFF-7965-41F5-B4E2-21E8795C9159} = {15CBFEFF-7965-41F5-B4E2-21E8795C9159}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Expand Down Expand Up @@ -199,6 +208,24 @@ Global
{DC47DA88-14E2-0634-61C5-7CEEC46A45C2}.Release|Win32.Build.0 = Release|Win32
{DC47DA88-14E2-0634-61C5-7CEEC46A45C2}.Template|Win32.ActiveCfg = Template|Win32
{DC47DA88-14E2-0634-61C5-7CEEC46A45C2}.Template|Win32.Build.0 = Template|Win32
{15CBFEFF-7965-41F5-B4E2-21E8795C9159}.Debug|Win32.ActiveCfg = Debug|Win32
{15CBFEFF-7965-41F5-B4E2-21E8795C9159}.Debug|Win32.Build.0 = Debug|Win32
{15CBFEFF-7965-41F5-B4E2-21E8795C9159}.Release|Win32.ActiveCfg = Release|Win32
{15CBFEFF-7965-41F5-B4E2-21E8795C9159}.Release|Win32.Build.0 = Release|Win32
{15CBFEFF-7965-41F5-B4E2-21E8795C9159}.Template|Win32.ActiveCfg = Release|Win32
{15CBFEFF-7965-41F5-B4E2-21E8795C9159}.Template|Win32.Build.0 = Release|Win32
{CEBDE98B-A6AA-46E6-BC79-FAAF823DB9EC}.Debug|Win32.ActiveCfg = Debug|Win32
{CEBDE98B-A6AA-46E6-BC79-FAAF823DB9EC}.Debug|Win32.Build.0 = Debug|Win32
{CEBDE98B-A6AA-46E6-BC79-FAAF823DB9EC}.Release|Win32.ActiveCfg = Release|Win32
{CEBDE98B-A6AA-46E6-BC79-FAAF823DB9EC}.Release|Win32.Build.0 = Release|Win32
{CEBDE98B-A6AA-46E6-BC79-FAAF823DB9EC}.Template|Win32.ActiveCfg = Release|Win32
{CEBDE98B-A6AA-46E6-BC79-FAAF823DB9EC}.Template|Win32.Build.0 = Release|Win32
{3A214E06-B95E-4D61-A291-1F8DF2EC10FD}.Debug|Win32.ActiveCfg = Debug|Win32
{3A214E06-B95E-4D61-A291-1F8DF2EC10FD}.Debug|Win32.Build.0 = Debug|Win32
{3A214E06-B95E-4D61-A291-1F8DF2EC10FD}.Release|Win32.ActiveCfg = Release|Win32
{3A214E06-B95E-4D61-A291-1F8DF2EC10FD}.Release|Win32.Build.0 = Release|Win32
{3A214E06-B95E-4D61-A291-1F8DF2EC10FD}.Template|Win32.ActiveCfg = Release|Win32
{3A214E06-B95E-4D61-A291-1F8DF2EC10FD}.Template|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
8 changes: 7 additions & 1 deletion Sources/Engine/Engine.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
<ProgramDataBaseFileName>.\Debug\</ProgramDataBaseFileName>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<DisableSpecificWarnings>4603;4996;4812;4333</DisableSpecificWarnings>
<AdditionalIncludeDirectories>..\libvorbis\include\;..\libogg\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Midl>
<SuppressStartupBanner>true</SuppressStartupBanner>
Expand Down Expand Up @@ -124,6 +125,8 @@
<GenerateMapFile>true</GenerateMapFile>
<IgnoreSpecificDefaultLibraries>libci.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
<AdditionalLibraryDirectories>
</AdditionalLibraryDirectories>
</Link>
<CustomBuildStep>
<Command>copy Debug\$(TargetName).dll $(SolutionDir)..\Bin\Debug\ &gt;nul
Expand Down Expand Up @@ -155,6 +158,7 @@ copy Debug\$(TargetName).lib $(SolutionDir)..\Bin\Debug\ &gt;nul</Command>
<ObjectFileName>.\Release\</ObjectFileName>
<ProgramDataBaseFileName>.\Release\</ProgramDataBaseFileName>
<DisableSpecificWarnings>4603;4996;4812;4333</DisableSpecificWarnings>
<AdditionalIncludeDirectories>..\libvorbis\include\;..\libogg\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Midl>
<SuppressStartupBanner>true</SuppressStartupBanner>
Expand Down Expand Up @@ -182,6 +186,8 @@ copy Debug\$(TargetName).lib $(SolutionDir)..\Bin\Debug\ &gt;nul</Command>
<GenerateMapFile>true</GenerateMapFile>
<IgnoreSpecificDefaultLibraries>libci.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
<AdditionalLibraryDirectories>
</AdditionalLibraryDirectories>
</Link>
<CustomBuildStep>
<Command>copy Release\$(TargetName).dll $(SolutionDir)..\Bin\ &gt;nul
Expand Down Expand Up @@ -778,6 +784,7 @@ copy Release\$(TargetName).lib $(SolutionDir)..\Bin\ &gt;nul</Command>
<ClInclude Include="Sound\al_functions.h" />
<ClInclude Include="Sound\DSound.h" />
<ClInclude Include="Sound\eax.h" />
<ClInclude Include="Sound\ov_functions.h" />
<ClInclude Include="Sound\SoundData.h" />
<ClInclude Include="Sound\SoundDecoder.h" />
<ClInclude Include="Sound\SoundLibrary.h" />
Expand Down Expand Up @@ -895,7 +902,6 @@ copy Release\$(TargetName).lib $(SolutionDir)..\Bin\ &gt;nul</Command>
<ClInclude Include="CurrentVersion.h" />
<ClInclude Include="Engine.h" />
<ClInclude Include="GameShell.h" />
<ClInclude Include="Sound\ov_functions.h" />
<ClInclude Include="StdH.h" />
</ItemGroup>
<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions Sources/Engine/Engine.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -1356,9 +1356,6 @@
<ClInclude Include="GameShell.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Sound\ov_functions.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="StdH.h">
<Filter>Header Files</Filter>
</ClInclude>
Expand All @@ -1368,6 +1365,9 @@
<ClInclude Include="GameAgent\MSLegacy.h">
<Filter>Header Files\GameAgent Headers</Filter>
</ClInclude>
<ClInclude Include="Sound\ov_functions.h">
<Filter>Header Files\Sound Headers</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="Base\CTString.inl">
Expand Down
71 changes: 13 additions & 58 deletions Sources/Engine/Sound/SoundDecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,53 +85,19 @@ class CDecodeData_MPEG {


// ------------------------------------ Ogg Vorbis

//#include <vorbis\vorbisfile.h> // we define needed stuff ourselves, and ignore the rest
#include <vorbis\vorbisfile.h> // we define needed stuff ourselves, and ignore the rest

// vorbis vars
extern BOOL _bOVEnabled = FALSE;
static HINSTANCE _hOV = NULL;

#define OV_FALSE -1
#define OV_EOF -2
#define OV_HOLE -3

#define OV_EREAD -128
#define OV_EFAULT -129
#define OV_EIMPL -130
#define OV_EINVAL -131
#define OV_ENOTVORBIS -132
#define OV_EBADHEADER -133
#define OV_EVERSION -134
#define OV_ENOTAUDIO -135
#define OV_EBADPACKET -136
#define OV_EBADLINK -137
#define OV_ENOSEEK -138

// vorbis types
typedef __int64 ogg_int64_t;
typedef struct {
size_t (*read_func) (void *ptr, size_t size, size_t nmemb, void *datasource);
int (*seek_func) (void *datasource, ogg_int64_t offset, int whence);
int (*close_func) (void *datasource);
long (*tell_func) (void *datasource);
} ov_callbacks;

struct OggVorbis_File {
// don't wanna know whats inside
UBYTE dummy[2048]; // last time checked, the actual size was 720 (ogg vorbis version 1.0rc1)
};
struct vorbis_info {
int version;
int channels;
long rate;

long bitrate_upper;
long bitrate_nominal;
long bitrate_lower;

// don't want to know the rest...
//..................
class CDecodeData_OGG {
public:
FILE *ogg_fFile; // the stdio file that ogg is in
SLONG ogg_slOffset; // offset where the ogg starts in the file (!=0 for oggs in zip)
SLONG ogg_slSize; // size of ogg in the file (!=filesize for oggs in zip)
OggVorbis_File *ogg_vfVorbisFile; // the decoder file
WAVEFORMATEX ogg_wfeFormat; // format of sound
};

// define vorbis function pointers
Expand All @@ -157,15 +123,6 @@ static void OV_ClearFunctionPointers(void) {
#undef DLLFUNCTION
}

class CDecodeData_OGG {
public:
FILE *ogg_fFile; // the stdio file that ogg is in
SLONG ogg_slOffset; // offset where the ogg starts in the file (!=0 for oggs in zip)
SLONG ogg_slSize; // size of ogg in the file (!=filesize for oggs in zip)
OggVorbis_File *ogg_vfVorbisFile; // the decoder file
WAVEFORMATEX ogg_wfeFormat; // format of sound
};

// ogg file reading callbacks
//

Expand Down Expand Up @@ -237,21 +194,21 @@ void CSoundDecoder::InitPlugins(void)
// load vorbis
if (_hOV==NULL) {
#ifndef NDEBUG
#define VORBISLIB "vorbisfile_d.dll"
#define VORBISLIB "libvorbisfile.dll"
#else
#define VORBISLIB "vorbisfile.dll"
#define VORBISLIB "libvorbisfile.dll"
#endif
_hOV = ::LoadLibraryA(VORBISLIB);
}
if( _hOV == NULL) {
ThrowF_t(TRANS("Cannot load vorbisfile.dll."));
ThrowF_t(TRANS("Cannot load libvorbisfile.dll."));
}
// prepare function pointers
OV_SetFunctionPointers_t();

// if all successful, enable mpx playing
_bOVEnabled = TRUE;
CPrintF(TRANS(" vorbisfile.dll loaded, ogg playing enabled\n"));
CPrintF(TRANS(" libvorbisfile.dll loaded, ogg playing enabled\n"));

} catch (char *strError) {
CPrintF(TRANS("OGG playing disabled: %s\n"), strError);
Expand Down Expand Up @@ -314,6 +271,7 @@ CSoundDecoder::CSoundDecoder(const CTFileName &fnm)
if (!_bOVEnabled) {
return;
}

sdc_pogg = new CDecodeData_OGG;
sdc_pogg->ogg_fFile = NULL;
sdc_pogg->ogg_vfVorbisFile = NULL;
Expand Down Expand Up @@ -559,9 +517,6 @@ void CSoundDecoder::Reset(void)
if (sdc_pmpeg!=NULL) {
palDecSeekAbs(sdc_pmpeg->mpeg_hDecoder, 0.0f);
} else if (sdc_pogg!=NULL) {
/* !!!! seeking is evil with vorbisfile 1.0RC2
pov_time_seek(sdc_pogg->ogg_vfVorbisFile, 0.0f);
*/
// so instead, we reinit
pov_clear(sdc_pogg->ogg_vfVorbisFile);
fseek(sdc_pogg->ogg_fFile, sdc_pogg->ogg_slOffset, SEEK_SET);
Expand Down
2 changes: 1 addition & 1 deletion Sources/Engine/Sound/ov_functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ DLLFUNCTION( OVF, int, ov_open, (FILE *f, OggVorbis_File *vf, char *initial, lon
DLLFUNCTION( OVF, int, ov_open_callbacks, (void *datasource, OggVorbis_File *vf, char *initial, long ibytes, ov_callbacks callbacks), 32,0);
DLLFUNCTION( OVF, long, ov_read, (OggVorbis_File *vf,char *buffer,int length, int bigendianp,int word,int sgned,int *bitstream), 28,0);
DLLFUNCTION( OVF, vorbis_info *, ov_info, (OggVorbis_File *vf,int link), 8,0);
DLLFUNCTION( OVF, int, ov_time_seek, (OggVorbis_File *vf, double pos), 12,0);
DLLFUNCTION( OVF, int, ov_time_seek, (OggVorbis_File *vf, double pos), 12,0);
7 changes: 7 additions & 0 deletions Sources/libogg/AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Monty <monty@xiph.org>
Greg Maxwell <greg@xiph.org>
Ralph Giles <giles@xiph.org>
Cristian Adam <cristian.adam@gmail.com>
Tim Terriberry <tterribe@xiph.org>

and the rest of the Xiph.Org Foundation.
88 changes: 88 additions & 0 deletions Sources/libogg/CHANGES
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
Version 1.3.2 (2014 May 27)

* Fix an bug in oggpack_writecopy().

Version 1.3.1 (2013 May 12)

* Guard against very large packets.
* Respect the configure --docdir override.
* Documentation fixes.
* More Windows build fixes.

Version 1.3.0 (2011 August 4)

* Add ogg_stream_flush_fill() call
This produces longer packets on flush, similar to
what ogg_stream_pageout_fill() does for single pages.
* Windows build fixes

Version 1.2.2 (2010 December 07)

* Build fix (types correction) for Mac OS X
* Update win32 project files to Visual Studio 2008
* ogg_stream_pageout_fill documentation fix

Version 1.2.1 (2010 November 01)

* Various build updates (see SVN)
* Add ogg_stream_pageout_fill() to API to allow applications
greater explicit flexibility in page sizing.
* Documentation updates including multiplexing description,
terminology and API (incl. ogg_packet_clear(),
ogg_stream_pageout_fill())
* Correct possible buffer overwrite in stream encoding on 32 bit
when a single packet exceed 250MB.
* Correct read-buffer overrun [without side effects] under
similar circumstances.
* Update unit testing to work properly with new page spill
heuristic.

Version 1.2.0 (2010 March 25)

* Alter default flushing behavior to span less often and use larger page
sizes when packet sizes are large.
* Build fixes for additional compilers
* Documentation updates

Version 1.1.4 (2009 June 24)

* New async error reporting mechanism. Calls made after a fatal error are
now safely handled in the event an error code is ignored
* Added allocation checks useful to some embedded applications
* fix possible read past end of buffer when reading 0 bits
* Updates to API documentation
* Build fixes

Version 1.1.3 (2005 November 27)

* Correct a bug in the granulepos field of pages where no packet ends
* New VS2003 and XCode builds, minor fixes to other builds
* documentation fixes and cleanup

Version 1.1.2 (2004 September 23)

* fix a bug with multipage packet assembly after seek

Version 1.1.1 (2004 September 12)

* various bugfixes
* important bugfix for 64-bit platforms
* various portability fixes
* autotools cleanup from Thomas Vander Stichele
* Symbian OS build support from Colin Ward at CSIRO
* new multiplexed Ogg stream documentation

Version 1.1 (2003 November 17)

* big-endian bitpacker routines for Theora
* various portability fixes
* improved API documenation
* RFC 3533 documentation of the format by Silvia Pfeiffer at CSIRO
* RFC 3534 documentation of the application/ogg mime-type by Linus Walleij

Version 1.0 (2002 July 19)

* First stable release
* little-endian bitpacker routines for Vorbis
* basic Ogg bitstream sync and coding support

28 changes: 28 additions & 0 deletions Sources/libogg/COPYING
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Copyright (c) 2002, Xiph.org Foundation

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 the Xiph.org Foundation nor the names of its
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 FOUNDATION
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.
Loading

0 comments on commit 5b4c0ab

Please sign in to comment.