initial checkin

This commit is contained in:
chudov
2008-10-13 19:25:11 +00:00
parent 2e379c72e2
commit 36757fca7a
937 changed files with 184964 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
# libFLAC++ - Free Lossless Audio Codec library
# Copyright (C) 2002,2003,2004,2005,2006,2007,2008 Josh Coalson
#
# 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.
lib_LTLIBRARIES = libFLAC++.la
m4datadir = $(datadir)/aclocal
m4data_DATA = libFLAC++.m4
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = flac++.pc
EXTRA_DIST = \
Makefile.lite \
flac++.pc.in \
libFLAC++_dynamic.dsp \
libFLAC++_dynamic.vcproj \
libFLAC++_static.dsp \
libFLAC++_static.vcproj \
libFLAC++.m4
# see 'http://www.gnu.org/software/libtool/manual.html#Libtool-versioning' for numbering convention
libFLAC___la_LDFLAGS = -version-info 8:0:2
libFLAC___la_LIBADD = ../libFLAC/libFLAC.la
libFLAC___la_SOURCES = \
metadata.cpp \
stream_decoder.cpp \
stream_encoder.cpp

View File

@@ -0,0 +1,47 @@
# libFLAC++ - Free Lossless Audio Codec library
# Copyright (C) 2002,2003,2004,2005,2006,2007,2008 Josh Coalson
#
# 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.
#
# GNU makefile
#
topdir = ../..
LIB_NAME = libFLAC++
INCLUDES = -I$(topdir)/include
SRCS_CPP = \
metadata.cpp \
stream_decoder.cpp \
stream_encoder.cpp
include $(topdir)/build/lib.mk
# DO NOT DELETE THIS LINE -- make depend depends on it.

View File

@@ -0,0 +1,11 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: FLAC++
Description: Free Lossless Audio Codec Library (C++ API)
Version: @VERSION@
Requires: flac
Libs: -L${libdir} -lFLAC++ -lm
Cflags: -I${includedir}/FLAC++

View File

@@ -0,0 +1,117 @@
# Configure paths for libFLAC++
# "Inspired" by ogg.m4
# Caller must first run AM_PATH_LIBFLAC
dnl AM_PATH_LIBFLACPP([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
dnl Test for libFLAC++, and define LIBFLACPP_CFLAGS, LIBFLACPP_LIBS, LIBFLACPP_LIBDIR
dnl
AC_DEFUN([AM_PATH_LIBFLACPP],
[dnl
dnl Get the cflags and libraries
dnl
AC_ARG_WITH(libFLACPP,[ --with-libFLACPP=PFX Prefix where libFLAC++ is installed (optional)], libFLACPP_prefix="$withval", libFLACPP_prefix="")
AC_ARG_WITH(libFLACPP-libraries,[ --with-libFLACPP-libraries=DIR Directory where libFLAC++ library is installed (optional)], libFLACPP_libraries="$withval", libFLACPP_libraries="")
AC_ARG_WITH(libFLACPP-includes,[ --with-libFLACPP-includes=DIR Directory where libFLAC++ header files are installed (optional)], libFLACPP_includes="$withval", libFLACPP_includes="")
AC_ARG_ENABLE(libFLACPPtest, [ --disable-libFLACPPtest Do not try to compile and run a test libFLAC++ program],, enable_libFLACPPtest=yes)
if test "x$libFLACPP_libraries" != "x" ; then
LIBFLACPP_LIBDIR="$libFLACPP_libraries"
elif test "x$libFLACPP_prefix" != "x" ; then
LIBFLACPP_LIBDIR="$libFLACPP_prefix/lib"
elif test "x$prefix" != "xNONE" ; then
LIBFLACPP_LIBDIR="$libdir"
fi
LIBFLACPP_LIBS="-L$LIBFLACPP_LIBDIR -lFLAC++ $LIBFLAC_LIBS"
if test "x$libFLACPP_includes" != "x" ; then
LIBFLACPP_CFLAGS="-I$libFLACPP_includes"
elif test "x$libFLACPP_prefix" != "x" ; then
LIBFLACPP_CFLAGS="-I$libFLACPP_prefix/include"
elif test "$prefix" != "xNONE"; then
LIBFLACPP_CFLAGS=""
fi
LIBFLACPP_CFLAGS="$LIBFLACPP_CFLAGS $LIBFLAC_CFLAGS"
AC_MSG_CHECKING(for libFLAC++)
no_libFLACPP=""
if test "x$enable_libFLACPPtest" = "xyes" ; then
ac_save_CFLAGS="$CFLAGS"
ac_save_CXXFLAGS="$CXXFLAGS"
ac_save_LIBS="$LIBS"
ac_save_LD_LIBRARY_PATH="$LD_LIBRARY_PATH"
CFLAGS="$CFLAGS $LIBFLACPP_CFLAGS"
CXXFLAGS="$CXXFLAGS $LIBFLACPP_CFLAGS"
LIBS="$LIBS $LIBFLACPP_LIBS"
LD_LIBRARY_PATH="$LIBFLACPP_LIBDIR:$LIBFLAC_LIBDIR:$LD_LIBRARY_PATH"
dnl
dnl Now check if the installed libFLAC++ is sufficiently new.
dnl
rm -f conf.libFLAC++test
AC_TRY_RUN([
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <FLAC++/decoder.h>
int main ()
{
system("touch conf.libFLAC++test");
return 0;
}
],, no_libFLACPP=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
CFLAGS="$ac_save_CFLAGS"
CXXFLAGS="$ac_save_CXXFLAGS"
LIBS="$ac_save_LIBS"
LD_LIBRARY_PATH="$ac_save_LD_LIBRARY_PATH"
fi
if test "x$no_libFLACPP" = "x" ; then
AC_MSG_RESULT(yes)
ifelse([$1], , :, [$1])
else
AC_MSG_RESULT(no)
if test -f conf.libFLAC++test ; then
:
else
echo "*** Could not run libFLAC++ test program, checking why..."
CFLAGS="$CFLAGS $LIBFLACPP_CFLAGS"
CXXFLAGS="$CXXFLAGS $LIBFLACPP_CFLAGS"
LIBS="$LIBS $LIBFLACPP_LIBS"
LD_LIBRARY_PATH="$LIBFLACPP_LIBDIR:$LIBFLAC_LIBDIR:$LD_LIBRARY_PATH"
AC_TRY_LINK([
#include <stdio.h>
#include <FLAC++/decoder.h>
], [ return 0; ],
[ echo "*** The test program compiled, but did not run. This usually means"
echo "*** that the run-time linker is not finding libFLAC++ or finding the wrong"
echo "*** version of libFLAC++. If it is not finding libFLAC++, you'll need to set your"
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
echo "*** to the installed location Also, make sure you have run ldconfig if that"
echo "*** is required on your system"
echo "***"
echo "*** If you have an old version installed, it is best to remove it, although"
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
[ echo "*** The test program failed to compile or link. See the file config.log for the"
echo "*** exact error that occured. This usually means libFLAC++ was incorrectly installed"
echo "*** or that you have moved libFLAC++ since it was installed. In the latter case, you"
echo "*** may want to edit the libFLAC++-config script: $LIBFLACPP_CONFIG" ])
CFLAGS="$ac_save_CFLAGS"
CXXFLAGS="$ac_save_CXXFLAGS"
LIBS="$ac_save_LIBS"
LD_LIBRARY_PATH="$ac_save_LD_LIBRARY_PATH"
fi
LIBFLACPP_CFLAGS=""
LIBFLACPP_LIBDIR=""
LIBFLACPP_LIBS=""
ifelse([$2], , :, [$2])
fi
AC_SUBST(LIBFLACPP_CFLAGS)
AC_SUBST(LIBFLACPP_LIBDIR)
AC_SUBST(LIBFLACPP_LIBS)
rm -f conf.libFLAC++test
])

View File

@@ -0,0 +1,139 @@
# Microsoft Developer Studio Project File - Name="libFLAC++_dynamic" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=libFLAC++_dynamic - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "libFLAC++_dynamic.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "libFLAC++_dynamic.mak" CFG="libFLAC++_dynamic - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "libFLAC++_dynamic - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "libFLAC++_dynamic - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName "libFLAC++"
# PROP Scc_LocalPath "..\.."
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "libFLAC++_dynamic - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "..\..\obj\release\lib"
# PROP Intermediate_Dir "Release_dynamic"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I ".\include" /I "..\..\include" /D "NDEBUG" /D "FLACPP_API_EXPORTS" /D "_WINDOWS" /D "_WINDLL" /D "WIN32" /D "_USRDLL" /FR /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG" /d "_USRDLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
# ADD LINK32 ..\..\obj\release\lib\libFLAC.lib /nologo /subsystem:windows /dll /machine:I386 /out:"..\..\obj\release\bin/libFLAC++.dll"
!ELSEIF "$(CFG)" == "libFLAC++_dynamic - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "..\..\obj\debug\lib"
# PROP Intermediate_Dir "Debug_dynamic"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""

View File

@@ -0,0 +1,392 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Name="libFLAC++_dynamic"
ProjectGUID="{4cefbc85-c215-11db-8314-0800200c9a66}"
RootNamespace="libFLAC++_dynamic"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="..\..\obj\debug\lib"
IntermediateDirectory="Debug_dynamic"
ConfigurationType="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".\include;..\..\include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FLACPP_API_EXPORTS;DEBUG"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
DisableSpecificWarnings="4267;4996"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="..\..\obj\release\lib"
IntermediateDirectory="Release_dynamic"
ConfigurationType="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
WholeProgramOptimization="true"
AdditionalIncludeDirectories=".\include;..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FLACPP_API_EXPORTS"
RuntimeLibrary="0"
BufferSecurityCheck="false"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
DisableSpecificWarnings="4267;4996"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
LinkTimeCodeGeneration="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".\include;..\..\include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FLACPP_API_EXPORTS;DEBUG"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
DisableSpecificWarnings="4267;4996"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
WholeProgramOptimization="true"
AdditionalIncludeDirectories=".\include;..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FLACPP_API_EXPORTS"
RuntimeLibrary="0"
BufferSecurityCheck="false"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
DisableSpecificWarnings="4267;4996"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
LinkTimeCodeGeneration="1"
TargetMachine="17"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
</Filter>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\metadata.cpp"
>
</File>
<File
RelativePath=".\stream_decoder.cpp"
>
</File>
<File
RelativePath=".\stream_encoder.cpp"
>
</File>
</Filter>
<Filter
Name="Public Header Files"
>
<File
RelativePath="..\..\include\FLAC++\all.h"
>
</File>
<File
RelativePath="..\..\include\FLAC++\decoder.h"
>
</File>
<File
RelativePath="..\..\include\FLAC++\encoder.h"
>
</File>
<File
RelativePath="..\..\include\FLAC++\export.h"
>
</File>
<File
RelativePath="..\..\include\FLAC++\metadata.h"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -0,0 +1,132 @@
# Microsoft Developer Studio Project File - Name="libFLAC++_static" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=libFLAC++_static - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "libFLAC++_static.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "libFLAC++_static.mak" CFG="libFLAC++_static - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "libFLAC++_static - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "libFLAC++_static - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName "libFLAC++"
# PROP Scc_LocalPath "..\.."
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "libFLAC++_static - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "..\..\obj\release\lib"
# PROP Intermediate_Dir "Release_static"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I ".\include" /I "..\..\include" /D "FLAC__NO_DLL" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "libFLAC++_static - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "..\..\obj\debug\lib"
# PROP Intermediate_Dir "Debug_static"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c

View File

@@ -0,0 +1,338 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Name="libFLAC++_static"
ProjectGUID="{4cefbc86-c215-11db-8314-0800200c9a66}"
RootNamespace="libFLAC++_static"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="..\..\obj\debug\lib"
IntermediateDirectory="Debug_static"
ConfigurationType="4"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".\include;..\..\include"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;FLAC__NO_DLL;DEBUG"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
DisableSpecificWarnings="4267;4996"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="..\..\obj\debug\lib\$(ProjectName).lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="..\..\obj\release\lib"
IntermediateDirectory="Release_static"
ConfigurationType="4"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
WholeProgramOptimization="true"
AdditionalIncludeDirectories=".\include;..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;FLAC__NO_DLL"
RuntimeLibrary="0"
BufferSecurityCheck="false"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
DisableSpecificWarnings="4267;4996"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="..\..\obj\release\lib\$(ProjectName).lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="4"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".\include;..\..\include"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;FLAC__NO_DLL;DEBUG"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
DisableSpecificWarnings="4267;4996"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="..\..\obj\debug\lib\$(ProjectName).lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="4"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
WholeProgramOptimization="true"
AdditionalIncludeDirectories=".\include;..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;FLAC__NO_DLL"
RuntimeLibrary="0"
BufferSecurityCheck="false"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
DisableSpecificWarnings="4267;4996"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="..\..\obj\release\lib\$(ProjectName).lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
</Filter>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\metadata.cpp"
>
</File>
<File
RelativePath=".\stream_decoder.cpp"
>
</File>
<File
RelativePath=".\stream_encoder.cpp"
>
</File>
</Filter>
<Filter
Name="Public Header Files"
>
<File
RelativePath="..\..\include\FLAC++\all.h"
>
</File>
<File
RelativePath="..\..\include\FLAC++\decoder.h"
>
</File>
<File
RelativePath="..\..\include\FLAC++\encoder.h"
>
</File>
<File
RelativePath="..\..\include\FLAC++\export.h"
>
</File>
<File
RelativePath="..\..\include\FLAC++\metadata.h"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,389 @@
/* libFLAC++ - Free Lossless Audio Codec library
* Copyright (C) 2002,2003,2004,2005,2006,2007,2008 Josh Coalson
*
* 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.
*/
#include "FLAC++/decoder.h"
#include "FLAC/assert.h"
#ifdef _MSC_VER
// warning C4800: 'int' : forcing to bool 'true' or 'false' (performance warning)
#pragma warning ( disable : 4800 )
#endif
namespace FLAC {
namespace Decoder {
// ------------------------------------------------------------
//
// Stream
//
// ------------------------------------------------------------
Stream::Stream():
decoder_(::FLAC__stream_decoder_new())
{ }
Stream::~Stream()
{
if(0 != decoder_) {
(void)::FLAC__stream_decoder_finish(decoder_);
::FLAC__stream_decoder_delete(decoder_);
}
}
bool Stream::is_valid() const
{
return 0 != decoder_;
}
bool Stream::set_ogg_serial_number(long value)
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_decoder_set_ogg_serial_number(decoder_, value);
}
bool Stream::set_md5_checking(bool value)
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_decoder_set_md5_checking(decoder_, value);
}
bool Stream::set_metadata_respond(::FLAC__MetadataType type)
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_decoder_set_metadata_respond(decoder_, type);
}
bool Stream::set_metadata_respond_application(const FLAC__byte id[4])
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_decoder_set_metadata_respond_application(decoder_, id);
}
bool Stream::set_metadata_respond_all()
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_decoder_set_metadata_respond_all(decoder_);
}
bool Stream::set_metadata_ignore(::FLAC__MetadataType type)
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_decoder_set_metadata_ignore(decoder_, type);
}
bool Stream::set_metadata_ignore_application(const FLAC__byte id[4])
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_decoder_set_metadata_ignore_application(decoder_, id);
}
bool Stream::set_metadata_ignore_all()
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_decoder_set_metadata_ignore_all(decoder_);
}
Stream::State Stream::get_state() const
{
FLAC__ASSERT(is_valid());
return State(::FLAC__stream_decoder_get_state(decoder_));
}
bool Stream::get_md5_checking() const
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_decoder_get_md5_checking(decoder_);
}
FLAC__uint64 Stream::get_total_samples() const
{
FLAC__ASSERT(is_valid());
return ::FLAC__stream_decoder_get_total_samples(decoder_);
}
unsigned Stream::get_channels() const
{
FLAC__ASSERT(is_valid());
return ::FLAC__stream_decoder_get_channels(decoder_);
}
::FLAC__ChannelAssignment Stream::get_channel_assignment() const
{
FLAC__ASSERT(is_valid());
return ::FLAC__stream_decoder_get_channel_assignment(decoder_);
}
unsigned Stream::get_bits_per_sample() const
{
FLAC__ASSERT(is_valid());
return ::FLAC__stream_decoder_get_bits_per_sample(decoder_);
}
unsigned Stream::get_sample_rate() const
{
FLAC__ASSERT(is_valid());
return ::FLAC__stream_decoder_get_sample_rate(decoder_);
}
unsigned Stream::get_blocksize() const
{
FLAC__ASSERT(is_valid());
return ::FLAC__stream_decoder_get_blocksize(decoder_);
}
bool Stream::get_decode_position(FLAC__uint64 *position) const
{
FLAC__ASSERT(is_valid());
return ::FLAC__stream_decoder_get_decode_position(decoder_, position);
}
::FLAC__StreamDecoderInitStatus Stream::init()
{
FLAC__ASSERT(is_valid());
return ::FLAC__stream_decoder_init_stream(decoder_, read_callback_, seek_callback_, tell_callback_, length_callback_, eof_callback_, write_callback_, metadata_callback_, error_callback_, /*client_data=*/(void*)this);
}
::FLAC__StreamDecoderInitStatus Stream::init_ogg()
{
FLAC__ASSERT(is_valid());
return ::FLAC__stream_decoder_init_ogg_stream(decoder_, read_callback_, seek_callback_, tell_callback_, length_callback_, eof_callback_, write_callback_, metadata_callback_, error_callback_, /*client_data=*/(void*)this);
}
bool Stream::finish()
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_decoder_finish(decoder_);
}
bool Stream::flush()
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_decoder_flush(decoder_);
}
bool Stream::reset()
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_decoder_reset(decoder_);
}
bool Stream::process_single()
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_decoder_process_single(decoder_);
}
bool Stream::process_until_end_of_metadata()
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_decoder_process_until_end_of_metadata(decoder_);
}
bool Stream::process_until_end_of_stream()
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_decoder_process_until_end_of_stream(decoder_);
}
bool Stream::skip_single_frame()
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_decoder_skip_single_frame(decoder_);
}
bool Stream::seek_absolute(FLAC__uint64 sample)
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_decoder_seek_absolute(decoder_, sample);
}
::FLAC__StreamDecoderSeekStatus Stream::seek_callback(FLAC__uint64 absolute_byte_offset)
{
(void)absolute_byte_offset;
return ::FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED;
}
::FLAC__StreamDecoderTellStatus Stream::tell_callback(FLAC__uint64 *absolute_byte_offset)
{
(void)absolute_byte_offset;
return ::FLAC__STREAM_DECODER_TELL_STATUS_UNSUPPORTED;
}
::FLAC__StreamDecoderLengthStatus Stream::length_callback(FLAC__uint64 *stream_length)
{
(void)stream_length;
return ::FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED;
}
bool Stream::eof_callback()
{
return false;
}
void Stream::metadata_callback(const ::FLAC__StreamMetadata *metadata)
{
(void)metadata;
}
::FLAC__StreamDecoderReadStatus Stream::read_callback_(const ::FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data)
{
(void)decoder;
FLAC__ASSERT(0 != client_data);
Stream *instance = reinterpret_cast<Stream *>(client_data);
FLAC__ASSERT(0 != instance);
return instance->read_callback(buffer, bytes);
}
::FLAC__StreamDecoderSeekStatus Stream::seek_callback_(const ::FLAC__StreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data)
{
(void) decoder;
FLAC__ASSERT(0 != client_data);
Stream *instance = reinterpret_cast<Stream *>(client_data);
FLAC__ASSERT(0 != instance);
return instance->seek_callback(absolute_byte_offset);
}
::FLAC__StreamDecoderTellStatus Stream::tell_callback_(const ::FLAC__StreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data)
{
(void) decoder;
FLAC__ASSERT(0 != client_data);
Stream *instance = reinterpret_cast<Stream *>(client_data);
FLAC__ASSERT(0 != instance);
return instance->tell_callback(absolute_byte_offset);
}
::FLAC__StreamDecoderLengthStatus Stream::length_callback_(const ::FLAC__StreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data)
{
(void) decoder;
FLAC__ASSERT(0 != client_data);
Stream *instance = reinterpret_cast<Stream *>(client_data);
FLAC__ASSERT(0 != instance);
return instance->length_callback(stream_length);
}
FLAC__bool Stream::eof_callback_(const ::FLAC__StreamDecoder *decoder, void *client_data)
{
(void) decoder;
FLAC__ASSERT(0 != client_data);
Stream *instance = reinterpret_cast<Stream *>(client_data);
FLAC__ASSERT(0 != instance);
return instance->eof_callback();
}
::FLAC__StreamDecoderWriteStatus Stream::write_callback_(const ::FLAC__StreamDecoder *decoder, const ::FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data)
{
(void)decoder;
FLAC__ASSERT(0 != client_data);
Stream *instance = reinterpret_cast<Stream *>(client_data);
FLAC__ASSERT(0 != instance);
return instance->write_callback(frame, buffer);
}
void Stream::metadata_callback_(const ::FLAC__StreamDecoder *decoder, const ::FLAC__StreamMetadata *metadata, void *client_data)
{
(void)decoder;
FLAC__ASSERT(0 != client_data);
Stream *instance = reinterpret_cast<Stream *>(client_data);
FLAC__ASSERT(0 != instance);
instance->metadata_callback(metadata);
}
void Stream::error_callback_(const ::FLAC__StreamDecoder *decoder, ::FLAC__StreamDecoderErrorStatus status, void *client_data)
{
(void)decoder;
FLAC__ASSERT(0 != client_data);
Stream *instance = reinterpret_cast<Stream *>(client_data);
FLAC__ASSERT(0 != instance);
instance->error_callback(status);
}
// ------------------------------------------------------------
//
// File
//
// ------------------------------------------------------------
File::File():
Stream()
{ }
File::~File()
{
}
::FLAC__StreamDecoderInitStatus File::init(FILE *file)
{
FLAC__ASSERT(0 != decoder_);
return ::FLAC__stream_decoder_init_FILE(decoder_, file, write_callback_, metadata_callback_, error_callback_, /*client_data=*/(void*)this);
}
::FLAC__StreamDecoderInitStatus File::init(const char *filename)
{
FLAC__ASSERT(0 != decoder_);
return ::FLAC__stream_decoder_init_file(decoder_, filename, write_callback_, metadata_callback_, error_callback_, /*client_data=*/(void*)this);
}
::FLAC__StreamDecoderInitStatus File::init(const std::string &filename)
{
return init(filename.c_str());
}
::FLAC__StreamDecoderInitStatus File::init_ogg(FILE *file)
{
FLAC__ASSERT(0 != decoder_);
return ::FLAC__stream_decoder_init_ogg_FILE(decoder_, file, write_callback_, metadata_callback_, error_callback_, /*client_data=*/(void*)this);
}
::FLAC__StreamDecoderInitStatus File::init_ogg(const char *filename)
{
FLAC__ASSERT(0 != decoder_);
return ::FLAC__stream_decoder_init_ogg_file(decoder_, filename, write_callback_, metadata_callback_, error_callback_, /*client_data=*/(void*)this);
}
::FLAC__StreamDecoderInitStatus File::init_ogg(const std::string &filename)
{
return init_ogg(filename.c_str());
}
// This is a dummy to satisfy the pure virtual from Stream; the
// read callback will never be called since we are initializing
// with FLAC__stream_decoder_init_FILE() or
// FLAC__stream_decoder_init_file() and those supply the read
// callback internally.
::FLAC__StreamDecoderReadStatus File::read_callback(FLAC__byte buffer[], size_t *bytes)
{
(void)buffer, (void)bytes;
FLAC__ASSERT(false);
return ::FLAC__STREAM_DECODER_READ_STATUS_ABORT; // double protection
}
}
}

View File

@@ -0,0 +1,511 @@
/* libFLAC++ - Free Lossless Audio Codec library
* Copyright (C) 2002,2003,2004,2005,2006,2007,2008 Josh Coalson
*
* 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.
*/
#include "FLAC++/encoder.h"
#include "FLAC++/metadata.h"
#include "FLAC/assert.h"
#ifdef _MSC_VER
// warning C4800: 'int' : forcing to bool 'true' or 'false' (performance warning)
#pragma warning ( disable : 4800 )
#endif
namespace FLAC {
namespace Encoder {
// ------------------------------------------------------------
//
// Stream
//
// ------------------------------------------------------------
Stream::Stream():
encoder_(::FLAC__stream_encoder_new())
{ }
Stream::~Stream()
{
if(0 != encoder_) {
(void)::FLAC__stream_encoder_finish(encoder_);
::FLAC__stream_encoder_delete(encoder_);
}
}
bool Stream::is_valid() const
{
return 0 != encoder_;
}
bool Stream::set_ogg_serial_number(long value)
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_encoder_set_ogg_serial_number(encoder_, value);
}
bool Stream::set_verify(bool value)
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_encoder_set_verify(encoder_, value);
}
bool Stream::set_streamable_subset(bool value)
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_encoder_set_streamable_subset(encoder_, value);
}
bool Stream::set_channels(unsigned value)
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_encoder_set_channels(encoder_, value);
}
bool Stream::set_bits_per_sample(unsigned value)
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_encoder_set_bits_per_sample(encoder_, value);
}
bool Stream::set_sample_rate(unsigned value)
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_encoder_set_sample_rate(encoder_, value);
}
bool Stream::set_compression_level(unsigned value)
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_encoder_set_compression_level(encoder_, value);
}
bool Stream::set_blocksize(unsigned value)
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_encoder_set_blocksize(encoder_, value);
}
bool Stream::set_do_mid_side_stereo(bool value)
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_encoder_set_do_mid_side_stereo(encoder_, value);
}
bool Stream::set_loose_mid_side_stereo(bool value)
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_encoder_set_loose_mid_side_stereo(encoder_, value);
}
bool Stream::set_apodization(const char *specification)
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_encoder_set_apodization(encoder_, specification);
}
bool Stream::set_max_lpc_order(unsigned value)
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_encoder_set_max_lpc_order(encoder_, value);
}
bool Stream::set_qlp_coeff_precision(unsigned value)
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_encoder_set_qlp_coeff_precision(encoder_, value);
}
bool Stream::set_do_qlp_coeff_prec_search(bool value)
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_encoder_set_do_qlp_coeff_prec_search(encoder_, value);
}
bool Stream::set_do_escape_coding(bool value)
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_encoder_set_do_escape_coding(encoder_, value);
}
bool Stream::set_do_exhaustive_model_search(bool value)
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_encoder_set_do_exhaustive_model_search(encoder_, value);
}
bool Stream::set_min_residual_partition_order(unsigned value)
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_encoder_set_min_residual_partition_order(encoder_, value);
}
bool Stream::set_max_residual_partition_order(unsigned value)
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_encoder_set_max_residual_partition_order(encoder_, value);
}
bool Stream::set_rice_parameter_search_dist(unsigned value)
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_encoder_set_rice_parameter_search_dist(encoder_, value);
}
bool Stream::set_total_samples_estimate(FLAC__uint64 value)
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_encoder_set_total_samples_estimate(encoder_, value);
}
bool Stream::set_metadata(::FLAC__StreamMetadata **metadata, unsigned num_blocks)
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_encoder_set_metadata(encoder_, metadata, num_blocks);
}
bool Stream::set_metadata(FLAC::Metadata::Prototype **metadata, unsigned num_blocks)
{
FLAC__ASSERT(is_valid());
#if (defined _MSC_VER) || (defined __BORLANDC__) || (defined __SUNPRO_CC)
// MSVC++ can't handle:
// ::FLAC__StreamMetadata *m[num_blocks];
// so we do this ugly workaround
::FLAC__StreamMetadata **m = new ::FLAC__StreamMetadata*[num_blocks];
#else
::FLAC__StreamMetadata *m[num_blocks];
#endif
for(unsigned i = 0; i < num_blocks; i++) {
// we can get away with the const_cast since we know the encoder will only correct the is_last flags
m[i] = const_cast< ::FLAC__StreamMetadata*>((const ::FLAC__StreamMetadata*)metadata[i]);
}
#if (defined _MSC_VER) || (defined __BORLANDC__) || (defined __SUNPRO_CC)
// complete the hack
const bool ok = (bool)::FLAC__stream_encoder_set_metadata(encoder_, m, num_blocks);
delete [] m;
return ok;
#else
return (bool)::FLAC__stream_encoder_set_metadata(encoder_, m, num_blocks);
#endif
}
Stream::State Stream::get_state() const
{
FLAC__ASSERT(is_valid());
return State(::FLAC__stream_encoder_get_state(encoder_));
}
Decoder::Stream::State Stream::get_verify_decoder_state() const
{
FLAC__ASSERT(is_valid());
return Decoder::Stream::State(::FLAC__stream_encoder_get_verify_decoder_state(encoder_));
}
void Stream::get_verify_decoder_error_stats(FLAC__uint64 *absolute_sample, unsigned *frame_number, unsigned *channel, unsigned *sample, FLAC__int32 *expected, FLAC__int32 *got)
{
FLAC__ASSERT(is_valid());
::FLAC__stream_encoder_get_verify_decoder_error_stats(encoder_, absolute_sample, frame_number, channel, sample, expected, got);
}
bool Stream::get_verify() const
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_encoder_get_verify(encoder_);
}
bool Stream::get_streamable_subset() const
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_encoder_get_streamable_subset(encoder_);
}
bool Stream::get_do_mid_side_stereo() const
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_encoder_get_do_mid_side_stereo(encoder_);
}
bool Stream::get_loose_mid_side_stereo() const
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_encoder_get_loose_mid_side_stereo(encoder_);
}
unsigned Stream::get_channels() const
{
FLAC__ASSERT(is_valid());
return ::FLAC__stream_encoder_get_channels(encoder_);
}
unsigned Stream::get_bits_per_sample() const
{
FLAC__ASSERT(is_valid());
return ::FLAC__stream_encoder_get_bits_per_sample(encoder_);
}
unsigned Stream::get_sample_rate() const
{
FLAC__ASSERT(is_valid());
return ::FLAC__stream_encoder_get_sample_rate(encoder_);
}
unsigned Stream::get_blocksize() const
{
FLAC__ASSERT(is_valid());
return ::FLAC__stream_encoder_get_blocksize(encoder_);
}
unsigned Stream::get_max_lpc_order() const
{
FLAC__ASSERT(is_valid());
return ::FLAC__stream_encoder_get_max_lpc_order(encoder_);
}
unsigned Stream::get_qlp_coeff_precision() const
{
FLAC__ASSERT(is_valid());
return ::FLAC__stream_encoder_get_qlp_coeff_precision(encoder_);
}
bool Stream::get_do_qlp_coeff_prec_search() const
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_encoder_get_do_qlp_coeff_prec_search(encoder_);
}
bool Stream::get_do_escape_coding() const
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_encoder_get_do_escape_coding(encoder_);
}
bool Stream::get_do_exhaustive_model_search() const
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_encoder_get_do_exhaustive_model_search(encoder_);
}
unsigned Stream::get_min_residual_partition_order() const
{
FLAC__ASSERT(is_valid());
return ::FLAC__stream_encoder_get_min_residual_partition_order(encoder_);
}
unsigned Stream::get_max_residual_partition_order() const
{
FLAC__ASSERT(is_valid());
return ::FLAC__stream_encoder_get_max_residual_partition_order(encoder_);
}
unsigned Stream::get_rice_parameter_search_dist() const
{
FLAC__ASSERT(is_valid());
return ::FLAC__stream_encoder_get_rice_parameter_search_dist(encoder_);
}
FLAC__uint64 Stream::get_total_samples_estimate() const
{
FLAC__ASSERT(is_valid());
return ::FLAC__stream_encoder_get_total_samples_estimate(encoder_);
}
::FLAC__StreamEncoderInitStatus Stream::init()
{
FLAC__ASSERT(is_valid());
return ::FLAC__stream_encoder_init_stream(encoder_, write_callback_, seek_callback_, tell_callback_, metadata_callback_, /*client_data=*/(void*)this);
}
::FLAC__StreamEncoderInitStatus Stream::init_ogg()
{
FLAC__ASSERT(is_valid());
return ::FLAC__stream_encoder_init_ogg_stream(encoder_, read_callback_, write_callback_, seek_callback_, tell_callback_, metadata_callback_, /*client_data=*/(void*)this);
}
bool Stream::finish()
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_encoder_finish(encoder_);
}
bool Stream::process(const FLAC__int32 * const buffer[], unsigned samples)
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_encoder_process(encoder_, buffer, samples);
}
bool Stream::process_interleaved(const FLAC__int32 buffer[], unsigned samples)
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_encoder_process_interleaved(encoder_, buffer, samples);
}
::FLAC__StreamEncoderReadStatus Stream::read_callback(FLAC__byte buffer[], size_t *bytes)
{
(void)buffer, (void)bytes;
return ::FLAC__STREAM_ENCODER_READ_STATUS_UNSUPPORTED;
}
::FLAC__StreamEncoderSeekStatus Stream::seek_callback(FLAC__uint64 absolute_byte_offset)
{
(void)absolute_byte_offset;
return ::FLAC__STREAM_ENCODER_SEEK_STATUS_UNSUPPORTED;
}
::FLAC__StreamEncoderTellStatus Stream::tell_callback(FLAC__uint64 *absolute_byte_offset)
{
(void)absolute_byte_offset;
return ::FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED;
}
void Stream::metadata_callback(const ::FLAC__StreamMetadata *metadata)
{
(void)metadata;
}
::FLAC__StreamEncoderReadStatus Stream::read_callback_(const ::FLAC__StreamEncoder *encoder, FLAC__byte buffer[], size_t *bytes, void *client_data)
{
(void)encoder;
FLAC__ASSERT(0 != client_data);
Stream *instance = reinterpret_cast<Stream *>(client_data);
FLAC__ASSERT(0 != instance);
return instance->read_callback(buffer, bytes);
}
::FLAC__StreamEncoderWriteStatus Stream::write_callback_(const ::FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, void *client_data)
{
(void)encoder;
FLAC__ASSERT(0 != client_data);
Stream *instance = reinterpret_cast<Stream *>(client_data);
FLAC__ASSERT(0 != instance);
return instance->write_callback(buffer, bytes, samples, current_frame);
}
::FLAC__StreamEncoderSeekStatus Stream::seek_callback_(const ::FLAC__StreamEncoder *encoder, FLAC__uint64 absolute_byte_offset, void *client_data)
{
(void)encoder;
FLAC__ASSERT(0 != client_data);
Stream *instance = reinterpret_cast<Stream *>(client_data);
FLAC__ASSERT(0 != instance);
return instance->seek_callback(absolute_byte_offset);
}
::FLAC__StreamEncoderTellStatus Stream::tell_callback_(const ::FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_byte_offset, void *client_data)
{
(void)encoder;
FLAC__ASSERT(0 != client_data);
Stream *instance = reinterpret_cast<Stream *>(client_data);
FLAC__ASSERT(0 != instance);
return instance->tell_callback(absolute_byte_offset);
}
void Stream::metadata_callback_(const ::FLAC__StreamEncoder *encoder, const ::FLAC__StreamMetadata *metadata, void *client_data)
{
(void)encoder;
FLAC__ASSERT(0 != client_data);
Stream *instance = reinterpret_cast<Stream *>(client_data);
FLAC__ASSERT(0 != instance);
instance->metadata_callback(metadata);
}
// ------------------------------------------------------------
//
// File
//
// ------------------------------------------------------------
File::File():
Stream()
{ }
File::~File()
{
}
::FLAC__StreamEncoderInitStatus File::init(FILE *file)
{
FLAC__ASSERT(is_valid());
return ::FLAC__stream_encoder_init_FILE(encoder_, file, progress_callback_, /*client_data=*/(void*)this);
}
::FLAC__StreamEncoderInitStatus File::init(const char *filename)
{
FLAC__ASSERT(is_valid());
return ::FLAC__stream_encoder_init_file(encoder_, filename, progress_callback_, /*client_data=*/(void*)this);
}
::FLAC__StreamEncoderInitStatus File::init(const std::string &filename)
{
return init(filename.c_str());
}
::FLAC__StreamEncoderInitStatus File::init_ogg(FILE *file)
{
FLAC__ASSERT(is_valid());
return ::FLAC__stream_encoder_init_ogg_FILE(encoder_, file, progress_callback_, /*client_data=*/(void*)this);
}
::FLAC__StreamEncoderInitStatus File::init_ogg(const char *filename)
{
FLAC__ASSERT(is_valid());
return ::FLAC__stream_encoder_init_ogg_file(encoder_, filename, progress_callback_, /*client_data=*/(void*)this);
}
::FLAC__StreamEncoderInitStatus File::init_ogg(const std::string &filename)
{
return init_ogg(filename.c_str());
}
// This is a dummy to satisfy the pure virtual from Stream; the
// read callback will never be called since we are initializing
// with FLAC__stream_decoder_init_FILE() or
// FLAC__stream_decoder_init_file() and those supply the read
// callback internally.
::FLAC__StreamEncoderWriteStatus File::write_callback(const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame)
{
(void)buffer, (void)bytes, (void)samples, (void)current_frame;
FLAC__ASSERT(false);
return ::FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR; // double protection
}
void File::progress_callback(FLAC__uint64 bytes_written, FLAC__uint64 samples_written, unsigned frames_written, unsigned total_frames_estimate)
{
(void)bytes_written, (void)samples_written, (void)frames_written, (void)total_frames_estimate;
}
void File::progress_callback_(const ::FLAC__StreamEncoder *encoder, FLAC__uint64 bytes_written, FLAC__uint64 samples_written, unsigned frames_written, unsigned total_frames_estimate, void *client_data)
{
(void)encoder;
FLAC__ASSERT(0 != client_data);
File *instance = reinterpret_cast<File *>(client_data);
FLAC__ASSERT(0 != instance);
instance->progress_callback(bytes_written, samples_written, frames_written, total_frames_estimate);
}
}
}