merge with 2.5 at r22793
This commit is contained in:
@@ -42,14 +42,40 @@ MACRO(SETUP_LIBDIRS)
|
|||||||
if(COMMAND cmake_policy)
|
if(COMMAND cmake_policy)
|
||||||
CMAKE_POLICY(SET CMP0003 NEW)
|
CMAKE_POLICY(SET CMP0003 NEW)
|
||||||
endif(COMMAND cmake_policy)
|
endif(COMMAND cmake_policy)
|
||||||
LINK_DIRECTORIES(${PYTHON_LIBPATH} ${SDL_LIBPATH} ${JPEG_LIBPATH} ${PNG_LIBPATH} ${ZLIB_LIBPATH} ${ICONV_LIBPATH} ${OPENEXR_LIBPATH} ${QUICKTIME_LIBPATH} ${FFMPEG_LIBPATH})
|
|
||||||
LINK_DIRECTORIES(${FREETYPE_LIBPATH})
|
LINK_DIRECTORIES(${JPEG_LIBPATH} ${PNG_LIBPATH} ${ZLIB_LIBPATH} ${FREETYPE_LIBPATH} ${LIBSAMPLERATE_LIBPATH})
|
||||||
|
|
||||||
|
IF(WITH_PYTHON)
|
||||||
|
LINK_DIRECTORIES(${PYTHON_LIBPATH})
|
||||||
|
ENDIF(WITH_PYTHON)
|
||||||
IF(WITH_INTERNATIONAL)
|
IF(WITH_INTERNATIONAL)
|
||||||
|
LINK_DIRECTORIES(${ICONV_LIBPATH})
|
||||||
LINK_DIRECTORIES(${GETTEXT_LIBPATH})
|
LINK_DIRECTORIES(${GETTEXT_LIBPATH})
|
||||||
ENDIF(WITH_INTERNATIONAL)
|
ENDIF(WITH_INTERNATIONAL)
|
||||||
|
IF(WITH_SDL)
|
||||||
|
LINK_DIRECTORIES(${SDL_LIBPATH})
|
||||||
|
ENDIF(WITH_SDL)
|
||||||
|
IF(WITH_FFMPEG)
|
||||||
|
LINK_DIRECTORIES(${FFMPEG_LIBPATH})
|
||||||
|
ENDIF(WITH_FFMPEG)
|
||||||
|
IF(WITH_OPENEXR)
|
||||||
|
LINK_DIRECTORIES(${OPENEXR_LIBPATH})
|
||||||
|
ENDIF(WITH_OPENEXR)
|
||||||
|
IF(WITH_QUICKTIME)
|
||||||
|
LINK_DIRECTORIES(${QUICKTIME_LIBPATH})
|
||||||
|
ENDIF(WITH_QUICKTIME)
|
||||||
IF(WITH_OPENAL)
|
IF(WITH_OPENAL)
|
||||||
LINK_DIRECTORIES(${OPENAL_LIBPATH})
|
LINK_DIRECTORIES(${OPENAL_LIBPATH})
|
||||||
ENDIF(WITH_OPENAL)
|
ENDIF(WITH_OPENAL)
|
||||||
|
IF(WITH_JACK)
|
||||||
|
LINK_DIRECTORIES(${JACK_LIBPATH})
|
||||||
|
ENDIF(WITH_JACK)
|
||||||
|
IF(WITH_SNDFILE)
|
||||||
|
LINK_DIRECTORIES(${SNDFILE_LIBPATH})
|
||||||
|
ENDIF(WITH_SNDFILE)
|
||||||
|
IF(WITH_FFTW3)
|
||||||
|
LINK_DIRECTORIES(${FFTW3_LIBPATH})
|
||||||
|
ENDIF(WITH_FFTW3)
|
||||||
|
|
||||||
IF(WIN32)
|
IF(WIN32)
|
||||||
LINK_DIRECTORIES(${PTHREADS_LIBPATH})
|
LINK_DIRECTORIES(${PTHREADS_LIBPATH})
|
||||||
@@ -59,48 +85,48 @@ ENDMACRO(SETUP_LIBDIRS)
|
|||||||
MACRO(SETUP_LIBLINKS
|
MACRO(SETUP_LIBLINKS
|
||||||
target)
|
target)
|
||||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PLATFORM_LINKFLAGS} ")
|
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PLATFORM_LINKFLAGS} ")
|
||||||
#TARGET_LINK_LIBRARIES(${target} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${PYTHON_LIB} ${PYTHON_LINKFLAGS} ${JPEG_LIB} ${PNG_LIB} ${ZLIB_LIB} ${SDL_LIB} ${LLIBS})
|
#TARGET_LINK_LIBRARIES(${target} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${PYTHON_LIB} ${PYTHON_LINKFLAGS} ${JPEG_LIB} ${PNG_LIB} ${ZLIB_LIB} ${SDL_LIBRARY} ${LLIBS})
|
||||||
|
|
||||||
TARGET_LINK_LIBRARIES(${target} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${PYTHON_LINKFLAGS} ${JPEG_LIBRARY} ${PNG_LIBRARIES} ${ZLIB_LIBRARIES} ${SDL_LIB} ${LLIBS})
|
TARGET_LINK_LIBRARIES(${target} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${PYTHON_LINKFLAGS} ${JPEG_LIBRARY} ${PNG_LIBRARIES} ${ZLIB_LIBRARIES} ${LLIBS})
|
||||||
|
|
||||||
# since we are using the local libs for python when compiling msvc projects, we need to add _d when compiling debug versions
|
# since we are using the local libs for python when compiling msvc projects, we need to add _d when compiling debug versions
|
||||||
|
|
||||||
IF(WIN32)
|
IF(WIN32)
|
||||||
|
TARGET_LINK_LIBRARIES(${target} debug ${PYTHON_LIB}_d)
|
||||||
TARGET_LINK_LIBRARIES(${target} debug ${PYTHON_LIB}_d)
|
TARGET_LINK_LIBRARIES(${target} optimized ${PYTHON_LIB})
|
||||||
|
|
||||||
TARGET_LINK_LIBRARIES(${target} optimized ${PYTHON_LIB})
|
|
||||||
|
|
||||||
ELSE(WIN32)
|
ELSE(WIN32)
|
||||||
|
TARGET_LINK_LIBRARIES(${target} ${PYTHON_LIB})
|
||||||
TARGET_LINK_LIBRARIES(${target} ${PYTHON_LIB})
|
|
||||||
|
|
||||||
ENDIF(WIN32)
|
ENDIF(WIN32)
|
||||||
|
|
||||||
|
TARGET_LINK_LIBRARIES(${target} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${PYTHON_LINKFLAGS} ${JPEG_LIB} ${PNG_LIB} ${ZLIB_LIB} ${LLIBS})
|
||||||
TARGET_LINK_LIBRARIES(${target} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${PYTHON_LINKFLAGS} ${JPEG_LIB} ${PNG_LIB} ${ZLIB_LIB} ${SDL_LIB} ${LLIBS})
|
TARGET_LINK_LIBRARIES(${target} ${FREETYPE_LIBRARY} ${LIBSAMPLERATE_LIB})
|
||||||
TARGET_LINK_LIBRARIES(${target} ${FREETYPE_LIB})
|
|
||||||
|
|
||||||
# since we are using the local libs for python when compiling msvc projects, we need to add _d when compiling debug versions
|
# since we are using the local libs for python when compiling msvc projects, we need to add _d when compiling debug versions
|
||||||
|
|
||||||
IF(WIN32)
|
IF(WIN32)
|
||||||
|
TARGET_LINK_LIBRARIES(${target} debug ${PYTHON_LIB}_d)
|
||||||
TARGET_LINK_LIBRARIES(${target} debug ${PYTHON_LIB}_d)
|
TARGET_LINK_LIBRARIES(${target} optimized ${PYTHON_LIB})
|
||||||
|
ELSE(WIN32)
|
||||||
TARGET_LINK_LIBRARIES(${target} optimized ${PYTHON_LIB})
|
TARGET_LINK_LIBRARIES(${target} ${PYTHON_LIB})
|
||||||
|
|
||||||
ELSE(WIN32)
|
|
||||||
|
|
||||||
TARGET_LINK_LIBRARIES(${target} ${PYTHON_LIB})
|
|
||||||
|
|
||||||
ENDIF(WIN32)
|
ENDIF(WIN32)
|
||||||
|
|
||||||
IF(WITH_INTERNATIONAL)
|
IF(WITH_INTERNATIONAL)
|
||||||
TARGET_LINK_LIBRARIES(${target} ${GETTEXT_LIB})
|
TARGET_LINK_LIBRARIES(${target} ${GETTEXT_LIB})
|
||||||
ENDIF(WITH_INTERNATIONAL)
|
ENDIF(WITH_INTERNATIONAL)
|
||||||
IF(WITH_OPENAL)
|
IF(WITH_OPENAL)
|
||||||
TARGET_LINK_LIBRARIES(${target} ${OPENAL_LIB})
|
TARGET_LINK_LIBRARIES(${target} ${OPENAL_LIBRARY})
|
||||||
ENDIF(WITH_OPENAL)
|
ENDIF(WITH_OPENAL)
|
||||||
|
IF(WITH_FFTW3)
|
||||||
|
TARGET_LINK_LIBRARIES(${target} ${FFTW3_LIB})
|
||||||
|
ENDIF(WITH_FFTW3)
|
||||||
|
IF(WITH_JACK)
|
||||||
|
TARGET_LINK_LIBRARIES(${target} ${JACK_LIB})
|
||||||
|
ENDIF(WITH_JACK)
|
||||||
|
IF(WITH_SNDFILE)
|
||||||
|
TARGET_LINK_LIBRARIES(${target} ${SNDFILE_LIB})
|
||||||
|
ENDIF(WITH_SNDFILE)
|
||||||
|
IF(WITH_SDL)
|
||||||
|
TARGET_LINK_LIBRARIES(${target} ${SDL_LIBRARY})
|
||||||
|
ENDIF(WITH_SDL)
|
||||||
IF(WIN32)
|
IF(WIN32)
|
||||||
TARGET_LINK_LIBRARIES(${target} ${ICONV_LIB})
|
TARGET_LINK_LIBRARIES(${target} ${ICONV_LIB})
|
||||||
ENDIF(WIN32)
|
ENDIF(WIN32)
|
||||||
@@ -117,3 +143,4 @@ MACRO(SETUP_LIBLINKS
|
|||||||
TARGET_LINK_LIBRARIES(${target} ${PTHREADS_LIB})
|
TARGET_LINK_LIBRARIES(${target} ${PTHREADS_LIB})
|
||||||
ENDIF(WIN32)
|
ENDIF(WIN32)
|
||||||
ENDMACRO(SETUP_LIBLINKS)
|
ENDMACRO(SETUP_LIBLINKS)
|
||||||
|
|
||||||
|
|||||||
262
CMakeLists.txt
262
CMakeLists.txt
@@ -53,21 +53,27 @@ SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
|
|||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# Set default config options
|
# Set default config options
|
||||||
OPTION(WITH_PLAYER "Build Player" OFF)
|
OPTION(WITH_PLAYER "Build Player" OFF)
|
||||||
OPTION(WITH_GAMEENGINE "Enable Game Engine" ON)
|
OPTION(WITH_GAMEENGINE "Enable Game Engine" ON)
|
||||||
OPTION(WITH_BULLET "Enable Bullet (Physics Engine)" ON)
|
OPTION(WITH_BULLET "Enable Bullet (Physics Engine)" ON)
|
||||||
OPTION(WITH_INTERNATIONAL "Enable I18N (International fonts and text)" ON)
|
OPTION(WITH_INTERNATIONAL "Enable I18N (International fonts and text)" ON)
|
||||||
OPTION(WITH_ELBEEM "Enable Elbeem (Fluid Simulation)" ON)
|
OPTION(WITH_ELBEEM "Enable Elbeem (Fluid Simulation)" ON)
|
||||||
OPTION(WITH_QUICKTIME "Enable Quicktime Support" OFF)
|
OPTION(WITH_QUICKTIME "Enable Quicktime Support" OFF)
|
||||||
OPTION(WITH_OPENEXR "Enable OpenEXR Support (http://www.openexr.com)" ON)
|
OPTION(WITH_OPENEXR "Enable OpenEXR Support (http://www.openexr.com)" ON)
|
||||||
OPTION(WITH_DDS "Enable DDS Support" ON)
|
OPTION(WITH_DDS "Enable DDS Support" ON)
|
||||||
OPTION(WITH_FFMPEG "Enable FFMPeg Support (http://ffmpeg.mplayerhq.hu/)" OFF)
|
OPTION(WITH_FFMPEG "Enable FFMPeg Support (http://ffmpeg.mplayerhq.hu/)" OFF)
|
||||||
OPTION(WITH_PYTHON "Enable Embedded Python API" ON)
|
OPTION(WITH_PYTHON "Enable Embedded Python API" ON)
|
||||||
OPTION(WITH_SDL "Enable SDL for sound and joystick support" ON)
|
OPTION(WITH_SDL "Enable SDL for sound and joystick support" ON)
|
||||||
OPTION(WITH_OPENJPEG "Enable OpenJpeg Support (http://www.openjpeg.org/)" OFF)
|
OPTION(WITH_OPENJPEG "Enable OpenJpeg Support (http://www.openjpeg.org/)" OFF)
|
||||||
OPTION(WITH_OPENAL "Enable OpenAL Support (http://www.openal.org)" ON)
|
OPTION(WITH_OPENAL "Enable OpenAL Support (http://www.openal.org)" ON)
|
||||||
OPTION(WITH_OPENMP "Enable OpenMP (has to be supported by the compiler)" OFF)
|
OPTION(WITH_OPENMP "Enable OpenMP (has to be supported by the compiler)" OFF)
|
||||||
OPTION(WITH_WEBPLUGIN "Enable Web Plugin (Unix only)" OFF)
|
OPTION(WITH_WEBPLUGIN "Enable Web Plugin (Unix only)" OFF)
|
||||||
|
OPTION(WITH_FFTW3 "Enable FFTW3 support" OFF)
|
||||||
|
OPTION(WITH_JACK "Enable Jack Support (http://www.jackaudio.org)" OFF)
|
||||||
|
OPTION(WITH_SNDFILE "Enable libsndfile Support (http://www.mega-nerd.com/libsndfile)" OFF)
|
||||||
|
OPTION(WITH_CXX_GUARDEDALLOC "Enable GuardedAlloc for C++ memory allocation" OFF)
|
||||||
|
# OPTION(WITH_BUILDINFO "Include extra build details" ON)
|
||||||
|
OPTION(WITH_INSTALL "Install accompanying scripts and language files needed to run blender" ON)
|
||||||
|
|
||||||
IF(NOT WITH_GAMEENGINE AND WITH_PLAYER)
|
IF(NOT WITH_GAMEENGINE AND WITH_PLAYER)
|
||||||
MESSAGE("WARNING: WITH_PLAYER needs WITH_GAMEENGINE")
|
MESSAGE("WARNING: WITH_PLAYER needs WITH_GAMEENGINE")
|
||||||
@@ -93,13 +99,25 @@ IF(UNIX AND NOT APPLE)
|
|||||||
FIND_PACKAGE(OpenAL)
|
FIND_PACKAGE(OpenAL)
|
||||||
IF(OPENAL_FOUND)
|
IF(OPENAL_FOUND)
|
||||||
SET(WITH_OPENAL ON)
|
SET(WITH_OPENAL ON)
|
||||||
SET(OPENAL_LIB ${OPENAL_LIBRARY})
|
|
||||||
SET(OPENAL_INC ${OPENAL_INCLUDE_DIR})
|
|
||||||
ELSE(OPENAL_FOUND)
|
ELSE(OPENAL_FOUND)
|
||||||
SET(WITH_OPENAL OFF)
|
SET(WITH_OPENAL OFF)
|
||||||
ENDIF(OPENAL_FOUND)
|
ENDIF(OPENAL_FOUND)
|
||||||
ENDIF(WITH_OPENAL)
|
ENDIF(WITH_OPENAL)
|
||||||
|
|
||||||
|
IF(WITH_JACK)
|
||||||
|
SET(JACK /usr)
|
||||||
|
SET(JACK_INC ${JACK}/include/jack)
|
||||||
|
SET(JACK_LIB jack)
|
||||||
|
SET(JACK_LIBPATH ${JACK}/lib)
|
||||||
|
ENDIF(WITH_JACK)
|
||||||
|
|
||||||
|
IF(WITH_SNDFILE)
|
||||||
|
SET(SNDFILE /usr)
|
||||||
|
SET(SNDFILE_INC ${SNDFILE}/include)
|
||||||
|
SET(SNDFILE_LIB sndfile)
|
||||||
|
SET(SNDFILE_LIBPATH ${SNDFILE}/lib)
|
||||||
|
ENDIF(WITH_SNDFILE)
|
||||||
|
|
||||||
FIND_LIBRARY(INTL_LIBRARY
|
FIND_LIBRARY(INTL_LIBRARY
|
||||||
NAMES intl
|
NAMES intl
|
||||||
PATHS
|
PATHS
|
||||||
@@ -110,34 +128,34 @@ IF(UNIX AND NOT APPLE)
|
|||||||
PATHS
|
PATHS
|
||||||
/sw/lib
|
/sw/lib
|
||||||
)
|
)
|
||||||
|
|
||||||
IF(INTL_LIBRARY AND ICONV_LIBRARY)
|
IF(INTL_LIBRARY AND ICONV_LIBRARY)
|
||||||
SET(GETTEXT_LIB ${INTL_LIBRARY} ${ICONV_LIBRARY})
|
SET(GETTEXT_LIB ${INTL_LIBRARY} ${ICONV_LIBRARY})
|
||||||
ENDIF(INTL_LIBRARY AND ICONV_LIBRARY)
|
ENDIF(INTL_LIBRARY AND ICONV_LIBRARY)
|
||||||
|
|
||||||
FIND_PATH(FREETYPE_INC
|
|
||||||
freetype
|
|
||||||
PATHS
|
|
||||||
/usr/local/include/freetype2
|
|
||||||
/usr/include/freetype2
|
|
||||||
/sw/include/freetype2
|
|
||||||
/opt/local/include/freetype2
|
|
||||||
/opt/csw/include/freetype2
|
|
||||||
/opt/include/freetype2
|
|
||||||
NO_DEFAULT_PATH
|
|
||||||
)
|
|
||||||
SET(FREETYPE_LIB freetype)
|
|
||||||
|
|
||||||
FIND_PACKAGE(PythonLibs)
|
FIND_PACKAGE(Freetype)
|
||||||
SET(PYTHON_INC "${PYTHON_INCLUDE_PATH}" CACHE STRING "")
|
# UNSET(FREETYPE_INCLUDE_DIRS CACHE) # cant use
|
||||||
SET(PYTHON_LIB "${PYTHON_LIBRARIES}" CACHE STRING "")
|
|
||||||
FIND_PACKAGE(PythonInterp)
|
# No way to set py31. remove for now.
|
||||||
SET(PYTHON_BINARY ${PYTHON_EXECUTABLE} CACHE STRING "")
|
# FIND_PACKAGE(PythonLibs)
|
||||||
|
SET(PYTHON /usr)
|
||||||
|
SET(PYTHON_VERSION 3.1)
|
||||||
|
SET(PYTHON_INC "${PYTHON}/include/python${PYTHON_VERSION}" CACHE STRING "")
|
||||||
|
# SET(PYTHON_BINARY python) # not used yet
|
||||||
|
SET(PYTHON_LIB python${PYTHON_VERSION} CACHE STRING "")
|
||||||
|
SET(PYTHON_LIBPATH ${PYTHON}/lib CACHE STRING "")
|
||||||
|
|
||||||
|
# FIND_PACKAGE(PythonInterp) # not used yet
|
||||||
|
# SET(PYTHON_BINARY ${PYTHON_EXECUTABLE} CACHE STRING "")
|
||||||
|
|
||||||
SET(PYTHON_LINKFLAGS "-Xlinker -export-dynamic")
|
SET(PYTHON_LINKFLAGS "-Xlinker -export-dynamic")
|
||||||
|
|
||||||
IF(WITH_SDL)
|
IF(WITH_SDL)
|
||||||
FIND_PACKAGE(SDL)
|
FIND_PACKAGE(SDL)
|
||||||
SET(SDL_INC ${SDL_INCLUDE_DIR})
|
# UNSET(SDLMAIN_LIBRARY CACHE)
|
||||||
SET(SDL_LIB ${SDL_LIBRARY})
|
IF(NOT SDL_FOUND)
|
||||||
|
SET(WITH_SDL OFF)
|
||||||
|
ENDIF(NOT SDL_FOUND)
|
||||||
ENDIF(WITH_SDL)
|
ENDIF(WITH_SDL)
|
||||||
|
|
||||||
FIND_PATH(OPENEXR_INC
|
FIND_PATH(OPENEXR_INC
|
||||||
@@ -156,6 +174,18 @@ IF(UNIX AND NOT APPLE)
|
|||||||
SET(FFMPEG_INC ${FFMPEG}/include)
|
SET(FFMPEG_INC ${FFMPEG}/include)
|
||||||
SET(FFMPEG_LIB avformat avcodec avutil avdevice swscale)
|
SET(FFMPEG_LIB avformat avcodec avutil avdevice swscale)
|
||||||
SET(FFMPEG_LIBPATH ${FFMPEG}/lib)
|
SET(FFMPEG_LIBPATH ${FFMPEG}/lib)
|
||||||
|
|
||||||
|
IF(WITH_FFTW3)
|
||||||
|
SET(FFTW3 /usr)
|
||||||
|
SET(FFTW3_INC ${FFTW3}/include)
|
||||||
|
SET(FFTW3_LIB fftw3)
|
||||||
|
SET(FFTW3_LIBPATH ${FFTW3}/lib)
|
||||||
|
ENDIF(WITH_FFTW3)
|
||||||
|
|
||||||
|
SET(LIBSAMPLERATE /usr)
|
||||||
|
SET(LIBSAMPLERATE_INC ${LIBSAMPLERATE}/include)
|
||||||
|
SET(LIBSAMPLERATE_LIB samplerate)
|
||||||
|
SET(LIBSAMPLERATE_LIBPATH ${LIBSAMPLERATE}/lib)
|
||||||
|
|
||||||
FIND_PACKAGE(JPEG REQUIRED)
|
FIND_PACKAGE(JPEG REQUIRED)
|
||||||
|
|
||||||
@@ -163,7 +193,13 @@ IF(UNIX AND NOT APPLE)
|
|||||||
|
|
||||||
FIND_PACKAGE(ZLIB REQUIRED)
|
FIND_PACKAGE(ZLIB REQUIRED)
|
||||||
|
|
||||||
SET(LLIBS "-lXi -lutil -lc -lm -lpthread -lstdc++ -lX11 -ldl")
|
# Could use ${X11_Xinput_LIB} ${X11_X11_LIB} too
|
||||||
|
SET(LLIBS "-lXi -lutil -lc -lm -lpthread -lstdc++ -lX11")
|
||||||
|
|
||||||
|
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||||
|
# BSD's dont use libdl.so
|
||||||
|
SET(LLIBS "${LLIBS} -ldl")
|
||||||
|
ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||||
|
|
||||||
IF(WITH_OPENMP)
|
IF(WITH_OPENMP)
|
||||||
SET(LLIBS "${LLIBS} -lgomp")
|
SET(LLIBS "${LLIBS} -lgomp")
|
||||||
@@ -177,7 +213,8 @@ IF(UNIX AND NOT APPLE)
|
|||||||
SET(PLATFORM_LINKFLAGS "-pthread")
|
SET(PLATFORM_LINKFLAGS "-pthread")
|
||||||
|
|
||||||
# Better warnings
|
# Better warnings
|
||||||
SET(C_WARNINGS "-Wall -Wno-char-subscripts -Wpointer-arith -Wcast-align -Wnested-externs -Wdeclaration-after-statement")
|
SET(C_WARNINGS "-Wall -Wno-char-subscripts -Wpointer-arith -Wcast-align -Wdeclaration-after-statement")
|
||||||
|
SET(CXX_WARNINGS "-Wall -Wno-invalid-offsetof -Wno-sign-compare")
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(${JPEG_INCLUDE_DIR} ${PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} )
|
INCLUDE_DIRECTORIES(${JPEG_INCLUDE_DIR} ${PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} )
|
||||||
ENDIF(UNIX AND NOT APPLE)
|
ENDIF(UNIX AND NOT APPLE)
|
||||||
@@ -196,10 +233,10 @@ IF(WIN32)
|
|||||||
ENDIF(CMAKE_CL_64)
|
ENDIF(CMAKE_CL_64)
|
||||||
|
|
||||||
SET(PYTHON ${LIBDIR}/python)
|
SET(PYTHON ${LIBDIR}/python)
|
||||||
SET(PYTHON_VERSION 2.6)
|
SET(PYTHON_VERSION 3.1)
|
||||||
SET(PYTHON_INC "${PYTHON}/include/python${PYTHON_VERSION}")
|
SET(PYTHON_INC "${PYTHON}/include/python${PYTHON_VERSION}")
|
||||||
SET(PYTHON_BINARY python)
|
# SET(PYTHON_BINARY python) # not used yet
|
||||||
SET(PYTHON_LIB python26)
|
SET(PYTHON_LIB python31)
|
||||||
SET(PYTHON_LIBPATH ${PYTHON}/lib)
|
SET(PYTHON_LIBPATH ${PYTHON}/lib)
|
||||||
|
|
||||||
IF(CMAKE_CL_64)
|
IF(CMAKE_CL_64)
|
||||||
@@ -207,13 +244,27 @@ IF(WIN32)
|
|||||||
ELSE(CMAKE_CL_64)
|
ELSE(CMAKE_CL_64)
|
||||||
#SET(WITH_OPENAL ON)
|
#SET(WITH_OPENAL ON)
|
||||||
SET(OPENAL ${LIBDIR}/openal)
|
SET(OPENAL ${LIBDIR}/openal)
|
||||||
SET(OPENAL_INC ${OPENAL}/include ${OPENAL}/include/AL)
|
SET(OPENAL_INCLUDE_DIR ${OPENAL}/include)
|
||||||
SET(OPENAL_LIB openal_static)
|
SET(OPENAL_LIBRARY wrap_oal)
|
||||||
SET(OPENAL_LIBPATH ${OPENAL}/lib)
|
SET(OPENAL_LIBPATH ${OPENAL}/lib)
|
||||||
ENDIF(CMAKE_CL_64)
|
ENDIF(CMAKE_CL_64)
|
||||||
|
|
||||||
|
IF(WITH_JACK)
|
||||||
|
SET(JACK ${LIBDIR}/jack)
|
||||||
|
SET(JACK_INC ${JACK}/include/jack ${JACK}/include)
|
||||||
|
SET(JACK_LIB libjack)
|
||||||
|
SET(JACK_LIBPATH ${JACK}/lib)
|
||||||
|
ENDIF(WITH_JACK)
|
||||||
|
|
||||||
|
IF(WITH_SNDFILE)
|
||||||
|
SET(SNDFILE ${LIBDIR}/sndfile)
|
||||||
|
SET(SNDFILE_INC ${SNDFILE}/include)
|
||||||
|
SET(SNDFILE_LIB sndfile)
|
||||||
|
SET(SNDFILE_LIBPATH ${SNDFILE}/lib)
|
||||||
|
ENDIF(WITH_SNDFILE)
|
||||||
|
|
||||||
IF(CMAKE_CL_64)
|
IF(CMAKE_CL_64)
|
||||||
SET(PNG_LIBRARIES libpng)
|
SET(PNG_LIBRARIES libpng)
|
||||||
ELSE(CMAKE_CL_64)
|
ELSE(CMAKE_CL_64)
|
||||||
SET(PNG_LIBRARIES libpng_st)
|
SET(PNG_LIBRARIES libpng_st)
|
||||||
ENDIF(CMAKE_CL_64)
|
ENDIF(CMAKE_CL_64)
|
||||||
@@ -221,7 +272,11 @@ IF(WIN32)
|
|||||||
|
|
||||||
SET(ZLIB ${LIBDIR}/zlib)
|
SET(ZLIB ${LIBDIR}/zlib)
|
||||||
SET(ZLIB_INC ${ZLIB}/include)
|
SET(ZLIB_INC ${ZLIB}/include)
|
||||||
SET(ZLIB_LIBRARIES zlib)
|
IF(CMAKE_CL_64)
|
||||||
|
SET(ZLIB_LIBRARIES libz)
|
||||||
|
ELSE(CMAKE_CL_64)
|
||||||
|
SET(ZLIB_LIBRARIES zlib)
|
||||||
|
ENDIF(CMAKE_CL_64)
|
||||||
SET(ZLIB_LIBPATH ${ZLIB}/lib)
|
SET(ZLIB_LIBPATH ${ZLIB}/lib)
|
||||||
|
|
||||||
SET(PTHREADS ${LIBDIR}/pthreads)
|
SET(PTHREADS ${LIBDIR}/pthreads)
|
||||||
@@ -234,30 +289,37 @@ IF(WIN32)
|
|||||||
SET(ICONV_LIB iconv)
|
SET(ICONV_LIB iconv)
|
||||||
SET(ICONV_LIBPATH ${ICONV}/lib)
|
SET(ICONV_LIBPATH ${ICONV}/lib)
|
||||||
|
|
||||||
|
IF(WITH_FFTW3)
|
||||||
|
SET(FFTW3 ${LIBDIR}/fftw3)
|
||||||
|
SET(FFTW3_INC ${FFTW3}/include)
|
||||||
|
SET(FFTW3_LIB libfftw)
|
||||||
|
SET(FFTW3_LIBPATH ${FFTW3}/lib)
|
||||||
|
ENDIF(WITH_FFTW3)
|
||||||
|
|
||||||
SET(GETTEXT ${LIBDIR}/gettext)
|
SET(GETTEXT ${LIBDIR}/gettext)
|
||||||
SET(GETTEXT_INC ${GETTEXT}/include)
|
SET(GETTEXT_INC ${GETTEXT}/include)
|
||||||
IF(CMAKE_CL_64)
|
IF(CMAKE_CL_64)
|
||||||
SET(GETTEXT_LIB gettextlib)
|
SET(GETTEXT_LIB gettext)
|
||||||
ELSE(CMAKE_CL_64)
|
ELSE(CMAKE_CL_64)
|
||||||
SET(GETTEXT_LIB gnu_gettext)
|
SET(GETTEXT_LIB gnu_gettext)
|
||||||
ENDIF(CMAKE_CL_64)
|
ENDIF(CMAKE_CL_64)
|
||||||
SET(GETTEXT_LIBPATH ${GETTEXT}/lib)
|
SET(GETTEXT_LIBPATH ${GETTEXT}/lib)
|
||||||
|
|
||||||
SET(FREETYPE ${LIBDIR}/freetype)
|
SET(FREETYPE ${LIBDIR}/freetype)
|
||||||
SET(FREETYPE_INC ${FREETYPE}/include ${FREETYPE}/include/freetype2)
|
SET(FREETYPE_INCLUDE_DIRS ${FREETYPE}/include ${FREETYPE}/include/freetype2)
|
||||||
SET(FREETYPE_LIBPATH ${FREETYPE}/lib)
|
SET(FREETYPE_LIBPATH ${FREETYPE}/lib)
|
||||||
SET(FREETYPE_LIB freetype2ST)
|
SET(FREETYPE_LIBRARY freetype2ST)
|
||||||
|
|
||||||
SET(OPENEXR ${LIBDIR}/openexr)
|
SET(OPENEXR ${LIBDIR}/openexr)
|
||||||
SET(OPENEXR_INC ${OPENEXR}/include ${OPENEXR}/include/IlmImf ${OPENEXR}/include/Iex ${OPENEXR}/include/Imath)
|
SET(OPENEXR_INC ${OPENEXR}/include ${OPENEXR}/include/IlmImf ${OPENEXR}/include/Iex ${OPENEXR}/include/Imath)
|
||||||
SET(OPENEXR_LIB Iex Half IlmImf Imath IlmThread)
|
SET(OPENEXR_LIB Iex Half IlmImf Imath IlmThread)
|
||||||
IF (MSVC80)
|
IF (MSVC80)
|
||||||
SET(OPENEXR_LIBPATH ${OPENEXR}/lib_vs2005)
|
SET(OPENEXR_LIBPATH ${OPENEXR}/lib_vs2005)
|
||||||
ELSE (MSVC80)
|
ELSE (MSVC80)
|
||||||
SET(OPENEXR_LIBPATH ${OPENEXR}/lib_msvc)
|
SET(OPENEXR_LIBPATH ${OPENEXR}/lib_msvc)
|
||||||
ENDIF(MSVC80)
|
ENDIF(MSVC80)
|
||||||
IF (MSVC90)
|
IF (MSVC90)
|
||||||
SET(OPENEXR_LIBPATH ${OPENEXR}/lib_vs2008)
|
SET(OPENEXR_LIBPATH ${OPENEXR}/lib_vs2008)
|
||||||
ENDIF(MSVC90)
|
ENDIF(MSVC90)
|
||||||
|
|
||||||
|
|
||||||
@@ -271,15 +333,16 @@ IF(WIN32)
|
|||||||
SET(FFMPEG_LIB avcodec-52 avformat-52 avdevice-52 avutil-50 swscale-0)
|
SET(FFMPEG_LIB avcodec-52 avformat-52 avdevice-52 avutil-50 swscale-0)
|
||||||
SET(FFMPEG_LIBPATH ${FFMPEG}/lib)
|
SET(FFMPEG_LIBPATH ${FFMPEG}/lib)
|
||||||
|
|
||||||
|
SET(LIBSAMPLERATE ${LIBDIR}/samplerate)
|
||||||
|
SET(LIBSAMPLERATE_INC ${LIBSAMPLERATE}/include)
|
||||||
|
SET(LIBSAMPLERATE_LIB libsamplerate)
|
||||||
|
SET(LIBSAMPLERATE_LIBPATH ${LIBSAMPLERATE}/lib)
|
||||||
|
|
||||||
IF(CMAKE_CL_64)
|
IF(CMAKE_CL_64)
|
||||||
SET(LLIBS kernel32 user32 vfw32 winmm ws2_32 )
|
SET(LLIBS kernel32 user32 vfw32 winmm ws2_32 )
|
||||||
ELSE(CMAKE_CL_64)
|
ELSE(CMAKE_CL_64)
|
||||||
SET(LLIBS kernel32 user32 gdi32 comdlg32 advapi32 shell32 ole32 oleaut32 uuid ws2_32 vfw32 winmm)
|
SET(LLIBS kernel32 user32 gdi32 comdlg32 advapi32 shell32 ole32 oleaut32 uuid ws2_32 vfw32 winmm)
|
||||||
ENDIF(CMAKE_CL_64)
|
ENDIF(CMAKE_CL_64)
|
||||||
|
|
||||||
IF(WITH_OPENAL)
|
|
||||||
SET(LLIBS ${LLIBS} dxguid)
|
|
||||||
ENDIF(WITH_OPENAL)
|
|
||||||
|
|
||||||
SET(CMAKE_CXX_FLAGS_DEBUG "/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /wd4800 /wd4244 /wd4305 /D_DEBUG /Od /Gm /EHsc /RTC1 /MTd /W3 /nologo /ZI /J" CACHE STRING "MSVC MT flags " FORCE)
|
SET(CMAKE_CXX_FLAGS_DEBUG "/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /wd4800 /wd4244 /wd4305 /D_DEBUG /Od /Gm /EHsc /RTC1 /MTd /W3 /nologo /ZI /J" CACHE STRING "MSVC MT flags " FORCE)
|
||||||
SET(CMAKE_CXX_FLAGS_RELEASE "/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /wd4800 /wd4244 /wd4305 /O2 /Ob2 /DNDEBUG /EHsc /MT /W3 /nologo /J" CACHE STRING "MSVC MT flags " FORCE)
|
SET(CMAKE_CXX_FLAGS_RELEASE "/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /wd4800 /wd4244 /wd4305 /O2 /Ob2 /DNDEBUG /EHsc /MT /W3 /nologo /J" CACHE STRING "MSVC MT flags " FORCE)
|
||||||
@@ -296,8 +359,8 @@ IF(WIN32)
|
|||||||
ENDIF(WITH_OPENMP)
|
ENDIF(WITH_OPENMP)
|
||||||
|
|
||||||
SET(SDL ${LIBDIR}/sdl)
|
SET(SDL ${LIBDIR}/sdl)
|
||||||
SET(SDL_INC ${SDL}/include)
|
SET(SDL_INCLUDE_DIR ${SDL}/include)
|
||||||
SET(SDL_LIB SDL)
|
SET(SDL_LIBRARY SDL)
|
||||||
SET(SDL_LIBPATH ${SDL}/lib)
|
SET(SDL_LIBPATH ${SDL}/lib)
|
||||||
|
|
||||||
SET(PNG "${LIBDIR}/png")
|
SET(PNG "${LIBDIR}/png")
|
||||||
@@ -314,10 +377,11 @@ IF(WIN32)
|
|||||||
SET(WINTAB_INC ${LIBDIR}/wintab/include)
|
SET(WINTAB_INC ${LIBDIR}/wintab/include)
|
||||||
|
|
||||||
IF(CMAKE_CL_64)
|
IF(CMAKE_CL_64)
|
||||||
SET(PLATFORM_LINKFLAGS "/MANIFEST:NO /MANIFESTUAC:NO /MACHINE:X64 /NODEFAULTLIB:libc.lib;MSVCRT.lib ")
|
SET(PLATFORM_LINKFLAGS "/MANIFEST:NO /MANIFESTUAC:NO /MACHINE:X64 /NODEFAULTLIB:libc.lib;MSVCRT.lib ")
|
||||||
ELSE(CMAKE_CL_64)
|
ELSE(CMAKE_CL_64)
|
||||||
SET(PLATFORM_LINKFLAGS "/NODEFAULTLIB:libc.lib ")
|
SET(PLATFORM_LINKFLAGS "/NODEFAULTLIB:libc.lib ")
|
||||||
ENDIF(CMAKE_CL_64)
|
ENDIF(CMAKE_CL_64)
|
||||||
|
|
||||||
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:libcmt.lib;libc.lib ")
|
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:libcmt.lib;libc.lib ")
|
||||||
ENDIF(WIN32)
|
ENDIF(WIN32)
|
||||||
|
|
||||||
@@ -332,13 +396,24 @@ IF(APPLE)
|
|||||||
FIND_PACKAGE(OpenAL)
|
FIND_PACKAGE(OpenAL)
|
||||||
IF(OPENAL_FOUND)
|
IF(OPENAL_FOUND)
|
||||||
SET(WITH_OPENAL ON)
|
SET(WITH_OPENAL ON)
|
||||||
SET(OPENAL_LIB ${OPENAL_LIBRARY})
|
|
||||||
SET(OPENAL_INC ${OPENAL_INCLUDE_DIR})
|
|
||||||
ELSE(OPENAL_FOUND)
|
ELSE(OPENAL_FOUND)
|
||||||
SET(WITH_OPENAL OFF)
|
SET(WITH_OPENAL OFF)
|
||||||
ENDIF(OPENAL_FOUND)
|
ENDIF(OPENAL_FOUND)
|
||||||
ENDIF(WITH_OPENAL)
|
ENDIF(WITH_OPENAL)
|
||||||
|
|
||||||
|
IF(WITH_JACK)
|
||||||
|
SET(JACK /usr)
|
||||||
|
SET(JACK_INC ${JACK}/include/jack)
|
||||||
|
SET(JACK_LIB jack)
|
||||||
|
SET(JACK_LIBPATH ${JACK}/lib)
|
||||||
|
ENDIF(WITH_JACK)
|
||||||
|
|
||||||
|
IF(WITH_SNDFILE)
|
||||||
|
SET(SNDFILE /usr)
|
||||||
|
SET(SNDFILE_INC ${SNDFILE}/include)
|
||||||
|
SET(SNDFILE_LIB sndfile)
|
||||||
|
SET(SNDFILE_LIBPATH ${SNDFILE}/lib)
|
||||||
|
ENDIF(WITH_SNDFILE)
|
||||||
|
|
||||||
SET(PYTHON_VERSION 3.1)
|
SET(PYTHON_VERSION 3.1)
|
||||||
|
|
||||||
@@ -347,7 +422,7 @@ IF(APPLE)
|
|||||||
|
|
||||||
SET(PYTHON ${LIBDIR}/python)
|
SET(PYTHON ${LIBDIR}/python)
|
||||||
SET(PYTHON_INC "${PYTHON}/include/python${PYTHON_VERSION}" CACHE STRING "")
|
SET(PYTHON_INC "${PYTHON}/include/python${PYTHON_VERSION}" CACHE STRING "")
|
||||||
SET(PYTHON_BINARY "${PYTHON}/bin/python${PYTHON_VERSION}" CACHE STRING "")
|
# SET(PYTHON_BINARY "${PYTHON}/bin/python${PYTHON_VERSION}" CACHE STRING "") # not used yet
|
||||||
SET(PYTHON_LIB python${PYTHON_VERSION})
|
SET(PYTHON_LIB python${PYTHON_VERSION})
|
||||||
SET(PYTHON_LIBPATH "${PYTHON}/lib/python${PYTHON_VERSION}" CACHE STRING "")
|
SET(PYTHON_LIBPATH "${PYTHON}/lib/python${PYTHON_VERSION}" CACHE STRING "")
|
||||||
# SET(PYTHON_LINKFLAGS "-u _PyMac_Error") # won't build with this enabled
|
# SET(PYTHON_LINKFLAGS "-u _PyMac_Error") # won't build with this enabled
|
||||||
@@ -357,7 +432,7 @@ IF(APPLE)
|
|||||||
SET(PYTHON /System/Library/Frameworks/Python.framework/Versions/)
|
SET(PYTHON /System/Library/Frameworks/Python.framework/Versions/)
|
||||||
SET(PYTHON_VERSION 2.5)
|
SET(PYTHON_VERSION 2.5)
|
||||||
SET(PYTHON_INC "${PYTHON}${PYTHON_VERSION}/include/python${PYTHON_VERSION}" CACHE STRING "")
|
SET(PYTHON_INC "${PYTHON}${PYTHON_VERSION}/include/python${PYTHON_VERSION}" CACHE STRING "")
|
||||||
SET(PYTHON_BINARY ${PYTHON}${PYTHON_VERSION}/bin/python${PYTHON_VERSION} CACHE STRING "")
|
# SET(PYTHON_BINARY ${PYTHON}${PYTHON_VERSION}/bin/python${PYTHON_VERSION} CACHE STRING "") # not used yet
|
||||||
SET(PYTHON_LIB "")
|
SET(PYTHON_LIB "")
|
||||||
SET(PYTHON_LIBPATH ${PYTHON}${PYTHON_VERSION}/lib/python${PYTHON_VERSION}/config CACHE STRING "")
|
SET(PYTHON_LIBPATH ${PYTHON}${PYTHON_VERSION}/lib/python${PYTHON_VERSION}/config CACHE STRING "")
|
||||||
SET(PYTHON_LINKFLAGS "-u _PyMac_Error -framework System -framework Python")
|
SET(PYTHON_LINKFLAGS "-u _PyMac_Error -framework System -framework Python")
|
||||||
@@ -367,6 +442,13 @@ IF(APPLE)
|
|||||||
SET(GETTEXT_INC "${GETTEXT}/include")
|
SET(GETTEXT_INC "${GETTEXT}/include")
|
||||||
SET(GETTEXT_LIB intl iconv)
|
SET(GETTEXT_LIB intl iconv)
|
||||||
SET(GETTEXT_LIBPATH ${GETTEXT}/lib)
|
SET(GETTEXT_LIBPATH ${GETTEXT}/lib)
|
||||||
|
|
||||||
|
IF(WITH_FFTW3)
|
||||||
|
SET(FFTW3 ${LIBDIR}/fftw3)
|
||||||
|
SET(FFTW3_INC ${FFTW3}/include)
|
||||||
|
SET(FFTW3_LIB libfftw)
|
||||||
|
SET(FFTW3_LIBPATH ${FFTW3}/lib)
|
||||||
|
ENDIF(WITH_FFTW3)
|
||||||
|
|
||||||
SET(PNG_LIBRARIES png)
|
SET(PNG_LIBRARIES png)
|
||||||
SET(JPEG_LIBRARY jpeg)
|
SET(JPEG_LIBRARY jpeg)
|
||||||
@@ -376,15 +458,25 @@ IF(APPLE)
|
|||||||
SET(ZLIB_LIBRARIES z)
|
SET(ZLIB_LIBRARIES z)
|
||||||
|
|
||||||
SET(FREETYPE ${LIBDIR}/freetype)
|
SET(FREETYPE ${LIBDIR}/freetype)
|
||||||
SET(FREETYPE_INC ${FREETYPE}/include ${FREETYPE}/include/freetype2)
|
SET(FREETYPE_INCLUDE_DIRS ${FREETYPE}/include ${FREETYPE}/include/freetype2)
|
||||||
SET(FREETYPE_LIBPATH ${FREETYPE}/lib)
|
SET(FREETYPE_LIBPATH ${FREETYPE}/lib)
|
||||||
SET(FREETYPE_LIB freetype)
|
SET(FREETYPE_LIBRARY freetype)
|
||||||
|
|
||||||
SET(OPENEXR ${LIBDIR}/openexr)
|
SET(OPENEXR ${LIBDIR}/openexr)
|
||||||
SET(OPENEXR_INC ${OPENEXR}/include/OpenEXR ${OPENEXR}/include)
|
SET(OPENEXR_INC ${OPENEXR}/include/OpenEXR ${OPENEXR}/include)
|
||||||
SET(OPENEXR_LIB Iex Half IlmImf Imath IlmThread)
|
SET(OPENEXR_LIB Iex Half IlmImf Imath IlmThread)
|
||||||
SET(OPENEXR_LIBPATH ${OPENEXR}/lib)
|
SET(OPENEXR_LIBPATH ${OPENEXR}/lib)
|
||||||
|
|
||||||
|
SET(FFMPEG ${LIBDIR}/ffmpeg)
|
||||||
|
SET(FFMPEG_INC ${CMAKE_SOURCE_DIR}/extern/ffmpeg)
|
||||||
|
SET(FFMPEG_LIB avcodec avdevice avformat avutil mp3lame swscale x264 xvidcore)
|
||||||
|
SET(FFMPEG_LIBPATH ${FFMPEG}/lib)
|
||||||
|
|
||||||
|
SET(LIBSAMPLERATE ${LIBDIR}/samplerate)
|
||||||
|
SET(LIBSAMPLERATE_INC ${LIBSAMPLERATE}/include)
|
||||||
|
SET(LIBSAMPLERATE_LIB samplerate)
|
||||||
|
SET(LIBSAMPLERATE_LIBPATH ${LIBSAMPLERATE}/lib)
|
||||||
|
|
||||||
SET(LLIBS stdc++ SystemStubs)
|
SET(LLIBS stdc++ SystemStubs)
|
||||||
|
|
||||||
SET(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
|
SET(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
|
||||||
@@ -397,8 +489,8 @@ IF(APPLE)
|
|||||||
ENDIF(WITH_OPENMP)
|
ENDIF(WITH_OPENMP)
|
||||||
|
|
||||||
SET(SDL ${LIBDIR}/sdl)
|
SET(SDL ${LIBDIR}/sdl)
|
||||||
SET(SDL_INC ${SDL}/include)
|
SET(SDL_INCLUDE_DIR ${SDL}/include)
|
||||||
SET(SDL_LIB SDL)
|
SET(SDL_LIBRARY SDL)
|
||||||
SET(SDL_LIBPATH ${SDL}/lib)
|
SET(SDL_LIBPATH ${SDL}/lib)
|
||||||
|
|
||||||
SET(PNG "${LIBDIR}/png")
|
SET(PNG "${LIBDIR}/png")
|
||||||
@@ -420,6 +512,17 @@ IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
|||||||
SET(BINRELOC_INC ${BINRELOC}/include)
|
SET(BINRELOC_INC ${BINRELOC}/include)
|
||||||
ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||||
|
|
||||||
|
|
||||||
|
# TODO - buildinfo
|
||||||
|
# IF(UNIX)
|
||||||
|
# IF(WITH_BUILDINFO)
|
||||||
|
# EXEC_PROGRAM("date \"+%Y-%m-%d\"" OUTPUT_VARIABLE BUILD_DATE)
|
||||||
|
# EXEC_PROGRAM("date \"+%H:%M:%S\"" OUTPUT_VARIABLE BUILD_TIME)
|
||||||
|
# EXEC_PROGRAM("svnversion ${CMAKE_SOURCE_DIR}" OUTPUT_VARIABLE BUILD_REV)
|
||||||
|
# SET(BUILD_TYPE ${CMAKE_BUILD_TYPE})
|
||||||
|
# ENDIF(WITH_BUILDINFO)
|
||||||
|
# ENDIF(UNIX)
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# Common.
|
# Common.
|
||||||
|
|
||||||
@@ -442,16 +545,18 @@ ENDIF(WITH_WEBPLUGIN)
|
|||||||
# Configure OpenGL.
|
# Configure OpenGL.
|
||||||
FIND_PACKAGE(OpenGL)
|
FIND_PACKAGE(OpenGL)
|
||||||
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
|
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
|
||||||
|
# UNSET(OPENGL_LIBRARIES CACHE) # not compat with older cmake
|
||||||
|
# UNSET(OPENGL_xmesa_INCLUDE_DIR CACHE) # not compat with older cmake
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# Extra compile flags
|
# Extra compile flags
|
||||||
IF(WITH_GAMEENGINE)
|
|
||||||
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DGAMEBLENDER ")
|
|
||||||
ENDIF(WITH_GAMEENGINE)
|
|
||||||
IF(WITH_BULLET)
|
|
||||||
SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DWITH_BULLET ")
|
|
||||||
ENDIF(WITH_BULLET)
|
|
||||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PLATFORM_CFLAGS} ${C_WARNINGS}")
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PLATFORM_CFLAGS} ${C_WARNINGS}")
|
||||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PLATFORM_CFLAGS} ")
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PLATFORM_CFLAGS} ${CXX_WARNINGS}")
|
||||||
|
|
||||||
|
# better not define flags here but this is a debugging option thats off by default.
|
||||||
|
IF(WITH_CXX_GUARDEDALLOC)
|
||||||
|
SET(CMAKE_CXX_FLAGS " -DWITH_CXX_GUARDEDALLOC -I${CMAKE_SOURCE_DIR}/intern/guardedalloc ${CMAKE_CXX_FLAGS}")
|
||||||
|
ENDIF(WITH_CXX_GUARDEDALLOC)
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# Libraries
|
# Libraries
|
||||||
@@ -471,3 +576,4 @@ ADD_SUBDIRECTORY(source/creator)
|
|||||||
IF(WITH_PLAYER)
|
IF(WITH_PLAYER)
|
||||||
ADD_SUBDIRECTORY(blenderplayer)
|
ADD_SUBDIRECTORY(blenderplayer)
|
||||||
ENDIF(WITH_PLAYER)
|
ENDIF(WITH_PLAYER)
|
||||||
|
|
||||||
|
|||||||
25
SConstruct
25
SConstruct
@@ -60,7 +60,6 @@ B = tools.Blender
|
|||||||
platform = sys.platform
|
platform = sys.platform
|
||||||
quickie = None
|
quickie = None
|
||||||
quickdebug = None
|
quickdebug = None
|
||||||
nsis_build = None
|
|
||||||
|
|
||||||
##### BEGIN SETUP #####
|
##### BEGIN SETUP #####
|
||||||
|
|
||||||
@@ -425,8 +424,6 @@ if env['OURPLATFORM']=='darwin':
|
|||||||
bundle = '%s.app' % prg[0]
|
bundle = '%s.app' % prg[0]
|
||||||
bundledir = os.path.dirname(bundle)
|
bundledir = os.path.dirname(bundle)
|
||||||
for dp, dn, df in os.walk(bundle):
|
for dp, dn, df in os.walk(bundle):
|
||||||
if 'CVS' in dn:
|
|
||||||
dn.remove('CVS')
|
|
||||||
if '.svn' in dn:
|
if '.svn' in dn:
|
||||||
dn.remove('.svn')
|
dn.remove('.svn')
|
||||||
dir=env['BF_INSTALLDIR']+dp[len(bundledir):]
|
dir=env['BF_INSTALLDIR']+dp[len(bundledir):]
|
||||||
@@ -443,8 +440,6 @@ scriptinstall = []
|
|||||||
|
|
||||||
if env['OURPLATFORM']!='darwin':
|
if env['OURPLATFORM']!='darwin':
|
||||||
for dp, dn, df in os.walk('bin/.blender'):
|
for dp, dn, df in os.walk('bin/.blender'):
|
||||||
if 'CVS' in dn:
|
|
||||||
dn.remove('CVS')
|
|
||||||
if '.svn' in dn:
|
if '.svn' in dn:
|
||||||
dn.remove('.svn')
|
dn.remove('.svn')
|
||||||
|
|
||||||
@@ -471,8 +466,6 @@ if env['OURPLATFORM']!='darwin':
|
|||||||
scriptpaths=['release/scripts', 'release/ui', 'release/io']
|
scriptpaths=['release/scripts', 'release/ui', 'release/io']
|
||||||
for scriptpath in scriptpaths:
|
for scriptpath in scriptpaths:
|
||||||
for dp, dn, df in os.walk(scriptpath):
|
for dp, dn, df in os.walk(scriptpath):
|
||||||
if 'CVS' in dn:
|
|
||||||
dn.remove('CVS')
|
|
||||||
if '.svn' in dn:
|
if '.svn' in dn:
|
||||||
dn.remove('.svn')
|
dn.remove('.svn')
|
||||||
dir=env['BF_INSTALLDIR']+'/.blender/'+os.path.basename(scriptpath)+dp[len(scriptpath):]
|
dir=env['BF_INSTALLDIR']+'/.blender/'+os.path.basename(scriptpath)+dp[len(scriptpath):]
|
||||||
@@ -485,8 +478,6 @@ if env['OURPLATFORM']=='linux2':
|
|||||||
icontargetlist = []
|
icontargetlist = []
|
||||||
|
|
||||||
for tp, tn, tf in os.walk('release/freedesktop/icons'):
|
for tp, tn, tf in os.walk('release/freedesktop/icons'):
|
||||||
if 'CVS' in tn:
|
|
||||||
tn.remove('CVS')
|
|
||||||
if '.svn' in tn:
|
if '.svn' in tn:
|
||||||
tn.remove('.svn')
|
tn.remove('.svn')
|
||||||
for f in tf:
|
for f in tf:
|
||||||
@@ -509,8 +500,6 @@ if env['OURPLATFORM']=='linuxcross':
|
|||||||
pluglist = []
|
pluglist = []
|
||||||
plugtargetlist = []
|
plugtargetlist = []
|
||||||
for tp, tn, tf in os.walk('release/plugins'):
|
for tp, tn, tf in os.walk('release/plugins'):
|
||||||
if 'CVS' in tn:
|
|
||||||
tn.remove('CVS')
|
|
||||||
if '.svn' in tn:
|
if '.svn' in tn:
|
||||||
tn.remove('.svn')
|
tn.remove('.svn')
|
||||||
for f in tf:
|
for f in tf:
|
||||||
@@ -541,8 +530,6 @@ for targetdir,srcfile in zip(plugtargetlist, pluglist):
|
|||||||
textlist = []
|
textlist = []
|
||||||
texttargetlist = []
|
texttargetlist = []
|
||||||
for tp, tn, tf in os.walk('release/text'):
|
for tp, tn, tf in os.walk('release/text'):
|
||||||
if 'CVS' in tn:
|
|
||||||
tn.remove('CVS')
|
|
||||||
if '.svn' in tn:
|
if '.svn' in tn:
|
||||||
tn.remove('.svn')
|
tn.remove('.svn')
|
||||||
for f in tf:
|
for f in tf:
|
||||||
@@ -593,12 +580,14 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-vc'):
|
|||||||
'${LCGDIR}/ffmpeg/lib/avformat-52.dll',
|
'${LCGDIR}/ffmpeg/lib/avformat-52.dll',
|
||||||
'${LCGDIR}/ffmpeg/lib/avdevice-52.dll',
|
'${LCGDIR}/ffmpeg/lib/avdevice-52.dll',
|
||||||
'${LCGDIR}/ffmpeg/lib/avutil-50.dll',
|
'${LCGDIR}/ffmpeg/lib/avutil-50.dll',
|
||||||
'${LCGDIR}/ffmpeg/lib/libfaad-2.dll',
|
# '${LCGDIR}/ffmpeg/lib/libfaad-2.dll',
|
||||||
'${LCGDIR}/ffmpeg/lib/libfaac-0.dll',
|
# '${LCGDIR}/ffmpeg/lib/libfaac-0.dll',
|
||||||
'${LCGDIR}/ffmpeg/lib/libmp3lame-0.dll',
|
# '${LCGDIR}/ffmpeg/lib/libmp3lame-0.dll',
|
||||||
'${LCGDIR}/ffmpeg/lib/libx264-67.dll',
|
# '${LCGDIR}/ffmpeg/lib/libx264-67.dll',
|
||||||
'${LCGDIR}/ffmpeg/lib/xvidcore.dll',
|
# '${LCGDIR}/ffmpeg/lib/xvidcore.dll',
|
||||||
'${LCGDIR}/ffmpeg/lib/swscale-0.dll']
|
'${LCGDIR}/ffmpeg/lib/swscale-0.dll']
|
||||||
|
if env['WITH_BF_JACK']:
|
||||||
|
dllsources += ['${LCGDIR}/jack/lib/libjack.dll']
|
||||||
windlls = env.Install(dir=env['BF_INSTALLDIR'], source = dllsources)
|
windlls = env.Install(dir=env['BF_INSTALLDIR'], source = dllsources)
|
||||||
allinstall += windlls
|
allinstall += windlls
|
||||||
|
|
||||||
|
|||||||
@@ -66,17 +66,12 @@ IF(UNIX)
|
|||||||
gp_common
|
gp_common
|
||||||
bf_string
|
bf_string
|
||||||
bf_ghost
|
bf_ghost
|
||||||
bf_blenkernel
|
bf_blenkernel
|
||||||
verse
|
|
||||||
bf_blenkernel
|
|
||||||
bf_blenloader
|
bf_blenloader
|
||||||
bf_blenpluginapi
|
bf_blenpluginapi
|
||||||
bf_blroutines
|
bf_blroutines
|
||||||
bf_converter
|
bf_converter
|
||||||
bf_sumo
|
|
||||||
bf_ketsji
|
bf_ketsji
|
||||||
extern_solid
|
|
||||||
extern_qhull
|
|
||||||
bf_bullet
|
bf_bullet
|
||||||
bf_common
|
bf_common
|
||||||
bf_dummy
|
bf_dummy
|
||||||
@@ -87,7 +82,6 @@ IF(UNIX)
|
|||||||
bf_scenegraph
|
bf_scenegraph
|
||||||
bf_IK
|
bf_IK
|
||||||
bf_moto
|
bf_moto
|
||||||
bf_soundsystem
|
|
||||||
bf_kernel
|
bf_kernel
|
||||||
bf_nodes
|
bf_nodes
|
||||||
bf_gpu
|
bf_gpu
|
||||||
@@ -106,10 +100,17 @@ IF(UNIX)
|
|||||||
bf_dds
|
bf_dds
|
||||||
bf_readblenfile
|
bf_readblenfile
|
||||||
blenkernel_blc
|
blenkernel_blc
|
||||||
bf_quicktime
|
|
||||||
extern_binreloc
|
extern_binreloc
|
||||||
extern_glew
|
extern_glew
|
||||||
)
|
)
|
||||||
|
|
||||||
|
IF(WITH_QUICKTIME)
|
||||||
|
SET(BLENDER_SORTED_LIBS ${BLENDER_SORTED_LIBS} quicktime)
|
||||||
|
ENDIF(WITH_QUICKTIME)
|
||||||
|
|
||||||
|
IF(WITH_CXX_GUARDEDALLOC)
|
||||||
|
SET(BLENDER_SORTED_LIBS ${BLENDER_SORTED_LIBS} bf_guardedalloc_cpp)
|
||||||
|
ENDIF(WITH_CXX_GUARDEDALLOC)
|
||||||
|
|
||||||
FOREACH(SORTLIB ${BLENDER_SORTED_LIBS})
|
FOREACH(SORTLIB ${BLENDER_SORTED_LIBS})
|
||||||
SET(REMLIB ${SORTLIB})
|
SET(REMLIB ${SORTLIB})
|
||||||
|
|||||||
@@ -1,10 +1,3 @@
|
|||||||
#
|
|
||||||
# Note : if you want to alter this file
|
|
||||||
# copy it as a whole in the upper folder
|
|
||||||
# as user-config.py
|
|
||||||
# dont create a new file with only some
|
|
||||||
# vars changed.
|
|
||||||
|
|
||||||
import commands
|
import commands
|
||||||
|
|
||||||
# IMPORTANT NOTE : OFFICIAL BUILDS SHOULD BE DONE WITH SDKs
|
# IMPORTANT NOTE : OFFICIAL BUILDS SHOULD BE DONE WITH SDKs
|
||||||
@@ -32,22 +25,28 @@ BF_PYTHON_VERSION = '3.1'
|
|||||||
if MAC_PROC== 'powerpc' and BF_PYTHON_VERSION == '2.3':
|
if MAC_PROC== 'powerpc' and BF_PYTHON_VERSION == '2.3':
|
||||||
MAC_MIN_VERS = '10.3'
|
MAC_MIN_VERS = '10.3'
|
||||||
MACOSX_SDK='/Developer/SDKs/MacOSX10.3.9.sdk'
|
MACOSX_SDK='/Developer/SDKs/MacOSX10.3.9.sdk'
|
||||||
elif MAC_CUR_VER=='10.4':
|
else:
|
||||||
MAC_MIN_VERS = '10.4'
|
MAC_MIN_VERS = '10.4'
|
||||||
MACOSX_SDK='/Developer/SDKs/MacOSX10.4u.sdk'
|
MACOSX_SDK='/Developer/SDKs/MacOSX10.4u.sdk'
|
||||||
else:
|
|
||||||
MAC_MIN_VERS = '10.5'
|
|
||||||
MACOSX_SDK='/Developer/SDKs/MacOSX10.5.sdk'
|
|
||||||
|
|
||||||
|
|
||||||
# enable ffmpeg support
|
# enable ffmpeg support
|
||||||
WITH_BF_FFMPEG = True # -DWITH_FFMPEG
|
WITH_BF_FFMPEG = True # -DWITH_FFMPEG
|
||||||
BF_FFMPEG = "#extern/ffmpeg"
|
FFMPEG_PRECOMPILED = False
|
||||||
BF_FFMPEG_INC = '${BF_FFMPEG}'
|
if FFMPEG_PRECOMPILED:
|
||||||
if USE_SDK==True:
|
# use precompiled ffmpeg in /lib
|
||||||
BF_FFMPEG_EXTRA = '-isysroot '+MACOSX_SDK+' -mmacosx-version-min='+MAC_MIN_VERS
|
BF_FFMPEG = LIBDIR + '/ffmpeg'
|
||||||
#BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
|
BF_FFMPEG_INC = "#extern/ffmpeg"
|
||||||
#BF_FFMPEG_LIB = 'avformat.a avcodec.a avutil.a'
|
BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
|
||||||
|
BF_FFMPEG_LIB = 'avcodec avdevice avformat avutil mp3lame swscale x264 xvidcore'
|
||||||
|
else:
|
||||||
|
# use ffmpeg in extern
|
||||||
|
BF_FFMPEG = "#extern/ffmpeg"
|
||||||
|
BF_FFMPEG_INC = '${BF_FFMPEG}'
|
||||||
|
if USE_SDK==True:
|
||||||
|
BF_FFMPEG_EXTRA = '-isysroot '+MACOSX_SDK+' -mmacosx-version-min='+MAC_MIN_VERS
|
||||||
|
BF_XVIDCORE_CONFIG = '--disable-assembly' # currently causes errors, even with yasm installed
|
||||||
|
BF_X264_CONFIG = '--disable-pthread'
|
||||||
|
|
||||||
if BF_PYTHON_VERSION=='3.1':
|
if BF_PYTHON_VERSION=='3.1':
|
||||||
# python 3.1 uses precompiled libraries in bf svn /lib by default
|
# python 3.1 uses precompiled libraries in bf svn /lib by default
|
||||||
@@ -57,7 +56,7 @@ if BF_PYTHON_VERSION=='3.1':
|
|||||||
# BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}'
|
# BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}'
|
||||||
BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}'
|
BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}'
|
||||||
BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib/python${BF_PYTHON_VERSION}'
|
BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib/python${BF_PYTHON_VERSION}'
|
||||||
# BF_PYTHON_LINKFLAGS = '-u _PyMac_Error -framework System'
|
# BF_PYTHON_LINKFLAGS = ['-u', '_PyMac_Error', '-framework', 'System']
|
||||||
else:
|
else:
|
||||||
# python 2.5 etc. uses built-in framework
|
# python 2.5 etc. uses built-in framework
|
||||||
|
|
||||||
@@ -73,18 +72,13 @@ else:
|
|||||||
BF_PYTHON_BINARY = '${BF_PYTHON}${BF_PYTHON_VERSION}/bin/python${BF_PYTHON_VERSION}'
|
BF_PYTHON_BINARY = '${BF_PYTHON}${BF_PYTHON_VERSION}/bin/python${BF_PYTHON_VERSION}'
|
||||||
BF_PYTHON_LIB = ''
|
BF_PYTHON_LIB = ''
|
||||||
BF_PYTHON_LIBPATH = '${BF_PYTHON}${BF_PYTHON_VERSION}/lib/python${BF_PYTHON_VERSION}/config'
|
BF_PYTHON_LIBPATH = '${BF_PYTHON}${BF_PYTHON_VERSION}/lib/python${BF_PYTHON_VERSION}/config'
|
||||||
BF_PYTHON_LINKFLAGS = '-u _PyMac_Error -framework System -framework Python'
|
BF_PYTHON_LINKFLAGS = ['-u','_PyMac_Error','-framework','System','-framework','Python']
|
||||||
if MAC_CUR_VER=='10.3' or MAC_CUR_VER=='10.4':
|
if MAC_CUR_VER=='10.3' or MAC_CUR_VER=='10.4':
|
||||||
BF_PYTHON_LINKFLAGS ='-u __dummy '+BF_PYTHON_LINKFLAGS
|
BF_PYTHON_LINKFLAGS = ['-u', '__dummy']+BF_PYTHON_LINKFLAGS
|
||||||
|
|
||||||
BF_QUIET = '1'
|
BF_QUIET = '1'
|
||||||
WITH_BF_OPENMP = '0'
|
WITH_BF_OPENMP = '0'
|
||||||
|
|
||||||
# Note : should be true, but openal simply dont work on intel
|
|
||||||
if MAC_PROC == 'i386':
|
|
||||||
WITH_BF_OPENAL = False
|
|
||||||
else:
|
|
||||||
WITH_BF_OPENAL = True
|
|
||||||
#different lib must be used following version of gcc
|
#different lib must be used following version of gcc
|
||||||
# for gcc 3.3
|
# for gcc 3.3
|
||||||
#BF_OPENAL = LIBDIR + '/openal'
|
#BF_OPENAL = LIBDIR + '/openal'
|
||||||
@@ -106,6 +100,24 @@ BF_CXX = '/usr'
|
|||||||
WITH_BF_STATICCXX = False
|
WITH_BF_STATICCXX = False
|
||||||
BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
|
BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
|
||||||
|
|
||||||
|
BF_LIBSAMPLERATE = LIBDIR + '/samplerate'
|
||||||
|
BF_LIBSAMPLERATE_INC = '${BF_LIBSAMPLERATE}/include'
|
||||||
|
BF_LIBSAMPLERATE_LIB = 'samplerate'
|
||||||
|
BF_LIBSAMPLERATE_LIBPATH = '${BF_LIBSAMPLERATE}/lib'
|
||||||
|
|
||||||
|
# TODO - set proper paths here (add precompiled to lib/ ? )
|
||||||
|
WITH_BF_JACK = False
|
||||||
|
BF_JACK = '/usr'
|
||||||
|
BF_JACK_INC = '${BF_JACK}/include/jack'
|
||||||
|
BF_JACK_LIB = 'jack'
|
||||||
|
BF_JACK_LIBPATH = '${BF_JACK}/lib'
|
||||||
|
|
||||||
|
WITH_BF_SNDFILE = False
|
||||||
|
BF_SNDFILE = LIBDIR + '/sndfile'
|
||||||
|
BF_SNDFILE_INC = '${BF_SNDFILE}/include'
|
||||||
|
BF_SNDFILE_LIB = 'sndfile'
|
||||||
|
BF_SNDFILE_LIBPATH = '${BF_SNDFILE}/lib'
|
||||||
|
|
||||||
WITH_BF_SDL = True
|
WITH_BF_SDL = True
|
||||||
BF_SDL = LIBDIR + '/sdl' #$(shell sdl-config --prefix)
|
BF_SDL = LIBDIR + '/sdl' #$(shell sdl-config --prefix)
|
||||||
BF_SDL_INC = '${BF_SDL}/include' #$(shell $(BF_SDL)/bin/sdl-config --cflags)
|
BF_SDL_INC = '${BF_SDL}/include' #$(shell $(BF_SDL)/bin/sdl-config --cflags)
|
||||||
@@ -158,6 +170,12 @@ BF_BULLET = '#extern/bullet2/src'
|
|||||||
BF_BULLET_INC = '${BF_BULLET}'
|
BF_BULLET_INC = '${BF_BULLET}'
|
||||||
BF_BULLET_LIB = 'extern_bullet'
|
BF_BULLET_LIB = 'extern_bullet'
|
||||||
|
|
||||||
|
WITH_BF_FFTW3 = False
|
||||||
|
BF_FFTW3 = LIBDIR + '/fftw3'
|
||||||
|
BF_FFTW3_INC = '${BF_FFTW3}/include'
|
||||||
|
BF_FFTW3_LIB = 'libfftw3'
|
||||||
|
BF_FFTW3_LIBPATH = '${BF_FFTW3}/lib'
|
||||||
|
|
||||||
#WITH_BF_NSPR = True
|
#WITH_BF_NSPR = True
|
||||||
#BF_NSPR = $(LIBDIR)/nspr
|
#BF_NSPR = $(LIBDIR)/nspr
|
||||||
#BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr
|
#BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr
|
||||||
@@ -193,14 +211,14 @@ BF_ICONV_LIB = 'iconv'
|
|||||||
WITH_BF_STATICOPENGL = True
|
WITH_BF_STATICOPENGL = True
|
||||||
BF_OPENGL_LIB = 'GL GLU'
|
BF_OPENGL_LIB = 'GL GLU'
|
||||||
BF_OPENGL_LIBPATH = '/System/Library/Frameworks/OpenGL.framework/Libraries'
|
BF_OPENGL_LIBPATH = '/System/Library/Frameworks/OpenGL.framework/Libraries'
|
||||||
BF_OPENGL_LINKFLAGS = '-framework OpenGL'
|
BF_OPENGL_LINKFLAGS = ['-framework', 'OpenGL']
|
||||||
|
|
||||||
CFLAGS = ['-pipe','-fPIC','-funsigned-char']
|
CFLAGS = ['-pipe','-fPIC','-funsigned-char']
|
||||||
|
|
||||||
CPPFLAGS = ['-fpascal-strings']
|
CPPFLAGS = ['-fpascal-strings']
|
||||||
CCFLAGS = ['-pipe','-fPIC','-funsigned-char','-fpascal-strings']
|
CCFLAGS = ['-pipe','-fPIC','-funsigned-char','-fpascal-strings']
|
||||||
CXXFLAGS = [ '-pipe','-fPIC','-funsigned-char', '-fpascal-strings']
|
CXXFLAGS = [ '-pipe','-fPIC','-funsigned-char', '-fpascal-strings']
|
||||||
PLATFORM_LINKFLAGS = '-fexceptions -framework CoreServices -framework Foundation -framework IOKit -framework AppKit -framework Carbon -framework AGL -framework AudioUnit -framework AudioToolbox -framework CoreAudio -framework QuickTime'
|
PLATFORM_LINKFLAGS = ['-fexceptions','-framework','CoreServices','-framework','Foundation','-framework','IOKit','-framework','AppKit','-framework','Carbon','-framework','AGL','-framework','AudioUnit','-framework','AudioToolbox','-framework','CoreAudio','-framework','QuickTime']
|
||||||
|
|
||||||
#note to build succesfully on 10.3.9 SDK you need to patch 10.3.9 by adding the SystemStubs.a lib from 10.4
|
#note to build succesfully on 10.3.9 SDK you need to patch 10.3.9 by adding the SystemStubs.a lib from 10.4
|
||||||
LLIBS = ['stdc++', 'SystemStubs']
|
LLIBS = ['stdc++', 'SystemStubs']
|
||||||
@@ -209,12 +227,12 @@ LLIBS = ['stdc++', 'SystemStubs']
|
|||||||
if MAC_MIN_VERS == '10.3':
|
if MAC_MIN_VERS == '10.3':
|
||||||
CFLAGS = ['-fuse-cxa-atexit']+CFLAGS
|
CFLAGS = ['-fuse-cxa-atexit']+CFLAGS
|
||||||
CXXFLAGS = ['-fuse-cxa-atexit']+CXXFLAGS
|
CXXFLAGS = ['-fuse-cxa-atexit']+CXXFLAGS
|
||||||
PLATFORM_LINKFLAGS = '-fuse-cxa-atexit '+PLATFORM_LINKFLAGS
|
PLATFORM_LINKFLAGS = ['-fuse-cxa-atexit']+PLATFORM_LINKFLAGS
|
||||||
LLIBS.append('crt3.o')
|
LLIBS.append('crt3.o')
|
||||||
|
|
||||||
if USE_SDK==True:
|
if USE_SDK==True:
|
||||||
SDK_FLAGS=['-isysroot', MACOSX_SDK,'-mmacosx-version-min='+MAC_MIN_VERS]
|
SDK_FLAGS=['-isysroot', MACOSX_SDK,'-mmacosx-version-min='+MAC_MIN_VERS]
|
||||||
PLATFORM_LINKFLAGS = '-mmacosx-version-min='+MAC_MIN_VERS+ ' -Wl,-syslibroot,' + MACOSX_SDK+" "+PLATFORM_LINKFLAGS
|
PLATFORM_LINKFLAGS = ['-mmacosx-version-min='+MAC_MIN_VERS, '-Wl,-syslibroot,' + MACOSX_SDK]+PLATFORM_LINKFLAGS
|
||||||
CCFLAGS=SDK_FLAGS+CCFLAGS
|
CCFLAGS=SDK_FLAGS+CCFLAGS
|
||||||
CXXFLAGS=SDK_FLAGS+CXXFLAGS
|
CXXFLAGS=SDK_FLAGS+CXXFLAGS
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,11 @@ BF_CXX = '/usr'
|
|||||||
WITH_BF_STATICCXX = 'false'
|
WITH_BF_STATICCXX = 'false'
|
||||||
BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
|
BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
|
||||||
|
|
||||||
|
BF_LIBSAMPLERATE = LCGDIR+'/samplerate'
|
||||||
|
BF_LIBSAMPLERATE_INC = '${BF_LIBSAMPLERATE}/include'
|
||||||
|
BF_LIBSAMPLERATE_LIB = 'samplerate'
|
||||||
|
BF_LIBSAMPLERATE_LIBPATH = '${BF_LIBSAMPLERATE}/lib'
|
||||||
|
|
||||||
WITH_BF_SDL = 'true'
|
WITH_BF_SDL = 'true'
|
||||||
BF_SDL = LCGDIR+'/sdl' #$(shell sdl-config --prefix)
|
BF_SDL = LCGDIR+'/sdl' #$(shell sdl-config --prefix)
|
||||||
BF_SDL_INC = '${BF_SDL}/include/SDL' #$(shell $(BF_SDL)/bin/sdl-config --cflags)
|
BF_SDL_INC = '${BF_SDL}/include/SDL' #$(shell $(BF_SDL)/bin/sdl-config --cflags)
|
||||||
|
|||||||
@@ -22,6 +22,23 @@ BF_CXX = '/usr'
|
|||||||
WITH_BF_STATICCXX = False
|
WITH_BF_STATICCXX = False
|
||||||
BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
|
BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
|
||||||
|
|
||||||
|
BF_LIBSAMPLERATE = '/usr'
|
||||||
|
BF_LIBSAMPLERATE_INC = '${BF_LIBSAMPLERATE}/include'
|
||||||
|
BF_LIBSAMPLERATE_LIB = 'samplerate'
|
||||||
|
BF_LIBSAMPLERATE_LIBPATH = '${BF_LIBSAMPLERATE}/lib'
|
||||||
|
|
||||||
|
WITH_BF_JACK = False
|
||||||
|
BF_JACK = '/usr'
|
||||||
|
BF_JACK_INC = '${BF_JACK}/include/jack'
|
||||||
|
BF_JACK_LIB = 'jack'
|
||||||
|
BF_JACK_LIBPATH = '${BF_JACK}/lib'
|
||||||
|
|
||||||
|
WITH_BF_SNDFILE = False
|
||||||
|
BF_SNDFILE = '/usr'
|
||||||
|
BF_SNDFILE_INC = '${BF_SNDFILE}/include/sndfile'
|
||||||
|
BF_SNDFILE_LIB = 'sndfile'
|
||||||
|
BF_SNDFILE_LIBPATH = '${BF_SNDFILE}/lib'
|
||||||
|
|
||||||
WITH_BF_SDL = True
|
WITH_BF_SDL = True
|
||||||
BF_SDL = '/usr' #$(shell sdl-config --prefix)
|
BF_SDL = '/usr' #$(shell sdl-config --prefix)
|
||||||
BF_SDL_INC = '${BF_SDL}/include/SDL' #$(shell $(BF_SDL)/bin/sdl-config --cflags)
|
BF_SDL_INC = '${BF_SDL}/include/SDL' #$(shell $(BF_SDL)/bin/sdl-config --cflags)
|
||||||
@@ -74,23 +91,6 @@ BF_BULLET = '#extern/bullet2/src'
|
|||||||
BF_BULLET_INC = '${BF_BULLET}'
|
BF_BULLET_INC = '${BF_BULLET}'
|
||||||
BF_BULLET_LIB = 'extern_bullet'
|
BF_BULLET_LIB = 'extern_bullet'
|
||||||
|
|
||||||
#WITH_BF_NSPR = True
|
|
||||||
#BF_NSPR = $(LIBDIR)/nspr
|
|
||||||
#BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr
|
|
||||||
#BF_NSPR_LIB =
|
|
||||||
|
|
||||||
# Uncomment the following line to use Mozilla inplace of netscape
|
|
||||||
#CPPFLAGS += -DMOZ_NOT_NET
|
|
||||||
# Location of MOZILLA/Netscape header files...
|
|
||||||
#BF_MOZILLA = $(LIBDIR)/mozilla
|
|
||||||
#BF_MOZILLA_INC = -I$(BF_MOZILLA)/include/mozilla/nspr -I$(BF_MOZILLA)/include/mozilla -I$(BF_MOZILLA)/include/mozilla/xpcom -I$(BF_MOZILLA)/include/mozilla/idl
|
|
||||||
#BF_MOZILLA_LIB =
|
|
||||||
# Will fall back to look in BF_MOZILLA_INC/nspr and BF_MOZILLA_LIB
|
|
||||||
# if this is not set.
|
|
||||||
#
|
|
||||||
# Be paranoid regarding library creation (do not update archives)
|
|
||||||
#BF_PARANOID = True
|
|
||||||
|
|
||||||
# enable freetype2 support for text objects
|
# enable freetype2 support for text objects
|
||||||
BF_FREETYPE = '/usr'
|
BF_FREETYPE = '/usr'
|
||||||
BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
|
BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
|
||||||
@@ -130,6 +130,12 @@ BF_OPENJPEG_LIB = ''
|
|||||||
BF_OPENJPEG_INC = '${BF_OPENJPEG}'
|
BF_OPENJPEG_INC = '${BF_OPENJPEG}'
|
||||||
BF_OPENJPEG_LIBPATH='${BF_OPENJPEG}/lib'
|
BF_OPENJPEG_LIBPATH='${BF_OPENJPEG}/lib'
|
||||||
|
|
||||||
|
WITH_BF_FFTW3 = False
|
||||||
|
BF_FFTW3 = LIBDIR + '/usr'
|
||||||
|
BF_FFTW3_INC = '${BF_FFTW3}/include'
|
||||||
|
BF_FFTW3_LIB = 'fftw3'
|
||||||
|
BF_FFTW3_LIBPATH = '${BF_FFTW3}/lib'
|
||||||
|
|
||||||
WITH_BF_REDCODE = False
|
WITH_BF_REDCODE = False
|
||||||
BF_REDCODE = '#extern/libredcode'
|
BF_REDCODE = '#extern/libredcode'
|
||||||
BF_REDCODE_LIB = ''
|
BF_REDCODE_LIB = ''
|
||||||
@@ -164,8 +170,9 @@ REL_CCFLAGS = ['-O2']
|
|||||||
##ARFLAGSQUIET = ru
|
##ARFLAGSQUIET = ru
|
||||||
##
|
##
|
||||||
C_WARN = ['-Wno-char-subscripts', '-Wdeclaration-after-statement']
|
C_WARN = ['-Wno-char-subscripts', '-Wdeclaration-after-statement']
|
||||||
|
|
||||||
CC_WARN = ['-Wall']
|
CC_WARN = ['-Wall']
|
||||||
|
CXX_WARN = ['-Wno-invalid-offsetof', '-Wno-sign-compare']
|
||||||
|
|
||||||
|
|
||||||
##FIX_STUBS_WARNINGS = -Wno-unused
|
##FIX_STUBS_WARNINGS = -Wno-unused
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,11 @@ BF_CXX = '/usr'
|
|||||||
WITH_BF_STATICCXX = False
|
WITH_BF_STATICCXX = False
|
||||||
BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
|
BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
|
||||||
|
|
||||||
|
BF_LIBSAMPLERATE = LIBDIR + '/samplerate'
|
||||||
|
BF_LIBSAMPLERATE_INC = '${BF_LIBSAMPLERATE}/include'
|
||||||
|
BF_LIBSAMPLERATE_LIB = 'samplerate'
|
||||||
|
BF_LIBSAMPLERATE_LIBPATH = '${BF_LIBSAMPLERATE}/lib'
|
||||||
|
|
||||||
WITH_BF_SDL = True
|
WITH_BF_SDL = True
|
||||||
BF_SDL = LIBDIR + '/sdl'
|
BF_SDL = LIBDIR + '/sdl'
|
||||||
BF_SDL_INC = '${BF_SDL}/include'
|
BF_SDL_INC = '${BF_SDL}/include'
|
||||||
|
|||||||
@@ -16,6 +16,11 @@ WITH_BF_OPENAL = False
|
|||||||
#BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
|
#BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
|
||||||
#BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a'
|
#BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a'
|
||||||
|
|
||||||
|
BF_LIBSAMPLERATE = '/usr/local'
|
||||||
|
BF_LIBSAMPLERATE_INC = '${BF_LIBSAMPLERATE}/include'
|
||||||
|
BF_LIBSAMPLERATE_LIB = 'samplerate'
|
||||||
|
BF_LIBSAMPLERATE_LIBPATH = '${BF_LIBSAMPLERATE}/lib'
|
||||||
|
|
||||||
WITH_BF_SDL = True
|
WITH_BF_SDL = True
|
||||||
BF_SDL = '/usr/local' #$(shell sdl-config --prefix)
|
BF_SDL = '/usr/local' #$(shell sdl-config --prefix)
|
||||||
BF_SDL_INC = '${BF_SDL}/include/SDL' #$(shell $(BF_SDL)/bin/sdl-config --cflags)
|
BF_SDL_INC = '${BF_SDL}/include/SDL' #$(shell $(BF_SDL)/bin/sdl-config --cflags)
|
||||||
|
|||||||
@@ -22,6 +22,11 @@ BF_CXX = '/usr'
|
|||||||
WITH_BF_STATICCXX = False
|
WITH_BF_STATICCXX = False
|
||||||
BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
|
BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
|
||||||
|
|
||||||
|
BF_LIBSAMPLERATE = '/usr/local'
|
||||||
|
BF_LIBSAMPLERATE_INC = '${BF_LIBSAMPLERATE}/include'
|
||||||
|
BF_LIBSAMPLERATE_LIB = 'samplerate'
|
||||||
|
BF_LIBSAMPLERATE_LIBPATH = '${BF_LIBSAMPLERATE}/lib'
|
||||||
|
|
||||||
WITH_BF_SDL = True
|
WITH_BF_SDL = True
|
||||||
BF_SDL = '/usr/local' #$(shell sdl-config --prefix)
|
BF_SDL = '/usr/local' #$(shell sdl-config --prefix)
|
||||||
BF_SDL_INC = '${BF_SDL}/include/SDL' #$(shell $(BF_SDL)/bin/sdl-config --cflags)
|
BF_SDL_INC = '${BF_SDL}/include/SDL' #$(shell $(BF_SDL)/bin/sdl-config --cflags)
|
||||||
@@ -109,7 +114,7 @@ BF_ICONV_LIB = 'iconv'
|
|||||||
BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
|
BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
|
||||||
|
|
||||||
# enable ffmpeg support
|
# enable ffmpeg support
|
||||||
WITH_BF_FFMPEG = False # -DWITH_FFMPEG
|
WITH_BF_FFMPEG = True # -DWITH_FFMPEG
|
||||||
BF_FFMPEG = '/usr/local'
|
BF_FFMPEG = '/usr/local'
|
||||||
BF_FFMPEG_INC = '${BF_FFMPEG}/include'
|
BF_FFMPEG_INC = '${BF_FFMPEG}/include'
|
||||||
BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
|
BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
|
||||||
|
|||||||
@@ -3,31 +3,40 @@ LIBDIR = "${LCGDIR}"
|
|||||||
|
|
||||||
BF_PYTHON = LIBDIR + '/python'
|
BF_PYTHON = LIBDIR + '/python'
|
||||||
BF_PYTHON_VERSION = '3.1'
|
BF_PYTHON_VERSION = '3.1'
|
||||||
#BF_PYTHON_VERSION = '2.6'
|
|
||||||
#BF_PYTHON_VERSION = '2.6'
|
|
||||||
WITH_BF_STATICPYTHON = False
|
WITH_BF_STATICPYTHON = False
|
||||||
BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
|
BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
|
||||||
BF_PYTHON_BINARY = 'python'
|
BF_PYTHON_BINARY = 'python'
|
||||||
#BF_PYTHON_LIB = 'python25'
|
|
||||||
#BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib/lib25_vs2005'
|
|
||||||
#BF_PYTHON_LIB_STATIC = '${BF_PYTHON}/lib/lib25_vs2005/libpython25.a'
|
|
||||||
BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION[0]}${BF_PYTHON_VERSION[2]}'
|
BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION[0]}${BF_PYTHON_VERSION[2]}'
|
||||||
BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
|
BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
|
||||||
BF_PYTHON_LIB_STATIC = '${BF_PYTHON}/lib/libpython${BF_PYTHON_VERSION[0]}${BF_PYTHON_VERSION[2]}.a'
|
BF_PYTHON_LIB_STATIC = '${BF_PYTHON}/lib/libpython${BF_PYTHON_VERSION[0]}${BF_PYTHON_VERSION[2]}.a'
|
||||||
|
|
||||||
WITH_BF_OPENAL = True
|
WITH_BF_OPENAL = True
|
||||||
WITH_BF_STATICOPENAL = False
|
|
||||||
BF_OPENAL = LIBDIR + '/openal'
|
BF_OPENAL = LIBDIR + '/openal'
|
||||||
BF_OPENAL_INC = '${BF_OPENAL}/include'
|
BF_OPENAL_INC = '${BF_OPENAL}/include'
|
||||||
BF_OPENAL_LIB = 'dxguid openal_static'
|
BF_OPENAL_LIB = 'wrap_oal'
|
||||||
BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
|
BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
|
||||||
# Warning, this static lib configuration is untested! users of this OS please confirm.
|
|
||||||
BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a'
|
|
||||||
|
|
||||||
WITH_BF_FFMPEG = False
|
WITH_BF_FFMPEG = False
|
||||||
BF_FFMPEG_LIB = 'avformat swscale avcodec avutil avdevice xvidcore x264'
|
BF_FFMPEG_LIB = 'avformat-52 avcodec-52 avdevice-52 avutil-50 swscale-0'
|
||||||
BF_FFMPEG_LIBPATH = LIBDIR + '/gcc/ffmpeg/lib'
|
BF_FFMPEG_LIBPATH = LIBDIR + '/ffmpeg/lib'
|
||||||
BF_FFMPEG_INC = LIBDIR + '/gcc/ffmpeg/include'
|
BF_FFMPEG_INC = LIBDIR + '/ffmpeg/include'
|
||||||
|
|
||||||
|
BF_LIBSAMPLERATE = LIBDIR + '/samplerate'
|
||||||
|
BF_LIBSAMPLERATE_INC = '${BF_LIBSAMPLERATE}/include'
|
||||||
|
BF_LIBSAMPLERATE_LIB = 'libsamplerate'
|
||||||
|
BF_LIBSAMPLERATE_LIBPATH = '${BF_LIBSAMPLERATE}/lib'
|
||||||
|
|
||||||
|
WITH_BF_JACK = False
|
||||||
|
BF_JACK = LIBDIR + '/jack'
|
||||||
|
BF_JACK_INC = '${BF_JACK}/include'
|
||||||
|
BF_JACK_LIB = 'libjack'
|
||||||
|
BF_JACK_LIBPATH = '${BF_JACK}/lib'
|
||||||
|
|
||||||
|
WITH_BF_SNDFILE = False
|
||||||
|
BF_SNDFILE = LIBDIR + '/sndfile'
|
||||||
|
BF_SNDFILE_INC = '${BF_SNDFILE}/include'
|
||||||
|
BF_SNDFILE_LIB = 'libsndfile'
|
||||||
|
BF_SNDFILE_LIBPATH = '${BF_SNDFILE}/lib'
|
||||||
|
|
||||||
WITH_BF_SDL = True
|
WITH_BF_SDL = True
|
||||||
BF_SDL = LIBDIR + '/sdl'
|
BF_SDL = LIBDIR + '/sdl'
|
||||||
@@ -91,20 +100,6 @@ BF_BULLET_LIB = 'extern_bullet'
|
|||||||
BF_WINTAB = LIBDIR + '/wintab'
|
BF_WINTAB = LIBDIR + '/wintab'
|
||||||
BF_WINTAB_INC = '${BF_WINTAB}/INCLUDE'
|
BF_WINTAB_INC = '${BF_WINTAB}/INCLUDE'
|
||||||
|
|
||||||
#WITH_BF_NSPR = True
|
|
||||||
#BF_NSPR = $(LIBDIR)/nspr
|
|
||||||
#BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr
|
|
||||||
#BF_NSPR_LIB =
|
|
||||||
|
|
||||||
# Uncomment the following line to use Mozilla inplace of netscape
|
|
||||||
#CPPFLAGS += -DMOZ_NOT_NET
|
|
||||||
# Location of MOZILLA/Netscape header files...
|
|
||||||
#BF_MOZILLA = $(LIBDIR)/mozilla
|
|
||||||
#BF_MOZILLA_INC = -I$(BF_MOZILLA)/include/mozilla/nspr -I$(BF_MOZILLA)/include/mozilla -I$(BF_MOZILLA)/include/mozilla/xpcom -I$(BF_MOZILLA)/include/mozilla/idl
|
|
||||||
#BF_MOZILLA_LIB =
|
|
||||||
# Will fall back to look in BF_MOZILLA_INC/nspr and BF_MOZILLA_LIB
|
|
||||||
# if this is not set.
|
|
||||||
|
|
||||||
# enable freetype2 support for text objects
|
# enable freetype2 support for text objects
|
||||||
BF_FREETYPE = LIBDIR + '/gcc/freetype'
|
BF_FREETYPE = LIBDIR + '/gcc/freetype'
|
||||||
BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
|
BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ LIBDIR = '${LCGDIR}'
|
|||||||
# enable ffmpeg support
|
# enable ffmpeg support
|
||||||
WITH_BF_FFMPEG = True # -DWITH_FFMPEG
|
WITH_BF_FFMPEG = True # -DWITH_FFMPEG
|
||||||
BF_FFMPEG = LIBDIR +'/ffmpeg'
|
BF_FFMPEG = LIBDIR +'/ffmpeg'
|
||||||
BF_FFMPEG_INC = '${BF_FFMPEG}/include'
|
BF_FFMPEG_INC = '${BF_FFMPEG}/include ${BF_FFMPEG}/include/msvc'
|
||||||
BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
|
BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
|
||||||
BF_FFMPEG_LIB = 'avformat-52.lib avcodec-52.lib avdevice-52.lib avutil-50.lib swscale-0.lib'
|
BF_FFMPEG_LIB = 'avformat-52.lib avcodec-52.lib avdevice-52.lib avutil-50.lib swscale-0.lib'
|
||||||
|
|
||||||
@@ -16,18 +16,10 @@ BF_PYTHON_LIB = 'python31'
|
|||||||
BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
|
BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
|
||||||
|
|
||||||
WITH_BF_OPENAL = True
|
WITH_BF_OPENAL = True
|
||||||
WITH_BF_STATICOPENAL = False
|
|
||||||
BF_OPENAL = LIBDIR + '/openal'
|
BF_OPENAL = LIBDIR + '/openal'
|
||||||
BF_OPENAL_INC = '${BF_OPENAL}/include ${BF_OPENAL}/include/AL '
|
BF_OPENAL_INC = '${BF_OPENAL}/include '
|
||||||
BF_OPENAL_LIB = 'OpenAL32 wrap_oal' #'dxguid openal_static'
|
BF_OPENAL_LIB = 'wrap_oal'
|
||||||
BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
|
BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
|
||||||
# Warning, this static lib configuration is untested! users of this OS please confirm.
|
|
||||||
BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a'
|
|
||||||
|
|
||||||
# TODO - are these useful on win32?
|
|
||||||
# BF_CXX = '/usr'
|
|
||||||
# WITH_BF_STATICCXX = False
|
|
||||||
# BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
|
|
||||||
|
|
||||||
WITH_BF_ICONV = True
|
WITH_BF_ICONV = True
|
||||||
BF_ICONV = LIBDIR + '/iconv'
|
BF_ICONV = LIBDIR + '/iconv'
|
||||||
@@ -35,6 +27,23 @@ BF_ICONV_INC = '${BF_ICONV}/include'
|
|||||||
BF_ICONV_LIB = 'iconv'
|
BF_ICONV_LIB = 'iconv'
|
||||||
BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
|
BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
|
||||||
|
|
||||||
|
BF_LIBSAMPLERATE = LIBDIR + '/samplerate'
|
||||||
|
BF_LIBSAMPLERATE_INC = '${BF_LIBSAMPLERATE}/include'
|
||||||
|
BF_LIBSAMPLERATE_LIB = 'libsamplerate'
|
||||||
|
BF_LIBSAMPLERATE_LIBPATH = '${BF_LIBSAMPLERATE}/lib'
|
||||||
|
|
||||||
|
WITH_BF_JACK = False
|
||||||
|
BF_JACK = LIBDIR + '/jack'
|
||||||
|
BF_JACK_INC = '${BF_JACK}/include'
|
||||||
|
BF_JACK_LIB = 'libjack'
|
||||||
|
BF_JACK_LIBPATH = '${BF_JACK}/lib'
|
||||||
|
|
||||||
|
WITH_BF_SNDFILE = False
|
||||||
|
BF_SNDFILE = LIBDIR + '/sndfile'
|
||||||
|
BF_SNDFILE_INC = '${BF_SNDFILE}/include'
|
||||||
|
BF_SNDFILE_LIB = 'libsndfile-1'
|
||||||
|
BF_SNDFILE_LIBPATH = '${BF_SNDFILE}/lib'
|
||||||
|
|
||||||
WITH_BF_SDL = True
|
WITH_BF_SDL = True
|
||||||
BF_SDL = LIBDIR + '/sdl'
|
BF_SDL = LIBDIR + '/sdl'
|
||||||
BF_SDL_INC = '${BF_SDL}/include'
|
BF_SDL_INC = '${BF_SDL}/include'
|
||||||
@@ -100,23 +109,6 @@ BF_WINTAB_INC = '${BF_WINTAB}/INCLUDE'
|
|||||||
|
|
||||||
WITH_BF_BINRELOC = False
|
WITH_BF_BINRELOC = False
|
||||||
|
|
||||||
#WITH_BF_NSPR = True
|
|
||||||
#BF_NSPR = $(LIBDIR)/nspr
|
|
||||||
#BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr
|
|
||||||
#BF_NSPR_LIB =
|
|
||||||
|
|
||||||
# Uncomment the following line to use Mozilla inplace of netscape
|
|
||||||
#CPPFLAGS += -DMOZ_NOT_NET
|
|
||||||
# Location of MOZILLA/Netscape header files...
|
|
||||||
#BF_MOZILLA = $(LIBDIR)/mozilla
|
|
||||||
#BF_MOZILLA_INC = -I$(BF_MOZILLA)/include/mozilla/nspr -I$(BF_MOZILLA)/include/mozilla -I$(BF_MOZILLA)/include/mozilla/xpcom -I$(BF_MOZILLA)/include/mozilla/idl
|
|
||||||
#BF_MOZILLA_LIB =
|
|
||||||
# Will fall back to look in BF_MOZILLA_INC/nspr and BF_MOZILLA_LIB
|
|
||||||
# if this is not set.
|
|
||||||
#
|
|
||||||
# Be paranoid regarding library creation (do not update archives)
|
|
||||||
#BF_PARANOID = True
|
|
||||||
|
|
||||||
# enable freetype2 support for text objects
|
# enable freetype2 support for text objects
|
||||||
BF_WITH_FREETYPE = True
|
BF_WITH_FREETYPE = True
|
||||||
BF_FREETYPE = LIBDIR + '/freetype'
|
BF_FREETYPE = LIBDIR + '/freetype'
|
||||||
@@ -136,6 +128,12 @@ BF_OPENJPEG_LIB = ''
|
|||||||
BF_OPENJPEG_INC = '${BF_OPENJPEG}'
|
BF_OPENJPEG_INC = '${BF_OPENJPEG}'
|
||||||
BF_OPENJPEG_LIBPATH='${BF_OPENJPEG}/lib'
|
BF_OPENJPEG_LIBPATH='${BF_OPENJPEG}/lib'
|
||||||
|
|
||||||
|
WITH_BF_FFTW3 = False
|
||||||
|
BF_FFTW3 = LIBDIR + '/fftw3'
|
||||||
|
BF_FFTW3_INC = '${BF_FFTW3}/include'
|
||||||
|
BF_FFTW3_LIB = 'libfftw'
|
||||||
|
BF_FFTW3_LIBPATH = '${BF_FFTW3}/lib'
|
||||||
|
|
||||||
WITH_BF_REDCODE = False
|
WITH_BF_REDCODE = False
|
||||||
BF_REDCODE_INC = '#extern'
|
BF_REDCODE_INC = '#extern'
|
||||||
|
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
|
|||||||
|
|
||||||
WITH_BF_OPENAL = False
|
WITH_BF_OPENAL = False
|
||||||
BF_OPENAL = LIBDIR + '/openal'
|
BF_OPENAL = LIBDIR + '/openal'
|
||||||
BF_OPENAL_INC = '${BF_OPENAL}/include ${BF_OPENAL}/include/AL '
|
BF_OPENAL_INC = '${BF_OPENAL}/include '
|
||||||
BF_OPENAL_LIB = 'OpenAL32 wrap_oal' #'dxguid openal_static'
|
BF_OPENAL_LIB = 'wrap_oal'
|
||||||
BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
|
BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
|
||||||
|
|
||||||
# TODO - are these useful on win32?
|
# TODO - are these useful on win32?
|
||||||
@@ -32,6 +32,11 @@ BF_ICONV_INC = '${BF_ICONV}/include'
|
|||||||
BF_ICONV_LIB = 'iconv'
|
BF_ICONV_LIB = 'iconv'
|
||||||
BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
|
BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
|
||||||
|
|
||||||
|
BF_LIBSAMPLERATE = LIBDIR + '/samplerate'
|
||||||
|
BF_LIBSAMPLERATE_INC = '${BF_LIBSAMPLERATE}/include'
|
||||||
|
BF_LIBSAMPLERATE_LIB = 'libsamplerate'
|
||||||
|
BF_LIBSAMPLERATE_LIBPATH = '${BF_LIBSAMPLERATE}/lib'
|
||||||
|
|
||||||
WITH_BF_SDL = True
|
WITH_BF_SDL = True
|
||||||
BF_SDL = LIBDIR + '/sdl'
|
BF_SDL = LIBDIR + '/sdl'
|
||||||
BF_SDL_INC = '${BF_SDL}/include'
|
BF_SDL_INC = '${BF_SDL}/include'
|
||||||
@@ -136,6 +141,12 @@ BF_OPENJPEG_LIB = ''
|
|||||||
BF_OPENJPEG_INC = '${BF_OPENJPEG}'
|
BF_OPENJPEG_INC = '${BF_OPENJPEG}'
|
||||||
BF_OPENJPEG_LIBPATH='${BF_OPENJPEG}/lib'
|
BF_OPENJPEG_LIBPATH='${BF_OPENJPEG}/lib'
|
||||||
|
|
||||||
|
WITH_BF_FFTW3 = True
|
||||||
|
BF_FFTW3 = LIBDIR + '/fftw3'
|
||||||
|
BF_FFTW3_INC = '${BF_FFTW3}/include'
|
||||||
|
BF_FFTW3_LIB = 'libfftw'
|
||||||
|
BF_FFTW3_LIBPATH = '${BF_FFTW3}/lib'
|
||||||
|
|
||||||
WITH_BF_REDCODE = False
|
WITH_BF_REDCODE = False
|
||||||
BF_REDCODE_INC = '#extern'
|
BF_REDCODE_INC = '#extern'
|
||||||
|
|
||||||
|
|||||||
3
extern/CMakeLists.txt
vendored
3
extern/CMakeLists.txt
vendored
@@ -37,3 +37,6 @@ ADD_SUBDIRECTORY(glew)
|
|||||||
IF(WITH_OPENJPEG)
|
IF(WITH_OPENJPEG)
|
||||||
ADD_SUBDIRECTORY(libopenjpeg)
|
ADD_SUBDIRECTORY(libopenjpeg)
|
||||||
ENDIF(WITH_OPENJPEG)
|
ENDIF(WITH_OPENJPEG)
|
||||||
|
|
||||||
|
ADD_SUBDIRECTORY(lzo)
|
||||||
|
ADD_SUBDIRECTORY(lzma)
|
||||||
|
|||||||
8
extern/Makefile
vendored
8
extern/Makefile
vendored
@@ -54,6 +54,14 @@ ifeq ($(WITH_OPENJPEG), true)
|
|||||||
DIRS += libopenjpeg
|
DIRS += libopenjpeg
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(WITH_LZO), true)
|
||||||
|
DIRS += lzo/minilzo
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(WITH_LZMA), true)
|
||||||
|
DIRS += lzma
|
||||||
|
endif
|
||||||
|
|
||||||
TARGET = solid
|
TARGET = solid
|
||||||
|
|
||||||
all::
|
all::
|
||||||
|
|||||||
4
extern/SConscript
vendored
4
extern/SConscript
vendored
@@ -22,5 +22,5 @@ if env['WITH_BF_REDCODE'] and env['BF_REDCODE_LIB'] == '':
|
|||||||
if env['OURPLATFORM'] == 'linux2':
|
if env['OURPLATFORM'] == 'linux2':
|
||||||
SConscript(['binreloc/SConscript']);
|
SConscript(['binreloc/SConscript']);
|
||||||
|
|
||||||
# FFTW not needed atm - dg
|
SConscript(['lzo/SConscript'])
|
||||||
# SConscript(['fftw/SConscript'])
|
SConscript(['lzma/SConscript'])
|
||||||
|
|||||||
5
extern/glew/CMakeLists.txt
vendored
5
extern/glew/CMakeLists.txt
vendored
@@ -26,8 +26,13 @@
|
|||||||
|
|
||||||
SET(INC include src)
|
SET(INC include src)
|
||||||
|
|
||||||
|
IF(UNIX)
|
||||||
|
SET(INC ${INC} ${X11_X11_INCLUDE_PATH})
|
||||||
|
ENDIF(UNIX)
|
||||||
|
|
||||||
SET(SRC
|
SET(SRC
|
||||||
src/glew.c
|
src/glew.c
|
||||||
)
|
)
|
||||||
|
|
||||||
BLENDERLIB(extern_glew "${SRC}" "${INC}")
|
BLENDERLIB(extern_glew "${SRC}" "${INC}")
|
||||||
|
|
||||||
|
|||||||
2
extern/libopenjpeg/CMakeLists.txt
vendored
2
extern/libopenjpeg/CMakeLists.txt
vendored
@@ -24,7 +24,7 @@
|
|||||||
#
|
#
|
||||||
# ***** END GPL LICENSE BLOCK *****
|
# ***** END GPL LICENSE BLOCK *****
|
||||||
|
|
||||||
SET(INC . src ${FREETYPE_INC})
|
SET(INC . src)
|
||||||
|
|
||||||
FILE(GLOB SRC *.c except t1_generate_luts.c)
|
FILE(GLOB SRC *.c except t1_generate_luts.c)
|
||||||
ADD_DEFINITIONS(-DWITH_OPENJPEG)
|
ADD_DEFINITIONS(-DWITH_OPENJPEG)
|
||||||
|
|||||||
127
extern/lzma/Alloc.c
vendored
Normal file
127
extern/lzma/Alloc.c
vendored
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
/* Alloc.c -- Memory allocation functions
|
||||||
|
2008-09-24
|
||||||
|
Igor Pavlov
|
||||||
|
Public domain */
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "Alloc.h"
|
||||||
|
|
||||||
|
/* #define _SZ_ALLOC_DEBUG */
|
||||||
|
|
||||||
|
/* use _SZ_ALLOC_DEBUG to debug alloc/free operations */
|
||||||
|
#ifdef _SZ_ALLOC_DEBUG
|
||||||
|
#include <stdio.h>
|
||||||
|
int g_allocCount = 0;
|
||||||
|
int g_allocCountMid = 0;
|
||||||
|
int g_allocCountBig = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void *MyAlloc(size_t size)
|
||||||
|
{
|
||||||
|
if (size == 0)
|
||||||
|
return 0;
|
||||||
|
#ifdef _SZ_ALLOC_DEBUG
|
||||||
|
{
|
||||||
|
void *p = malloc(size);
|
||||||
|
fprintf(stderr, "\nAlloc %10d bytes, count = %10d, addr = %8X", size, g_allocCount++, (unsigned)p);
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
return malloc(size);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyFree(void *address)
|
||||||
|
{
|
||||||
|
#ifdef _SZ_ALLOC_DEBUG
|
||||||
|
if (address != 0)
|
||||||
|
fprintf(stderr, "\nFree; count = %10d, addr = %8X", --g_allocCount, (unsigned)address);
|
||||||
|
#endif
|
||||||
|
free(address);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
|
||||||
|
void *MidAlloc(size_t size)
|
||||||
|
{
|
||||||
|
if (size == 0)
|
||||||
|
return 0;
|
||||||
|
#ifdef _SZ_ALLOC_DEBUG
|
||||||
|
fprintf(stderr, "\nAlloc_Mid %10d bytes; count = %10d", size, g_allocCountMid++);
|
||||||
|
#endif
|
||||||
|
return VirtualAlloc(0, size, MEM_COMMIT, PAGE_READWRITE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MidFree(void *address)
|
||||||
|
{
|
||||||
|
#ifdef _SZ_ALLOC_DEBUG
|
||||||
|
if (address != 0)
|
||||||
|
fprintf(stderr, "\nFree_Mid; count = %10d", --g_allocCountMid);
|
||||||
|
#endif
|
||||||
|
if (address == 0)
|
||||||
|
return;
|
||||||
|
VirtualFree(address, 0, MEM_RELEASE);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef MEM_LARGE_PAGES
|
||||||
|
#undef _7ZIP_LARGE_PAGES
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _7ZIP_LARGE_PAGES
|
||||||
|
SIZE_T g_LargePageSize = 0;
|
||||||
|
typedef SIZE_T (WINAPI *GetLargePageMinimumP)();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void SetLargePageSize()
|
||||||
|
{
|
||||||
|
#ifdef _7ZIP_LARGE_PAGES
|
||||||
|
SIZE_T size = 0;
|
||||||
|
GetLargePageMinimumP largePageMinimum = (GetLargePageMinimumP)
|
||||||
|
GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "GetLargePageMinimum");
|
||||||
|
if (largePageMinimum == 0)
|
||||||
|
return;
|
||||||
|
size = largePageMinimum();
|
||||||
|
if (size == 0 || (size & (size - 1)) != 0)
|
||||||
|
return;
|
||||||
|
g_LargePageSize = size;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void *BigAlloc(size_t size)
|
||||||
|
{
|
||||||
|
if (size == 0)
|
||||||
|
return 0;
|
||||||
|
#ifdef _SZ_ALLOC_DEBUG
|
||||||
|
fprintf(stderr, "\nAlloc_Big %10d bytes; count = %10d", size, g_allocCountBig++);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _7ZIP_LARGE_PAGES
|
||||||
|
if (g_LargePageSize != 0 && g_LargePageSize <= (1 << 30) && size >= (1 << 18))
|
||||||
|
{
|
||||||
|
void *res = VirtualAlloc(0, (size + g_LargePageSize - 1) & (~(g_LargePageSize - 1)),
|
||||||
|
MEM_COMMIT | MEM_LARGE_PAGES, PAGE_READWRITE);
|
||||||
|
if (res != 0)
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return VirtualAlloc(0, size, MEM_COMMIT, PAGE_READWRITE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BigFree(void *address)
|
||||||
|
{
|
||||||
|
#ifdef _SZ_ALLOC_DEBUG
|
||||||
|
if (address != 0)
|
||||||
|
fprintf(stderr, "\nFree_Big; count = %10d", --g_allocCountBig);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (address == 0)
|
||||||
|
return;
|
||||||
|
VirtualFree(address, 0, MEM_RELEASE);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
32
extern/lzma/Alloc.h
vendored
Normal file
32
extern/lzma/Alloc.h
vendored
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
/* Alloc.h -- Memory allocation functions
|
||||||
|
2008-03-13
|
||||||
|
Igor Pavlov
|
||||||
|
Public domain */
|
||||||
|
|
||||||
|
#ifndef __COMMON_ALLOC_H
|
||||||
|
#define __COMMON_ALLOC_H
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
void *MyAlloc(size_t size);
|
||||||
|
void MyFree(void *address);
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
|
||||||
|
void SetLargePageSize();
|
||||||
|
|
||||||
|
void *MidAlloc(size_t size);
|
||||||
|
void MidFree(void *address);
|
||||||
|
void *BigAlloc(size_t size);
|
||||||
|
void BigFree(void *address);
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#define MidAlloc(size) MyAlloc(size)
|
||||||
|
#define MidFree(address) MyFree(address)
|
||||||
|
#define BigAlloc(size) MyAlloc(size)
|
||||||
|
#define BigFree(address) MyFree(address)
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
34
extern/lzma/CMakeLists.txt
vendored
Normal file
34
extern/lzma/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
# $Id$
|
||||||
|
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software Foundation,
|
||||||
|
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
#
|
||||||
|
# The Original Code is Copyright (C) 2006, Blender Foundation
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# The Original Code is: all of this file.
|
||||||
|
#
|
||||||
|
# Contributor(s): Daniel Genrich
|
||||||
|
#
|
||||||
|
# ***** END GPL LICENSE BLOCK *****
|
||||||
|
|
||||||
|
SET(INC . )
|
||||||
|
|
||||||
|
FILE(GLOB SRC ./*.c)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
BLENDERLIB(bf_lzma "${SRC}" "${INC}")
|
||||||
|
#, libtype='blender', priority = 0 )
|
||||||
751
extern/lzma/LzFind.c
vendored
Normal file
751
extern/lzma/LzFind.c
vendored
Normal file
@@ -0,0 +1,751 @@
|
|||||||
|
/* LzFind.c -- Match finder for LZ algorithms
|
||||||
|
2008-10-04 : Igor Pavlov : Public domain */
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "LzFind.h"
|
||||||
|
#include "LzHash.h"
|
||||||
|
|
||||||
|
#define kEmptyHashValue 0
|
||||||
|
#define kMaxValForNormalize ((UInt32)0xFFFFFFFF)
|
||||||
|
#define kNormalizeStepMin (1 << 10) /* it must be power of 2 */
|
||||||
|
#define kNormalizeMask (~(kNormalizeStepMin - 1))
|
||||||
|
#define kMaxHistorySize ((UInt32)3 << 30)
|
||||||
|
|
||||||
|
#define kStartMaxLen 3
|
||||||
|
|
||||||
|
static void LzInWindow_Free(CMatchFinder *p, ISzAlloc *alloc)
|
||||||
|
{
|
||||||
|
if (!p->directInput)
|
||||||
|
{
|
||||||
|
alloc->Free(alloc, p->bufferBase);
|
||||||
|
p->bufferBase = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* keepSizeBefore + keepSizeAfter + keepSizeReserv must be < 4G) */
|
||||||
|
|
||||||
|
static int LzInWindow_Create(CMatchFinder *p, UInt32 keepSizeReserv, ISzAlloc *alloc)
|
||||||
|
{
|
||||||
|
UInt32 blockSize = p->keepSizeBefore + p->keepSizeAfter + keepSizeReserv;
|
||||||
|
if (p->directInput)
|
||||||
|
{
|
||||||
|
p->blockSize = blockSize;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (p->bufferBase == 0 || p->blockSize != blockSize)
|
||||||
|
{
|
||||||
|
LzInWindow_Free(p, alloc);
|
||||||
|
p->blockSize = blockSize;
|
||||||
|
p->bufferBase = (Byte *)alloc->Alloc(alloc, (size_t)blockSize);
|
||||||
|
}
|
||||||
|
return (p->bufferBase != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p) { return p->buffer; }
|
||||||
|
Byte MatchFinder_GetIndexByte(CMatchFinder *p, Int32 index) { return p->buffer[index]; }
|
||||||
|
|
||||||
|
UInt32 MatchFinder_GetNumAvailableBytes(CMatchFinder *p) { return p->streamPos - p->pos; }
|
||||||
|
|
||||||
|
void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue)
|
||||||
|
{
|
||||||
|
p->posLimit -= subValue;
|
||||||
|
p->pos -= subValue;
|
||||||
|
p->streamPos -= subValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MatchFinder_ReadBlock(CMatchFinder *p)
|
||||||
|
{
|
||||||
|
if (p->streamEndWasReached || p->result != SZ_OK)
|
||||||
|
return;
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
Byte *dest = p->buffer + (p->streamPos - p->pos);
|
||||||
|
size_t size = (p->bufferBase + p->blockSize - dest);
|
||||||
|
if (size == 0)
|
||||||
|
return;
|
||||||
|
p->result = p->stream->Read(p->stream, dest, &size);
|
||||||
|
if (p->result != SZ_OK)
|
||||||
|
return;
|
||||||
|
if (size == 0)
|
||||||
|
{
|
||||||
|
p->streamEndWasReached = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
p->streamPos += (UInt32)size;
|
||||||
|
if (p->streamPos - p->pos > p->keepSizeAfter)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MatchFinder_MoveBlock(CMatchFinder *p)
|
||||||
|
{
|
||||||
|
memmove(p->bufferBase,
|
||||||
|
p->buffer - p->keepSizeBefore,
|
||||||
|
(size_t)(p->streamPos - p->pos + p->keepSizeBefore));
|
||||||
|
p->buffer = p->bufferBase + p->keepSizeBefore;
|
||||||
|
}
|
||||||
|
|
||||||
|
int MatchFinder_NeedMove(CMatchFinder *p)
|
||||||
|
{
|
||||||
|
/* if (p->streamEndWasReached) return 0; */
|
||||||
|
return ((size_t)(p->bufferBase + p->blockSize - p->buffer) <= p->keepSizeAfter);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MatchFinder_ReadIfRequired(CMatchFinder *p)
|
||||||
|
{
|
||||||
|
if (p->streamEndWasReached)
|
||||||
|
return;
|
||||||
|
if (p->keepSizeAfter >= p->streamPos - p->pos)
|
||||||
|
MatchFinder_ReadBlock(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MatchFinder_CheckAndMoveAndRead(CMatchFinder *p)
|
||||||
|
{
|
||||||
|
if (MatchFinder_NeedMove(p))
|
||||||
|
MatchFinder_MoveBlock(p);
|
||||||
|
MatchFinder_ReadBlock(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MatchFinder_SetDefaultSettings(CMatchFinder *p)
|
||||||
|
{
|
||||||
|
p->cutValue = 32;
|
||||||
|
p->btMode = 1;
|
||||||
|
p->numHashBytes = 4;
|
||||||
|
/* p->skipModeBits = 0; */
|
||||||
|
p->directInput = 0;
|
||||||
|
p->bigHash = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define kCrcPoly 0xEDB88320
|
||||||
|
|
||||||
|
void MatchFinder_Construct(CMatchFinder *p)
|
||||||
|
{
|
||||||
|
UInt32 i;
|
||||||
|
p->bufferBase = 0;
|
||||||
|
p->directInput = 0;
|
||||||
|
p->hash = 0;
|
||||||
|
MatchFinder_SetDefaultSettings(p);
|
||||||
|
|
||||||
|
for (i = 0; i < 256; i++)
|
||||||
|
{
|
||||||
|
UInt32 r = i;
|
||||||
|
int j;
|
||||||
|
for (j = 0; j < 8; j++)
|
||||||
|
r = (r >> 1) ^ (kCrcPoly & ~((r & 1) - 1));
|
||||||
|
p->crc[i] = r;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MatchFinder_FreeThisClassMemory(CMatchFinder *p, ISzAlloc *alloc)
|
||||||
|
{
|
||||||
|
alloc->Free(alloc, p->hash);
|
||||||
|
p->hash = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc)
|
||||||
|
{
|
||||||
|
MatchFinder_FreeThisClassMemory(p, alloc);
|
||||||
|
LzInWindow_Free(p, alloc);
|
||||||
|
}
|
||||||
|
|
||||||
|
static CLzRef* AllocRefs(UInt32 num, ISzAlloc *alloc)
|
||||||
|
{
|
||||||
|
size_t sizeInBytes = (size_t)num * sizeof(CLzRef);
|
||||||
|
if (sizeInBytes / sizeof(CLzRef) != num)
|
||||||
|
return 0;
|
||||||
|
return (CLzRef *)alloc->Alloc(alloc, sizeInBytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
int MatchFinder_Create(CMatchFinder *p, UInt32 historySize,
|
||||||
|
UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter,
|
||||||
|
ISzAlloc *alloc)
|
||||||
|
{
|
||||||
|
UInt32 sizeReserv;
|
||||||
|
if (historySize > kMaxHistorySize)
|
||||||
|
{
|
||||||
|
MatchFinder_Free(p, alloc);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
sizeReserv = historySize >> 1;
|
||||||
|
if (historySize > ((UInt32)2 << 30))
|
||||||
|
sizeReserv = historySize >> 2;
|
||||||
|
sizeReserv += (keepAddBufferBefore + matchMaxLen + keepAddBufferAfter) / 2 + (1 << 19);
|
||||||
|
|
||||||
|
p->keepSizeBefore = historySize + keepAddBufferBefore + 1;
|
||||||
|
p->keepSizeAfter = matchMaxLen + keepAddBufferAfter;
|
||||||
|
/* we need one additional byte, since we use MoveBlock after pos++ and before dictionary using */
|
||||||
|
if (LzInWindow_Create(p, sizeReserv, alloc))
|
||||||
|
{
|
||||||
|
UInt32 newCyclicBufferSize = (historySize /* >> p->skipModeBits */) + 1;
|
||||||
|
UInt32 hs;
|
||||||
|
p->matchMaxLen = matchMaxLen;
|
||||||
|
{
|
||||||
|
p->fixedHashSize = 0;
|
||||||
|
if (p->numHashBytes == 2)
|
||||||
|
hs = (1 << 16) - 1;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
hs = historySize - 1;
|
||||||
|
hs |= (hs >> 1);
|
||||||
|
hs |= (hs >> 2);
|
||||||
|
hs |= (hs >> 4);
|
||||||
|
hs |= (hs >> 8);
|
||||||
|
hs >>= 1;
|
||||||
|
/* hs >>= p->skipModeBits; */
|
||||||
|
hs |= 0xFFFF; /* don't change it! It's required for Deflate */
|
||||||
|
if (hs > (1 << 24))
|
||||||
|
{
|
||||||
|
if (p->numHashBytes == 3)
|
||||||
|
hs = (1 << 24) - 1;
|
||||||
|
else
|
||||||
|
hs >>= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
p->hashMask = hs;
|
||||||
|
hs++;
|
||||||
|
if (p->numHashBytes > 2) p->fixedHashSize += kHash2Size;
|
||||||
|
if (p->numHashBytes > 3) p->fixedHashSize += kHash3Size;
|
||||||
|
if (p->numHashBytes > 4) p->fixedHashSize += kHash4Size;
|
||||||
|
hs += p->fixedHashSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
UInt32 prevSize = p->hashSizeSum + p->numSons;
|
||||||
|
UInt32 newSize;
|
||||||
|
p->historySize = historySize;
|
||||||
|
p->hashSizeSum = hs;
|
||||||
|
p->cyclicBufferSize = newCyclicBufferSize;
|
||||||
|
p->numSons = (p->btMode ? newCyclicBufferSize * 2 : newCyclicBufferSize);
|
||||||
|
newSize = p->hashSizeSum + p->numSons;
|
||||||
|
if (p->hash != 0 && prevSize == newSize)
|
||||||
|
return 1;
|
||||||
|
MatchFinder_FreeThisClassMemory(p, alloc);
|
||||||
|
p->hash = AllocRefs(newSize, alloc);
|
||||||
|
if (p->hash != 0)
|
||||||
|
{
|
||||||
|
p->son = p->hash + p->hashSizeSum;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MatchFinder_Free(p, alloc);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MatchFinder_SetLimits(CMatchFinder *p)
|
||||||
|
{
|
||||||
|
UInt32 limit = kMaxValForNormalize - p->pos;
|
||||||
|
UInt32 limit2 = p->cyclicBufferSize - p->cyclicBufferPos;
|
||||||
|
if (limit2 < limit)
|
||||||
|
limit = limit2;
|
||||||
|
limit2 = p->streamPos - p->pos;
|
||||||
|
if (limit2 <= p->keepSizeAfter)
|
||||||
|
{
|
||||||
|
if (limit2 > 0)
|
||||||
|
limit2 = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
limit2 -= p->keepSizeAfter;
|
||||||
|
if (limit2 < limit)
|
||||||
|
limit = limit2;
|
||||||
|
{
|
||||||
|
UInt32 lenLimit = p->streamPos - p->pos;
|
||||||
|
if (lenLimit > p->matchMaxLen)
|
||||||
|
lenLimit = p->matchMaxLen;
|
||||||
|
p->lenLimit = lenLimit;
|
||||||
|
}
|
||||||
|
p->posLimit = p->pos + limit;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MatchFinder_Init(CMatchFinder *p)
|
||||||
|
{
|
||||||
|
UInt32 i;
|
||||||
|
for (i = 0; i < p->hashSizeSum; i++)
|
||||||
|
p->hash[i] = kEmptyHashValue;
|
||||||
|
p->cyclicBufferPos = 0;
|
||||||
|
p->buffer = p->bufferBase;
|
||||||
|
p->pos = p->streamPos = p->cyclicBufferSize;
|
||||||
|
p->result = SZ_OK;
|
||||||
|
p->streamEndWasReached = 0;
|
||||||
|
MatchFinder_ReadBlock(p);
|
||||||
|
MatchFinder_SetLimits(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
static UInt32 MatchFinder_GetSubValue(CMatchFinder *p)
|
||||||
|
{
|
||||||
|
return (p->pos - p->historySize - 1) & kNormalizeMask;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems)
|
||||||
|
{
|
||||||
|
UInt32 i;
|
||||||
|
for (i = 0; i < numItems; i++)
|
||||||
|
{
|
||||||
|
UInt32 value = items[i];
|
||||||
|
if (value <= subValue)
|
||||||
|
value = kEmptyHashValue;
|
||||||
|
else
|
||||||
|
value -= subValue;
|
||||||
|
items[i] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MatchFinder_Normalize(CMatchFinder *p)
|
||||||
|
{
|
||||||
|
UInt32 subValue = MatchFinder_GetSubValue(p);
|
||||||
|
MatchFinder_Normalize3(subValue, p->hash, p->hashSizeSum + p->numSons);
|
||||||
|
MatchFinder_ReduceOffsets(p, subValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MatchFinder_CheckLimits(CMatchFinder *p)
|
||||||
|
{
|
||||||
|
if (p->pos == kMaxValForNormalize)
|
||||||
|
MatchFinder_Normalize(p);
|
||||||
|
if (!p->streamEndWasReached && p->keepSizeAfter == p->streamPos - p->pos)
|
||||||
|
MatchFinder_CheckAndMoveAndRead(p);
|
||||||
|
if (p->cyclicBufferPos == p->cyclicBufferSize)
|
||||||
|
p->cyclicBufferPos = 0;
|
||||||
|
MatchFinder_SetLimits(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
static UInt32 * Hc_GetMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son,
|
||||||
|
UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue,
|
||||||
|
UInt32 *distances, UInt32 maxLen)
|
||||||
|
{
|
||||||
|
son[_cyclicBufferPos] = curMatch;
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
UInt32 delta = pos - curMatch;
|
||||||
|
if (cutValue-- == 0 || delta >= _cyclicBufferSize)
|
||||||
|
return distances;
|
||||||
|
{
|
||||||
|
const Byte *pb = cur - delta;
|
||||||
|
curMatch = son[_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)];
|
||||||
|
if (pb[maxLen] == cur[maxLen] && *pb == *cur)
|
||||||
|
{
|
||||||
|
UInt32 len = 0;
|
||||||
|
while (++len != lenLimit)
|
||||||
|
if (pb[len] != cur[len])
|
||||||
|
break;
|
||||||
|
if (maxLen < len)
|
||||||
|
{
|
||||||
|
*distances++ = maxLen = len;
|
||||||
|
*distances++ = delta - 1;
|
||||||
|
if (len == lenLimit)
|
||||||
|
return distances;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son,
|
||||||
|
UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue,
|
||||||
|
UInt32 *distances, UInt32 maxLen)
|
||||||
|
{
|
||||||
|
CLzRef *ptr0 = son + (_cyclicBufferPos << 1) + 1;
|
||||||
|
CLzRef *ptr1 = son + (_cyclicBufferPos << 1);
|
||||||
|
UInt32 len0 = 0, len1 = 0;
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
UInt32 delta = pos - curMatch;
|
||||||
|
if (cutValue-- == 0 || delta >= _cyclicBufferSize)
|
||||||
|
{
|
||||||
|
*ptr0 = *ptr1 = kEmptyHashValue;
|
||||||
|
return distances;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
CLzRef *pair = son + ((_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1);
|
||||||
|
const Byte *pb = cur - delta;
|
||||||
|
UInt32 len = (len0 < len1 ? len0 : len1);
|
||||||
|
if (pb[len] == cur[len])
|
||||||
|
{
|
||||||
|
if (++len != lenLimit && pb[len] == cur[len])
|
||||||
|
while (++len != lenLimit)
|
||||||
|
if (pb[len] != cur[len])
|
||||||
|
break;
|
||||||
|
if (maxLen < len)
|
||||||
|
{
|
||||||
|
*distances++ = maxLen = len;
|
||||||
|
*distances++ = delta - 1;
|
||||||
|
if (len == lenLimit)
|
||||||
|
{
|
||||||
|
*ptr1 = pair[0];
|
||||||
|
*ptr0 = pair[1];
|
||||||
|
return distances;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (pb[len] < cur[len])
|
||||||
|
{
|
||||||
|
*ptr1 = curMatch;
|
||||||
|
ptr1 = pair + 1;
|
||||||
|
curMatch = *ptr1;
|
||||||
|
len1 = len;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*ptr0 = curMatch;
|
||||||
|
ptr0 = pair;
|
||||||
|
curMatch = *ptr0;
|
||||||
|
len0 = len;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void SkipMatchesSpec(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son,
|
||||||
|
UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue)
|
||||||
|
{
|
||||||
|
CLzRef *ptr0 = son + (_cyclicBufferPos << 1) + 1;
|
||||||
|
CLzRef *ptr1 = son + (_cyclicBufferPos << 1);
|
||||||
|
UInt32 len0 = 0, len1 = 0;
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
UInt32 delta = pos - curMatch;
|
||||||
|
if (cutValue-- == 0 || delta >= _cyclicBufferSize)
|
||||||
|
{
|
||||||
|
*ptr0 = *ptr1 = kEmptyHashValue;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
CLzRef *pair = son + ((_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1);
|
||||||
|
const Byte *pb = cur - delta;
|
||||||
|
UInt32 len = (len0 < len1 ? len0 : len1);
|
||||||
|
if (pb[len] == cur[len])
|
||||||
|
{
|
||||||
|
while (++len != lenLimit)
|
||||||
|
if (pb[len] != cur[len])
|
||||||
|
break;
|
||||||
|
{
|
||||||
|
if (len == lenLimit)
|
||||||
|
{
|
||||||
|
*ptr1 = pair[0];
|
||||||
|
*ptr0 = pair[1];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (pb[len] < cur[len])
|
||||||
|
{
|
||||||
|
*ptr1 = curMatch;
|
||||||
|
ptr1 = pair + 1;
|
||||||
|
curMatch = *ptr1;
|
||||||
|
len1 = len;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*ptr0 = curMatch;
|
||||||
|
ptr0 = pair;
|
||||||
|
curMatch = *ptr0;
|
||||||
|
len0 = len;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#define MOVE_POS \
|
||||||
|
++p->cyclicBufferPos; \
|
||||||
|
p->buffer++; \
|
||||||
|
if (++p->pos == p->posLimit) MatchFinder_CheckLimits(p);
|
||||||
|
|
||||||
|
#define MOVE_POS_RET MOVE_POS return offset;
|
||||||
|
|
||||||
|
static void MatchFinder_MovePos(CMatchFinder *p) { MOVE_POS; }
|
||||||
|
|
||||||
|
#define GET_MATCHES_HEADER2(minLen, ret_op) \
|
||||||
|
UInt32 lenLimit; UInt32 hashValue; const Byte *cur; UInt32 curMatch; \
|
||||||
|
lenLimit = p->lenLimit; { if (lenLimit < minLen) { MatchFinder_MovePos(p); ret_op; }} \
|
||||||
|
cur = p->buffer;
|
||||||
|
|
||||||
|
#define GET_MATCHES_HEADER(minLen) GET_MATCHES_HEADER2(minLen, return 0)
|
||||||
|
#define SKIP_HEADER(minLen) GET_MATCHES_HEADER2(minLen, continue)
|
||||||
|
|
||||||
|
#define MF_PARAMS(p) p->pos, p->buffer, p->son, p->cyclicBufferPos, p->cyclicBufferSize, p->cutValue
|
||||||
|
|
||||||
|
#define GET_MATCHES_FOOTER(offset, maxLen) \
|
||||||
|
offset = (UInt32)(GetMatchesSpec1(lenLimit, curMatch, MF_PARAMS(p), \
|
||||||
|
distances + offset, maxLen) - distances); MOVE_POS_RET;
|
||||||
|
|
||||||
|
#define SKIP_FOOTER \
|
||||||
|
SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p)); MOVE_POS;
|
||||||
|
|
||||||
|
static UInt32 Bt2_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
|
||||||
|
{
|
||||||
|
UInt32 offset;
|
||||||
|
GET_MATCHES_HEADER(2)
|
||||||
|
HASH2_CALC;
|
||||||
|
curMatch = p->hash[hashValue];
|
||||||
|
p->hash[hashValue] = p->pos;
|
||||||
|
offset = 0;
|
||||||
|
GET_MATCHES_FOOTER(offset, 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
|
||||||
|
{
|
||||||
|
UInt32 offset;
|
||||||
|
GET_MATCHES_HEADER(3)
|
||||||
|
HASH_ZIP_CALC;
|
||||||
|
curMatch = p->hash[hashValue];
|
||||||
|
p->hash[hashValue] = p->pos;
|
||||||
|
offset = 0;
|
||||||
|
GET_MATCHES_FOOTER(offset, 2)
|
||||||
|
}
|
||||||
|
|
||||||
|
static UInt32 Bt3_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
|
||||||
|
{
|
||||||
|
UInt32 hash2Value, delta2, maxLen, offset;
|
||||||
|
GET_MATCHES_HEADER(3)
|
||||||
|
|
||||||
|
HASH3_CALC;
|
||||||
|
|
||||||
|
delta2 = p->pos - p->hash[hash2Value];
|
||||||
|
curMatch = p->hash[kFix3HashSize + hashValue];
|
||||||
|
|
||||||
|
p->hash[hash2Value] =
|
||||||
|
p->hash[kFix3HashSize + hashValue] = p->pos;
|
||||||
|
|
||||||
|
|
||||||
|
maxLen = 2;
|
||||||
|
offset = 0;
|
||||||
|
if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur)
|
||||||
|
{
|
||||||
|
for (; maxLen != lenLimit; maxLen++)
|
||||||
|
if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen])
|
||||||
|
break;
|
||||||
|
distances[0] = maxLen;
|
||||||
|
distances[1] = delta2 - 1;
|
||||||
|
offset = 2;
|
||||||
|
if (maxLen == lenLimit)
|
||||||
|
{
|
||||||
|
SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p));
|
||||||
|
MOVE_POS_RET;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
GET_MATCHES_FOOTER(offset, maxLen)
|
||||||
|
}
|
||||||
|
|
||||||
|
static UInt32 Bt4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
|
||||||
|
{
|
||||||
|
UInt32 hash2Value, hash3Value, delta2, delta3, maxLen, offset;
|
||||||
|
GET_MATCHES_HEADER(4)
|
||||||
|
|
||||||
|
HASH4_CALC;
|
||||||
|
|
||||||
|
delta2 = p->pos - p->hash[ hash2Value];
|
||||||
|
delta3 = p->pos - p->hash[kFix3HashSize + hash3Value];
|
||||||
|
curMatch = p->hash[kFix4HashSize + hashValue];
|
||||||
|
|
||||||
|
p->hash[ hash2Value] =
|
||||||
|
p->hash[kFix3HashSize + hash3Value] =
|
||||||
|
p->hash[kFix4HashSize + hashValue] = p->pos;
|
||||||
|
|
||||||
|
maxLen = 1;
|
||||||
|
offset = 0;
|
||||||
|
if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur)
|
||||||
|
{
|
||||||
|
distances[0] = maxLen = 2;
|
||||||
|
distances[1] = delta2 - 1;
|
||||||
|
offset = 2;
|
||||||
|
}
|
||||||
|
if (delta2 != delta3 && delta3 < p->cyclicBufferSize && *(cur - delta3) == *cur)
|
||||||
|
{
|
||||||
|
maxLen = 3;
|
||||||
|
distances[offset + 1] = delta3 - 1;
|
||||||
|
offset += 2;
|
||||||
|
delta2 = delta3;
|
||||||
|
}
|
||||||
|
if (offset != 0)
|
||||||
|
{
|
||||||
|
for (; maxLen != lenLimit; maxLen++)
|
||||||
|
if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen])
|
||||||
|
break;
|
||||||
|
distances[offset - 2] = maxLen;
|
||||||
|
if (maxLen == lenLimit)
|
||||||
|
{
|
||||||
|
SkipMatchesSpec(lenLimit, curMatch, MF_PARAMS(p));
|
||||||
|
MOVE_POS_RET;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (maxLen < 3)
|
||||||
|
maxLen = 3;
|
||||||
|
GET_MATCHES_FOOTER(offset, maxLen)
|
||||||
|
}
|
||||||
|
|
||||||
|
static UInt32 Hc4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
|
||||||
|
{
|
||||||
|
UInt32 hash2Value, hash3Value, delta2, delta3, maxLen, offset;
|
||||||
|
GET_MATCHES_HEADER(4)
|
||||||
|
|
||||||
|
HASH4_CALC;
|
||||||
|
|
||||||
|
delta2 = p->pos - p->hash[ hash2Value];
|
||||||
|
delta3 = p->pos - p->hash[kFix3HashSize + hash3Value];
|
||||||
|
curMatch = p->hash[kFix4HashSize + hashValue];
|
||||||
|
|
||||||
|
p->hash[ hash2Value] =
|
||||||
|
p->hash[kFix3HashSize + hash3Value] =
|
||||||
|
p->hash[kFix4HashSize + hashValue] = p->pos;
|
||||||
|
|
||||||
|
maxLen = 1;
|
||||||
|
offset = 0;
|
||||||
|
if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur)
|
||||||
|
{
|
||||||
|
distances[0] = maxLen = 2;
|
||||||
|
distances[1] = delta2 - 1;
|
||||||
|
offset = 2;
|
||||||
|
}
|
||||||
|
if (delta2 != delta3 && delta3 < p->cyclicBufferSize && *(cur - delta3) == *cur)
|
||||||
|
{
|
||||||
|
maxLen = 3;
|
||||||
|
distances[offset + 1] = delta3 - 1;
|
||||||
|
offset += 2;
|
||||||
|
delta2 = delta3;
|
||||||
|
}
|
||||||
|
if (offset != 0)
|
||||||
|
{
|
||||||
|
for (; maxLen != lenLimit; maxLen++)
|
||||||
|
if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen])
|
||||||
|
break;
|
||||||
|
distances[offset - 2] = maxLen;
|
||||||
|
if (maxLen == lenLimit)
|
||||||
|
{
|
||||||
|
p->son[p->cyclicBufferPos] = curMatch;
|
||||||
|
MOVE_POS_RET;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (maxLen < 3)
|
||||||
|
maxLen = 3;
|
||||||
|
offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p),
|
||||||
|
distances + offset, maxLen) - (distances));
|
||||||
|
MOVE_POS_RET
|
||||||
|
}
|
||||||
|
|
||||||
|
UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
|
||||||
|
{
|
||||||
|
UInt32 offset;
|
||||||
|
GET_MATCHES_HEADER(3)
|
||||||
|
HASH_ZIP_CALC;
|
||||||
|
curMatch = p->hash[hashValue];
|
||||||
|
p->hash[hashValue] = p->pos;
|
||||||
|
offset = (UInt32)(Hc_GetMatchesSpec(lenLimit, curMatch, MF_PARAMS(p),
|
||||||
|
distances, 2) - (distances));
|
||||||
|
MOVE_POS_RET
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Bt2_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
SKIP_HEADER(2)
|
||||||
|
HASH2_CALC;
|
||||||
|
curMatch = p->hash[hashValue];
|
||||||
|
p->hash[hashValue] = p->pos;
|
||||||
|
SKIP_FOOTER
|
||||||
|
}
|
||||||
|
while (--num != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
SKIP_HEADER(3)
|
||||||
|
HASH_ZIP_CALC;
|
||||||
|
curMatch = p->hash[hashValue];
|
||||||
|
p->hash[hashValue] = p->pos;
|
||||||
|
SKIP_FOOTER
|
||||||
|
}
|
||||||
|
while (--num != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Bt3_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
UInt32 hash2Value;
|
||||||
|
SKIP_HEADER(3)
|
||||||
|
HASH3_CALC;
|
||||||
|
curMatch = p->hash[kFix3HashSize + hashValue];
|
||||||
|
p->hash[hash2Value] =
|
||||||
|
p->hash[kFix3HashSize + hashValue] = p->pos;
|
||||||
|
SKIP_FOOTER
|
||||||
|
}
|
||||||
|
while (--num != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Bt4_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
UInt32 hash2Value, hash3Value;
|
||||||
|
SKIP_HEADER(4)
|
||||||
|
HASH4_CALC;
|
||||||
|
curMatch = p->hash[kFix4HashSize + hashValue];
|
||||||
|
p->hash[ hash2Value] =
|
||||||
|
p->hash[kFix3HashSize + hash3Value] = p->pos;
|
||||||
|
p->hash[kFix4HashSize + hashValue] = p->pos;
|
||||||
|
SKIP_FOOTER
|
||||||
|
}
|
||||||
|
while (--num != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Hc4_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
UInt32 hash2Value, hash3Value;
|
||||||
|
SKIP_HEADER(4)
|
||||||
|
HASH4_CALC;
|
||||||
|
curMatch = p->hash[kFix4HashSize + hashValue];
|
||||||
|
p->hash[ hash2Value] =
|
||||||
|
p->hash[kFix3HashSize + hash3Value] =
|
||||||
|
p->hash[kFix4HashSize + hashValue] = p->pos;
|
||||||
|
p->son[p->cyclicBufferPos] = curMatch;
|
||||||
|
MOVE_POS
|
||||||
|
}
|
||||||
|
while (--num != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
SKIP_HEADER(3)
|
||||||
|
HASH_ZIP_CALC;
|
||||||
|
curMatch = p->hash[hashValue];
|
||||||
|
p->hash[hashValue] = p->pos;
|
||||||
|
p->son[p->cyclicBufferPos] = curMatch;
|
||||||
|
MOVE_POS
|
||||||
|
}
|
||||||
|
while (--num != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable)
|
||||||
|
{
|
||||||
|
vTable->Init = (Mf_Init_Func)MatchFinder_Init;
|
||||||
|
vTable->GetIndexByte = (Mf_GetIndexByte_Func)MatchFinder_GetIndexByte;
|
||||||
|
vTable->GetNumAvailableBytes = (Mf_GetNumAvailableBytes_Func)MatchFinder_GetNumAvailableBytes;
|
||||||
|
vTable->GetPointerToCurrentPos = (Mf_GetPointerToCurrentPos_Func)MatchFinder_GetPointerToCurrentPos;
|
||||||
|
if (!p->btMode)
|
||||||
|
{
|
||||||
|
vTable->GetMatches = (Mf_GetMatches_Func)Hc4_MatchFinder_GetMatches;
|
||||||
|
vTable->Skip = (Mf_Skip_Func)Hc4_MatchFinder_Skip;
|
||||||
|
}
|
||||||
|
else if (p->numHashBytes == 2)
|
||||||
|
{
|
||||||
|
vTable->GetMatches = (Mf_GetMatches_Func)Bt2_MatchFinder_GetMatches;
|
||||||
|
vTable->Skip = (Mf_Skip_Func)Bt2_MatchFinder_Skip;
|
||||||
|
}
|
||||||
|
else if (p->numHashBytes == 3)
|
||||||
|
{
|
||||||
|
vTable->GetMatches = (Mf_GetMatches_Func)Bt3_MatchFinder_GetMatches;
|
||||||
|
vTable->Skip = (Mf_Skip_Func)Bt3_MatchFinder_Skip;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vTable->GetMatches = (Mf_GetMatches_Func)Bt4_MatchFinder_GetMatches;
|
||||||
|
vTable->Skip = (Mf_Skip_Func)Bt4_MatchFinder_Skip;
|
||||||
|
}
|
||||||
|
}
|
||||||
107
extern/lzma/LzFind.h
vendored
Normal file
107
extern/lzma/LzFind.h
vendored
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
/* LzFind.h -- Match finder for LZ algorithms
|
||||||
|
2008-10-04 : Igor Pavlov : Public domain */
|
||||||
|
|
||||||
|
#ifndef __LZFIND_H
|
||||||
|
#define __LZFIND_H
|
||||||
|
|
||||||
|
#include "Types.h"
|
||||||
|
|
||||||
|
typedef UInt32 CLzRef;
|
||||||
|
|
||||||
|
typedef struct _CMatchFinder
|
||||||
|
{
|
||||||
|
Byte *buffer;
|
||||||
|
UInt32 pos;
|
||||||
|
UInt32 posLimit;
|
||||||
|
UInt32 streamPos;
|
||||||
|
UInt32 lenLimit;
|
||||||
|
|
||||||
|
UInt32 cyclicBufferPos;
|
||||||
|
UInt32 cyclicBufferSize; /* it must be = (historySize + 1) */
|
||||||
|
|
||||||
|
UInt32 matchMaxLen;
|
||||||
|
CLzRef *hash;
|
||||||
|
CLzRef *son;
|
||||||
|
UInt32 hashMask;
|
||||||
|
UInt32 cutValue;
|
||||||
|
|
||||||
|
Byte *bufferBase;
|
||||||
|
ISeqInStream *stream;
|
||||||
|
int streamEndWasReached;
|
||||||
|
|
||||||
|
UInt32 blockSize;
|
||||||
|
UInt32 keepSizeBefore;
|
||||||
|
UInt32 keepSizeAfter;
|
||||||
|
|
||||||
|
UInt32 numHashBytes;
|
||||||
|
int directInput;
|
||||||
|
int btMode;
|
||||||
|
/* int skipModeBits; */
|
||||||
|
int bigHash;
|
||||||
|
UInt32 historySize;
|
||||||
|
UInt32 fixedHashSize;
|
||||||
|
UInt32 hashSizeSum;
|
||||||
|
UInt32 numSons;
|
||||||
|
SRes result;
|
||||||
|
UInt32 crc[256];
|
||||||
|
} CMatchFinder;
|
||||||
|
|
||||||
|
#define Inline_MatchFinder_GetPointerToCurrentPos(p) ((p)->buffer)
|
||||||
|
#define Inline_MatchFinder_GetIndexByte(p, index) ((p)->buffer[(Int32)(index)])
|
||||||
|
|
||||||
|
#define Inline_MatchFinder_GetNumAvailableBytes(p) ((p)->streamPos - (p)->pos)
|
||||||
|
|
||||||
|
int MatchFinder_NeedMove(CMatchFinder *p);
|
||||||
|
Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p);
|
||||||
|
void MatchFinder_MoveBlock(CMatchFinder *p);
|
||||||
|
void MatchFinder_ReadIfRequired(CMatchFinder *p);
|
||||||
|
|
||||||
|
void MatchFinder_Construct(CMatchFinder *p);
|
||||||
|
|
||||||
|
/* Conditions:
|
||||||
|
historySize <= 3 GB
|
||||||
|
keepAddBufferBefore + matchMaxLen + keepAddBufferAfter < 511MB
|
||||||
|
*/
|
||||||
|
int MatchFinder_Create(CMatchFinder *p, UInt32 historySize,
|
||||||
|
UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter,
|
||||||
|
ISzAlloc *alloc);
|
||||||
|
void MatchFinder_Free(CMatchFinder *p, ISzAlloc *alloc);
|
||||||
|
void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, UInt32 numItems);
|
||||||
|
void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue);
|
||||||
|
|
||||||
|
UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *buffer, CLzRef *son,
|
||||||
|
UInt32 _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 _cutValue,
|
||||||
|
UInt32 *distances, UInt32 maxLen);
|
||||||
|
|
||||||
|
/*
|
||||||
|
Conditions:
|
||||||
|
Mf_GetNumAvailableBytes_Func must be called before each Mf_GetMatchLen_Func.
|
||||||
|
Mf_GetPointerToCurrentPos_Func's result must be used only before any other function
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef void (*Mf_Init_Func)(void *object);
|
||||||
|
typedef Byte (*Mf_GetIndexByte_Func)(void *object, Int32 index);
|
||||||
|
typedef UInt32 (*Mf_GetNumAvailableBytes_Func)(void *object);
|
||||||
|
typedef const Byte * (*Mf_GetPointerToCurrentPos_Func)(void *object);
|
||||||
|
typedef UInt32 (*Mf_GetMatches_Func)(void *object, UInt32 *distances);
|
||||||
|
typedef void (*Mf_Skip_Func)(void *object, UInt32);
|
||||||
|
|
||||||
|
typedef struct _IMatchFinder
|
||||||
|
{
|
||||||
|
Mf_Init_Func Init;
|
||||||
|
Mf_GetIndexByte_Func GetIndexByte;
|
||||||
|
Mf_GetNumAvailableBytes_Func GetNumAvailableBytes;
|
||||||
|
Mf_GetPointerToCurrentPos_Func GetPointerToCurrentPos;
|
||||||
|
Mf_GetMatches_Func GetMatches;
|
||||||
|
Mf_Skip_Func Skip;
|
||||||
|
} IMatchFinder;
|
||||||
|
|
||||||
|
void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder *vTable);
|
||||||
|
|
||||||
|
void MatchFinder_Init(CMatchFinder *p);
|
||||||
|
UInt32 Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);
|
||||||
|
UInt32 Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);
|
||||||
|
void Bt3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num);
|
||||||
|
void Hc3Zip_MatchFinder_Skip(CMatchFinder *p, UInt32 num);
|
||||||
|
|
||||||
|
#endif
|
||||||
54
extern/lzma/LzHash.h
vendored
Normal file
54
extern/lzma/LzHash.h
vendored
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
/* LzHash.h -- HASH functions for LZ algorithms
|
||||||
|
2008-10-04 : Igor Pavlov : Public domain */
|
||||||
|
|
||||||
|
#ifndef __LZHASH_H
|
||||||
|
#define __LZHASH_H
|
||||||
|
|
||||||
|
#define kHash2Size (1 << 10)
|
||||||
|
#define kHash3Size (1 << 16)
|
||||||
|
#define kHash4Size (1 << 20)
|
||||||
|
|
||||||
|
#define kFix3HashSize (kHash2Size)
|
||||||
|
#define kFix4HashSize (kHash2Size + kHash3Size)
|
||||||
|
#define kFix5HashSize (kHash2Size + kHash3Size + kHash4Size)
|
||||||
|
|
||||||
|
#define HASH2_CALC hashValue = cur[0] | ((UInt32)cur[1] << 8);
|
||||||
|
|
||||||
|
#define HASH3_CALC { \
|
||||||
|
UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
|
||||||
|
hash2Value = temp & (kHash2Size - 1); \
|
||||||
|
hashValue = (temp ^ ((UInt32)cur[2] << 8)) & p->hashMask; }
|
||||||
|
|
||||||
|
#define HASH4_CALC { \
|
||||||
|
UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
|
||||||
|
hash2Value = temp & (kHash2Size - 1); \
|
||||||
|
hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \
|
||||||
|
hashValue = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)) & p->hashMask; }
|
||||||
|
|
||||||
|
#define HASH5_CALC { \
|
||||||
|
UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
|
||||||
|
hash2Value = temp & (kHash2Size - 1); \
|
||||||
|
hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \
|
||||||
|
hash4Value = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)); \
|
||||||
|
hashValue = (hash4Value ^ (p->crc[cur[4]] << 3)) & p->hashMask; \
|
||||||
|
hash4Value &= (kHash4Size - 1); }
|
||||||
|
|
||||||
|
/* #define HASH_ZIP_CALC hashValue = ((cur[0] | ((UInt32)cur[1] << 8)) ^ p->crc[cur[2]]) & 0xFFFF; */
|
||||||
|
#define HASH_ZIP_CALC hashValue = ((cur[2] | ((UInt32)cur[0] << 8)) ^ p->crc[cur[1]]) & 0xFFFF;
|
||||||
|
|
||||||
|
|
||||||
|
#define MT_HASH2_CALC \
|
||||||
|
hash2Value = (p->crc[cur[0]] ^ cur[1]) & (kHash2Size - 1);
|
||||||
|
|
||||||
|
#define MT_HASH3_CALC { \
|
||||||
|
UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
|
||||||
|
hash2Value = temp & (kHash2Size - 1); \
|
||||||
|
hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); }
|
||||||
|
|
||||||
|
#define MT_HASH4_CALC { \
|
||||||
|
UInt32 temp = p->crc[cur[0]] ^ cur[1]; \
|
||||||
|
hash2Value = temp & (kHash2Size - 1); \
|
||||||
|
hash3Value = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); \
|
||||||
|
hash4Value = (temp ^ ((UInt32)cur[2] << 8) ^ (p->crc[cur[3]] << 5)) & (kHash4Size - 1); }
|
||||||
|
|
||||||
|
#endif
|
||||||
1007
extern/lzma/LzmaDec.c
vendored
Normal file
1007
extern/lzma/LzmaDec.c
vendored
Normal file
File diff suppressed because it is too large
Load Diff
223
extern/lzma/LzmaDec.h
vendored
Normal file
223
extern/lzma/LzmaDec.h
vendored
Normal file
@@ -0,0 +1,223 @@
|
|||||||
|
/* LzmaDec.h -- LZMA Decoder
|
||||||
|
2008-10-04 : Igor Pavlov : Public domain */
|
||||||
|
|
||||||
|
#ifndef __LZMADEC_H
|
||||||
|
#define __LZMADEC_H
|
||||||
|
|
||||||
|
#include "Types.h"
|
||||||
|
|
||||||
|
/* #define _LZMA_PROB32 */
|
||||||
|
/* _LZMA_PROB32 can increase the speed on some CPUs,
|
||||||
|
but memory usage for CLzmaDec::probs will be doubled in that case */
|
||||||
|
|
||||||
|
#ifdef _LZMA_PROB32
|
||||||
|
#define CLzmaProb UInt32
|
||||||
|
#else
|
||||||
|
#define CLzmaProb UInt16
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* ---------- LZMA Properties ---------- */
|
||||||
|
|
||||||
|
#define LZMA_PROPS_SIZE 5
|
||||||
|
|
||||||
|
typedef struct _CLzmaProps
|
||||||
|
{
|
||||||
|
unsigned lc, lp, pb;
|
||||||
|
UInt32 dicSize;
|
||||||
|
} CLzmaProps;
|
||||||
|
|
||||||
|
/* LzmaProps_Decode - decodes properties
|
||||||
|
Returns:
|
||||||
|
SZ_OK
|
||||||
|
SZ_ERROR_UNSUPPORTED - Unsupported properties
|
||||||
|
*/
|
||||||
|
|
||||||
|
SRes LzmaProps_Decode(CLzmaProps *p, const Byte *data, unsigned size);
|
||||||
|
|
||||||
|
|
||||||
|
/* ---------- LZMA Decoder state ---------- */
|
||||||
|
|
||||||
|
/* LZMA_REQUIRED_INPUT_MAX = number of required input bytes for worst case.
|
||||||
|
Num bits = log2((2^11 / 31) ^ 22) + 26 < 134 + 26 = 160; */
|
||||||
|
|
||||||
|
#define LZMA_REQUIRED_INPUT_MAX 20
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
CLzmaProps prop;
|
||||||
|
CLzmaProb *probs;
|
||||||
|
Byte *dic;
|
||||||
|
const Byte *buf;
|
||||||
|
UInt32 range, code;
|
||||||
|
SizeT dicPos;
|
||||||
|
SizeT dicBufSize;
|
||||||
|
UInt32 processedPos;
|
||||||
|
UInt32 checkDicSize;
|
||||||
|
unsigned state;
|
||||||
|
UInt32 reps[4];
|
||||||
|
unsigned remainLen;
|
||||||
|
int needFlush;
|
||||||
|
int needInitState;
|
||||||
|
UInt32 numProbs;
|
||||||
|
unsigned tempBufSize;
|
||||||
|
Byte tempBuf[LZMA_REQUIRED_INPUT_MAX];
|
||||||
|
} CLzmaDec;
|
||||||
|
|
||||||
|
#define LzmaDec_Construct(p) { (p)->dic = 0; (p)->probs = 0; }
|
||||||
|
|
||||||
|
void LzmaDec_Init(CLzmaDec *p);
|
||||||
|
|
||||||
|
/* There are two types of LZMA streams:
|
||||||
|
0) Stream with end mark. That end mark adds about 6 bytes to compressed size.
|
||||||
|
1) Stream without end mark. You must know exact uncompressed size to decompress such stream. */
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
LZMA_FINISH_ANY, /* finish at any point */
|
||||||
|
LZMA_FINISH_END /* block must be finished at the end */
|
||||||
|
} ELzmaFinishMode;
|
||||||
|
|
||||||
|
/* ELzmaFinishMode has meaning only if the decoding reaches output limit !!!
|
||||||
|
|
||||||
|
You must use LZMA_FINISH_END, when you know that current output buffer
|
||||||
|
covers last bytes of block. In other cases you must use LZMA_FINISH_ANY.
|
||||||
|
|
||||||
|
If LZMA decoder sees end marker before reaching output limit, it returns SZ_OK,
|
||||||
|
and output value of destLen will be less than output buffer size limit.
|
||||||
|
You can check status result also.
|
||||||
|
|
||||||
|
You can use multiple checks to test data integrity after full decompression:
|
||||||
|
1) Check Result and "status" variable.
|
||||||
|
2) Check that output(destLen) = uncompressedSize, if you know real uncompressedSize.
|
||||||
|
3) Check that output(srcLen) = compressedSize, if you know real compressedSize.
|
||||||
|
You must use correct finish mode in that case. */
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
LZMA_STATUS_NOT_SPECIFIED, /* use main error code instead */
|
||||||
|
LZMA_STATUS_FINISHED_WITH_MARK, /* stream was finished with end mark. */
|
||||||
|
LZMA_STATUS_NOT_FINISHED, /* stream was not finished */
|
||||||
|
LZMA_STATUS_NEEDS_MORE_INPUT, /* you must provide more input bytes */
|
||||||
|
LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK /* there is probability that stream was finished without end mark */
|
||||||
|
} ELzmaStatus;
|
||||||
|
|
||||||
|
/* ELzmaStatus is used only as output value for function call */
|
||||||
|
|
||||||
|
|
||||||
|
/* ---------- Interfaces ---------- */
|
||||||
|
|
||||||
|
/* There are 3 levels of interfaces:
|
||||||
|
1) Dictionary Interface
|
||||||
|
2) Buffer Interface
|
||||||
|
3) One Call Interface
|
||||||
|
You can select any of these interfaces, but don't mix functions from different
|
||||||
|
groups for same object. */
|
||||||
|
|
||||||
|
|
||||||
|
/* There are two variants to allocate state for Dictionary Interface:
|
||||||
|
1) LzmaDec_Allocate / LzmaDec_Free
|
||||||
|
2) LzmaDec_AllocateProbs / LzmaDec_FreeProbs
|
||||||
|
You can use variant 2, if you set dictionary buffer manually.
|
||||||
|
For Buffer Interface you must always use variant 1.
|
||||||
|
|
||||||
|
LzmaDec_Allocate* can return:
|
||||||
|
SZ_OK
|
||||||
|
SZ_ERROR_MEM - Memory allocation error
|
||||||
|
SZ_ERROR_UNSUPPORTED - Unsupported properties
|
||||||
|
*/
|
||||||
|
|
||||||
|
SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc);
|
||||||
|
void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc);
|
||||||
|
|
||||||
|
SRes LzmaDec_Allocate(CLzmaDec *state, const Byte *prop, unsigned propsSize, ISzAlloc *alloc);
|
||||||
|
void LzmaDec_Free(CLzmaDec *state, ISzAlloc *alloc);
|
||||||
|
|
||||||
|
/* ---------- Dictionary Interface ---------- */
|
||||||
|
|
||||||
|
/* You can use it, if you want to eliminate the overhead for data copying from
|
||||||
|
dictionary to some other external buffer.
|
||||||
|
You must work with CLzmaDec variables directly in this interface.
|
||||||
|
|
||||||
|
STEPS:
|
||||||
|
LzmaDec_Constr()
|
||||||
|
LzmaDec_Allocate()
|
||||||
|
for (each new stream)
|
||||||
|
{
|
||||||
|
LzmaDec_Init()
|
||||||
|
while (it needs more decompression)
|
||||||
|
{
|
||||||
|
LzmaDec_DecodeToDic()
|
||||||
|
use data from CLzmaDec::dic and update CLzmaDec::dicPos
|
||||||
|
}
|
||||||
|
}
|
||||||
|
LzmaDec_Free()
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* LzmaDec_DecodeToDic
|
||||||
|
|
||||||
|
The decoding to internal dictionary buffer (CLzmaDec::dic).
|
||||||
|
You must manually update CLzmaDec::dicPos, if it reaches CLzmaDec::dicBufSize !!!
|
||||||
|
|
||||||
|
finishMode:
|
||||||
|
It has meaning only if the decoding reaches output limit (dicLimit).
|
||||||
|
LZMA_FINISH_ANY - Decode just dicLimit bytes.
|
||||||
|
LZMA_FINISH_END - Stream must be finished after dicLimit.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
SZ_OK
|
||||||
|
status:
|
||||||
|
LZMA_STATUS_FINISHED_WITH_MARK
|
||||||
|
LZMA_STATUS_NOT_FINISHED
|
||||||
|
LZMA_STATUS_NEEDS_MORE_INPUT
|
||||||
|
LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK
|
||||||
|
SZ_ERROR_DATA - Data error
|
||||||
|
*/
|
||||||
|
|
||||||
|
SRes LzmaDec_DecodeToDic(CLzmaDec *p, SizeT dicLimit,
|
||||||
|
const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status);
|
||||||
|
|
||||||
|
|
||||||
|
/* ---------- Buffer Interface ---------- */
|
||||||
|
|
||||||
|
/* It's zlib-like interface.
|
||||||
|
See LzmaDec_DecodeToDic description for information about STEPS and return results,
|
||||||
|
but you must use LzmaDec_DecodeToBuf instead of LzmaDec_DecodeToDic and you don't need
|
||||||
|
to work with CLzmaDec variables manually.
|
||||||
|
|
||||||
|
finishMode:
|
||||||
|
It has meaning only if the decoding reaches output limit (*destLen).
|
||||||
|
LZMA_FINISH_ANY - Decode just destLen bytes.
|
||||||
|
LZMA_FINISH_END - Stream must be finished after (*destLen).
|
||||||
|
*/
|
||||||
|
|
||||||
|
SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen,
|
||||||
|
const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status);
|
||||||
|
|
||||||
|
|
||||||
|
/* ---------- One Call Interface ---------- */
|
||||||
|
|
||||||
|
/* LzmaDecode
|
||||||
|
|
||||||
|
finishMode:
|
||||||
|
It has meaning only if the decoding reaches output limit (*destLen).
|
||||||
|
LZMA_FINISH_ANY - Decode just destLen bytes.
|
||||||
|
LZMA_FINISH_END - Stream must be finished after (*destLen).
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
SZ_OK
|
||||||
|
status:
|
||||||
|
LZMA_STATUS_FINISHED_WITH_MARK
|
||||||
|
LZMA_STATUS_NOT_FINISHED
|
||||||
|
LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK
|
||||||
|
SZ_ERROR_DATA - Data error
|
||||||
|
SZ_ERROR_MEM - Memory allocation error
|
||||||
|
SZ_ERROR_UNSUPPORTED - Unsupported properties
|
||||||
|
SZ_ERROR_INPUT_EOF - It needs more bytes in input buffer (src).
|
||||||
|
*/
|
||||||
|
|
||||||
|
SRes LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen,
|
||||||
|
const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode,
|
||||||
|
ELzmaStatus *status, ISzAlloc *alloc);
|
||||||
|
|
||||||
|
#endif
|
||||||
2281
extern/lzma/LzmaEnc.c
vendored
Normal file
2281
extern/lzma/LzmaEnc.c
vendored
Normal file
File diff suppressed because it is too large
Load Diff
72
extern/lzma/LzmaEnc.h
vendored
Normal file
72
extern/lzma/LzmaEnc.h
vendored
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
/* LzmaEnc.h -- LZMA Encoder
|
||||||
|
2008-10-04 : Igor Pavlov : Public domain */
|
||||||
|
|
||||||
|
#ifndef __LZMAENC_H
|
||||||
|
#define __LZMAENC_H
|
||||||
|
|
||||||
|
#include "Types.h"
|
||||||
|
|
||||||
|
#define LZMA_PROPS_SIZE 5
|
||||||
|
|
||||||
|
typedef struct _CLzmaEncProps
|
||||||
|
{
|
||||||
|
int level; /* 0 <= level <= 9 */
|
||||||
|
UInt32 dictSize; /* (1 << 12) <= dictSize <= (1 << 27) for 32-bit version
|
||||||
|
(1 << 12) <= dictSize <= (1 << 30) for 64-bit version
|
||||||
|
default = (1 << 24) */
|
||||||
|
int lc; /* 0 <= lc <= 8, default = 3 */
|
||||||
|
int lp; /* 0 <= lp <= 4, default = 0 */
|
||||||
|
int pb; /* 0 <= pb <= 4, default = 2 */
|
||||||
|
int algo; /* 0 - fast, 1 - normal, default = 1 */
|
||||||
|
int fb; /* 5 <= fb <= 273, default = 32 */
|
||||||
|
int btMode; /* 0 - hashChain Mode, 1 - binTree mode - normal, default = 1 */
|
||||||
|
int numHashBytes; /* 2, 3 or 4, default = 4 */
|
||||||
|
UInt32 mc; /* 1 <= mc <= (1 << 30), default = 32 */
|
||||||
|
unsigned writeEndMark; /* 0 - do not write EOPM, 1 - write EOPM, default = 0 */
|
||||||
|
int numThreads; /* 1 or 2, default = 2 */
|
||||||
|
} CLzmaEncProps;
|
||||||
|
|
||||||
|
void LzmaEncProps_Init(CLzmaEncProps *p);
|
||||||
|
void LzmaEncProps_Normalize(CLzmaEncProps *p);
|
||||||
|
UInt32 LzmaEncProps_GetDictSize(const CLzmaEncProps *props2);
|
||||||
|
|
||||||
|
|
||||||
|
/* ---------- CLzmaEncHandle Interface ---------- */
|
||||||
|
|
||||||
|
/* LzmaEnc_* functions can return the following exit codes:
|
||||||
|
Returns:
|
||||||
|
SZ_OK - OK
|
||||||
|
SZ_ERROR_MEM - Memory allocation error
|
||||||
|
SZ_ERROR_PARAM - Incorrect paramater in props
|
||||||
|
SZ_ERROR_WRITE - Write callback error.
|
||||||
|
SZ_ERROR_PROGRESS - some break from progress callback
|
||||||
|
SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version)
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef void * CLzmaEncHandle;
|
||||||
|
|
||||||
|
CLzmaEncHandle LzmaEnc_Create(ISzAlloc *alloc);
|
||||||
|
void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAlloc *alloc, ISzAlloc *allocBig);
|
||||||
|
SRes LzmaEnc_SetProps(CLzmaEncHandle p, const CLzmaEncProps *props);
|
||||||
|
SRes LzmaEnc_WriteProperties(CLzmaEncHandle p, Byte *properties, SizeT *size);
|
||||||
|
SRes LzmaEnc_Encode(CLzmaEncHandle p, ISeqOutStream *outStream, ISeqInStream *inStream,
|
||||||
|
ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
|
||||||
|
SRes LzmaEnc_MemEncode(CLzmaEncHandle p, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
|
||||||
|
int writeEndMark, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
|
||||||
|
|
||||||
|
/* ---------- One Call Interface ---------- */
|
||||||
|
|
||||||
|
/* LzmaEncode
|
||||||
|
Return code:
|
||||||
|
SZ_OK - OK
|
||||||
|
SZ_ERROR_MEM - Memory allocation error
|
||||||
|
SZ_ERROR_PARAM - Incorrect paramater
|
||||||
|
SZ_ERROR_OUTPUT_EOF - output buffer overflow
|
||||||
|
SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version)
|
||||||
|
*/
|
||||||
|
|
||||||
|
SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
|
||||||
|
const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark,
|
||||||
|
ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
|
||||||
|
|
||||||
|
#endif
|
||||||
46
extern/lzma/LzmaLib.c
vendored
Normal file
46
extern/lzma/LzmaLib.c
vendored
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
/* LzmaLib.c -- LZMA library wrapper
|
||||||
|
2008-08-05
|
||||||
|
Igor Pavlov
|
||||||
|
Public domain */
|
||||||
|
|
||||||
|
#include "LzmaEnc.h"
|
||||||
|
#include "LzmaDec.h"
|
||||||
|
#include "Alloc.h"
|
||||||
|
#include "LzmaLib.h"
|
||||||
|
|
||||||
|
static void *SzAlloc(void *p, size_t size) { p = p; return MyAlloc(size); }
|
||||||
|
static void SzFree(void *p, void *address) { p = p; MyFree(address); }
|
||||||
|
static ISzAlloc g_Alloc = { SzAlloc, SzFree };
|
||||||
|
|
||||||
|
MY_STDAPI LzmaCompress(unsigned char *dest, size_t *destLen, const unsigned char *src, size_t srcLen,
|
||||||
|
unsigned char *outProps, size_t *outPropsSize,
|
||||||
|
int level, /* 0 <= level <= 9, default = 5 */
|
||||||
|
unsigned dictSize, /* use (1 << N) or (3 << N). 4 KB < dictSize <= 128 MB */
|
||||||
|
int lc, /* 0 <= lc <= 8, default = 3 */
|
||||||
|
int lp, /* 0 <= lp <= 4, default = 0 */
|
||||||
|
int pb, /* 0 <= pb <= 4, default = 2 */
|
||||||
|
int fb, /* 5 <= fb <= 273, default = 32 */
|
||||||
|
int numThreads /* 1 or 2, default = 2 */
|
||||||
|
)
|
||||||
|
{
|
||||||
|
CLzmaEncProps props;
|
||||||
|
LzmaEncProps_Init(&props);
|
||||||
|
props.level = level;
|
||||||
|
props.dictSize = dictSize;
|
||||||
|
props.lc = lc;
|
||||||
|
props.lp = lp;
|
||||||
|
props.pb = pb;
|
||||||
|
props.fb = fb;
|
||||||
|
props.numThreads = numThreads;
|
||||||
|
|
||||||
|
return LzmaEncode(dest, destLen, src, srcLen, &props, outProps, outPropsSize, 0,
|
||||||
|
NULL, &g_Alloc, &g_Alloc);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
MY_STDAPI LzmaUncompress(unsigned char *dest, size_t *destLen, const unsigned char *src, size_t *srcLen,
|
||||||
|
const unsigned char *props, size_t propsSize)
|
||||||
|
{
|
||||||
|
ELzmaStatus status;
|
||||||
|
return LzmaDecode(dest, destLen, src, srcLen, props, (unsigned)propsSize, LZMA_FINISH_ANY, &status, &g_Alloc);
|
||||||
|
}
|
||||||
135
extern/lzma/LzmaLib.h
vendored
Normal file
135
extern/lzma/LzmaLib.h
vendored
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
/* LzmaLib.h -- LZMA library interface
|
||||||
|
2008-08-05
|
||||||
|
Igor Pavlov
|
||||||
|
Public domain */
|
||||||
|
|
||||||
|
#ifndef __LZMALIB_H
|
||||||
|
#define __LZMALIB_H
|
||||||
|
|
||||||
|
#include "Types.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#define MY_EXTERN_C extern "C"
|
||||||
|
#else
|
||||||
|
#define MY_EXTERN_C extern
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define MY_STDAPI MY_EXTERN_C int MY_STD_CALL
|
||||||
|
|
||||||
|
#define LZMA_PROPS_SIZE 5
|
||||||
|
|
||||||
|
/*
|
||||||
|
RAM requirements for LZMA:
|
||||||
|
for compression: (dictSize * 11.5 + 6 MB) + state_size
|
||||||
|
for decompression: dictSize + state_size
|
||||||
|
state_size = (4 + (1.5 << (lc + lp))) KB
|
||||||
|
by default (lc=3, lp=0), state_size = 16 KB.
|
||||||
|
|
||||||
|
LZMA properties (5 bytes) format
|
||||||
|
Offset Size Description
|
||||||
|
0 1 lc, lp and pb in encoded form.
|
||||||
|
1 4 dictSize (little endian).
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
LzmaCompress
|
||||||
|
------------
|
||||||
|
|
||||||
|
outPropsSize -
|
||||||
|
In: the pointer to the size of outProps buffer; *outPropsSize = LZMA_PROPS_SIZE = 5.
|
||||||
|
Out: the pointer to the size of written properties in outProps buffer; *outPropsSize = LZMA_PROPS_SIZE = 5.
|
||||||
|
|
||||||
|
LZMA Encoder will use defult values for any parameter, if it is
|
||||||
|
-1 for any from: level, loc, lp, pb, fb, numThreads
|
||||||
|
0 for dictSize
|
||||||
|
|
||||||
|
level - compression level: 0 <= level <= 9;
|
||||||
|
|
||||||
|
level dictSize algo fb
|
||||||
|
0: 16 KB 0 32
|
||||||
|
1: 64 KB 0 32
|
||||||
|
2: 256 KB 0 32
|
||||||
|
3: 1 MB 0 32
|
||||||
|
4: 4 MB 0 32
|
||||||
|
5: 16 MB 1 32
|
||||||
|
6: 32 MB 1 32
|
||||||
|
7+: 64 MB 1 64
|
||||||
|
|
||||||
|
The default value for "level" is 5.
|
||||||
|
|
||||||
|
algo = 0 means fast method
|
||||||
|
algo = 1 means normal method
|
||||||
|
|
||||||
|
dictSize - The dictionary size in bytes. The maximum value is
|
||||||
|
128 MB = (1 << 27) bytes for 32-bit version
|
||||||
|
1 GB = (1 << 30) bytes for 64-bit version
|
||||||
|
The default value is 16 MB = (1 << 24) bytes.
|
||||||
|
It's recommended to use the dictionary that is larger than 4 KB and
|
||||||
|
that can be calculated as (1 << N) or (3 << N) sizes.
|
||||||
|
|
||||||
|
lc - The number of literal context bits (high bits of previous literal).
|
||||||
|
It can be in the range from 0 to 8. The default value is 3.
|
||||||
|
Sometimes lc=4 gives the gain for big files.
|
||||||
|
|
||||||
|
lp - The number of literal pos bits (low bits of current position for literals).
|
||||||
|
It can be in the range from 0 to 4. The default value is 0.
|
||||||
|
The lp switch is intended for periodical data when the period is equal to 2^lp.
|
||||||
|
For example, for 32-bit (4 bytes) periodical data you can use lp=2. Often it's
|
||||||
|
better to set lc=0, if you change lp switch.
|
||||||
|
|
||||||
|
pb - The number of pos bits (low bits of current position).
|
||||||
|
It can be in the range from 0 to 4. The default value is 2.
|
||||||
|
The pb switch is intended for periodical data when the period is equal 2^pb.
|
||||||
|
|
||||||
|
fb - Word size (the number of fast bytes).
|
||||||
|
It can be in the range from 5 to 273. The default value is 32.
|
||||||
|
Usually, a big number gives a little bit better compression ratio and
|
||||||
|
slower compression process.
|
||||||
|
|
||||||
|
numThreads - The number of thereads. 1 or 2. The default value is 2.
|
||||||
|
Fast mode (algo = 0) can use only 1 thread.
|
||||||
|
|
||||||
|
Out:
|
||||||
|
destLen - processed output size
|
||||||
|
Returns:
|
||||||
|
SZ_OK - OK
|
||||||
|
SZ_ERROR_MEM - Memory allocation error
|
||||||
|
SZ_ERROR_PARAM - Incorrect paramater
|
||||||
|
SZ_ERROR_OUTPUT_EOF - output buffer overflow
|
||||||
|
SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version)
|
||||||
|
*/
|
||||||
|
|
||||||
|
MY_STDAPI LzmaCompress(unsigned char *dest, size_t *destLen, const unsigned char *src, size_t srcLen,
|
||||||
|
unsigned char *outProps, size_t *outPropsSize, /* *outPropsSize must be = 5 */
|
||||||
|
int level, /* 0 <= level <= 9, default = 5 */
|
||||||
|
unsigned dictSize, /* default = (1 << 24) */
|
||||||
|
int lc, /* 0 <= lc <= 8, default = 3 */
|
||||||
|
int lp, /* 0 <= lp <= 4, default = 0 */
|
||||||
|
int pb, /* 0 <= pb <= 4, default = 2 */
|
||||||
|
int fb, /* 5 <= fb <= 273, default = 32 */
|
||||||
|
int numThreads /* 1 or 2, default = 2 */
|
||||||
|
);
|
||||||
|
|
||||||
|
/*
|
||||||
|
LzmaUncompress
|
||||||
|
--------------
|
||||||
|
In:
|
||||||
|
dest - output data
|
||||||
|
destLen - output data size
|
||||||
|
src - input data
|
||||||
|
srcLen - input data size
|
||||||
|
Out:
|
||||||
|
destLen - processed output size
|
||||||
|
srcLen - processed input size
|
||||||
|
Returns:
|
||||||
|
SZ_OK - OK
|
||||||
|
SZ_ERROR_DATA - Data error
|
||||||
|
SZ_ERROR_MEM - Memory allocation arror
|
||||||
|
SZ_ERROR_UNSUPPORTED - Unsupported properties
|
||||||
|
SZ_ERROR_INPUT_EOF - it needs more bytes in input buffer (src)
|
||||||
|
*/
|
||||||
|
|
||||||
|
MY_STDAPI LzmaUncompress(unsigned char *dest, size_t *destLen, const unsigned char *src, SizeT *srcLen,
|
||||||
|
const unsigned char *props, size_t propsSize);
|
||||||
|
|
||||||
|
#endif
|
||||||
46
extern/lzma/Makefile
vendored
Normal file
46
extern/lzma/Makefile
vendored
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
#
|
||||||
|
# $Id$
|
||||||
|
#
|
||||||
|
# ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or (at your option) any later version. The Blender
|
||||||
|
# Foundation also sells licenses for use in proprietary software under
|
||||||
|
# the Blender License. See http://www.blender.org/BL/ for information
|
||||||
|
# about this.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software Foundation,
|
||||||
|
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
#
|
||||||
|
# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# The Original Code is: all of this file.
|
||||||
|
#
|
||||||
|
# Contributor(s):
|
||||||
|
#
|
||||||
|
# ***** END GPL/BL DUAL LICENSE BLOCK *****
|
||||||
|
#
|
||||||
|
#
|
||||||
|
|
||||||
|
LIBNAME = lzma
|
||||||
|
DIR = $(OCGDIR)/extern/$(LIBNAME)
|
||||||
|
|
||||||
|
include nan_compile.mk
|
||||||
|
|
||||||
|
install: $(ALL_OR_DEBUG)
|
||||||
|
@[ -d $(NAN_LZMA) ] || mkdir -p $(NAN_LZMA)
|
||||||
|
@[ -d $(NAN_LZMA)/lib/$(DEBUG_DIR) ] || mkdir -p $(NAN_LZMA)/lib/$(DEBUG_DIR)
|
||||||
|
@$(NANBLENDERHOME)/intern/tools/cpifdiff.sh $(DIR)/$(DEBUG_DIR)lib$(LIBNAME).a $(NAN_LZMA)/lib/$(DEBUG_DIR)
|
||||||
|
ifeq ($(OS),darwin)
|
||||||
|
ranlib $(NAN_LZMA)/lib/$(DEBUG_DIR)lib$(LIBNAME).a
|
||||||
|
endif
|
||||||
|
@$(NANBLENDERHOME)/intern/tools/cpifdiff.sh *.h $(NAN_LZMA)
|
||||||
9
extern/lzma/SConscript
vendored
Normal file
9
extern/lzma/SConscript
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
Import ('env')
|
||||||
|
|
||||||
|
sources = env.Glob('./*.c')
|
||||||
|
|
||||||
|
defs = ''
|
||||||
|
incs = ' . '
|
||||||
|
|
||||||
|
env.BlenderLib ('bf_lzma', sources, Split(incs), Split(defs), libtype=['intern'], priority=[40] )
|
||||||
208
extern/lzma/Types.h
vendored
Normal file
208
extern/lzma/Types.h
vendored
Normal file
@@ -0,0 +1,208 @@
|
|||||||
|
/* Types.h -- Basic types
|
||||||
|
2008-11-23 : Igor Pavlov : Public domain */
|
||||||
|
|
||||||
|
#ifndef __7Z_TYPES_H
|
||||||
|
#define __7Z_TYPES_H
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define SZ_OK 0
|
||||||
|
|
||||||
|
#define SZ_ERROR_DATA 1
|
||||||
|
#define SZ_ERROR_MEM 2
|
||||||
|
#define SZ_ERROR_CRC 3
|
||||||
|
#define SZ_ERROR_UNSUPPORTED 4
|
||||||
|
#define SZ_ERROR_PARAM 5
|
||||||
|
#define SZ_ERROR_INPUT_EOF 6
|
||||||
|
#define SZ_ERROR_OUTPUT_EOF 7
|
||||||
|
#define SZ_ERROR_READ 8
|
||||||
|
#define SZ_ERROR_WRITE 9
|
||||||
|
#define SZ_ERROR_PROGRESS 10
|
||||||
|
#define SZ_ERROR_FAIL 11
|
||||||
|
#define SZ_ERROR_THREAD 12
|
||||||
|
|
||||||
|
#define SZ_ERROR_ARCHIVE 16
|
||||||
|
#define SZ_ERROR_NO_ARCHIVE 17
|
||||||
|
|
||||||
|
typedef int SRes;
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
typedef DWORD WRes;
|
||||||
|
#else
|
||||||
|
typedef int WRes;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef RINOK
|
||||||
|
#define RINOK(x) { int __result__ = (x); if (__result__ != 0) return __result__; }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef unsigned char Byte;
|
||||||
|
typedef short Int16;
|
||||||
|
typedef unsigned short UInt16;
|
||||||
|
|
||||||
|
#ifdef _LZMA_UINT32_IS_ULONG
|
||||||
|
typedef long Int32;
|
||||||
|
typedef unsigned long UInt32;
|
||||||
|
#else
|
||||||
|
typedef int Int32;
|
||||||
|
typedef unsigned int UInt32;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _SZ_NO_INT_64
|
||||||
|
|
||||||
|
/* define _SZ_NO_INT_64, if your compiler doesn't support 64-bit integers.
|
||||||
|
NOTES: Some code will work incorrectly in that case! */
|
||||||
|
|
||||||
|
typedef long Int64;
|
||||||
|
typedef unsigned long UInt64;
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
||||||
|
typedef __int64 Int64;
|
||||||
|
typedef unsigned __int64 UInt64;
|
||||||
|
#else
|
||||||
|
typedef long long int Int64;
|
||||||
|
typedef unsigned long long int UInt64;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _LZMA_NO_SYSTEM_SIZE_T
|
||||||
|
typedef UInt32 SizeT;
|
||||||
|
#else
|
||||||
|
typedef size_t SizeT;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef int Bool;
|
||||||
|
#define True 1
|
||||||
|
#define False 0
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
|
||||||
|
#if _MSC_VER >= 1300
|
||||||
|
#define MY_NO_INLINE __declspec(noinline)
|
||||||
|
#else
|
||||||
|
#define MY_NO_INLINE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define MY_CDECL __cdecl
|
||||||
|
#define MY_STD_CALL __stdcall
|
||||||
|
#define MY_FAST_CALL MY_NO_INLINE __fastcall
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#define MY_CDECL
|
||||||
|
#define MY_STD_CALL
|
||||||
|
#define MY_FAST_CALL
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* The following interfaces use first parameter as pointer to structure */
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
SRes (*Read)(void *p, void *buf, size_t *size);
|
||||||
|
/* if (input(*size) != 0 && output(*size) == 0) means end_of_stream.
|
||||||
|
(output(*size) < input(*size)) is allowed */
|
||||||
|
} ISeqInStream;
|
||||||
|
|
||||||
|
/* it can return SZ_ERROR_INPUT_EOF */
|
||||||
|
SRes SeqInStream_Read(ISeqInStream *stream, void *buf, size_t size);
|
||||||
|
SRes SeqInStream_Read2(ISeqInStream *stream, void *buf, size_t size, SRes errorType);
|
||||||
|
SRes SeqInStream_ReadByte(ISeqInStream *stream, Byte *buf);
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
size_t (*Write)(void *p, const void *buf, size_t size);
|
||||||
|
/* Returns: result - the number of actually written bytes.
|
||||||
|
(result < size) means error */
|
||||||
|
} ISeqOutStream;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
SZ_SEEK_SET = 0,
|
||||||
|
SZ_SEEK_CUR = 1,
|
||||||
|
SZ_SEEK_END = 2
|
||||||
|
} ESzSeek;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
SRes (*Read)(void *p, void *buf, size_t *size); /* same as ISeqInStream::Read */
|
||||||
|
SRes (*Seek)(void *p, Int64 *pos, ESzSeek origin);
|
||||||
|
} ISeekInStream;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
SRes (*Look)(void *p, void **buf, size_t *size);
|
||||||
|
/* if (input(*size) != 0 && output(*size) == 0) means end_of_stream.
|
||||||
|
(output(*size) > input(*size)) is not allowed
|
||||||
|
(output(*size) < input(*size)) is allowed */
|
||||||
|
SRes (*Skip)(void *p, size_t offset);
|
||||||
|
/* offset must be <= output(*size) of Look */
|
||||||
|
|
||||||
|
SRes (*Read)(void *p, void *buf, size_t *size);
|
||||||
|
/* reads directly (without buffer). It's same as ISeqInStream::Read */
|
||||||
|
SRes (*Seek)(void *p, Int64 *pos, ESzSeek origin);
|
||||||
|
} ILookInStream;
|
||||||
|
|
||||||
|
SRes LookInStream_LookRead(ILookInStream *stream, void *buf, size_t *size);
|
||||||
|
SRes LookInStream_SeekTo(ILookInStream *stream, UInt64 offset);
|
||||||
|
|
||||||
|
/* reads via ILookInStream::Read */
|
||||||
|
SRes LookInStream_Read2(ILookInStream *stream, void *buf, size_t size, SRes errorType);
|
||||||
|
SRes LookInStream_Read(ILookInStream *stream, void *buf, size_t size);
|
||||||
|
|
||||||
|
#define LookToRead_BUF_SIZE (1 << 14)
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
ILookInStream s;
|
||||||
|
ISeekInStream *realStream;
|
||||||
|
size_t pos;
|
||||||
|
size_t size;
|
||||||
|
Byte buf[LookToRead_BUF_SIZE];
|
||||||
|
} CLookToRead;
|
||||||
|
|
||||||
|
void LookToRead_CreateVTable(CLookToRead *p, int lookahead);
|
||||||
|
void LookToRead_Init(CLookToRead *p);
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
ISeqInStream s;
|
||||||
|
ILookInStream *realStream;
|
||||||
|
} CSecToLook;
|
||||||
|
|
||||||
|
void SecToLook_CreateVTable(CSecToLook *p);
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
ISeqInStream s;
|
||||||
|
ILookInStream *realStream;
|
||||||
|
} CSecToRead;
|
||||||
|
|
||||||
|
void SecToRead_CreateVTable(CSecToRead *p);
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
SRes (*Progress)(void *p, UInt64 inSize, UInt64 outSize);
|
||||||
|
/* Returns: result. (result != SZ_OK) means break.
|
||||||
|
Value (UInt64)(Int64)-1 for size means unknown value. */
|
||||||
|
} ICompressProgress;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
void *(*Alloc)(void *p, size_t size);
|
||||||
|
void (*Free)(void *p, void *address); /* address can be 0 */
|
||||||
|
} ISzAlloc;
|
||||||
|
|
||||||
|
#define IAlloc_Alloc(p, size) (p)->Alloc((p), size)
|
||||||
|
#define IAlloc_Free(p, a) (p)->Free((p), a)
|
||||||
|
|
||||||
|
#endif
|
||||||
236
extern/lzma/history.txt
vendored
Normal file
236
extern/lzma/history.txt
vendored
Normal file
@@ -0,0 +1,236 @@
|
|||||||
|
HISTORY of the LZMA SDK
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
4.65 2009-02-03
|
||||||
|
-------------------------
|
||||||
|
- Some minor fixes
|
||||||
|
|
||||||
|
|
||||||
|
4.63 2008-12-31
|
||||||
|
-------------------------
|
||||||
|
- Some minor fixes
|
||||||
|
|
||||||
|
|
||||||
|
4.61 beta 2008-11-23
|
||||||
|
-------------------------
|
||||||
|
- The bug in ANSI-C LZMA Decoder was fixed:
|
||||||
|
If encoded stream was corrupted, decoder could access memory
|
||||||
|
outside of allocated range.
|
||||||
|
- Some changes in ANSI-C 7z Decoder interfaces.
|
||||||
|
- LZMA SDK is placed in the public domain.
|
||||||
|
|
||||||
|
|
||||||
|
4.60 beta 2008-08-19
|
||||||
|
-------------------------
|
||||||
|
- Some minor fixes.
|
||||||
|
|
||||||
|
|
||||||
|
4.59 beta 2008-08-13
|
||||||
|
-------------------------
|
||||||
|
- The bug was fixed:
|
||||||
|
LZMA Encoder in fast compression mode could access memory outside of
|
||||||
|
allocated range in some rare cases.
|
||||||
|
|
||||||
|
|
||||||
|
4.58 beta 2008-05-05
|
||||||
|
-------------------------
|
||||||
|
- ANSI-C LZMA Decoder was rewritten for speed optimizations.
|
||||||
|
- ANSI-C LZMA Encoder was included to LZMA SDK.
|
||||||
|
- C++ LZMA code now is just wrapper over ANSI-C code.
|
||||||
|
|
||||||
|
|
||||||
|
4.57 2007-12-12
|
||||||
|
-------------------------
|
||||||
|
- Speed optimizations in <20>++ LZMA Decoder.
|
||||||
|
- Small changes for more compatibility with some C/C++ compilers.
|
||||||
|
|
||||||
|
|
||||||
|
4.49 beta 2007-07-05
|
||||||
|
-------------------------
|
||||||
|
- .7z ANSI-C Decoder:
|
||||||
|
- now it supports BCJ and BCJ2 filters
|
||||||
|
- now it supports files larger than 4 GB.
|
||||||
|
- now it supports "Last Write Time" field for files.
|
||||||
|
- C++ code for .7z archives compressing/decompressing from 7-zip
|
||||||
|
was included to LZMA SDK.
|
||||||
|
|
||||||
|
|
||||||
|
4.43 2006-06-04
|
||||||
|
-------------------------
|
||||||
|
- Small changes for more compatibility with some C/C++ compilers.
|
||||||
|
|
||||||
|
|
||||||
|
4.42 2006-05-15
|
||||||
|
-------------------------
|
||||||
|
- Small changes in .h files in ANSI-C version.
|
||||||
|
|
||||||
|
|
||||||
|
4.39 beta 2006-04-14
|
||||||
|
-------------------------
|
||||||
|
- The bug in versions 4.33b:4.38b was fixed:
|
||||||
|
C++ version of LZMA encoder could not correctly compress
|
||||||
|
files larger than 2 GB with HC4 match finder (-mfhc4).
|
||||||
|
|
||||||
|
|
||||||
|
4.37 beta 2005-04-06
|
||||||
|
-------------------------
|
||||||
|
- Fixes in C++ code: code could no be compiled if _NO_EXCEPTIONS was defined.
|
||||||
|
|
||||||
|
|
||||||
|
4.35 beta 2005-03-02
|
||||||
|
-------------------------
|
||||||
|
- The bug was fixed in C++ version of LZMA Decoder:
|
||||||
|
If encoded stream was corrupted, decoder could access memory
|
||||||
|
outside of allocated range.
|
||||||
|
|
||||||
|
|
||||||
|
4.34 beta 2006-02-27
|
||||||
|
-------------------------
|
||||||
|
- Compressing speed and memory requirements for compressing were increased
|
||||||
|
- LZMA now can use only these match finders: HC4, BT2, BT3, BT4
|
||||||
|
|
||||||
|
|
||||||
|
4.32 2005-12-09
|
||||||
|
-------------------------
|
||||||
|
- Java version of LZMA SDK was included
|
||||||
|
|
||||||
|
|
||||||
|
4.30 2005-11-20
|
||||||
|
-------------------------
|
||||||
|
- Compression ratio was improved in -a2 mode
|
||||||
|
- Speed optimizations for compressing in -a2 mode
|
||||||
|
- -fb switch now supports values up to 273
|
||||||
|
- The bug in 7z_C (7zIn.c) was fixed:
|
||||||
|
It used Alloc/Free functions from different memory pools.
|
||||||
|
So if program used two memory pools, it worked incorrectly.
|
||||||
|
- 7z_C: .7z format supporting was improved
|
||||||
|
- LZMA# SDK (C#.NET version) was included
|
||||||
|
|
||||||
|
|
||||||
|
4.27 (Updated) 2005-09-21
|
||||||
|
-------------------------
|
||||||
|
- Some GUIDs/interfaces in C++ were changed.
|
||||||
|
IStream.h:
|
||||||
|
ISequentialInStream::Read now works as old ReadPart
|
||||||
|
ISequentialOutStream::Write now works as old WritePart
|
||||||
|
|
||||||
|
|
||||||
|
4.27 2005-08-07
|
||||||
|
-------------------------
|
||||||
|
- The bug in LzmaDecodeSize.c was fixed:
|
||||||
|
if _LZMA_IN_CB and _LZMA_OUT_READ were defined,
|
||||||
|
decompressing worked incorrectly.
|
||||||
|
|
||||||
|
|
||||||
|
4.26 2005-08-05
|
||||||
|
-------------------------
|
||||||
|
- Fixes in 7z_C code and LzmaTest.c:
|
||||||
|
previous versions could work incorrectly,
|
||||||
|
if malloc(0) returns 0
|
||||||
|
|
||||||
|
|
||||||
|
4.23 2005-06-29
|
||||||
|
-------------------------
|
||||||
|
- Small fixes in C++ code
|
||||||
|
|
||||||
|
|
||||||
|
4.22 2005-06-10
|
||||||
|
-------------------------
|
||||||
|
- Small fixes
|
||||||
|
|
||||||
|
|
||||||
|
4.21 2005-06-08
|
||||||
|
-------------------------
|
||||||
|
- Interfaces for ANSI-C LZMA Decoder (LzmaDecode.c) were changed
|
||||||
|
- New additional version of ANSI-C LZMA Decoder with zlib-like interface:
|
||||||
|
- LzmaStateDecode.h
|
||||||
|
- LzmaStateDecode.c
|
||||||
|
- LzmaStateTest.c
|
||||||
|
- ANSI-C LZMA Decoder now can decompress files larger than 4 GB
|
||||||
|
|
||||||
|
|
||||||
|
4.17 2005-04-18
|
||||||
|
-------------------------
|
||||||
|
- New example for RAM->RAM compressing/decompressing:
|
||||||
|
LZMA + BCJ (filter for x86 code):
|
||||||
|
- LzmaRam.h
|
||||||
|
- LzmaRam.cpp
|
||||||
|
- LzmaRamDecode.h
|
||||||
|
- LzmaRamDecode.c
|
||||||
|
- -f86 switch for lzma.exe
|
||||||
|
|
||||||
|
|
||||||
|
4.16 2005-03-29
|
||||||
|
-------------------------
|
||||||
|
- The bug was fixed in LzmaDecode.c (ANSI-C LZMA Decoder):
|
||||||
|
If _LZMA_OUT_READ was defined, and if encoded stream was corrupted,
|
||||||
|
decoder could access memory outside of allocated range.
|
||||||
|
- Speed optimization of ANSI-C LZMA Decoder (now it's about 20% faster).
|
||||||
|
Old version of LZMA Decoder now is in file LzmaDecodeSize.c.
|
||||||
|
LzmaDecodeSize.c can provide slightly smaller code than LzmaDecode.c
|
||||||
|
- Small speed optimization in LZMA C++ code
|
||||||
|
- filter for SPARC's code was added
|
||||||
|
- Simplified version of .7z ANSI-C Decoder was included
|
||||||
|
|
||||||
|
|
||||||
|
4.06 2004-09-05
|
||||||
|
-------------------------
|
||||||
|
- The bug in v4.05 was fixed:
|
||||||
|
LZMA-Encoder didn't release output stream in some cases.
|
||||||
|
|
||||||
|
|
||||||
|
4.05 2004-08-25
|
||||||
|
-------------------------
|
||||||
|
- Source code of filters for x86, IA-64, ARM, ARM-Thumb
|
||||||
|
and PowerPC code was included to SDK
|
||||||
|
- Some internal minor changes
|
||||||
|
|
||||||
|
|
||||||
|
4.04 2004-07-28
|
||||||
|
-------------------------
|
||||||
|
- More compatibility with some C++ compilers
|
||||||
|
|
||||||
|
|
||||||
|
4.03 2004-06-18
|
||||||
|
-------------------------
|
||||||
|
- "Benchmark" command was added. It measures compressing
|
||||||
|
and decompressing speed and shows rating values.
|
||||||
|
Also it checks hardware errors.
|
||||||
|
|
||||||
|
|
||||||
|
4.02 2004-06-10
|
||||||
|
-------------------------
|
||||||
|
- C++ LZMA Encoder/Decoder code now is more portable
|
||||||
|
and it can be compiled by GCC on Linux.
|
||||||
|
|
||||||
|
|
||||||
|
4.01 2004-02-15
|
||||||
|
-------------------------
|
||||||
|
- Some detection of data corruption was enabled.
|
||||||
|
LzmaDecode.c / RangeDecoderReadByte
|
||||||
|
.....
|
||||||
|
{
|
||||||
|
rd->ExtraBytes = 1;
|
||||||
|
return 0xFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
4.00 2004-02-13
|
||||||
|
-------------------------
|
||||||
|
- Original version of LZMA SDK
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
HISTORY of the LZMA
|
||||||
|
-------------------
|
||||||
|
2001-2008: Improvements to LZMA compressing/decompressing code,
|
||||||
|
keeping compatibility with original LZMA format
|
||||||
|
1996-2001: Development of LZMA compression format
|
||||||
|
|
||||||
|
Some milestones:
|
||||||
|
|
||||||
|
2001-08-30: LZMA compression was added to 7-Zip
|
||||||
|
1999-01-02: First version of 7-Zip was released
|
||||||
|
|
||||||
|
|
||||||
|
End of document
|
||||||
594
extern/lzma/lzma.txt
vendored
Normal file
594
extern/lzma/lzma.txt
vendored
Normal file
@@ -0,0 +1,594 @@
|
|||||||
|
LZMA SDK 4.65
|
||||||
|
-------------
|
||||||
|
|
||||||
|
LZMA SDK provides the documentation, samples, header files, libraries,
|
||||||
|
and tools you need to develop applications that use LZMA compression.
|
||||||
|
|
||||||
|
LZMA is default and general compression method of 7z format
|
||||||
|
in 7-Zip compression program (www.7-zip.org). LZMA provides high
|
||||||
|
compression ratio and very fast decompression.
|
||||||
|
|
||||||
|
LZMA is an improved version of famous LZ77 compression algorithm.
|
||||||
|
It was improved in way of maximum increasing of compression ratio,
|
||||||
|
keeping high decompression speed and low memory requirements for
|
||||||
|
decompressing.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
LICENSE
|
||||||
|
-------
|
||||||
|
|
||||||
|
LZMA SDK is written and placed in the public domain by Igor Pavlov.
|
||||||
|
|
||||||
|
|
||||||
|
LZMA SDK Contents
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
LZMA SDK includes:
|
||||||
|
|
||||||
|
- ANSI-C/C++/C#/Java source code for LZMA compressing and decompressing
|
||||||
|
- Compiled file->file LZMA compressing/decompressing program for Windows system
|
||||||
|
|
||||||
|
|
||||||
|
UNIX/Linux version
|
||||||
|
------------------
|
||||||
|
To compile C++ version of file->file LZMA encoding, go to directory
|
||||||
|
C++/7zip/Compress/LZMA_Alone
|
||||||
|
and call make to recompile it:
|
||||||
|
make -f makefile.gcc clean all
|
||||||
|
|
||||||
|
In some UNIX/Linux versions you must compile LZMA with static libraries.
|
||||||
|
To compile with static libraries, you can use
|
||||||
|
LIB = -lm -static
|
||||||
|
|
||||||
|
|
||||||
|
Files
|
||||||
|
---------------------
|
||||||
|
lzma.txt - LZMA SDK description (this file)
|
||||||
|
7zFormat.txt - 7z Format description
|
||||||
|
7zC.txt - 7z ANSI-C Decoder description
|
||||||
|
methods.txt - Compression method IDs for .7z
|
||||||
|
lzma.exe - Compiled file->file LZMA encoder/decoder for Windows
|
||||||
|
history.txt - history of the LZMA SDK
|
||||||
|
|
||||||
|
|
||||||
|
Source code structure
|
||||||
|
---------------------
|
||||||
|
|
||||||
|
C/ - C files
|
||||||
|
7zCrc*.* - CRC code
|
||||||
|
Alloc.* - Memory allocation functions
|
||||||
|
Bra*.* - Filters for x86, IA-64, ARM, ARM-Thumb, PowerPC and SPARC code
|
||||||
|
LzFind.* - Match finder for LZ (LZMA) encoders
|
||||||
|
LzFindMt.* - Match finder for LZ (LZMA) encoders for multithreading encoding
|
||||||
|
LzHash.h - Additional file for LZ match finder
|
||||||
|
LzmaDec.* - LZMA decoding
|
||||||
|
LzmaEnc.* - LZMA encoding
|
||||||
|
LzmaLib.* - LZMA Library for DLL calling
|
||||||
|
Types.h - Basic types for another .c files
|
||||||
|
Threads.* - The code for multithreading.
|
||||||
|
|
||||||
|
LzmaLib - LZMA Library (.DLL for Windows)
|
||||||
|
|
||||||
|
LzmaUtil - LZMA Utility (file->file LZMA encoder/decoder).
|
||||||
|
|
||||||
|
Archive - files related to archiving
|
||||||
|
7z - 7z ANSI-C Decoder
|
||||||
|
|
||||||
|
CPP/ -- CPP files
|
||||||
|
|
||||||
|
Common - common files for C++ projects
|
||||||
|
Windows - common files for Windows related code
|
||||||
|
|
||||||
|
7zip - files related to 7-Zip Project
|
||||||
|
|
||||||
|
Common - common files for 7-Zip
|
||||||
|
|
||||||
|
Compress - files related to compression/decompression
|
||||||
|
|
||||||
|
Copy - Copy coder
|
||||||
|
RangeCoder - Range Coder (special code of compression/decompression)
|
||||||
|
LZMA - LZMA compression/decompression on C++
|
||||||
|
LZMA_Alone - file->file LZMA compression/decompression
|
||||||
|
Branch - Filters for x86, IA-64, ARM, ARM-Thumb, PowerPC and SPARC code
|
||||||
|
|
||||||
|
Archive - files related to archiving
|
||||||
|
|
||||||
|
Common - common files for archive handling
|
||||||
|
7z - 7z C++ Encoder/Decoder
|
||||||
|
|
||||||
|
Bundles - Modules that are bundles of other modules
|
||||||
|
|
||||||
|
Alone7z - 7zr.exe: Standalone version of 7z.exe that supports only 7z/LZMA/BCJ/BCJ2
|
||||||
|
Format7zR - 7zr.dll: Reduced version of 7za.dll: extracting/compressing to 7z/LZMA/BCJ/BCJ2
|
||||||
|
Format7zExtractR - 7zxr.dll: Reduced version of 7zxa.dll: extracting from 7z/LZMA/BCJ/BCJ2.
|
||||||
|
|
||||||
|
UI - User Interface files
|
||||||
|
|
||||||
|
Client7z - Test application for 7za.dll, 7zr.dll, 7zxr.dll
|
||||||
|
Common - Common UI files
|
||||||
|
Console - Code for console archiver
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CS/ - C# files
|
||||||
|
7zip
|
||||||
|
Common - some common files for 7-Zip
|
||||||
|
Compress - files related to compression/decompression
|
||||||
|
LZ - files related to LZ (Lempel-Ziv) compression algorithm
|
||||||
|
LZMA - LZMA compression/decompression
|
||||||
|
LzmaAlone - file->file LZMA compression/decompression
|
||||||
|
RangeCoder - Range Coder (special code of compression/decompression)
|
||||||
|
|
||||||
|
Java/ - Java files
|
||||||
|
SevenZip
|
||||||
|
Compression - files related to compression/decompression
|
||||||
|
LZ - files related to LZ (Lempel-Ziv) compression algorithm
|
||||||
|
LZMA - LZMA compression/decompression
|
||||||
|
RangeCoder - Range Coder (special code of compression/decompression)
|
||||||
|
|
||||||
|
|
||||||
|
C/C++ source code of LZMA SDK is part of 7-Zip project.
|
||||||
|
7-Zip source code can be downloaded from 7-Zip's SourceForge page:
|
||||||
|
|
||||||
|
http://sourceforge.net/projects/sevenzip/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
LZMA features
|
||||||
|
-------------
|
||||||
|
- Variable dictionary size (up to 1 GB)
|
||||||
|
- Estimated compressing speed: about 2 MB/s on 2 GHz CPU
|
||||||
|
- Estimated decompressing speed:
|
||||||
|
- 20-30 MB/s on 2 GHz Core 2 or AMD Athlon 64
|
||||||
|
- 1-2 MB/s on 200 MHz ARM, MIPS, PowerPC or other simple RISC
|
||||||
|
- Small memory requirements for decompressing (16 KB + DictionarySize)
|
||||||
|
- Small code size for decompressing: 5-8 KB
|
||||||
|
|
||||||
|
LZMA decoder uses only integer operations and can be
|
||||||
|
implemented in any modern 32-bit CPU (or on 16-bit CPU with some conditions).
|
||||||
|
|
||||||
|
Some critical operations that affect the speed of LZMA decompression:
|
||||||
|
1) 32*16 bit integer multiply
|
||||||
|
2) Misspredicted branches (penalty mostly depends from pipeline length)
|
||||||
|
3) 32-bit shift and arithmetic operations
|
||||||
|
|
||||||
|
The speed of LZMA decompressing mostly depends from CPU speed.
|
||||||
|
Memory speed has no big meaning. But if your CPU has small data cache,
|
||||||
|
overall weight of memory speed will slightly increase.
|
||||||
|
|
||||||
|
|
||||||
|
How To Use
|
||||||
|
----------
|
||||||
|
|
||||||
|
Using LZMA encoder/decoder executable
|
||||||
|
--------------------------------------
|
||||||
|
|
||||||
|
Usage: LZMA <e|d> inputFile outputFile [<switches>...]
|
||||||
|
|
||||||
|
e: encode file
|
||||||
|
|
||||||
|
d: decode file
|
||||||
|
|
||||||
|
b: Benchmark. There are two tests: compressing and decompressing
|
||||||
|
with LZMA method. Benchmark shows rating in MIPS (million
|
||||||
|
instructions per second). Rating value is calculated from
|
||||||
|
measured speed and it is normalized with Intel's Core 2 results.
|
||||||
|
Also Benchmark checks possible hardware errors (RAM
|
||||||
|
errors in most cases). Benchmark uses these settings:
|
||||||
|
(-a1, -d21, -fb32, -mfbt4). You can change only -d parameter.
|
||||||
|
Also you can change the number of iterations. Example for 30 iterations:
|
||||||
|
LZMA b 30
|
||||||
|
Default number of iterations is 10.
|
||||||
|
|
||||||
|
<Switches>
|
||||||
|
|
||||||
|
|
||||||
|
-a{N}: set compression mode 0 = fast, 1 = normal
|
||||||
|
default: 1 (normal)
|
||||||
|
|
||||||
|
d{N}: Sets Dictionary size - [0, 30], default: 23 (8MB)
|
||||||
|
The maximum value for dictionary size is 1 GB = 2^30 bytes.
|
||||||
|
Dictionary size is calculated as DictionarySize = 2^N bytes.
|
||||||
|
For decompressing file compressed by LZMA method with dictionary
|
||||||
|
size D = 2^N you need about D bytes of memory (RAM).
|
||||||
|
|
||||||
|
-fb{N}: set number of fast bytes - [5, 273], default: 128
|
||||||
|
Usually big number gives a little bit better compression ratio
|
||||||
|
and slower compression process.
|
||||||
|
|
||||||
|
-lc{N}: set number of literal context bits - [0, 8], default: 3
|
||||||
|
Sometimes lc=4 gives gain for big files.
|
||||||
|
|
||||||
|
-lp{N}: set number of literal pos bits - [0, 4], default: 0
|
||||||
|
lp switch is intended for periodical data when period is
|
||||||
|
equal 2^N. For example, for 32-bit (4 bytes)
|
||||||
|
periodical data you can use lp=2. Often it's better to set lc0,
|
||||||
|
if you change lp switch.
|
||||||
|
|
||||||
|
-pb{N}: set number of pos bits - [0, 4], default: 2
|
||||||
|
pb switch is intended for periodical data
|
||||||
|
when period is equal 2^N.
|
||||||
|
|
||||||
|
-mf{MF_ID}: set Match Finder. Default: bt4.
|
||||||
|
Algorithms from hc* group doesn't provide good compression
|
||||||
|
ratio, but they often works pretty fast in combination with
|
||||||
|
fast mode (-a0).
|
||||||
|
|
||||||
|
Memory requirements depend from dictionary size
|
||||||
|
(parameter "d" in table below).
|
||||||
|
|
||||||
|
MF_ID Memory Description
|
||||||
|
|
||||||
|
bt2 d * 9.5 + 4MB Binary Tree with 2 bytes hashing.
|
||||||
|
bt3 d * 11.5 + 4MB Binary Tree with 3 bytes hashing.
|
||||||
|
bt4 d * 11.5 + 4MB Binary Tree with 4 bytes hashing.
|
||||||
|
hc4 d * 7.5 + 4MB Hash Chain with 4 bytes hashing.
|
||||||
|
|
||||||
|
-eos: write End Of Stream marker. By default LZMA doesn't write
|
||||||
|
eos marker, since LZMA decoder knows uncompressed size
|
||||||
|
stored in .lzma file header.
|
||||||
|
|
||||||
|
-si: Read data from stdin (it will write End Of Stream marker).
|
||||||
|
-so: Write data to stdout
|
||||||
|
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
|
||||||
|
1) LZMA e file.bin file.lzma -d16 -lc0
|
||||||
|
|
||||||
|
compresses file.bin to file.lzma with 64 KB dictionary (2^16=64K)
|
||||||
|
and 0 literal context bits. -lc0 allows to reduce memory requirements
|
||||||
|
for decompression.
|
||||||
|
|
||||||
|
|
||||||
|
2) LZMA e file.bin file.lzma -lc0 -lp2
|
||||||
|
|
||||||
|
compresses file.bin to file.lzma with settings suitable
|
||||||
|
for 32-bit periodical data (for example, ARM or MIPS code).
|
||||||
|
|
||||||
|
3) LZMA d file.lzma file.bin
|
||||||
|
|
||||||
|
decompresses file.lzma to file.bin.
|
||||||
|
|
||||||
|
|
||||||
|
Compression ratio hints
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
Recommendations
|
||||||
|
---------------
|
||||||
|
|
||||||
|
To increase the compression ratio for LZMA compressing it's desirable
|
||||||
|
to have aligned data (if it's possible) and also it's desirable to locate
|
||||||
|
data in such order, where code is grouped in one place and data is
|
||||||
|
grouped in other place (it's better than such mixing: code, data, code,
|
||||||
|
data, ...).
|
||||||
|
|
||||||
|
|
||||||
|
Filters
|
||||||
|
-------
|
||||||
|
You can increase the compression ratio for some data types, using
|
||||||
|
special filters before compressing. For example, it's possible to
|
||||||
|
increase the compression ratio on 5-10% for code for those CPU ISAs:
|
||||||
|
x86, IA-64, ARM, ARM-Thumb, PowerPC, SPARC.
|
||||||
|
|
||||||
|
You can find C source code of such filters in C/Bra*.* files
|
||||||
|
|
||||||
|
You can check the compression ratio gain of these filters with such
|
||||||
|
7-Zip commands (example for ARM code):
|
||||||
|
No filter:
|
||||||
|
7z a a1.7z a.bin -m0=lzma
|
||||||
|
|
||||||
|
With filter for little-endian ARM code:
|
||||||
|
7z a a2.7z a.bin -m0=arm -m1=lzma
|
||||||
|
|
||||||
|
It works in such manner:
|
||||||
|
Compressing = Filter_encoding + LZMA_encoding
|
||||||
|
Decompressing = LZMA_decoding + Filter_decoding
|
||||||
|
|
||||||
|
Compressing and decompressing speed of such filters is very high,
|
||||||
|
so it will not increase decompressing time too much.
|
||||||
|
Moreover, it reduces decompression time for LZMA_decoding,
|
||||||
|
since compression ratio with filtering is higher.
|
||||||
|
|
||||||
|
These filters convert CALL (calling procedure) instructions
|
||||||
|
from relative offsets to absolute addresses, so such data becomes more
|
||||||
|
compressible.
|
||||||
|
|
||||||
|
For some ISAs (for example, for MIPS) it's impossible to get gain from such filter.
|
||||||
|
|
||||||
|
|
||||||
|
LZMA compressed file format
|
||||||
|
---------------------------
|
||||||
|
Offset Size Description
|
||||||
|
0 1 Special LZMA properties (lc,lp, pb in encoded form)
|
||||||
|
1 4 Dictionary size (little endian)
|
||||||
|
5 8 Uncompressed size (little endian). -1 means unknown size
|
||||||
|
13 Compressed data
|
||||||
|
|
||||||
|
|
||||||
|
ANSI-C LZMA Decoder
|
||||||
|
~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
Please note that interfaces for ANSI-C code were changed in LZMA SDK 4.58.
|
||||||
|
If you want to use old interfaces you can download previous version of LZMA SDK
|
||||||
|
from sourceforge.net site.
|
||||||
|
|
||||||
|
To use ANSI-C LZMA Decoder you need the following files:
|
||||||
|
1) LzmaDec.h + LzmaDec.c + Types.h
|
||||||
|
LzmaUtil/LzmaUtil.c is example application that uses these files.
|
||||||
|
|
||||||
|
|
||||||
|
Memory requirements for LZMA decoding
|
||||||
|
-------------------------------------
|
||||||
|
|
||||||
|
Stack usage of LZMA decoding function for local variables is not
|
||||||
|
larger than 200-400 bytes.
|
||||||
|
|
||||||
|
LZMA Decoder uses dictionary buffer and internal state structure.
|
||||||
|
Internal state structure consumes
|
||||||
|
state_size = (4 + (1.5 << (lc + lp))) KB
|
||||||
|
by default (lc=3, lp=0), state_size = 16 KB.
|
||||||
|
|
||||||
|
|
||||||
|
How To decompress data
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
LZMA Decoder (ANSI-C version) now supports 2 interfaces:
|
||||||
|
1) Single-call Decompressing
|
||||||
|
2) Multi-call State Decompressing (zlib-like interface)
|
||||||
|
|
||||||
|
You must use external allocator:
|
||||||
|
Example:
|
||||||
|
void *SzAlloc(void *p, size_t size) { p = p; return malloc(size); }
|
||||||
|
void SzFree(void *p, void *address) { p = p; free(address); }
|
||||||
|
ISzAlloc alloc = { SzAlloc, SzFree };
|
||||||
|
|
||||||
|
You can use p = p; operator to disable compiler warnings.
|
||||||
|
|
||||||
|
|
||||||
|
Single-call Decompressing
|
||||||
|
-------------------------
|
||||||
|
When to use: RAM->RAM decompressing
|
||||||
|
Compile files: LzmaDec.h + LzmaDec.c + Types.h
|
||||||
|
Compile defines: no defines
|
||||||
|
Memory Requirements:
|
||||||
|
- Input buffer: compressed size
|
||||||
|
- Output buffer: uncompressed size
|
||||||
|
- LZMA Internal Structures: state_size (16 KB for default settings)
|
||||||
|
|
||||||
|
Interface:
|
||||||
|
int LzmaDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen,
|
||||||
|
const Byte *propData, unsigned propSize, ELzmaFinishMode finishMode,
|
||||||
|
ELzmaStatus *status, ISzAlloc *alloc);
|
||||||
|
In:
|
||||||
|
dest - output data
|
||||||
|
destLen - output data size
|
||||||
|
src - input data
|
||||||
|
srcLen - input data size
|
||||||
|
propData - LZMA properties (5 bytes)
|
||||||
|
propSize - size of propData buffer (5 bytes)
|
||||||
|
finishMode - It has meaning only if the decoding reaches output limit (*destLen).
|
||||||
|
LZMA_FINISH_ANY - Decode just destLen bytes.
|
||||||
|
LZMA_FINISH_END - Stream must be finished after (*destLen).
|
||||||
|
You can use LZMA_FINISH_END, when you know that
|
||||||
|
current output buffer covers last bytes of stream.
|
||||||
|
alloc - Memory allocator.
|
||||||
|
|
||||||
|
Out:
|
||||||
|
destLen - processed output size
|
||||||
|
srcLen - processed input size
|
||||||
|
|
||||||
|
Output:
|
||||||
|
SZ_OK
|
||||||
|
status:
|
||||||
|
LZMA_STATUS_FINISHED_WITH_MARK
|
||||||
|
LZMA_STATUS_NOT_FINISHED
|
||||||
|
LZMA_STATUS_MAYBE_FINISHED_WITHOUT_MARK
|
||||||
|
SZ_ERROR_DATA - Data error
|
||||||
|
SZ_ERROR_MEM - Memory allocation error
|
||||||
|
SZ_ERROR_UNSUPPORTED - Unsupported properties
|
||||||
|
SZ_ERROR_INPUT_EOF - It needs more bytes in input buffer (src).
|
||||||
|
|
||||||
|
If LZMA decoder sees end_marker before reaching output limit, it returns OK result,
|
||||||
|
and output value of destLen will be less than output buffer size limit.
|
||||||
|
|
||||||
|
You can use multiple checks to test data integrity after full decompression:
|
||||||
|
1) Check Result and "status" variable.
|
||||||
|
2) Check that output(destLen) = uncompressedSize, if you know real uncompressedSize.
|
||||||
|
3) Check that output(srcLen) = compressedSize, if you know real compressedSize.
|
||||||
|
You must use correct finish mode in that case. */
|
||||||
|
|
||||||
|
|
||||||
|
Multi-call State Decompressing (zlib-like interface)
|
||||||
|
----------------------------------------------------
|
||||||
|
|
||||||
|
When to use: file->file decompressing
|
||||||
|
Compile files: LzmaDec.h + LzmaDec.c + Types.h
|
||||||
|
|
||||||
|
Memory Requirements:
|
||||||
|
- Buffer for input stream: any size (for example, 16 KB)
|
||||||
|
- Buffer for output stream: any size (for example, 16 KB)
|
||||||
|
- LZMA Internal Structures: state_size (16 KB for default settings)
|
||||||
|
- LZMA dictionary (dictionary size is encoded in LZMA properties header)
|
||||||
|
|
||||||
|
1) read LZMA properties (5 bytes) and uncompressed size (8 bytes, little-endian) to header:
|
||||||
|
unsigned char header[LZMA_PROPS_SIZE + 8];
|
||||||
|
ReadFile(inFile, header, sizeof(header)
|
||||||
|
|
||||||
|
2) Allocate CLzmaDec structures (state + dictionary) using LZMA properties
|
||||||
|
|
||||||
|
CLzmaDec state;
|
||||||
|
LzmaDec_Constr(&state);
|
||||||
|
res = LzmaDec_Allocate(&state, header, LZMA_PROPS_SIZE, &g_Alloc);
|
||||||
|
if (res != SZ_OK)
|
||||||
|
return res;
|
||||||
|
|
||||||
|
3) Init LzmaDec structure before any new LZMA stream. And call LzmaDec_DecodeToBuf in loop
|
||||||
|
|
||||||
|
LzmaDec_Init(&state);
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
...
|
||||||
|
int res = LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen,
|
||||||
|
const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode);
|
||||||
|
...
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
4) Free all allocated structures
|
||||||
|
LzmaDec_Free(&state, &g_Alloc);
|
||||||
|
|
||||||
|
For full code example, look at C/LzmaUtil/LzmaUtil.c code.
|
||||||
|
|
||||||
|
|
||||||
|
How To compress data
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
Compile files: LzmaEnc.h + LzmaEnc.c + Types.h +
|
||||||
|
LzFind.c + LzFind.h + LzFindMt.c + LzFindMt.h + LzHash.h
|
||||||
|
|
||||||
|
Memory Requirements:
|
||||||
|
- (dictSize * 11.5 + 6 MB) + state_size
|
||||||
|
|
||||||
|
Lzma Encoder can use two memory allocators:
|
||||||
|
1) alloc - for small arrays.
|
||||||
|
2) allocBig - for big arrays.
|
||||||
|
|
||||||
|
For example, you can use Large RAM Pages (2 MB) in allocBig allocator for
|
||||||
|
better compression speed. Note that Windows has bad implementation for
|
||||||
|
Large RAM Pages.
|
||||||
|
It's OK to use same allocator for alloc and allocBig.
|
||||||
|
|
||||||
|
|
||||||
|
Single-call Compression with callbacks
|
||||||
|
--------------------------------------
|
||||||
|
|
||||||
|
Check C/LzmaUtil/LzmaUtil.c as example,
|
||||||
|
|
||||||
|
When to use: file->file decompressing
|
||||||
|
|
||||||
|
1) you must implement callback structures for interfaces:
|
||||||
|
ISeqInStream
|
||||||
|
ISeqOutStream
|
||||||
|
ICompressProgress
|
||||||
|
ISzAlloc
|
||||||
|
|
||||||
|
static void *SzAlloc(void *p, size_t size) { p = p; return MyAlloc(size); }
|
||||||
|
static void SzFree(void *p, void *address) { p = p; MyFree(address); }
|
||||||
|
static ISzAlloc g_Alloc = { SzAlloc, SzFree };
|
||||||
|
|
||||||
|
CFileSeqInStream inStream;
|
||||||
|
CFileSeqOutStream outStream;
|
||||||
|
|
||||||
|
inStream.funcTable.Read = MyRead;
|
||||||
|
inStream.file = inFile;
|
||||||
|
outStream.funcTable.Write = MyWrite;
|
||||||
|
outStream.file = outFile;
|
||||||
|
|
||||||
|
|
||||||
|
2) Create CLzmaEncHandle object;
|
||||||
|
|
||||||
|
CLzmaEncHandle enc;
|
||||||
|
|
||||||
|
enc = LzmaEnc_Create(&g_Alloc);
|
||||||
|
if (enc == 0)
|
||||||
|
return SZ_ERROR_MEM;
|
||||||
|
|
||||||
|
|
||||||
|
3) initialize CLzmaEncProps properties;
|
||||||
|
|
||||||
|
LzmaEncProps_Init(&props);
|
||||||
|
|
||||||
|
Then you can change some properties in that structure.
|
||||||
|
|
||||||
|
4) Send LZMA properties to LZMA Encoder
|
||||||
|
|
||||||
|
res = LzmaEnc_SetProps(enc, &props);
|
||||||
|
|
||||||
|
5) Write encoded properties to header
|
||||||
|
|
||||||
|
Byte header[LZMA_PROPS_SIZE + 8];
|
||||||
|
size_t headerSize = LZMA_PROPS_SIZE;
|
||||||
|
UInt64 fileSize;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
res = LzmaEnc_WriteProperties(enc, header, &headerSize);
|
||||||
|
fileSize = MyGetFileLength(inFile);
|
||||||
|
for (i = 0; i < 8; i++)
|
||||||
|
header[headerSize++] = (Byte)(fileSize >> (8 * i));
|
||||||
|
MyWriteFileAndCheck(outFile, header, headerSize)
|
||||||
|
|
||||||
|
6) Call encoding function:
|
||||||
|
res = LzmaEnc_Encode(enc, &outStream.funcTable, &inStream.funcTable,
|
||||||
|
NULL, &g_Alloc, &g_Alloc);
|
||||||
|
|
||||||
|
7) Destroy LZMA Encoder Object
|
||||||
|
LzmaEnc_Destroy(enc, &g_Alloc, &g_Alloc);
|
||||||
|
|
||||||
|
|
||||||
|
If callback function return some error code, LzmaEnc_Encode also returns that code.
|
||||||
|
|
||||||
|
|
||||||
|
Single-call RAM->RAM Compression
|
||||||
|
--------------------------------
|
||||||
|
|
||||||
|
Single-call RAM->RAM Compression is similar to Compression with callbacks,
|
||||||
|
but you provide pointers to buffers instead of pointers to stream callbacks:
|
||||||
|
|
||||||
|
HRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
|
||||||
|
CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark,
|
||||||
|
ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
|
||||||
|
|
||||||
|
Return code:
|
||||||
|
SZ_OK - OK
|
||||||
|
SZ_ERROR_MEM - Memory allocation error
|
||||||
|
SZ_ERROR_PARAM - Incorrect paramater
|
||||||
|
SZ_ERROR_OUTPUT_EOF - output buffer overflow
|
||||||
|
SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
LZMA Defines
|
||||||
|
------------
|
||||||
|
|
||||||
|
_LZMA_SIZE_OPT - Enable some optimizations in LZMA Decoder to get smaller executable code.
|
||||||
|
|
||||||
|
_LZMA_PROB32 - It can increase the speed on some 32-bit CPUs, but memory usage for
|
||||||
|
some structures will be doubled in that case.
|
||||||
|
|
||||||
|
_LZMA_UINT32_IS_ULONG - Define it if int is 16-bit on your compiler and long is 32-bit.
|
||||||
|
|
||||||
|
_LZMA_NO_SYSTEM_SIZE_T - Define it if you don't want to use size_t type.
|
||||||
|
|
||||||
|
|
||||||
|
C++ LZMA Encoder/Decoder
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
C++ LZMA code use COM-like interfaces. So if you want to use it,
|
||||||
|
you can study basics of COM/OLE.
|
||||||
|
C++ LZMA code is just wrapper over ANSI-C code.
|
||||||
|
|
||||||
|
|
||||||
|
C++ Notes
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
If you use some C++ code folders in 7-Zip (for example, C++ code for .7z handling),
|
||||||
|
you must check that you correctly work with "new" operator.
|
||||||
|
7-Zip can be compiled with MSVC 6.0 that doesn't throw "exception" from "new" operator.
|
||||||
|
So 7-Zip uses "CPP\Common\NewHandler.cpp" that redefines "new" operator:
|
||||||
|
operator new(size_t size)
|
||||||
|
{
|
||||||
|
void *p = ::malloc(size);
|
||||||
|
if (p == 0)
|
||||||
|
throw CNewException();
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
If you use MSCV that throws exception for "new" operator, you can compile without
|
||||||
|
"NewHandler.cpp". So standard exception will be used. Actually some code of
|
||||||
|
7-Zip catches any exception in internal code and converts it to HRESULT code.
|
||||||
|
So you don't need to catch CNewException, if you call COM interfaces of 7-Zip.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
http://www.7-zip.org
|
||||||
|
http://www.7-zip.org/sdk.html
|
||||||
|
http://www.7-zip.org/support.html
|
||||||
385
extern/lzma/make/msvc_9_0/lzma.vcproj
vendored
Normal file
385
extern/lzma/make/msvc_9_0/lzma.vcproj
vendored
Normal file
@@ -0,0 +1,385 @@
|
|||||||
|
<?xml version="1.0" encoding="Windows-1252"?>
|
||||||
|
<VisualStudioProject
|
||||||
|
ProjectType="Visual C++"
|
||||||
|
Version="9,00"
|
||||||
|
Name="EXT_lzma"
|
||||||
|
ProjectGUID="{79D0B232-208C-F208-DA71-79B4AC088602}"
|
||||||
|
RootNamespace="lzma"
|
||||||
|
TargetFrameworkVersion="131072"
|
||||||
|
>
|
||||||
|
<Platforms>
|
||||||
|
<Platform
|
||||||
|
Name="Win32"
|
||||||
|
/>
|
||||||
|
</Platforms>
|
||||||
|
<ToolFiles>
|
||||||
|
</ToolFiles>
|
||||||
|
<Configurations>
|
||||||
|
<Configuration
|
||||||
|
Name="Blender Debug|Win32"
|
||||||
|
OutputDirectory="..\..\..\..\..\build\msvc_9\extern\lzma\debug"
|
||||||
|
IntermediateDirectory="..\..\..\..\..\build\msvc_9\extern\lzma\debug"
|
||||||
|
ConfigurationType="4"
|
||||||
|
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||||
|
UseOfMFC="0"
|
||||||
|
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||||
|
CharacterSet="2"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="0"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions="_DEBUG;_LIB;WIN32"
|
||||||
|
ExceptionHandling="1"
|
||||||
|
BasicRuntimeChecks="3"
|
||||||
|
RuntimeLibrary="1"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\extern\lzma\debug\lzma.pch"
|
||||||
|
AssemblerListingLocation="..\..\..\..\..\build\msvc_9\extern\lzma\debug\"
|
||||||
|
ObjectFile="..\..\..\..\..\build\msvc_9\extern\lzma\debug\"
|
||||||
|
ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\extern\lzma\debug\"
|
||||||
|
WarningLevel="3"
|
||||||
|
SuppressStartupBanner="true"
|
||||||
|
DebugInformationFormat="4"
|
||||||
|
CompileAs="0"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="_DEBUG"
|
||||||
|
Culture="1033"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLibrarianTool"
|
||||||
|
OutputFile="..\..\..\..\..\build\msvc_9\libs\extern\debug\lzma.lib"
|
||||||
|
SuppressStartupBanner="true"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Blender Release|Win32"
|
||||||
|
OutputDirectory="..\..\..\..\..\build\msvc_9\extern\lzma"
|
||||||
|
IntermediateDirectory="..\..\..\..\..\build\msvc_9\extern\lzma"
|
||||||
|
ConfigurationType="4"
|
||||||
|
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||||
|
UseOfMFC="0"
|
||||||
|
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||||
|
CharacterSet="2"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="2"
|
||||||
|
InlineFunctionExpansion="1"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions="NDEBUG;_LIB;WIN32"
|
||||||
|
StringPooling="true"
|
||||||
|
ExceptionHandling="0"
|
||||||
|
RuntimeLibrary="0"
|
||||||
|
EnableFunctionLevelLinking="true"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\extern\lzma\lzma.pch"
|
||||||
|
AssemblerListingLocation="..\..\..\..\..\build\msvc_9\extern\lzma\"
|
||||||
|
ObjectFile="..\..\..\..\..\build\msvc_9\extern\lzma\"
|
||||||
|
ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\extern\lzma\"
|
||||||
|
WarningLevel="3"
|
||||||
|
SuppressStartupBanner="true"
|
||||||
|
DebugInformationFormat="1"
|
||||||
|
CompileAs="0"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="NDEBUG"
|
||||||
|
Culture="1033"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLibrarianTool"
|
||||||
|
OutputFile="..\..\..\..\..\build\msvc_9\libs\extern\lzma.lib"
|
||||||
|
SuppressStartupBanner="true"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="3D Plugin Debug|Win32"
|
||||||
|
OutputDirectory="..\..\..\..\..\build\msvc_9\extern\lzma\mtdll\debug"
|
||||||
|
IntermediateDirectory="..\..\..\..\..\build\msvc_9\extern\lzma\mtdll\debug"
|
||||||
|
ConfigurationType="4"
|
||||||
|
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||||
|
UseOfMFC="0"
|
||||||
|
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||||
|
CharacterSet="2"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="0"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions="_DEBUG;_LIB;WIN32"
|
||||||
|
ExceptionHandling="0"
|
||||||
|
BasicRuntimeChecks="3"
|
||||||
|
RuntimeLibrary="3"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\extern\lzma\mtdll\debug\lzma.pch"
|
||||||
|
AssemblerListingLocation="..\..\..\..\..\build\msvc_9\extern\lzma\mtdll\debug\"
|
||||||
|
ObjectFile="..\..\..\..\..\build\msvc_9\extern\lzma\mtdll\debug\"
|
||||||
|
ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\extern\lzma\mtdll\debug\"
|
||||||
|
WarningLevel="3"
|
||||||
|
SuppressStartupBanner="true"
|
||||||
|
DebugInformationFormat="4"
|
||||||
|
CompileAs="0"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="_DEBUG"
|
||||||
|
Culture="1033"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLibrarianTool"
|
||||||
|
OutputFile="..\..\..\..\..\build\msvc_9\libs\extern\mtdll\debug\lzma.lib"
|
||||||
|
SuppressStartupBanner="true"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="3D Plugin Release|Win32"
|
||||||
|
OutputDirectory="..\..\..\..\..\build\msvc_9\extern\lzma\mtdll"
|
||||||
|
IntermediateDirectory="..\..\..\..\..\build\msvc_9\extern\lzma\mtdll"
|
||||||
|
ConfigurationType="4"
|
||||||
|
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||||
|
UseOfMFC="0"
|
||||||
|
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||||
|
CharacterSet="2"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="2"
|
||||||
|
InlineFunctionExpansion="1"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions="NDEBUG;_LIB;WIN32"
|
||||||
|
StringPooling="true"
|
||||||
|
ExceptionHandling="0"
|
||||||
|
RuntimeLibrary="2"
|
||||||
|
EnableFunctionLevelLinking="true"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\extern\lzma\mtdll\lzma.pch"
|
||||||
|
AssemblerListingLocation="..\..\..\..\..\build\msvc_9\extern\lzma\mtdll\"
|
||||||
|
ObjectFile="..\..\..\..\..\build\msvc_9\extern\lzma\mtdll\"
|
||||||
|
ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\extern\lzma\mtdll\"
|
||||||
|
WarningLevel="3"
|
||||||
|
SuppressStartupBanner="true"
|
||||||
|
DebugInformationFormat="1"
|
||||||
|
CompileAs="0"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="NDEBUG"
|
||||||
|
Culture="1033"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLibrarianTool"
|
||||||
|
OutputFile="..\..\..\..\..\build\msvc_9\libs\extern\mtdll\lzma.lib"
|
||||||
|
SuppressStartupBanner="true"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
</Configurations>
|
||||||
|
<References>
|
||||||
|
</References>
|
||||||
|
<Files>
|
||||||
|
<Filter
|
||||||
|
Name="Source Files"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Alloc.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\LzFind.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\LzmaDec.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\LzmaEnc.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\LzmaLib.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Header Files"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Alloc.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\LzFind.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\LzHash.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\LzmaDec.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\LzmaEnc.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\LzmaLib.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\Types.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
</Files>
|
||||||
|
<Globals>
|
||||||
|
</Globals>
|
||||||
|
</VisualStudioProject>
|
||||||
34
extern/lzo/CMakeLists.txt
vendored
Normal file
34
extern/lzo/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
# $Id$
|
||||||
|
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software Foundation,
|
||||||
|
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
#
|
||||||
|
# The Original Code is Copyright (C) 2006, Blender Foundation
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# The Original Code is: all of this file.
|
||||||
|
#
|
||||||
|
# Contributor(s): Daniel Genrich
|
||||||
|
#
|
||||||
|
# ***** END GPL LICENSE BLOCK *****
|
||||||
|
|
||||||
|
SET(INC include)
|
||||||
|
|
||||||
|
FILE(GLOB SRC minilzo/*.c)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
BLENDERLIB(bf_minilzo "${SRC}" "${INC}")
|
||||||
|
#, libtype='blender', priority = 0 )
|
||||||
9
extern/lzo/SConscript
vendored
Normal file
9
extern/lzo/SConscript
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
Import ('env')
|
||||||
|
|
||||||
|
sources = env.Glob('minilzo/*.c')
|
||||||
|
|
||||||
|
defs = ''
|
||||||
|
incs = ' include '
|
||||||
|
|
||||||
|
env.BlenderLib ('bf_minilzo', sources, Split(incs), Split(defs), libtype=['intern'], priority=[40] )
|
||||||
353
extern/lzo/make/msvc_9_0/lzo.vcproj
vendored
Normal file
353
extern/lzo/make/msvc_9_0/lzo.vcproj
vendored
Normal file
@@ -0,0 +1,353 @@
|
|||||||
|
<?xml version="1.0" encoding="Windows-1252"?>
|
||||||
|
<VisualStudioProject
|
||||||
|
ProjectType="Visual C++"
|
||||||
|
Version="9,00"
|
||||||
|
Name="EXT_lzo"
|
||||||
|
ProjectGUID="{8BFA4082-773B-D100-BC24-659083BA023F}"
|
||||||
|
RootNamespace="lzo"
|
||||||
|
TargetFrameworkVersion="131072"
|
||||||
|
>
|
||||||
|
<Platforms>
|
||||||
|
<Platform
|
||||||
|
Name="Win32"
|
||||||
|
/>
|
||||||
|
</Platforms>
|
||||||
|
<ToolFiles>
|
||||||
|
</ToolFiles>
|
||||||
|
<Configurations>
|
||||||
|
<Configuration
|
||||||
|
Name="Blender Debug|Win32"
|
||||||
|
OutputDirectory="..\..\..\..\..\build\msvc_9\extern\lzo\debug"
|
||||||
|
IntermediateDirectory="..\..\..\..\..\build\msvc_9\extern\lzo\debug"
|
||||||
|
ConfigurationType="4"
|
||||||
|
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||||
|
UseOfMFC="0"
|
||||||
|
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||||
|
CharacterSet="2"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="0"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions="_DEBUG;_LIB;WIN32"
|
||||||
|
ExceptionHandling="1"
|
||||||
|
BasicRuntimeChecks="3"
|
||||||
|
RuntimeLibrary="1"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\extern\lzo\debug\lzo.pch"
|
||||||
|
AssemblerListingLocation="..\..\..\..\..\build\msvc_9\extern\lzo\debug\"
|
||||||
|
ObjectFile="..\..\..\..\..\build\msvc_9\extern\lzo\debug\"
|
||||||
|
ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\extern\lzo\debug\"
|
||||||
|
WarningLevel="3"
|
||||||
|
SuppressStartupBanner="true"
|
||||||
|
DebugInformationFormat="4"
|
||||||
|
CompileAs="0"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="_DEBUG"
|
||||||
|
Culture="1033"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLibrarianTool"
|
||||||
|
OutputFile="..\..\..\..\..\build\msvc_9\libs\extern\debug\lzo.lib"
|
||||||
|
SuppressStartupBanner="true"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Blender Release|Win32"
|
||||||
|
OutputDirectory="..\..\..\..\..\build\msvc_9\extern\lzo"
|
||||||
|
IntermediateDirectory="..\..\..\..\..\build\msvc_9\extern\lzo"
|
||||||
|
ConfigurationType="4"
|
||||||
|
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||||
|
UseOfMFC="0"
|
||||||
|
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||||
|
CharacterSet="2"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="2"
|
||||||
|
InlineFunctionExpansion="1"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions="NDEBUG;_LIB;WIN32"
|
||||||
|
StringPooling="true"
|
||||||
|
ExceptionHandling="0"
|
||||||
|
RuntimeLibrary="0"
|
||||||
|
EnableFunctionLevelLinking="true"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\extern\lzo\lzo.pch"
|
||||||
|
AssemblerListingLocation="..\..\..\..\..\build\msvc_9\extern\lzo\"
|
||||||
|
ObjectFile="..\..\..\..\..\build\msvc_9\extern\lzo\"
|
||||||
|
ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\extern\lzo\"
|
||||||
|
WarningLevel="3"
|
||||||
|
SuppressStartupBanner="true"
|
||||||
|
DebugInformationFormat="1"
|
||||||
|
CompileAs="0"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="NDEBUG"
|
||||||
|
Culture="1033"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLibrarianTool"
|
||||||
|
OutputFile="..\..\..\..\..\build\msvc_9\libs\extern\lzo.lib"
|
||||||
|
SuppressStartupBanner="true"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="3D Plugin Debug|Win32"
|
||||||
|
OutputDirectory="..\..\..\..\..\build\msvc_9\extern\lzo\mtdll\debug"
|
||||||
|
IntermediateDirectory="..\..\..\..\..\build\msvc_9\extern\lzo\mtdll\debug"
|
||||||
|
ConfigurationType="4"
|
||||||
|
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||||
|
UseOfMFC="0"
|
||||||
|
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||||
|
CharacterSet="2"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="0"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions="_DEBUG;_LIB;WIN32"
|
||||||
|
ExceptionHandling="0"
|
||||||
|
BasicRuntimeChecks="3"
|
||||||
|
RuntimeLibrary="3"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\extern\lzo\mtdll\debug\lzo.pch"
|
||||||
|
AssemblerListingLocation="..\..\..\..\..\build\msvc_9\extern\lzo\mtdll\debug\"
|
||||||
|
ObjectFile="..\..\..\..\..\build\msvc_9\extern\lzo\mtdll\debug\"
|
||||||
|
ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\extern\lzo\mtdll\debug\"
|
||||||
|
WarningLevel="3"
|
||||||
|
SuppressStartupBanner="true"
|
||||||
|
DebugInformationFormat="4"
|
||||||
|
CompileAs="0"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="_DEBUG"
|
||||||
|
Culture="1033"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLibrarianTool"
|
||||||
|
OutputFile="..\..\..\..\..\build\msvc_9\libs\extern\mtdll\debug\lzo.lib"
|
||||||
|
SuppressStartupBanner="true"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="3D Plugin Release|Win32"
|
||||||
|
OutputDirectory="..\..\..\..\..\build\msvc_9\extern\lzo\mtdll"
|
||||||
|
IntermediateDirectory="..\..\..\..\..\build\msvc_9\extern\lzo\mtdll"
|
||||||
|
ConfigurationType="4"
|
||||||
|
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||||
|
UseOfMFC="0"
|
||||||
|
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||||
|
CharacterSet="2"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="2"
|
||||||
|
InlineFunctionExpansion="1"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions="NDEBUG;_LIB;WIN32"
|
||||||
|
StringPooling="true"
|
||||||
|
ExceptionHandling="0"
|
||||||
|
RuntimeLibrary="2"
|
||||||
|
EnableFunctionLevelLinking="true"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
PrecompiledHeaderFile="..\..\..\..\..\build\msvc_9\extern\lzo\mtdll\lzo.pch"
|
||||||
|
AssemblerListingLocation="..\..\..\..\..\build\msvc_9\extern\lzo\mtdll\"
|
||||||
|
ObjectFile="..\..\..\..\..\build\msvc_9\extern\lzo\mtdll\"
|
||||||
|
ProgramDataBaseFileName="..\..\..\..\..\build\msvc_9\extern\lzo\mtdll\"
|
||||||
|
WarningLevel="3"
|
||||||
|
SuppressStartupBanner="true"
|
||||||
|
DebugInformationFormat="1"
|
||||||
|
CompileAs="0"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="NDEBUG"
|
||||||
|
Culture="1033"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLibrarianTool"
|
||||||
|
OutputFile="..\..\..\..\..\build\msvc_9\libs\extern\mtdll\lzo.lib"
|
||||||
|
SuppressStartupBanner="true"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
</Configurations>
|
||||||
|
<References>
|
||||||
|
</References>
|
||||||
|
<Files>
|
||||||
|
<Filter
|
||||||
|
Name="Source Files"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\minilzo\minilzo.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Header Files"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\minilzo\lzoconf.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\minilzo\lzodefs.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\minilzo\minilzo.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
</Files>
|
||||||
|
<Globals>
|
||||||
|
</Globals>
|
||||||
|
</VisualStudioProject>
|
||||||
340
extern/lzo/minilzo/COPYING
vendored
Normal file
340
extern/lzo/minilzo/COPYING
vendored
Normal file
@@ -0,0 +1,340 @@
|
|||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 2, June 1991
|
||||||
|
|
||||||
|
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The licenses for most software are designed to take away your
|
||||||
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
|
License is intended to guarantee your freedom to share and change free
|
||||||
|
software--to make sure the software is free for all its users. This
|
||||||
|
General Public License applies to most of the Free Software
|
||||||
|
Foundation's software and to any other program whose authors commit to
|
||||||
|
using it. (Some other Free Software Foundation software is covered by
|
||||||
|
the GNU Library General Public License instead.) You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
this service if you wish), that you receive source code or can get it
|
||||||
|
if you want it, that you can change the software or use pieces of it
|
||||||
|
in new free programs; and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to make restrictions that forbid
|
||||||
|
anyone to deny you these rights or to ask you to surrender the rights.
|
||||||
|
These restrictions translate to certain responsibilities for you if you
|
||||||
|
distribute copies of the software, or if you modify it.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must give the recipients all the rights that
|
||||||
|
you have. You must make sure that they, too, receive or can get the
|
||||||
|
source code. And you must show them these terms so they know their
|
||||||
|
rights.
|
||||||
|
|
||||||
|
We protect your rights with two steps: (1) copyright the software, and
|
||||||
|
(2) offer you this license which gives you legal permission to copy,
|
||||||
|
distribute and/or modify the software.
|
||||||
|
|
||||||
|
Also, for each author's protection and ours, we want to make certain
|
||||||
|
that everyone understands that there is no warranty for this free
|
||||||
|
software. If the software is modified by someone else and passed on, we
|
||||||
|
want its recipients to know that what they have is not the original, so
|
||||||
|
that any problems introduced by others will not reflect on the original
|
||||||
|
authors' reputations.
|
||||||
|
|
||||||
|
Finally, any free program is threatened constantly by software
|
||||||
|
patents. We wish to avoid the danger that redistributors of a free
|
||||||
|
program will individually obtain patent licenses, in effect making the
|
||||||
|
program proprietary. To prevent this, we have made it clear that any
|
||||||
|
patent must be licensed for everyone's free use or not licensed at all.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. This License applies to any program or other work which contains
|
||||||
|
a notice placed by the copyright holder saying it may be distributed
|
||||||
|
under the terms of this General Public License. The "Program", below,
|
||||||
|
refers to any such program or work, and a "work based on the Program"
|
||||||
|
means either the Program or any derivative work under copyright law:
|
||||||
|
that is to say, a work containing the Program or a portion of it,
|
||||||
|
either verbatim or with modifications and/or translated into another
|
||||||
|
language. (Hereinafter, translation is included without limitation in
|
||||||
|
the term "modification".) Each licensee is addressed as "you".
|
||||||
|
|
||||||
|
Activities other than copying, distribution and modification are not
|
||||||
|
covered by this License; they are outside its scope. The act of
|
||||||
|
running the Program is not restricted, and the output from the Program
|
||||||
|
is covered only if its contents constitute a work based on the
|
||||||
|
Program (independent of having been made by running the Program).
|
||||||
|
Whether that is true depends on what the Program does.
|
||||||
|
|
||||||
|
1. You may copy and distribute verbatim copies of the Program's
|
||||||
|
source code as you receive it, in any medium, provided that you
|
||||||
|
conspicuously and appropriately publish on each copy an appropriate
|
||||||
|
copyright notice and disclaimer of warranty; keep intact all the
|
||||||
|
notices that refer to this License and to the absence of any warranty;
|
||||||
|
and give any other recipients of the Program a copy of this License
|
||||||
|
along with the Program.
|
||||||
|
|
||||||
|
You may charge a fee for the physical act of transferring a copy, and
|
||||||
|
you may at your option offer warranty protection in exchange for a fee.
|
||||||
|
|
||||||
|
2. You may modify your copy or copies of the Program or any portion
|
||||||
|
of it, thus forming a work based on the Program, and copy and
|
||||||
|
distribute such modifications or work under the terms of Section 1
|
||||||
|
above, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) You must cause the modified files to carry prominent notices
|
||||||
|
stating that you changed the files and the date of any change.
|
||||||
|
|
||||||
|
b) You must cause any work that you distribute or publish, that in
|
||||||
|
whole or in part contains or is derived from the Program or any
|
||||||
|
part thereof, to be licensed as a whole at no charge to all third
|
||||||
|
parties under the terms of this License.
|
||||||
|
|
||||||
|
c) If the modified program normally reads commands interactively
|
||||||
|
when run, you must cause it, when started running for such
|
||||||
|
interactive use in the most ordinary way, to print or display an
|
||||||
|
announcement including an appropriate copyright notice and a
|
||||||
|
notice that there is no warranty (or else, saying that you provide
|
||||||
|
a warranty) and that users may redistribute the program under
|
||||||
|
these conditions, and telling the user how to view a copy of this
|
||||||
|
License. (Exception: if the Program itself is interactive but
|
||||||
|
does not normally print such an announcement, your work based on
|
||||||
|
the Program is not required to print an announcement.)
|
||||||
|
|
||||||
|
These requirements apply to the modified work as a whole. If
|
||||||
|
identifiable sections of that work are not derived from the Program,
|
||||||
|
and can be reasonably considered independent and separate works in
|
||||||
|
themselves, then this License, and its terms, do not apply to those
|
||||||
|
sections when you distribute them as separate works. But when you
|
||||||
|
distribute the same sections as part of a whole which is a work based
|
||||||
|
on the Program, the distribution of the whole must be on the terms of
|
||||||
|
this License, whose permissions for other licensees extend to the
|
||||||
|
entire whole, and thus to each and every part regardless of who wrote it.
|
||||||
|
|
||||||
|
Thus, it is not the intent of this section to claim rights or contest
|
||||||
|
your rights to work written entirely by you; rather, the intent is to
|
||||||
|
exercise the right to control the distribution of derivative or
|
||||||
|
collective works based on the Program.
|
||||||
|
|
||||||
|
In addition, mere aggregation of another work not based on the Program
|
||||||
|
with the Program (or with a work based on the Program) on a volume of
|
||||||
|
a storage or distribution medium does not bring the other work under
|
||||||
|
the scope of this License.
|
||||||
|
|
||||||
|
3. You may copy and distribute the Program (or a work based on it,
|
||||||
|
under Section 2) in object code or executable form under the terms of
|
||||||
|
Sections 1 and 2 above provided that you also do one of the following:
|
||||||
|
|
||||||
|
a) Accompany it with the complete corresponding machine-readable
|
||||||
|
source code, which must be distributed under the terms of Sections
|
||||||
|
1 and 2 above on a medium customarily used for software interchange; or,
|
||||||
|
|
||||||
|
b) Accompany it with a written offer, valid for at least three
|
||||||
|
years, to give any third party, for a charge no more than your
|
||||||
|
cost of physically performing source distribution, a complete
|
||||||
|
machine-readable copy of the corresponding source code, to be
|
||||||
|
distributed under the terms of Sections 1 and 2 above on a medium
|
||||||
|
customarily used for software interchange; or,
|
||||||
|
|
||||||
|
c) Accompany it with the information you received as to the offer
|
||||||
|
to distribute corresponding source code. (This alternative is
|
||||||
|
allowed only for noncommercial distribution and only if you
|
||||||
|
received the program in object code or executable form with such
|
||||||
|
an offer, in accord with Subsection b above.)
|
||||||
|
|
||||||
|
The source code for a work means the preferred form of the work for
|
||||||
|
making modifications to it. For an executable work, complete source
|
||||||
|
code means all the source code for all modules it contains, plus any
|
||||||
|
associated interface definition files, plus the scripts used to
|
||||||
|
control compilation and installation of the executable. However, as a
|
||||||
|
special exception, the source code distributed need not include
|
||||||
|
anything that is normally distributed (in either source or binary
|
||||||
|
form) with the major components (compiler, kernel, and so on) of the
|
||||||
|
operating system on which the executable runs, unless that component
|
||||||
|
itself accompanies the executable.
|
||||||
|
|
||||||
|
If distribution of executable or object code is made by offering
|
||||||
|
access to copy from a designated place, then offering equivalent
|
||||||
|
access to copy the source code from the same place counts as
|
||||||
|
distribution of the source code, even though third parties are not
|
||||||
|
compelled to copy the source along with the object code.
|
||||||
|
|
||||||
|
4. You may not copy, modify, sublicense, or distribute the Program
|
||||||
|
except as expressly provided under this License. Any attempt
|
||||||
|
otherwise to copy, modify, sublicense or distribute the Program is
|
||||||
|
void, and will automatically terminate your rights under this License.
|
||||||
|
However, parties who have received copies, or rights, from you under
|
||||||
|
this License will not have their licenses terminated so long as such
|
||||||
|
parties remain in full compliance.
|
||||||
|
|
||||||
|
5. You are not required to accept this License, since you have not
|
||||||
|
signed it. However, nothing else grants you permission to modify or
|
||||||
|
distribute the Program or its derivative works. These actions are
|
||||||
|
prohibited by law if you do not accept this License. Therefore, by
|
||||||
|
modifying or distributing the Program (or any work based on the
|
||||||
|
Program), you indicate your acceptance of this License to do so, and
|
||||||
|
all its terms and conditions for copying, distributing or modifying
|
||||||
|
the Program or works based on it.
|
||||||
|
|
||||||
|
6. Each time you redistribute the Program (or any work based on the
|
||||||
|
Program), the recipient automatically receives a license from the
|
||||||
|
original licensor to copy, distribute or modify the Program subject to
|
||||||
|
these terms and conditions. You may not impose any further
|
||||||
|
restrictions on the recipients' exercise of the rights granted herein.
|
||||||
|
You are not responsible for enforcing compliance by third parties to
|
||||||
|
this License.
|
||||||
|
|
||||||
|
7. If, as a consequence of a court judgment or allegation of patent
|
||||||
|
infringement or for any other reason (not limited to patent issues),
|
||||||
|
conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot
|
||||||
|
distribute so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you
|
||||||
|
may not distribute the Program at all. For example, if a patent
|
||||||
|
license would not permit royalty-free redistribution of the Program by
|
||||||
|
all those who receive copies directly or indirectly through you, then
|
||||||
|
the only way you could satisfy both it and this License would be to
|
||||||
|
refrain entirely from distribution of the Program.
|
||||||
|
|
||||||
|
If any portion of this section is held invalid or unenforceable under
|
||||||
|
any particular circumstance, the balance of the section is intended to
|
||||||
|
apply and the section as a whole is intended to apply in other
|
||||||
|
circumstances.
|
||||||
|
|
||||||
|
It is not the purpose of this section to induce you to infringe any
|
||||||
|
patents or other property right claims or to contest validity of any
|
||||||
|
such claims; this section has the sole purpose of protecting the
|
||||||
|
integrity of the free software distribution system, which is
|
||||||
|
implemented by public license practices. Many people have made
|
||||||
|
generous contributions to the wide range of software distributed
|
||||||
|
through that system in reliance on consistent application of that
|
||||||
|
system; it is up to the author/donor to decide if he or she is willing
|
||||||
|
to distribute software through any other system and a licensee cannot
|
||||||
|
impose that choice.
|
||||||
|
|
||||||
|
This section is intended to make thoroughly clear what is believed to
|
||||||
|
be a consequence of the rest of this License.
|
||||||
|
|
||||||
|
8. If the distribution and/or use of the Program is restricted in
|
||||||
|
certain countries either by patents or by copyrighted interfaces, the
|
||||||
|
original copyright holder who places the Program under this License
|
||||||
|
may add an explicit geographical distribution limitation excluding
|
||||||
|
those countries, so that distribution is permitted only in or among
|
||||||
|
countries not thus excluded. In such case, this License incorporates
|
||||||
|
the limitation as if written in the body of this License.
|
||||||
|
|
||||||
|
9. The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Program
|
||||||
|
specifies a version number of this License which applies to it and "any
|
||||||
|
later version", you have the option of following the terms and conditions
|
||||||
|
either of that version or of any later version published by the Free
|
||||||
|
Software Foundation. If the Program does not specify a version number of
|
||||||
|
this License, you may choose any version ever published by the Free Software
|
||||||
|
Foundation.
|
||||||
|
|
||||||
|
10. If you wish to incorporate parts of the Program into other free
|
||||||
|
programs whose distribution conditions are different, write to the author
|
||||||
|
to ask for permission. For software which is copyrighted by the Free
|
||||||
|
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||||
|
make exceptions for this. Our decision will be guided by the two goals
|
||||||
|
of preserving the free status of all derivatives of our free software and
|
||||||
|
of promoting the sharing and reuse of software generally.
|
||||||
|
|
||||||
|
NO WARRANTY
|
||||||
|
|
||||||
|
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||||
|
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||||
|
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||||
|
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||||
|
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||||
|
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||||
|
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||||
|
REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||||
|
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||||
|
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||||
|
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||||
|
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||||
|
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
convey the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) 19yy <name of author>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program is interactive, make it output a short notice like this
|
||||||
|
when it starts in an interactive mode:
|
||||||
|
|
||||||
|
Gnomovision version 69, Copyright (C) 19yy name of author
|
||||||
|
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, the commands you use may
|
||||||
|
be called something other than `show w' and `show c'; they could even be
|
||||||
|
mouse-clicks or menu items--whatever suits your program.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or your
|
||||||
|
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||||
|
necessary. Here is a sample; alter the names:
|
||||||
|
|
||||||
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||||
|
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||||
|
|
||||||
|
<signature of Ty Coon>, 1 April 1989
|
||||||
|
Ty Coon, President of Vice
|
||||||
|
|
||||||
|
This General Public License does not permit incorporating your program into
|
||||||
|
proprietary programs. If your program is a subroutine library, you may
|
||||||
|
consider it more useful to permit linking proprietary applications with the
|
||||||
|
library. If this is what you want to do, use the GNU Library General
|
||||||
|
Public License instead of this License.
|
||||||
40
extern/lzo/minilzo/Makefile
vendored
Normal file
40
extern/lzo/minilzo/Makefile
vendored
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
#
|
||||||
|
# $Id:
|
||||||
|
#
|
||||||
|
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software Foundation,
|
||||||
|
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
#
|
||||||
|
# The Original Code is Copyright (C) 2009 Blender Foundation
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# Contributor(s): none yet.
|
||||||
|
#
|
||||||
|
# ***** END GPL LICENSE BLOCK *****
|
||||||
|
|
||||||
|
LIBNAME = minilzo
|
||||||
|
DIR = $(OCGDIR)/extern/$(LIBNAME)
|
||||||
|
|
||||||
|
include nan_compile.mk
|
||||||
|
|
||||||
|
install: $(ALL_OR_DEBUG)
|
||||||
|
@[ -d $(NAN_LZO) ] || mkdir -p $(NAN_LZO)
|
||||||
|
@[ -d $(NAN_LZO)/minilzo ] || mkdir -p $(NAN_LZO)/minilzo
|
||||||
|
@[ -d $(NAN_LZO)/lib/$(DEBUG_DIR) ] || mkdir -p $(NAN_LZO)/lib/$(DEBUG_DIR)
|
||||||
|
@$(NANBLENDERHOME)/intern/tools/cpifdiff.sh $(DIR)/$(DEBUG_DIR)lib$(LIBNAME).a $(NAN_LZO)/lib/$(DEBUG_DIR)
|
||||||
|
ifeq ($(OS),darwin)
|
||||||
|
ranlib $(NAN_LZO)/lib/$(DEBUG_DIR)lib$(LIBNAME).a
|
||||||
|
endif
|
||||||
|
@$(NANBLENDERHOME)/intern/tools/cpifdiff.sh *.h $(NAN_LZO)/minilzo
|
||||||
123
extern/lzo/minilzo/README.LZO
vendored
Normal file
123
extern/lzo/minilzo/README.LZO
vendored
Normal file
@@ -0,0 +1,123 @@
|
|||||||
|
|
||||||
|
============================================================================
|
||||||
|
miniLZO -- mini subset of the LZO real-time data compression library
|
||||||
|
============================================================================
|
||||||
|
|
||||||
|
Author : Markus Franz Xaver Johannes Oberhumer
|
||||||
|
<markus@oberhumer.com>
|
||||||
|
http://www.oberhumer.com/opensource/lzo/
|
||||||
|
Version : 2.03
|
||||||
|
Date : 30 Apr 2008
|
||||||
|
|
||||||
|
I've created miniLZO for projects where it is inconvenient to
|
||||||
|
include (or require) the full LZO source code just because you
|
||||||
|
want to add a little bit of data compression to your application.
|
||||||
|
|
||||||
|
miniLZO implements the LZO1X-1 compressor and both the standard and
|
||||||
|
safe LZO1X decompressor. Apart from fast compression it also useful
|
||||||
|
for situations where you want to use pre-compressed data files (which
|
||||||
|
must have been compressed with LZO1X-999).
|
||||||
|
|
||||||
|
miniLZO consists of one C source file and three header files:
|
||||||
|
minilzo.c
|
||||||
|
minilzo.h, lzoconf.h, lzodefs.h
|
||||||
|
|
||||||
|
To use miniLZO just copy these files into your source directory, add
|
||||||
|
minilzo.c to your Makefile and #include minilzo.h from your program.
|
||||||
|
Note: you also must distribute this file (`README.LZO') with your project.
|
||||||
|
|
||||||
|
minilzo.o compiles to about 6 kB (using gcc or Visual C on a i386), and
|
||||||
|
the sources are about 30 kB when packed with zip - so there's no more
|
||||||
|
excuse that your application doesn't support data compression :-)
|
||||||
|
|
||||||
|
For more information, documentation, example programs and other support
|
||||||
|
files (like Makefiles and build scripts) please download the full LZO
|
||||||
|
package from
|
||||||
|
http://www.oberhumer.com/opensource/lzo/
|
||||||
|
|
||||||
|
Have fun,
|
||||||
|
Markus
|
||||||
|
|
||||||
|
|
||||||
|
P.S. minilzo.c is generated automatically from the LZO sources and
|
||||||
|
therefore functionality is completely identical
|
||||||
|
|
||||||
|
|
||||||
|
Appendix A: building miniLZO
|
||||||
|
----------------------------
|
||||||
|
miniLZO is written such a way that it should compile and run
|
||||||
|
out-of-the-box on most machines.
|
||||||
|
|
||||||
|
If you are running on a very unusual architecture and lzo_init() fails then
|
||||||
|
you should first recompile with `-DLZO_DEBUG' to see what causes the failure.
|
||||||
|
The most probable case is something like `sizeof(char *) != sizeof(long)'.
|
||||||
|
After identifying the problem you can compile by adding some defines
|
||||||
|
like `-DSIZEOF_CHAR_P=8' to your Makefile.
|
||||||
|
|
||||||
|
The best solution is (of course) using Autoconf - if your project uses
|
||||||
|
Autoconf anyway just add `-DMINILZO_HAVE_CONFIG_H' to your compiler
|
||||||
|
flags when compiling minilzo.c. See the LZO distribution for an example
|
||||||
|
how to set up configure.in.
|
||||||
|
|
||||||
|
|
||||||
|
Appendix B: list of public functions available in miniLZO
|
||||||
|
---------------------------------------------------------
|
||||||
|
Library initialization
|
||||||
|
lzo_init()
|
||||||
|
|
||||||
|
Compression
|
||||||
|
lzo1x_1_compress()
|
||||||
|
|
||||||
|
Decompression
|
||||||
|
lzo1x_decompress()
|
||||||
|
lzo1x_decompress_safe()
|
||||||
|
|
||||||
|
Checksum functions
|
||||||
|
lzo_adler32()
|
||||||
|
|
||||||
|
Version functions
|
||||||
|
lzo_version()
|
||||||
|
lzo_version_string()
|
||||||
|
lzo_version_date()
|
||||||
|
|
||||||
|
Portable (but slow) string functions
|
||||||
|
lzo_memcmp()
|
||||||
|
lzo_memcpy()
|
||||||
|
lzo_memmove()
|
||||||
|
lzo_memset()
|
||||||
|
|
||||||
|
|
||||||
|
Appendix C: suggested macros for `configure.in' when using Autoconf
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Checks for typedefs and structures
|
||||||
|
AC_CHECK_TYPE(ptrdiff_t,long)
|
||||||
|
AC_TYPE_SIZE_T
|
||||||
|
AC_CHECK_SIZEOF(short)
|
||||||
|
AC_CHECK_SIZEOF(int)
|
||||||
|
AC_CHECK_SIZEOF(long)
|
||||||
|
AC_CHECK_SIZEOF(long long)
|
||||||
|
AC_CHECK_SIZEOF(__int64)
|
||||||
|
AC_CHECK_SIZEOF(void *)
|
||||||
|
AC_CHECK_SIZEOF(size_t)
|
||||||
|
AC_CHECK_SIZEOF(ptrdiff_t)
|
||||||
|
|
||||||
|
Checks for compiler characteristics
|
||||||
|
AC_C_CONST
|
||||||
|
|
||||||
|
Checks for library functions
|
||||||
|
AC_CHECK_FUNCS(memcmp memcpy memmove memset)
|
||||||
|
|
||||||
|
|
||||||
|
Appendix D: Copyright
|
||||||
|
---------------------
|
||||||
|
LZO and miniLZO are Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||||
|
2003, 2004, 2005, 2006, 2007, 2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
|
||||||
|
LZO and miniLZO are distributed under the terms of the GNU General
|
||||||
|
Public License (GPL). See the file COPYING.
|
||||||
|
|
||||||
|
Special licenses for commercial and other applications which
|
||||||
|
are not willing to accept the GNU General Public License
|
||||||
|
are available by contacting the author.
|
||||||
|
|
||||||
|
|
||||||
417
extern/lzo/minilzo/lzoconf.h
vendored
Normal file
417
extern/lzo/minilzo/lzoconf.h
vendored
Normal file
@@ -0,0 +1,417 @@
|
|||||||
|
/* lzoconf.h -- configuration for the LZO real-time data compression library
|
||||||
|
|
||||||
|
This file is part of the LZO real-time data compression library.
|
||||||
|
|
||||||
|
Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
All Rights Reserved.
|
||||||
|
|
||||||
|
The LZO library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of
|
||||||
|
the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The LZO library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with the LZO library; see the file COPYING.
|
||||||
|
If not, write to the Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
Markus F.X.J. Oberhumer
|
||||||
|
<markus@oberhumer.com>
|
||||||
|
http://www.oberhumer.com/opensource/lzo/
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef __LZOCONF_H_INCLUDED
|
||||||
|
#define __LZOCONF_H_INCLUDED
|
||||||
|
|
||||||
|
#define LZO_VERSION 0x2030
|
||||||
|
#define LZO_VERSION_STRING "2.03"
|
||||||
|
#define LZO_VERSION_DATE "Apr 30 2008"
|
||||||
|
|
||||||
|
/* internal Autoconf configuration file - only used when building LZO */
|
||||||
|
#if defined(LZO_HAVE_CONFIG_H)
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
#include <limits.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
// LZO requires a conforming <limits.h>
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
|
#if !defined(CHAR_BIT) || (CHAR_BIT != 8)
|
||||||
|
# error "invalid CHAR_BIT"
|
||||||
|
#endif
|
||||||
|
#if !defined(UCHAR_MAX) || !defined(UINT_MAX) || !defined(ULONG_MAX)
|
||||||
|
# error "check your compiler installation"
|
||||||
|
#endif
|
||||||
|
#if (USHRT_MAX < 1) || (UINT_MAX < 1) || (ULONG_MAX < 1)
|
||||||
|
# error "your limits.h macros are broken"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* get OS and architecture defines */
|
||||||
|
#ifndef __LZODEFS_H_INCLUDED
|
||||||
|
#include "lzodefs.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
// some core defines
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
|
#if !defined(LZO_UINT32_C)
|
||||||
|
# if (UINT_MAX < LZO_0xffffffffL)
|
||||||
|
# define LZO_UINT32_C(c) c ## UL
|
||||||
|
# else
|
||||||
|
# define LZO_UINT32_C(c) ((c) + 0U)
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* memory checkers */
|
||||||
|
#if !defined(__LZO_CHECKER)
|
||||||
|
# if defined(__BOUNDS_CHECKING_ON)
|
||||||
|
# define __LZO_CHECKER 1
|
||||||
|
# elif defined(__CHECKER__)
|
||||||
|
# define __LZO_CHECKER 1
|
||||||
|
# elif defined(__INSURE__)
|
||||||
|
# define __LZO_CHECKER 1
|
||||||
|
# elif defined(__PURIFY__)
|
||||||
|
# define __LZO_CHECKER 1
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
// integral and pointer types
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
|
/* lzo_uint should match size_t */
|
||||||
|
#if !defined(LZO_UINT_MAX)
|
||||||
|
# if defined(LZO_ABI_LLP64) /* WIN64 */
|
||||||
|
# if defined(LZO_OS_WIN64)
|
||||||
|
typedef unsigned __int64 lzo_uint;
|
||||||
|
typedef __int64 lzo_int;
|
||||||
|
# else
|
||||||
|
typedef unsigned long long lzo_uint;
|
||||||
|
typedef long long lzo_int;
|
||||||
|
# endif
|
||||||
|
# define LZO_UINT_MAX 0xffffffffffffffffull
|
||||||
|
# define LZO_INT_MAX 9223372036854775807LL
|
||||||
|
# define LZO_INT_MIN (-1LL - LZO_INT_MAX)
|
||||||
|
# elif defined(LZO_ABI_IP32L64) /* MIPS R5900 */
|
||||||
|
typedef unsigned int lzo_uint;
|
||||||
|
typedef int lzo_int;
|
||||||
|
# define LZO_UINT_MAX UINT_MAX
|
||||||
|
# define LZO_INT_MAX INT_MAX
|
||||||
|
# define LZO_INT_MIN INT_MIN
|
||||||
|
# elif (ULONG_MAX >= LZO_0xffffffffL)
|
||||||
|
typedef unsigned long lzo_uint;
|
||||||
|
typedef long lzo_int;
|
||||||
|
# define LZO_UINT_MAX ULONG_MAX
|
||||||
|
# define LZO_INT_MAX LONG_MAX
|
||||||
|
# define LZO_INT_MIN LONG_MIN
|
||||||
|
# else
|
||||||
|
# error "lzo_uint"
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Integral types with 32 bits or more. */
|
||||||
|
#if !defined(LZO_UINT32_MAX)
|
||||||
|
# if (UINT_MAX >= LZO_0xffffffffL)
|
||||||
|
typedef unsigned int lzo_uint32;
|
||||||
|
typedef int lzo_int32;
|
||||||
|
# define LZO_UINT32_MAX UINT_MAX
|
||||||
|
# define LZO_INT32_MAX INT_MAX
|
||||||
|
# define LZO_INT32_MIN INT_MIN
|
||||||
|
# elif (ULONG_MAX >= LZO_0xffffffffL)
|
||||||
|
typedef unsigned long lzo_uint32;
|
||||||
|
typedef long lzo_int32;
|
||||||
|
# define LZO_UINT32_MAX ULONG_MAX
|
||||||
|
# define LZO_INT32_MAX LONG_MAX
|
||||||
|
# define LZO_INT32_MIN LONG_MIN
|
||||||
|
# else
|
||||||
|
# error "lzo_uint32"
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* The larger type of lzo_uint and lzo_uint32. */
|
||||||
|
#if (LZO_UINT_MAX >= LZO_UINT32_MAX)
|
||||||
|
# define lzo_xint lzo_uint
|
||||||
|
#else
|
||||||
|
# define lzo_xint lzo_uint32
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Memory model that allows to access memory at offsets of lzo_uint. */
|
||||||
|
#if !defined(__LZO_MMODEL)
|
||||||
|
# if (LZO_UINT_MAX <= UINT_MAX)
|
||||||
|
# define __LZO_MMODEL
|
||||||
|
# elif defined(LZO_HAVE_MM_HUGE_PTR)
|
||||||
|
# define __LZO_MMODEL_HUGE 1
|
||||||
|
# define __LZO_MMODEL __huge
|
||||||
|
# else
|
||||||
|
# define __LZO_MMODEL
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* no typedef here because of const-pointer issues */
|
||||||
|
#define lzo_bytep unsigned char __LZO_MMODEL *
|
||||||
|
#define lzo_charp char __LZO_MMODEL *
|
||||||
|
#define lzo_voidp void __LZO_MMODEL *
|
||||||
|
#define lzo_shortp short __LZO_MMODEL *
|
||||||
|
#define lzo_ushortp unsigned short __LZO_MMODEL *
|
||||||
|
#define lzo_uint32p lzo_uint32 __LZO_MMODEL *
|
||||||
|
#define lzo_int32p lzo_int32 __LZO_MMODEL *
|
||||||
|
#define lzo_uintp lzo_uint __LZO_MMODEL *
|
||||||
|
#define lzo_intp lzo_int __LZO_MMODEL *
|
||||||
|
#define lzo_xintp lzo_xint __LZO_MMODEL *
|
||||||
|
#define lzo_voidpp lzo_voidp __LZO_MMODEL *
|
||||||
|
#define lzo_bytepp lzo_bytep __LZO_MMODEL *
|
||||||
|
/* deprecated - use `lzo_bytep' instead of `lzo_byte *' */
|
||||||
|
#define lzo_byte unsigned char __LZO_MMODEL
|
||||||
|
|
||||||
|
typedef int lzo_bool;
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
// function types
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
|
/* name mangling */
|
||||||
|
#if !defined(__LZO_EXTERN_C)
|
||||||
|
# ifdef __cplusplus
|
||||||
|
# define __LZO_EXTERN_C extern "C"
|
||||||
|
# else
|
||||||
|
# define __LZO_EXTERN_C extern
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* calling convention */
|
||||||
|
#if !defined(__LZO_CDECL)
|
||||||
|
# define __LZO_CDECL __lzo_cdecl
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* DLL export information */
|
||||||
|
#if !defined(__LZO_EXPORT1)
|
||||||
|
# define __LZO_EXPORT1
|
||||||
|
#endif
|
||||||
|
#if !defined(__LZO_EXPORT2)
|
||||||
|
# define __LZO_EXPORT2
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* __cdecl calling convention for public C and assembly functions */
|
||||||
|
#if !defined(LZO_PUBLIC)
|
||||||
|
# define LZO_PUBLIC(_rettype) __LZO_EXPORT1 _rettype __LZO_EXPORT2 __LZO_CDECL
|
||||||
|
#endif
|
||||||
|
#if !defined(LZO_EXTERN)
|
||||||
|
# define LZO_EXTERN(_rettype) __LZO_EXTERN_C LZO_PUBLIC(_rettype)
|
||||||
|
#endif
|
||||||
|
#if !defined(LZO_PRIVATE)
|
||||||
|
# define LZO_PRIVATE(_rettype) static _rettype __LZO_CDECL
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* function types */
|
||||||
|
typedef int
|
||||||
|
(__LZO_CDECL *lzo_compress_t) ( const lzo_bytep src, lzo_uint src_len,
|
||||||
|
lzo_bytep dst, lzo_uintp dst_len,
|
||||||
|
lzo_voidp wrkmem );
|
||||||
|
|
||||||
|
typedef int
|
||||||
|
(__LZO_CDECL *lzo_decompress_t) ( const lzo_bytep src, lzo_uint src_len,
|
||||||
|
lzo_bytep dst, lzo_uintp dst_len,
|
||||||
|
lzo_voidp wrkmem );
|
||||||
|
|
||||||
|
typedef int
|
||||||
|
(__LZO_CDECL *lzo_optimize_t) ( lzo_bytep src, lzo_uint src_len,
|
||||||
|
lzo_bytep dst, lzo_uintp dst_len,
|
||||||
|
lzo_voidp wrkmem );
|
||||||
|
|
||||||
|
typedef int
|
||||||
|
(__LZO_CDECL *lzo_compress_dict_t)(const lzo_bytep src, lzo_uint src_len,
|
||||||
|
lzo_bytep dst, lzo_uintp dst_len,
|
||||||
|
lzo_voidp wrkmem,
|
||||||
|
const lzo_bytep dict, lzo_uint dict_len );
|
||||||
|
|
||||||
|
typedef int
|
||||||
|
(__LZO_CDECL *lzo_decompress_dict_t)(const lzo_bytep src, lzo_uint src_len,
|
||||||
|
lzo_bytep dst, lzo_uintp dst_len,
|
||||||
|
lzo_voidp wrkmem,
|
||||||
|
const lzo_bytep dict, lzo_uint dict_len );
|
||||||
|
|
||||||
|
|
||||||
|
/* Callback interface. Currently only the progress indicator ("nprogress")
|
||||||
|
* is used, but this may change in a future release. */
|
||||||
|
|
||||||
|
struct lzo_callback_t;
|
||||||
|
typedef struct lzo_callback_t lzo_callback_t;
|
||||||
|
#define lzo_callback_p lzo_callback_t __LZO_MMODEL *
|
||||||
|
|
||||||
|
/* malloc & free function types */
|
||||||
|
typedef lzo_voidp (__LZO_CDECL *lzo_alloc_func_t)
|
||||||
|
(lzo_callback_p self, lzo_uint items, lzo_uint size);
|
||||||
|
typedef void (__LZO_CDECL *lzo_free_func_t)
|
||||||
|
(lzo_callback_p self, lzo_voidp ptr);
|
||||||
|
|
||||||
|
/* a progress indicator callback function */
|
||||||
|
typedef void (__LZO_CDECL *lzo_progress_func_t)
|
||||||
|
(lzo_callback_p, lzo_uint, lzo_uint, int);
|
||||||
|
|
||||||
|
struct lzo_callback_t
|
||||||
|
{
|
||||||
|
/* custom allocators (set to 0 to disable) */
|
||||||
|
lzo_alloc_func_t nalloc; /* [not used right now] */
|
||||||
|
lzo_free_func_t nfree; /* [not used right now] */
|
||||||
|
|
||||||
|
/* a progress indicator callback function (set to 0 to disable) */
|
||||||
|
lzo_progress_func_t nprogress;
|
||||||
|
|
||||||
|
/* NOTE: the first parameter "self" of the nalloc/nfree/nprogress
|
||||||
|
* callbacks points back to this struct, so you are free to store
|
||||||
|
* some extra info in the following variables. */
|
||||||
|
lzo_voidp user1;
|
||||||
|
lzo_xint user2;
|
||||||
|
lzo_xint user3;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
// error codes and prototypes
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
|
/* Error codes for the compression/decompression functions. Negative
|
||||||
|
* values are errors, positive values will be used for special but
|
||||||
|
* normal events.
|
||||||
|
*/
|
||||||
|
#define LZO_E_OK 0
|
||||||
|
#define LZO_E_ERROR (-1)
|
||||||
|
#define LZO_E_OUT_OF_MEMORY (-2) /* [not used right now] */
|
||||||
|
#define LZO_E_NOT_COMPRESSIBLE (-3) /* [not used right now] */
|
||||||
|
#define LZO_E_INPUT_OVERRUN (-4)
|
||||||
|
#define LZO_E_OUTPUT_OVERRUN (-5)
|
||||||
|
#define LZO_E_LOOKBEHIND_OVERRUN (-6)
|
||||||
|
#define LZO_E_EOF_NOT_FOUND (-7)
|
||||||
|
#define LZO_E_INPUT_NOT_CONSUMED (-8)
|
||||||
|
#define LZO_E_NOT_YET_IMPLEMENTED (-9) /* [not used right now] */
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef lzo_sizeof_dict_t
|
||||||
|
# define lzo_sizeof_dict_t ((unsigned)sizeof(lzo_bytep))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* lzo_init() should be the first function you call.
|
||||||
|
* Check the return code !
|
||||||
|
*
|
||||||
|
* lzo_init() is a macro to allow checking that the library and the
|
||||||
|
* compiler's view of various types are consistent.
|
||||||
|
*/
|
||||||
|
#define lzo_init() __lzo_init_v2(LZO_VERSION,(int)sizeof(short),(int)sizeof(int),\
|
||||||
|
(int)sizeof(long),(int)sizeof(lzo_uint32),(int)sizeof(lzo_uint),\
|
||||||
|
(int)lzo_sizeof_dict_t,(int)sizeof(char *),(int)sizeof(lzo_voidp),\
|
||||||
|
(int)sizeof(lzo_callback_t))
|
||||||
|
LZO_EXTERN(int) __lzo_init_v2(unsigned,int,int,int,int,int,int,int,int,int);
|
||||||
|
|
||||||
|
/* version functions (useful for shared libraries) */
|
||||||
|
LZO_EXTERN(unsigned) lzo_version(void);
|
||||||
|
LZO_EXTERN(const char *) lzo_version_string(void);
|
||||||
|
LZO_EXTERN(const char *) lzo_version_date(void);
|
||||||
|
LZO_EXTERN(const lzo_charp) _lzo_version_string(void);
|
||||||
|
LZO_EXTERN(const lzo_charp) _lzo_version_date(void);
|
||||||
|
|
||||||
|
/* string functions */
|
||||||
|
LZO_EXTERN(int)
|
||||||
|
lzo_memcmp(const lzo_voidp _s1, const lzo_voidp _s2, lzo_uint _len);
|
||||||
|
LZO_EXTERN(lzo_voidp)
|
||||||
|
lzo_memcpy(lzo_voidp _dest, const lzo_voidp _src, lzo_uint _len);
|
||||||
|
LZO_EXTERN(lzo_voidp)
|
||||||
|
lzo_memmove(lzo_voidp _dest, const lzo_voidp _src, lzo_uint _len);
|
||||||
|
LZO_EXTERN(lzo_voidp)
|
||||||
|
lzo_memset(lzo_voidp _s, int _c, lzo_uint _len);
|
||||||
|
|
||||||
|
/* checksum functions */
|
||||||
|
LZO_EXTERN(lzo_uint32)
|
||||||
|
lzo_adler32(lzo_uint32 _adler, const lzo_bytep _buf, lzo_uint _len);
|
||||||
|
LZO_EXTERN(lzo_uint32)
|
||||||
|
lzo_crc32(lzo_uint32 _c, const lzo_bytep _buf, lzo_uint _len);
|
||||||
|
LZO_EXTERN(const lzo_uint32p)
|
||||||
|
lzo_get_crc32_table(void);
|
||||||
|
|
||||||
|
/* misc. */
|
||||||
|
LZO_EXTERN(int) _lzo_config_check(void);
|
||||||
|
typedef union { lzo_bytep p; lzo_uint u; } __lzo_pu_u;
|
||||||
|
typedef union { lzo_bytep p; lzo_uint32 u32; } __lzo_pu32_u;
|
||||||
|
typedef union { void *vp; lzo_bytep bp; lzo_uint32 u32; long l; } lzo_align_t;
|
||||||
|
|
||||||
|
/* align a char pointer on a boundary that is a multiple of `size' */
|
||||||
|
LZO_EXTERN(unsigned) __lzo_align_gap(const lzo_voidp _ptr, lzo_uint _size);
|
||||||
|
#define LZO_PTR_ALIGN_UP(_ptr,_size) \
|
||||||
|
((_ptr) + (lzo_uint) __lzo_align_gap((const lzo_voidp)(_ptr),(lzo_uint)(_size)))
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
// deprecated macros - only for backward compatibility with LZO v1.xx
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
|
#if defined(LZO_CFG_COMPAT)
|
||||||
|
|
||||||
|
#define __LZOCONF_H 1
|
||||||
|
|
||||||
|
#if defined(LZO_ARCH_I086)
|
||||||
|
# define __LZO_i386 1
|
||||||
|
#elif defined(LZO_ARCH_I386)
|
||||||
|
# define __LZO_i386 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(LZO_OS_DOS16)
|
||||||
|
# define __LZO_DOS 1
|
||||||
|
# define __LZO_DOS16 1
|
||||||
|
#elif defined(LZO_OS_DOS32)
|
||||||
|
# define __LZO_DOS 1
|
||||||
|
#elif defined(LZO_OS_WIN16)
|
||||||
|
# define __LZO_WIN 1
|
||||||
|
# define __LZO_WIN16 1
|
||||||
|
#elif defined(LZO_OS_WIN32)
|
||||||
|
# define __LZO_WIN 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define __LZO_CMODEL
|
||||||
|
#define __LZO_DMODEL
|
||||||
|
#define __LZO_ENTRY __LZO_CDECL
|
||||||
|
#define LZO_EXTERN_CDECL LZO_EXTERN
|
||||||
|
#define LZO_ALIGN LZO_PTR_ALIGN_UP
|
||||||
|
|
||||||
|
#define lzo_compress_asm_t lzo_compress_t
|
||||||
|
#define lzo_decompress_asm_t lzo_decompress_t
|
||||||
|
|
||||||
|
#endif /* LZO_CFG_COMPAT */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* extern "C" */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* already included */
|
||||||
|
|
||||||
|
|
||||||
|
/* vim:set ts=4 et: */
|
||||||
1807
extern/lzo/minilzo/lzodefs.h
vendored
Normal file
1807
extern/lzo/minilzo/lzodefs.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
4112
extern/lzo/minilzo/minilzo.c
vendored
Normal file
4112
extern/lzo/minilzo/minilzo.c
vendored
Normal file
File diff suppressed because it is too large
Load Diff
112
extern/lzo/minilzo/minilzo.h
vendored
Normal file
112
extern/lzo/minilzo/minilzo.h
vendored
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
/* minilzo.h -- mini subset of the LZO real-time data compression library
|
||||||
|
|
||||||
|
This file is part of the LZO real-time data compression library.
|
||||||
|
|
||||||
|
Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
All Rights Reserved.
|
||||||
|
|
||||||
|
The LZO library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of
|
||||||
|
the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The LZO library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with the LZO library; see the file COPYING.
|
||||||
|
If not, write to the Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
Markus F.X.J. Oberhumer
|
||||||
|
<markus@oberhumer.com>
|
||||||
|
http://www.oberhumer.com/opensource/lzo/
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* NOTE:
|
||||||
|
* the full LZO package can be found at
|
||||||
|
* http://www.oberhumer.com/opensource/lzo/
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef __MINILZO_H
|
||||||
|
#define __MINILZO_H
|
||||||
|
|
||||||
|
#define MINILZO_VERSION 0x2030
|
||||||
|
|
||||||
|
#ifdef __LZOCONF_H
|
||||||
|
# error "you cannot use both LZO and miniLZO"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#undef LZO_HAVE_CONFIG_H
|
||||||
|
#include "lzoconf.h"
|
||||||
|
|
||||||
|
#if !defined(LZO_VERSION) || (LZO_VERSION != MINILZO_VERSION)
|
||||||
|
# error "version mismatch in header files"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
//
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
|
/* Memory required for the wrkmem parameter.
|
||||||
|
* When the required size is 0, you can also pass a NULL pointer.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define LZO1X_MEM_COMPRESS LZO1X_1_MEM_COMPRESS
|
||||||
|
#define LZO1X_1_MEM_COMPRESS ((lzo_uint32) (16384L * lzo_sizeof_dict_t))
|
||||||
|
#define LZO1X_MEM_DECOMPRESS (0)
|
||||||
|
|
||||||
|
|
||||||
|
/* compression */
|
||||||
|
LZO_EXTERN(int)
|
||||||
|
lzo1x_1_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||||
|
lzo_bytep dst, lzo_uintp dst_len,
|
||||||
|
lzo_voidp wrkmem );
|
||||||
|
|
||||||
|
/* decompression */
|
||||||
|
LZO_EXTERN(int)
|
||||||
|
lzo1x_decompress ( const lzo_bytep src, lzo_uint src_len,
|
||||||
|
lzo_bytep dst, lzo_uintp dst_len,
|
||||||
|
lzo_voidp wrkmem /* NOT USED */ );
|
||||||
|
|
||||||
|
/* safe decompression with overrun testing */
|
||||||
|
LZO_EXTERN(int)
|
||||||
|
lzo1x_decompress_safe ( const lzo_bytep src, lzo_uint src_len,
|
||||||
|
lzo_bytep dst, lzo_uintp dst_len,
|
||||||
|
lzo_voidp wrkmem /* NOT USED */ );
|
||||||
|
|
||||||
|
|
||||||
|
#define LZO_OUT_LEN(size) ((size) + (size) / 16 + 64 + 3)
|
||||||
|
|
||||||
|
#define LZO_HEAP_ALLOC(var,size) \
|
||||||
|
lzo_align_t __LZO_MMODEL var [ ((size) + (sizeof(lzo_align_t) - 1)) / sizeof(lzo_align_t) ]
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* extern "C" */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* already included */
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
#
|
#
|
||||||
# ***** END GPL LICENSE BLOCK *****
|
# ***** END GPL LICENSE BLOCK *****
|
||||||
|
|
||||||
ADD_SUBDIRECTORY(SoundSystem)
|
ADD_SUBDIRECTORY(audaspace)
|
||||||
ADD_SUBDIRECTORY(string)
|
ADD_SUBDIRECTORY(string)
|
||||||
ADD_SUBDIRECTORY(ghost)
|
ADD_SUBDIRECTORY(ghost)
|
||||||
ADD_SUBDIRECTORY(guardedalloc)
|
ADD_SUBDIRECTORY(guardedalloc)
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ SOURCEDIR = intern
|
|||||||
# include nan_subdirs.mk
|
# include nan_subdirs.mk
|
||||||
|
|
||||||
ALLDIRS = string ghost guardedalloc moto container memutil
|
ALLDIRS = string ghost guardedalloc moto container memutil
|
||||||
ALLDIRS += decimation iksolver bsp SoundSystem opennl elbeem boolop smoke
|
ALLDIRS += decimation iksolver bsp opennl elbeem boolop smoke audaspace
|
||||||
|
|
||||||
all::
|
all::
|
||||||
@for i in $(ALLDIRS); do \
|
@for i in $(ALLDIRS); do \
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
Import ('env')
|
Import ('env')
|
||||||
|
|
||||||
SConscript(['SoundSystem/SConscript',
|
SConscript(['audaspace/SConscript',
|
||||||
'string/SConscript',
|
'string/SConscript',
|
||||||
'ghost/SConscript',
|
'ghost/SConscript',
|
||||||
'guardedalloc/SConscript',
|
'guardedalloc/SConscript',
|
||||||
|
|||||||
64
intern/audaspace/CMakeLists.txt
Normal file
64
intern/audaspace/CMakeLists.txt
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
# $Id$
|
||||||
|
# ***** BEGIN LGPL LICENSE BLOCK *****
|
||||||
|
#
|
||||||
|
# Copyright 2009 Jörg Hermann Müller
|
||||||
|
#
|
||||||
|
# This file is part of AudaSpace.
|
||||||
|
#
|
||||||
|
# AudaSpace is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# AudaSpace is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Lesser General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Lesser General Public License
|
||||||
|
# along with AudaSpace. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
# ***** END LGPL LICENSE BLOCK *****
|
||||||
|
|
||||||
|
SET(INC . intern FX SRC ${PTHREADS_INC} ${LIBSAMPLERATE_INC})
|
||||||
|
|
||||||
|
FILE(GLOB SRC intern/*.cpp intern/*.h FX/*.cpp SRC/*.cpp)
|
||||||
|
|
||||||
|
IF(WITH_FFMPEG)
|
||||||
|
SET(INC ${INC} ffmpeg ${FFMPEG_INC})
|
||||||
|
FILE(GLOB FFMPEGSRC ffmpeg/*.cpp)
|
||||||
|
ADD_DEFINITIONS(-DWITH_FFMPEG)
|
||||||
|
ENDIF(WITH_FFMPEG)
|
||||||
|
|
||||||
|
IF(WITH_SDL)
|
||||||
|
SET(INC ${INC} SDL ${SDL_INCLUDE_DIR})
|
||||||
|
FILE(GLOB SDLSRC SDL/*.cpp)
|
||||||
|
ADD_DEFINITIONS(-DWITH_SDL)
|
||||||
|
ENDIF(WITH_SDL)
|
||||||
|
|
||||||
|
IF(WITH_OPENAL)
|
||||||
|
SET(INC ${INC} OpenAL ${OPENAL_INCLUDE_DIR})
|
||||||
|
FILE(GLOB OPENALSRC OpenAL/*.cpp)
|
||||||
|
ADD_DEFINITIONS(-DWITH_OPENAL)
|
||||||
|
|
||||||
|
STRING(REGEX MATCH ".*ramework.*" FRAMEWORK ${OPENAL_INCLUDE_DIR})
|
||||||
|
IF(FRAMEWORK)
|
||||||
|
ADD_DEFINITIONS(-DAPPLE_FRAMEWORK_FIX)
|
||||||
|
ENDIF(FRAMEWORK)
|
||||||
|
ENDIF(WITH_OPENAL)
|
||||||
|
|
||||||
|
IF(WITH_JACK)
|
||||||
|
SET(INC ${INC} jack ${JACK_INC})
|
||||||
|
FILE(GLOB JACKSRC jack/*.cpp)
|
||||||
|
ADD_DEFINITIONS(-DWITH_JACK)
|
||||||
|
ENDIF(WITH_JACK)
|
||||||
|
|
||||||
|
IF(WITH_SNDFILE)
|
||||||
|
SET(INC ${INC} sndfile ${SNDFILE_INC})
|
||||||
|
FILE(GLOB SNDFILESRC sndfile/*.cpp)
|
||||||
|
ADD_DEFINITIONS(-DWITH_SNDFILE)
|
||||||
|
ENDIF(WITH_SNDFILE)
|
||||||
|
|
||||||
|
SET(SRC ${SRC} ${FFMPEGSRC} ${SNDFILESRC} ${SDLSRC} ${OPENALSRC} ${JACKSRC})
|
||||||
|
|
||||||
|
BLENDERLIB(bf_audaspace "${SRC}" "${INC}")
|
||||||
674
intern/audaspace/COPYING
Normal file
674
intern/audaspace/COPYING
Normal file
@@ -0,0 +1,674 @@
|
|||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The GNU General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
the GNU General Public License is intended to guarantee your freedom to
|
||||||
|
share and change all versions of a program--to make sure it remains free
|
||||||
|
software for all its users. We, the Free Software Foundation, use the
|
||||||
|
GNU General Public License for most of our software; it applies also to
|
||||||
|
any other work released this way by its authors. You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to prevent others from denying you
|
||||||
|
these rights or asking you to surrender the rights. Therefore, you have
|
||||||
|
certain responsibilities if you distribute copies of the software, or if
|
||||||
|
you modify it: responsibilities to respect the freedom of others.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must pass on to the recipients the same
|
||||||
|
freedoms that you received. You must make sure that they, too, receive
|
||||||
|
or can get the source code. And you must show them these terms so they
|
||||||
|
know their rights.
|
||||||
|
|
||||||
|
Developers that use the GNU GPL protect your rights with two steps:
|
||||||
|
(1) assert copyright on the software, and (2) offer you this License
|
||||||
|
giving you legal permission to copy, distribute and/or modify it.
|
||||||
|
|
||||||
|
For the developers' and authors' protection, the GPL clearly explains
|
||||||
|
that there is no warranty for this free software. For both users' and
|
||||||
|
authors' sake, the GPL requires that modified versions be marked as
|
||||||
|
changed, so that their problems will not be attributed erroneously to
|
||||||
|
authors of previous versions.
|
||||||
|
|
||||||
|
Some devices are designed to deny users access to install or run
|
||||||
|
modified versions of the software inside them, although the manufacturer
|
||||||
|
can do so. This is fundamentally incompatible with the aim of
|
||||||
|
protecting users' freedom to change the software. The systematic
|
||||||
|
pattern of such abuse occurs in the area of products for individuals to
|
||||||
|
use, which is precisely where it is most unacceptable. Therefore, we
|
||||||
|
have designed this version of the GPL to prohibit the practice for those
|
||||||
|
products. If such problems arise substantially in other domains, we
|
||||||
|
stand ready to extend this provision to those domains in future versions
|
||||||
|
of the GPL, as needed to protect the freedom of users.
|
||||||
|
|
||||||
|
Finally, every program is threatened constantly by software patents.
|
||||||
|
States should not allow patents to restrict development and use of
|
||||||
|
software on general-purpose computers, but in those that do, we wish to
|
||||||
|
avoid the special danger that patents applied to a free program could
|
||||||
|
make it effectively proprietary. To prevent this, the GPL assures that
|
||||||
|
patents cannot be used to render the program non-free.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU General Public License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of an
|
||||||
|
exact copy. The resulting work is called a "modified version" of the
|
||||||
|
earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user through
|
||||||
|
a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices"
|
||||||
|
to the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work
|
||||||
|
for making modifications to it. "Object code" means any non-source
|
||||||
|
form of a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users
|
||||||
|
can regenerate automatically from other parts of the Corresponding
|
||||||
|
Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that
|
||||||
|
same work.
|
||||||
|
|
||||||
|
2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not
|
||||||
|
convey, without conditions so long as your license otherwise remains
|
||||||
|
in force. You may convey covered works to others for the sole purpose
|
||||||
|
of having them make modifications exclusively for you, or provide you
|
||||||
|
with facilities for running those works, provided that you comply with
|
||||||
|
the terms of this License in conveying all material for which you do
|
||||||
|
not control copyright. Those thus making or running the covered works
|
||||||
|
for you must do so exclusively on your behalf, under your direction
|
||||||
|
and control, on terms that prohibit them from making any copies of
|
||||||
|
your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under
|
||||||
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
|
makes it unnecessary.
|
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such circumvention
|
||||||
|
is effected by exercising rights under this License with respect to
|
||||||
|
the covered work, and you disclaim any intention to limit operation or
|
||||||
|
modification of the work as a means of enforcing, against the work's
|
||||||
|
users, your or third parties' legal rights to forbid circumvention of
|
||||||
|
technological measures.
|
||||||
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under section
|
||||||
|
7. This requirement modifies the requirement in section 4 to
|
||||||
|
"keep intact all notices".
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms
|
||||||
|
of sections 4 and 5, provided that you also convey the
|
||||||
|
machine-readable Corresponding Source under the terms of this License,
|
||||||
|
in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the
|
||||||
|
Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided
|
||||||
|
you inform other peers where the object code and Corresponding
|
||||||
|
Source of the work are being offered to the general public at no
|
||||||
|
charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal, family,
|
||||||
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
|
product received by a particular user, "normally used" refers to a
|
||||||
|
typical or common use of that class of product, regardless of the status
|
||||||
|
of the particular user or of the way in which the particular user
|
||||||
|
actually uses, or expects or is expected to use, the product. A product
|
||||||
|
is a consumer product regardless of whether the product has substantial
|
||||||
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
|
the only significant mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to install
|
||||||
|
and execute modified versions of a covered work in that User Product from
|
||||||
|
a modified version of its Corresponding Source. The information must
|
||||||
|
suffice to ensure that the continued functioning of the modified object
|
||||||
|
code is in no case prevented or interfered with solely because
|
||||||
|
modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or updates
|
||||||
|
for a work that has been modified or installed by the recipient, or for
|
||||||
|
the User Product in which it has been modified or installed. Access to a
|
||||||
|
network may be denied when the modification itself materially and
|
||||||
|
adversely affects the operation of the network or violates the rules and
|
||||||
|
protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders of
|
||||||
|
that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or
|
||||||
|
requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or
|
||||||
|
authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions of
|
||||||
|
it) with contractual assumptions of liability to the recipient, for
|
||||||
|
any liability that these contractual assumptions directly impose on
|
||||||
|
those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions;
|
||||||
|
the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your
|
||||||
|
license from a particular copyright holder is reinstated (a)
|
||||||
|
provisionally, unless and until the copyright holder explicitly and
|
||||||
|
finally terminates your license, and (b) permanently, if the copyright
|
||||||
|
holder fails to notify you of the violation by some reasonable means
|
||||||
|
prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or
|
||||||
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims
|
||||||
|
owned or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within
|
||||||
|
the scope of its coverage, prohibits the exercise of, or is
|
||||||
|
conditioned on the non-exercise of one or more of the rights that are
|
||||||
|
specifically granted under this License. You may not convey a covered
|
||||||
|
work if you are a party to an arrangement with a third party that is
|
||||||
|
in the business of distributing software, under which you make payment
|
||||||
|
to the third party based on the extent of your activity of conveying
|
||||||
|
the work, and under which the third party grants, to any of the
|
||||||
|
parties who would receive the covered work from you, a discriminatory
|
||||||
|
patent license (a) in connection with copies of the covered work
|
||||||
|
conveyed by you (or copies made from those copies), or (b) primarily
|
||||||
|
for and in connection with specific products or compilations that
|
||||||
|
contain the covered work, unless you entered into that arrangement,
|
||||||
|
or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you may
|
||||||
|
not convey it at all. For example, if you agree to terms that obligate you
|
||||||
|
to collect a royalty for further conveying from those to whom you convey
|
||||||
|
the Program, the only way you could satisfy both those terms and this
|
||||||
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Use with the GNU Affero General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU Affero General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the special requirements of the GNU Affero General Public License,
|
||||||
|
section 13, concerning interaction through a network will apply to the
|
||||||
|
combination as such.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
|
the GNU General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Program specifies that a certain numbered version of the GNU General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU General Public License, you may choose any version ever published
|
||||||
|
by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future
|
||||||
|
versions of the GNU General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||||
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||||
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||||
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||||
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||||
|
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||||
|
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||||
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||||
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
state the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program does terminal interaction, make it output a short
|
||||||
|
notice like this when it starts in an interactive mode:
|
||||||
|
|
||||||
|
<program> Copyright (C) <year> <name of author>
|
||||||
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, your program's commands
|
||||||
|
might be different; for a GUI interface, you would use an "about box".
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
|
For more information on this, and how to apply and follow the GNU GPL, see
|
||||||
|
<http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
The GNU General Public License does not permit incorporating your program
|
||||||
|
into proprietary programs. If your program is a subroutine library, you
|
||||||
|
may consider it more useful to permit linking proprietary applications with
|
||||||
|
the library. If this is what you want to do, use the GNU Lesser General
|
||||||
|
Public License instead of this License. But first, please read
|
||||||
|
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||||
165
intern/audaspace/COPYING.LESSER
Normal file
165
intern/audaspace/COPYING.LESSER
Normal file
@@ -0,0 +1,165 @@
|
|||||||
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
|
||||||
|
This version of the GNU Lesser General Public License incorporates
|
||||||
|
the terms and conditions of version 3 of the GNU General Public
|
||||||
|
License, supplemented by the additional permissions listed below.
|
||||||
|
|
||||||
|
0. Additional Definitions.
|
||||||
|
|
||||||
|
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||||
|
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||||
|
General Public License.
|
||||||
|
|
||||||
|
"The Library" refers to a covered work governed by this License,
|
||||||
|
other than an Application or a Combined Work as defined below.
|
||||||
|
|
||||||
|
An "Application" is any work that makes use of an interface provided
|
||||||
|
by the Library, but which is not otherwise based on the Library.
|
||||||
|
Defining a subclass of a class defined by the Library is deemed a mode
|
||||||
|
of using an interface provided by the Library.
|
||||||
|
|
||||||
|
A "Combined Work" is a work produced by combining or linking an
|
||||||
|
Application with the Library. The particular version of the Library
|
||||||
|
with which the Combined Work was made is also called the "Linked
|
||||||
|
Version".
|
||||||
|
|
||||||
|
The "Minimal Corresponding Source" for a Combined Work means the
|
||||||
|
Corresponding Source for the Combined Work, excluding any source code
|
||||||
|
for portions of the Combined Work that, considered in isolation, are
|
||||||
|
based on the Application, and not on the Linked Version.
|
||||||
|
|
||||||
|
The "Corresponding Application Code" for a Combined Work means the
|
||||||
|
object code and/or source code for the Application, including any data
|
||||||
|
and utility programs needed for reproducing the Combined Work from the
|
||||||
|
Application, but excluding the System Libraries of the Combined Work.
|
||||||
|
|
||||||
|
1. Exception to Section 3 of the GNU GPL.
|
||||||
|
|
||||||
|
You may convey a covered work under sections 3 and 4 of this License
|
||||||
|
without being bound by section 3 of the GNU GPL.
|
||||||
|
|
||||||
|
2. Conveying Modified Versions.
|
||||||
|
|
||||||
|
If you modify a copy of the Library, and, in your modifications, a
|
||||||
|
facility refers to a function or data to be supplied by an Application
|
||||||
|
that uses the facility (other than as an argument passed when the
|
||||||
|
facility is invoked), then you may convey a copy of the modified
|
||||||
|
version:
|
||||||
|
|
||||||
|
a) under this License, provided that you make a good faith effort to
|
||||||
|
ensure that, in the event an Application does not supply the
|
||||||
|
function or data, the facility still operates, and performs
|
||||||
|
whatever part of its purpose remains meaningful, or
|
||||||
|
|
||||||
|
b) under the GNU GPL, with none of the additional permissions of
|
||||||
|
this License applicable to that copy.
|
||||||
|
|
||||||
|
3. Object Code Incorporating Material from Library Header Files.
|
||||||
|
|
||||||
|
The object code form of an Application may incorporate material from
|
||||||
|
a header file that is part of the Library. You may convey such object
|
||||||
|
code under terms of your choice, provided that, if the incorporated
|
||||||
|
material is not limited to numerical parameters, data structure
|
||||||
|
layouts and accessors, or small macros, inline functions and templates
|
||||||
|
(ten or fewer lines in length), you do both of the following:
|
||||||
|
|
||||||
|
a) Give prominent notice with each copy of the object code that the
|
||||||
|
Library is used in it and that the Library and its use are
|
||||||
|
covered by this License.
|
||||||
|
|
||||||
|
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||||
|
document.
|
||||||
|
|
||||||
|
4. Combined Works.
|
||||||
|
|
||||||
|
You may convey a Combined Work under terms of your choice that,
|
||||||
|
taken together, effectively do not restrict modification of the
|
||||||
|
portions of the Library contained in the Combined Work and reverse
|
||||||
|
engineering for debugging such modifications, if you also do each of
|
||||||
|
the following:
|
||||||
|
|
||||||
|
a) Give prominent notice with each copy of the Combined Work that
|
||||||
|
the Library is used in it and that the Library and its use are
|
||||||
|
covered by this License.
|
||||||
|
|
||||||
|
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||||
|
document.
|
||||||
|
|
||||||
|
c) For a Combined Work that displays copyright notices during
|
||||||
|
execution, include the copyright notice for the Library among
|
||||||
|
these notices, as well as a reference directing the user to the
|
||||||
|
copies of the GNU GPL and this license document.
|
||||||
|
|
||||||
|
d) Do one of the following:
|
||||||
|
|
||||||
|
0) Convey the Minimal Corresponding Source under the terms of this
|
||||||
|
License, and the Corresponding Application Code in a form
|
||||||
|
suitable for, and under terms that permit, the user to
|
||||||
|
recombine or relink the Application with a modified version of
|
||||||
|
the Linked Version to produce a modified Combined Work, in the
|
||||||
|
manner specified by section 6 of the GNU GPL for conveying
|
||||||
|
Corresponding Source.
|
||||||
|
|
||||||
|
1) Use a suitable shared library mechanism for linking with the
|
||||||
|
Library. A suitable mechanism is one that (a) uses at run time
|
||||||
|
a copy of the Library already present on the user's computer
|
||||||
|
system, and (b) will operate properly with a modified version
|
||||||
|
of the Library that is interface-compatible with the Linked
|
||||||
|
Version.
|
||||||
|
|
||||||
|
e) Provide Installation Information, but only if you would otherwise
|
||||||
|
be required to provide such information under section 6 of the
|
||||||
|
GNU GPL, and only to the extent that such information is
|
||||||
|
necessary to install and execute a modified version of the
|
||||||
|
Combined Work produced by recombining or relinking the
|
||||||
|
Application with a modified version of the Linked Version. (If
|
||||||
|
you use option 4d0, the Installation Information must accompany
|
||||||
|
the Minimal Corresponding Source and Corresponding Application
|
||||||
|
Code. If you use option 4d1, you must provide the Installation
|
||||||
|
Information in the manner specified by section 6 of the GNU GPL
|
||||||
|
for conveying Corresponding Source.)
|
||||||
|
|
||||||
|
5. Combined Libraries.
|
||||||
|
|
||||||
|
You may place library facilities that are a work based on the
|
||||||
|
Library side by side in a single library together with other library
|
||||||
|
facilities that are not Applications and are not covered by this
|
||||||
|
License, and convey such a combined library under terms of your
|
||||||
|
choice, if you do both of the following:
|
||||||
|
|
||||||
|
a) Accompany the combined library with a copy of the same work based
|
||||||
|
on the Library, uncombined with any other library facilities,
|
||||||
|
conveyed under the terms of this License.
|
||||||
|
|
||||||
|
b) Give prominent notice with the combined library that part of it
|
||||||
|
is a work based on the Library, and explaining where to find the
|
||||||
|
accompanying uncombined form of the same work.
|
||||||
|
|
||||||
|
6. Revised Versions of the GNU Lesser General Public License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the GNU Lesser General Public License from time to time. Such new
|
||||||
|
versions will be similar in spirit to the present version, but may
|
||||||
|
differ in detail to address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Library as you received it specifies that a certain numbered version
|
||||||
|
of the GNU Lesser General Public License "or any later version"
|
||||||
|
applies to it, you have the option of following the terms and
|
||||||
|
conditions either of that published version or of any later version
|
||||||
|
published by the Free Software Foundation. If the Library as you
|
||||||
|
received it does not specify a version number of the GNU Lesser
|
||||||
|
General Public License, you may choose any version of the GNU Lesser
|
||||||
|
General Public License ever published by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Library as you received it specifies that a proxy can decide
|
||||||
|
whether future versions of the GNU Lesser General Public License shall
|
||||||
|
apply, that proxy's public statement of acceptance of any version is
|
||||||
|
permanent authorization for you to choose that version for the
|
||||||
|
Library.
|
||||||
58
intern/audaspace/FX/AUD_DelayFactory.cpp
Normal file
58
intern/audaspace/FX/AUD_DelayFactory.cpp
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* ***** BEGIN LGPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* Copyright 2009 Jörg Hermann Müller
|
||||||
|
*
|
||||||
|
* This file is part of AudaSpace.
|
||||||
|
*
|
||||||
|
* AudaSpace is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* AudaSpace is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with AudaSpace. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* ***** END LGPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "AUD_DelayFactory.h"
|
||||||
|
#include "AUD_DelayReader.h"
|
||||||
|
#include "AUD_Space.h"
|
||||||
|
|
||||||
|
AUD_DelayFactory::AUD_DelayFactory(AUD_IFactory* factory, float delay) :
|
||||||
|
AUD_EffectFactory(factory),
|
||||||
|
m_delay(delay) {}
|
||||||
|
|
||||||
|
AUD_DelayFactory::AUD_DelayFactory(float delay) :
|
||||||
|
AUD_EffectFactory(0),
|
||||||
|
m_delay(delay) {}
|
||||||
|
|
||||||
|
float AUD_DelayFactory::getDelay()
|
||||||
|
{
|
||||||
|
return m_delay;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AUD_DelayFactory::setDelay(float delay)
|
||||||
|
{
|
||||||
|
m_delay = delay;
|
||||||
|
}
|
||||||
|
|
||||||
|
AUD_IReader* AUD_DelayFactory::createReader()
|
||||||
|
{
|
||||||
|
AUD_IReader* reader = getReader();
|
||||||
|
|
||||||
|
if(reader != 0)
|
||||||
|
{
|
||||||
|
reader = new AUD_DelayReader(reader, m_delay); AUD_NEW("reader")
|
||||||
|
}
|
||||||
|
|
||||||
|
return reader;
|
||||||
|
}
|
||||||
70
intern/audaspace/FX/AUD_DelayFactory.h
Normal file
70
intern/audaspace/FX/AUD_DelayFactory.h
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* ***** BEGIN LGPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* Copyright 2009 Jörg Hermann Müller
|
||||||
|
*
|
||||||
|
* This file is part of AudaSpace.
|
||||||
|
*
|
||||||
|
* AudaSpace is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* AudaSpace is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with AudaSpace. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* ***** END LGPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef AUD_DELAYFACTORY
|
||||||
|
#define AUD_DELAYFACTORY
|
||||||
|
|
||||||
|
#include "AUD_EffectFactory.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This factory plays another factory delayed.
|
||||||
|
*/
|
||||||
|
class AUD_DelayFactory : public AUD_EffectFactory
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* The delay in samples.
|
||||||
|
*/
|
||||||
|
float m_delay;
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Creates a new delay factory.
|
||||||
|
* \param factory The input factory.
|
||||||
|
* \param delay The desired delay in seconds.
|
||||||
|
*/
|
||||||
|
AUD_DelayFactory(AUD_IFactory* factory = 0, float delay = 0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new delay factory.
|
||||||
|
* \param delay The desired delay in seconds.
|
||||||
|
*/
|
||||||
|
AUD_DelayFactory(float delay);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the delay in seconds.
|
||||||
|
*/
|
||||||
|
float getDelay();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the delay.
|
||||||
|
* \param delay The new delay value in seconds.
|
||||||
|
*/
|
||||||
|
void setDelay(float delay);
|
||||||
|
|
||||||
|
virtual AUD_IReader* createReader();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //AUD_DELAYFACTORY
|
||||||
111
intern/audaspace/FX/AUD_DelayReader.cpp
Normal file
111
intern/audaspace/FX/AUD_DelayReader.cpp
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* ***** BEGIN LGPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* Copyright 2009 Jörg Hermann Müller
|
||||||
|
*
|
||||||
|
* This file is part of AudaSpace.
|
||||||
|
*
|
||||||
|
* AudaSpace is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* AudaSpace is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with AudaSpace. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* ***** END LGPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "AUD_DelayReader.h"
|
||||||
|
#include "AUD_Buffer.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
AUD_DelayReader::AUD_DelayReader(AUD_IReader* reader, float delay) :
|
||||||
|
AUD_EffectReader(reader)
|
||||||
|
{
|
||||||
|
m_delay = (int)(delay * reader->getSpecs().rate);
|
||||||
|
m_remdelay = m_delay;
|
||||||
|
m_buffer = new AUD_Buffer(); AUD_NEW("buffer")
|
||||||
|
}
|
||||||
|
|
||||||
|
AUD_DelayReader::~AUD_DelayReader()
|
||||||
|
{
|
||||||
|
delete m_buffer; AUD_DELETE("buffer")
|
||||||
|
}
|
||||||
|
|
||||||
|
void AUD_DelayReader::seek(int position)
|
||||||
|
{
|
||||||
|
if(position < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(position < m_delay)
|
||||||
|
{
|
||||||
|
m_remdelay = m_delay - position;
|
||||||
|
m_reader->seek(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_remdelay = 0;
|
||||||
|
m_reader->seek(position - m_delay);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int AUD_DelayReader::getLength()
|
||||||
|
{
|
||||||
|
int len = m_reader->getLength();
|
||||||
|
if(len < 0)
|
||||||
|
return len;
|
||||||
|
return len+m_delay;
|
||||||
|
}
|
||||||
|
|
||||||
|
int AUD_DelayReader::getPosition()
|
||||||
|
{
|
||||||
|
if(m_remdelay > 0)
|
||||||
|
return m_delay-m_remdelay;
|
||||||
|
return m_reader->getPosition() + m_delay;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AUD_DelayReader::read(int & length, sample_t* & buffer)
|
||||||
|
{
|
||||||
|
if(m_remdelay > 0)
|
||||||
|
{
|
||||||
|
int samplesize = AUD_SAMPLE_SIZE(m_reader->getSpecs());
|
||||||
|
|
||||||
|
if(m_buffer->getSize() < length*samplesize)
|
||||||
|
m_buffer->resize(length*samplesize);
|
||||||
|
|
||||||
|
if(length > m_remdelay)
|
||||||
|
{
|
||||||
|
if(getSpecs().format == AUD_FORMAT_U8)
|
||||||
|
memset(m_buffer->getBuffer(), 0x80, m_remdelay*samplesize);
|
||||||
|
else
|
||||||
|
memset(m_buffer->getBuffer(), 0, m_remdelay*samplesize);
|
||||||
|
int len = length - m_remdelay;
|
||||||
|
m_reader->read(len, buffer);
|
||||||
|
memcpy(m_buffer->getBuffer()+m_remdelay*samplesize,
|
||||||
|
buffer, len*samplesize);
|
||||||
|
if(len < length-m_remdelay)
|
||||||
|
length = m_remdelay + len;
|
||||||
|
m_remdelay = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(getSpecs().format == AUD_FORMAT_U8)
|
||||||
|
memset(m_buffer->getBuffer(), 0x80, length*samplesize);
|
||||||
|
else
|
||||||
|
memset(m_buffer->getBuffer(), 0, length*samplesize);
|
||||||
|
m_remdelay -= length;
|
||||||
|
}
|
||||||
|
buffer = m_buffer->getBuffer();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
m_reader->read(length, buffer);
|
||||||
|
}
|
||||||
73
intern/audaspace/FX/AUD_DelayReader.h
Normal file
73
intern/audaspace/FX/AUD_DelayReader.h
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* ***** BEGIN LGPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* Copyright 2009 Jörg Hermann Müller
|
||||||
|
*
|
||||||
|
* This file is part of AudaSpace.
|
||||||
|
*
|
||||||
|
* AudaSpace is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* AudaSpace is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with AudaSpace. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* ***** END LGPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef AUD_DELAYREADER
|
||||||
|
#define AUD_DELAYREADER
|
||||||
|
|
||||||
|
#include "AUD_EffectReader.h"
|
||||||
|
class AUD_Buffer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class reads another reader and changes it's delay.
|
||||||
|
*/
|
||||||
|
class AUD_DelayReader : public AUD_EffectReader
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* The playback buffer.
|
||||||
|
*/
|
||||||
|
AUD_Buffer *m_buffer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The delay level.
|
||||||
|
*/
|
||||||
|
int m_delay;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The remaining delay for playback.
|
||||||
|
*/
|
||||||
|
int m_remdelay;
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Creates a new delay reader.
|
||||||
|
* \param reader The reader to read from.
|
||||||
|
* \param delay The delay in seconds.
|
||||||
|
* \exception AUD_Exception Thrown if the reader specified is NULL.
|
||||||
|
*/
|
||||||
|
AUD_DelayReader(AUD_IReader* reader, float delay);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destroys the reader.
|
||||||
|
*/
|
||||||
|
virtual ~AUD_DelayReader();
|
||||||
|
|
||||||
|
virtual void seek(int position);
|
||||||
|
virtual int getLength();
|
||||||
|
virtual int getPosition();
|
||||||
|
virtual void read(int & length, sample_t* & buffer);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //AUD_DELAYREADER
|
||||||
158
intern/audaspace/FX/AUD_DoubleReader.cpp
Normal file
158
intern/audaspace/FX/AUD_DoubleReader.cpp
Normal file
@@ -0,0 +1,158 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* ***** BEGIN LGPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* Copyright 2009 Jörg Hermann Müller
|
||||||
|
*
|
||||||
|
* This file is part of AudaSpace.
|
||||||
|
*
|
||||||
|
* AudaSpace is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* AudaSpace is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with AudaSpace. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* ***** END LGPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "AUD_DoubleReader.h"
|
||||||
|
#include "AUD_Buffer.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
AUD_DoubleReader::AUD_DoubleReader(AUD_IReader* reader1,
|
||||||
|
AUD_IReader* reader2) :
|
||||||
|
m_reader1(reader1), m_reader2(reader2)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if(!reader1)
|
||||||
|
AUD_THROW(AUD_ERROR_READER);
|
||||||
|
|
||||||
|
if(!reader2)
|
||||||
|
AUD_THROW(AUD_ERROR_READER);
|
||||||
|
|
||||||
|
AUD_Specs s1, s2;
|
||||||
|
s1 = reader1->getSpecs();
|
||||||
|
s2 = reader2->getSpecs();
|
||||||
|
if(memcmp(&s1, &s2, sizeof(AUD_Specs)) != 0)
|
||||||
|
AUD_THROW(AUD_ERROR_READER);
|
||||||
|
}
|
||||||
|
|
||||||
|
catch(AUD_Exception e)
|
||||||
|
{
|
||||||
|
if(reader1)
|
||||||
|
{
|
||||||
|
delete reader1; AUD_DELETE("reader")
|
||||||
|
}
|
||||||
|
if(reader2)
|
||||||
|
{
|
||||||
|
delete reader2; AUD_DELETE("reader")
|
||||||
|
}
|
||||||
|
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_buffer = new AUD_Buffer(); AUD_NEW("buffer")
|
||||||
|
m_finished1 = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
AUD_DoubleReader::~AUD_DoubleReader()
|
||||||
|
{
|
||||||
|
delete m_reader1; AUD_DELETE("reader")
|
||||||
|
delete m_reader2; AUD_DELETE("reader")
|
||||||
|
delete m_buffer; AUD_DELETE("buffer")
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AUD_DoubleReader::isSeekable()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AUD_DoubleReader::seek(int position)
|
||||||
|
{
|
||||||
|
int length1 = m_reader1->getLength();
|
||||||
|
|
||||||
|
if(position < 0)
|
||||||
|
position = 0;
|
||||||
|
|
||||||
|
if(position < length1)
|
||||||
|
{
|
||||||
|
m_reader1->seek(position);
|
||||||
|
m_reader2->seek(0);
|
||||||
|
m_finished1 = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_reader2->seek(position-length1);
|
||||||
|
m_finished1 = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int AUD_DoubleReader::getLength()
|
||||||
|
{
|
||||||
|
int len1 = m_reader1->getLength();
|
||||||
|
int len2 = m_reader2->getLength();
|
||||||
|
if(len1 < 0 || len2 < 0)
|
||||||
|
return -1;
|
||||||
|
return len1 + len2;
|
||||||
|
}
|
||||||
|
|
||||||
|
int AUD_DoubleReader::getPosition()
|
||||||
|
{
|
||||||
|
return m_reader1->getPosition() + m_reader2->getPosition();
|
||||||
|
}
|
||||||
|
|
||||||
|
AUD_Specs AUD_DoubleReader::getSpecs()
|
||||||
|
{
|
||||||
|
return m_reader1->getSpecs();
|
||||||
|
}
|
||||||
|
|
||||||
|
AUD_ReaderType AUD_DoubleReader::getType()
|
||||||
|
{
|
||||||
|
if(m_reader1->getType() == AUD_TYPE_BUFFER &&
|
||||||
|
m_reader2->getType() == AUD_TYPE_BUFFER)
|
||||||
|
return AUD_TYPE_BUFFER;
|
||||||
|
return AUD_TYPE_STREAM;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AUD_DoubleReader::notify(AUD_Message &message)
|
||||||
|
{
|
||||||
|
return m_reader1->notify(message) | m_reader2->notify(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AUD_DoubleReader::read(int & length, sample_t* & buffer)
|
||||||
|
{
|
||||||
|
if(!m_finished1)
|
||||||
|
{
|
||||||
|
int len = length;
|
||||||
|
m_reader1->read(len, buffer);
|
||||||
|
if(len < length)
|
||||||
|
{
|
||||||
|
int samplesize = AUD_SAMPLE_SIZE(m_reader1->getSpecs());
|
||||||
|
if(m_buffer->getSize() < length * samplesize)
|
||||||
|
m_buffer->resize(length * samplesize);
|
||||||
|
memcpy(m_buffer->getBuffer(), buffer, len*samplesize);
|
||||||
|
len = length - len;
|
||||||
|
length -= len;
|
||||||
|
m_reader2->read(len, buffer);
|
||||||
|
memcpy(m_buffer->getBuffer() + length*samplesize,
|
||||||
|
buffer, len*samplesize);
|
||||||
|
length += len;
|
||||||
|
buffer = m_buffer->getBuffer();
|
||||||
|
m_finished1 = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_reader2->read(length, buffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
83
intern/audaspace/FX/AUD_DoubleReader.h
Normal file
83
intern/audaspace/FX/AUD_DoubleReader.h
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* ***** BEGIN LGPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* Copyright 2009 Jörg Hermann Müller
|
||||||
|
*
|
||||||
|
* This file is part of AudaSpace.
|
||||||
|
*
|
||||||
|
* AudaSpace is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* AudaSpace is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with AudaSpace. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* ***** END LGPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef AUD_DOUBLEREADER
|
||||||
|
#define AUD_DOUBLEREADER
|
||||||
|
|
||||||
|
#include "AUD_IReader.h"
|
||||||
|
class AUD_Buffer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This reader plays two readers with the same specs sequently.
|
||||||
|
*/
|
||||||
|
class AUD_DoubleReader : public AUD_IReader
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* The first reader.
|
||||||
|
*/
|
||||||
|
AUD_IReader* m_reader1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The second reader.
|
||||||
|
*/
|
||||||
|
AUD_IReader* m_reader2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether we've reached the end of the first reader.
|
||||||
|
*/
|
||||||
|
bool m_finished1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The playback buffer for the intersecting part.
|
||||||
|
*/
|
||||||
|
AUD_Buffer* m_buffer;
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Creates a new ping pong reader.
|
||||||
|
* \param reader1 The first reader to read from.
|
||||||
|
* \param reader2 The second reader to read from.
|
||||||
|
* \exception AUD_Exception Thrown if one of the reader specified is NULL
|
||||||
|
* or the specs from the readers differ.
|
||||||
|
*/
|
||||||
|
AUD_DoubleReader(AUD_IReader* reader1, AUD_IReader* reader2);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destroys the reader.
|
||||||
|
*/
|
||||||
|
virtual ~AUD_DoubleReader();
|
||||||
|
|
||||||
|
virtual bool isSeekable();
|
||||||
|
virtual void seek(int position);
|
||||||
|
virtual int getLength();
|
||||||
|
virtual int getPosition();
|
||||||
|
virtual AUD_Specs getSpecs();
|
||||||
|
virtual AUD_ReaderType getType();
|
||||||
|
virtual bool notify(AUD_Message &message);
|
||||||
|
virtual void read(int & length, sample_t* & buffer);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //AUD_DOUBLEREADER
|
||||||
50
intern/audaspace/FX/AUD_EffectFactory.cpp
Normal file
50
intern/audaspace/FX/AUD_EffectFactory.cpp
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* ***** BEGIN LGPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* Copyright 2009 Jörg Hermann Müller
|
||||||
|
*
|
||||||
|
* This file is part of AudaSpace.
|
||||||
|
*
|
||||||
|
* AudaSpace is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* AudaSpace is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with AudaSpace. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* ***** END LGPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "AUD_EffectFactory.h"
|
||||||
|
#include "AUD_IReader.h"
|
||||||
|
|
||||||
|
AUD_IReader* AUD_EffectFactory::getReader()
|
||||||
|
{
|
||||||
|
if(m_factory != 0)
|
||||||
|
return m_factory->createReader();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
AUD_EffectFactory::AUD_EffectFactory(AUD_IFactory* factory)
|
||||||
|
{
|
||||||
|
m_factory = factory;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AUD_EffectFactory::setFactory(AUD_IFactory* factory)
|
||||||
|
{
|
||||||
|
m_factory = factory;
|
||||||
|
}
|
||||||
|
|
||||||
|
AUD_IFactory* AUD_EffectFactory::getFactory()
|
||||||
|
{
|
||||||
|
return m_factory;
|
||||||
|
}
|
||||||
76
intern/audaspace/FX/AUD_EffectFactory.h
Normal file
76
intern/audaspace/FX/AUD_EffectFactory.h
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* ***** BEGIN LGPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* Copyright 2009 Jörg Hermann Müller
|
||||||
|
*
|
||||||
|
* This file is part of AudaSpace.
|
||||||
|
*
|
||||||
|
* AudaSpace is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* AudaSpace is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with AudaSpace. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* ***** END LGPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef AUD_EFFECTFACTORY
|
||||||
|
#define AUD_EFFECTFACTORY
|
||||||
|
|
||||||
|
#include "AUD_IFactory.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This factory is a base class for all effect factories that take one other
|
||||||
|
* factory as input.
|
||||||
|
*/
|
||||||
|
class AUD_EffectFactory : public AUD_IFactory
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
/**
|
||||||
|
* If there is no reader it is created out of this factory.
|
||||||
|
*/
|
||||||
|
AUD_IFactory* m_factory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the reader created out of the factory.
|
||||||
|
* This method can be used for the createReader function of the implementing
|
||||||
|
* classes.
|
||||||
|
* \return The reader created out of the factory or NULL if there is none.
|
||||||
|
*/
|
||||||
|
AUD_IReader* getReader();
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Creates a new factory.
|
||||||
|
* \param factory The input factory.
|
||||||
|
*/
|
||||||
|
AUD_EffectFactory(AUD_IFactory* factory);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destroys the factory.
|
||||||
|
*/
|
||||||
|
virtual ~AUD_EffectFactory() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the input factory.
|
||||||
|
* \param factory The input factory.
|
||||||
|
*/
|
||||||
|
void setFactory(AUD_IFactory* factory);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the saved factory.
|
||||||
|
* \return The factory or NULL if there has no factory been saved.
|
||||||
|
*/
|
||||||
|
AUD_IFactory* getFactory();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //AUD_EFFECTFACTORY
|
||||||
78
intern/audaspace/FX/AUD_EffectReader.cpp
Normal file
78
intern/audaspace/FX/AUD_EffectReader.cpp
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* ***** BEGIN LGPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* Copyright 2009 Jörg Hermann Müller
|
||||||
|
*
|
||||||
|
* This file is part of AudaSpace.
|
||||||
|
*
|
||||||
|
* AudaSpace is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* AudaSpace is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with AudaSpace. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* ***** END LGPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "AUD_EffectReader.h"
|
||||||
|
|
||||||
|
AUD_EffectReader::AUD_EffectReader(AUD_IReader* reader)
|
||||||
|
{
|
||||||
|
if(!reader)
|
||||||
|
AUD_THROW(AUD_ERROR_READER);
|
||||||
|
m_reader = reader;
|
||||||
|
}
|
||||||
|
|
||||||
|
AUD_EffectReader::~AUD_EffectReader()
|
||||||
|
{
|
||||||
|
delete m_reader; AUD_DELETE("reader")
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AUD_EffectReader::isSeekable()
|
||||||
|
{
|
||||||
|
return m_reader->isSeekable();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AUD_EffectReader::seek(int position)
|
||||||
|
{
|
||||||
|
m_reader->seek(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
int AUD_EffectReader::getLength()
|
||||||
|
{
|
||||||
|
return m_reader->getLength();
|
||||||
|
}
|
||||||
|
|
||||||
|
int AUD_EffectReader::getPosition()
|
||||||
|
{
|
||||||
|
return m_reader->getPosition();
|
||||||
|
}
|
||||||
|
|
||||||
|
AUD_Specs AUD_EffectReader::getSpecs()
|
||||||
|
{
|
||||||
|
return m_reader->getSpecs();
|
||||||
|
}
|
||||||
|
|
||||||
|
AUD_ReaderType AUD_EffectReader::getType()
|
||||||
|
{
|
||||||
|
return m_reader->getType();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AUD_EffectReader::notify(AUD_Message &message)
|
||||||
|
{
|
||||||
|
return m_reader->notify(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AUD_EffectReader::read(int & length, sample_t* & buffer)
|
||||||
|
{
|
||||||
|
m_reader->read(length, buffer);
|
||||||
|
}
|
||||||
66
intern/audaspace/FX/AUD_EffectReader.h
Normal file
66
intern/audaspace/FX/AUD_EffectReader.h
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* ***** BEGIN LGPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* Copyright 2009 Jörg Hermann Müller
|
||||||
|
*
|
||||||
|
* This file is part of AudaSpace.
|
||||||
|
*
|
||||||
|
* AudaSpace is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* AudaSpace is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with AudaSpace. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* ***** END LGPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef AUD_EFFECTREADER
|
||||||
|
#define AUD_EFFECTREADER
|
||||||
|
|
||||||
|
#include "AUD_IReader.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This reader is a base class for all effect readers that take one other reader
|
||||||
|
* as input.
|
||||||
|
*/
|
||||||
|
class AUD_EffectReader : public AUD_IReader
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
/**
|
||||||
|
* The reader to read from.
|
||||||
|
*/
|
||||||
|
AUD_IReader* m_reader;
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Creates a new effect reader.
|
||||||
|
* \param reader The reader to read from.
|
||||||
|
* \exception AUD_Exception Thrown if the reader specified is NULL.
|
||||||
|
*/
|
||||||
|
AUD_EffectReader(AUD_IReader* reader);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destroys the reader.
|
||||||
|
*/
|
||||||
|
virtual ~AUD_EffectReader();
|
||||||
|
|
||||||
|
virtual bool isSeekable();
|
||||||
|
virtual void seek(int position);
|
||||||
|
virtual int getLength();
|
||||||
|
virtual int getPosition();
|
||||||
|
virtual AUD_Specs getSpecs();
|
||||||
|
virtual AUD_ReaderType getType();
|
||||||
|
virtual bool notify(AUD_Message &message);
|
||||||
|
virtual void read(int & length, sample_t* & buffer);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //AUD_EFFECTREADER
|
||||||
84
intern/audaspace/FX/AUD_FaderFactory.cpp
Normal file
84
intern/audaspace/FX/AUD_FaderFactory.cpp
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* ***** BEGIN LGPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* Copyright 2009 Jörg Hermann Müller
|
||||||
|
*
|
||||||
|
* This file is part of AudaSpace.
|
||||||
|
*
|
||||||
|
* AudaSpace is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* AudaSpace is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with AudaSpace. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* ***** END LGPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "AUD_FaderFactory.h"
|
||||||
|
#include "AUD_FaderReader.h"
|
||||||
|
|
||||||
|
AUD_FaderFactory::AUD_FaderFactory(AUD_IFactory* factory, AUD_FadeType type,
|
||||||
|
float start, float length) :
|
||||||
|
AUD_EffectFactory(factory),
|
||||||
|
m_type(type),
|
||||||
|
m_start(start),
|
||||||
|
m_length(length) {}
|
||||||
|
|
||||||
|
AUD_FaderFactory::AUD_FaderFactory(AUD_FadeType type,
|
||||||
|
float start, float length) :
|
||||||
|
AUD_EffectFactory(0),
|
||||||
|
m_type(type),
|
||||||
|
m_start(start),
|
||||||
|
m_length(length) {}
|
||||||
|
|
||||||
|
AUD_FadeType AUD_FaderFactory::getType()
|
||||||
|
{
|
||||||
|
return m_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AUD_FaderFactory::setType(AUD_FadeType type)
|
||||||
|
{
|
||||||
|
m_type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
float AUD_FaderFactory::getStart()
|
||||||
|
{
|
||||||
|
return m_start;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AUD_FaderFactory::setStart(float start)
|
||||||
|
{
|
||||||
|
m_start = start;
|
||||||
|
}
|
||||||
|
|
||||||
|
float AUD_FaderFactory::getLength()
|
||||||
|
{
|
||||||
|
return m_length;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AUD_FaderFactory::setLength(float length)
|
||||||
|
{
|
||||||
|
m_length = length;
|
||||||
|
}
|
||||||
|
|
||||||
|
AUD_IReader* AUD_FaderFactory::createReader()
|
||||||
|
{
|
||||||
|
AUD_IReader* reader = getReader();
|
||||||
|
|
||||||
|
if(reader != 0)
|
||||||
|
{
|
||||||
|
reader = new AUD_FaderReader(reader, m_type, m_start, m_length);
|
||||||
|
AUD_NEW("reader")
|
||||||
|
}
|
||||||
|
|
||||||
|
return reader;
|
||||||
|
}
|
||||||
111
intern/audaspace/FX/AUD_FaderFactory.h
Normal file
111
intern/audaspace/FX/AUD_FaderFactory.h
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* ***** BEGIN LGPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* Copyright 2009 Jörg Hermann Müller
|
||||||
|
*
|
||||||
|
* This file is part of AudaSpace.
|
||||||
|
*
|
||||||
|
* AudaSpace is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* AudaSpace is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with AudaSpace. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* ***** END LGPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef AUD_FADERFACTORY
|
||||||
|
#define AUD_FADERFACTORY
|
||||||
|
|
||||||
|
#include "AUD_EffectFactory.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This factory fades another factory.
|
||||||
|
* If the fading type is AUD_FADE_IN, everything before the fading start will be
|
||||||
|
* silenced, for AUD_FADE_OUT that's true for everything after fading ends.
|
||||||
|
*/
|
||||||
|
class AUD_FaderFactory : public AUD_EffectFactory
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* The fading type.
|
||||||
|
*/
|
||||||
|
AUD_FadeType m_type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The fading start.
|
||||||
|
*/
|
||||||
|
float m_start;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The fading length.
|
||||||
|
*/
|
||||||
|
float m_length;
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Creates a new fader factory.
|
||||||
|
* \param factory The input factory.
|
||||||
|
* \param type The fading type.
|
||||||
|
* \param start The time where fading should start in seconds.
|
||||||
|
* \param length How long fading should last in seconds.
|
||||||
|
*/
|
||||||
|
AUD_FaderFactory(AUD_IFactory* factory = 0,
|
||||||
|
AUD_FadeType type = AUD_FADE_IN,
|
||||||
|
float start = 0.0f, float length = 1.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new fader factory.
|
||||||
|
* \param type The fading type.
|
||||||
|
* \param start The time where fading should start in seconds.
|
||||||
|
* \param length How long fading should last in seconds.
|
||||||
|
*/
|
||||||
|
AUD_FaderFactory(AUD_FadeType type = AUD_FADE_IN,
|
||||||
|
float start = 0.0f, float length = 1.0f);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the fading type.
|
||||||
|
*/
|
||||||
|
AUD_FadeType getType();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the fading type.
|
||||||
|
* \param type The new fading type: AUD_FADE_IN or AUD_FADE_OUT.
|
||||||
|
*/
|
||||||
|
void setType(AUD_FadeType type);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the fading start.
|
||||||
|
*/
|
||||||
|
float getStart();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the fading start.
|
||||||
|
* \param start The new fading start.
|
||||||
|
*/
|
||||||
|
void setStart(float start);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the fading length.
|
||||||
|
*/
|
||||||
|
float getLength();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the fading length.
|
||||||
|
* \param start The new fading length.
|
||||||
|
*/
|
||||||
|
void setLength(float length);
|
||||||
|
|
||||||
|
virtual AUD_IReader* createReader();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //AUD_FADERFACTORY
|
||||||
133
intern/audaspace/FX/AUD_FaderReader.cpp
Normal file
133
intern/audaspace/FX/AUD_FaderReader.cpp
Normal file
@@ -0,0 +1,133 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* ***** BEGIN LGPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* Copyright 2009 Jörg Hermann Müller
|
||||||
|
*
|
||||||
|
* This file is part of AudaSpace.
|
||||||
|
*
|
||||||
|
* AudaSpace is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* AudaSpace is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with AudaSpace. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* ***** END LGPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "AUD_FaderReader.h"
|
||||||
|
#include "AUD_Buffer.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
AUD_FaderReader::AUD_FaderReader(AUD_IReader* reader, AUD_FadeType type,
|
||||||
|
float start,float length) :
|
||||||
|
AUD_EffectReader(reader),
|
||||||
|
m_type(type),
|
||||||
|
m_start(start),
|
||||||
|
m_length(length)
|
||||||
|
{
|
||||||
|
int bigendian = 1;
|
||||||
|
bigendian = (((char*)&bigendian)[0]) ? 0: 1; // 1 if Big Endian
|
||||||
|
|
||||||
|
switch(m_reader->getSpecs().format)
|
||||||
|
{
|
||||||
|
case AUD_FORMAT_S16:
|
||||||
|
m_adjust = AUD_volume_adjust<int16_t>;
|
||||||
|
break;
|
||||||
|
case AUD_FORMAT_S32:
|
||||||
|
m_adjust = AUD_volume_adjust<int32_t>;
|
||||||
|
break;
|
||||||
|
case AUD_FORMAT_FLOAT32:
|
||||||
|
m_adjust = AUD_volume_adjust<float>;
|
||||||
|
break;
|
||||||
|
case AUD_FORMAT_FLOAT64:
|
||||||
|
m_adjust = AUD_volume_adjust<double>;
|
||||||
|
break;
|
||||||
|
case AUD_FORMAT_U8:
|
||||||
|
m_adjust = AUD_volume_adjust_u8;
|
||||||
|
break;
|
||||||
|
case AUD_FORMAT_S24:
|
||||||
|
m_adjust = bigendian ? AUD_volume_adjust_s24_be :
|
||||||
|
AUD_volume_adjust_s24_le;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
delete m_reader;
|
||||||
|
AUD_THROW(AUD_ERROR_READER);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_buffer = new AUD_Buffer(); AUD_NEW("buffer")
|
||||||
|
}
|
||||||
|
|
||||||
|
AUD_FaderReader::~AUD_FaderReader()
|
||||||
|
{
|
||||||
|
delete m_buffer; AUD_DELETE("buffer")
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AUD_FaderReader::notify(AUD_Message &message)
|
||||||
|
{
|
||||||
|
return m_reader->notify(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AUD_FaderReader::read(int & length, sample_t* & buffer)
|
||||||
|
{
|
||||||
|
int position = m_reader->getPosition();
|
||||||
|
AUD_Specs specs = m_reader->getSpecs();
|
||||||
|
int samplesize = AUD_SAMPLE_SIZE(specs);
|
||||||
|
|
||||||
|
m_reader->read(length, buffer);
|
||||||
|
|
||||||
|
if(m_buffer->getSize() < length * samplesize)
|
||||||
|
m_buffer->resize(length * samplesize);
|
||||||
|
|
||||||
|
if((position + length) / (float)specs.rate <= m_start)
|
||||||
|
{
|
||||||
|
if(m_type != AUD_FADE_OUT)
|
||||||
|
{
|
||||||
|
buffer = m_buffer->getBuffer();
|
||||||
|
memset(buffer,
|
||||||
|
specs.format == AUD_FORMAT_U8 ? 0x80 : 0,
|
||||||
|
length * samplesize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(position / (float)specs.rate >= m_start+m_length)
|
||||||
|
{
|
||||||
|
if(m_type == AUD_FADE_OUT)
|
||||||
|
{
|
||||||
|
buffer = m_buffer->getBuffer();
|
||||||
|
memset(buffer,
|
||||||
|
specs.format == AUD_FORMAT_U8 ? 0x80 : 0,
|
||||||
|
length * samplesize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sample_t* buf = m_buffer->getBuffer();
|
||||||
|
float volume;
|
||||||
|
|
||||||
|
for(int i = 0; i < length; i++)
|
||||||
|
{
|
||||||
|
volume = (((position+i)/(float)specs.rate)-m_start) / m_length;
|
||||||
|
if(volume > 1.0f)
|
||||||
|
volume = 1.0f;
|
||||||
|
else if(volume < 0.0f)
|
||||||
|
volume = 0.0f;
|
||||||
|
|
||||||
|
if(m_type == AUD_FADE_OUT)
|
||||||
|
volume = 1.0f - volume;
|
||||||
|
|
||||||
|
m_adjust(buf + i * samplesize, buffer + i * samplesize,
|
||||||
|
specs.channels, volume);
|
||||||
|
}
|
||||||
|
|
||||||
|
buffer = buf;
|
||||||
|
}
|
||||||
|
}
|
||||||
86
intern/audaspace/FX/AUD_FaderReader.h
Normal file
86
intern/audaspace/FX/AUD_FaderReader.h
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* ***** BEGIN LGPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* Copyright 2009 Jörg Hermann Müller
|
||||||
|
*
|
||||||
|
* This file is part of AudaSpace.
|
||||||
|
*
|
||||||
|
* AudaSpace is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* AudaSpace is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with AudaSpace. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* ***** END LGPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef AUD_FADERREADER
|
||||||
|
#define AUD_FADERREADER
|
||||||
|
|
||||||
|
#include "AUD_EffectReader.h"
|
||||||
|
#include "AUD_ConverterFunctions.h"
|
||||||
|
class AUD_Buffer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class fades another reader.
|
||||||
|
* If the fading type is AUD_FADE_IN, everything before the fading start will be
|
||||||
|
* silenced, for AUD_FADE_OUT that's true for everything after fading ends.
|
||||||
|
*/
|
||||||
|
class AUD_FaderReader : public AUD_EffectReader
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* The playback buffer.
|
||||||
|
*/
|
||||||
|
AUD_Buffer *m_buffer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The fading type.
|
||||||
|
*/
|
||||||
|
AUD_FadeType m_type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The fading start.
|
||||||
|
*/
|
||||||
|
float m_start;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The fading length.
|
||||||
|
*/
|
||||||
|
float m_length;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Volume adjustment function.
|
||||||
|
*/
|
||||||
|
AUD_volume_adjust_f m_adjust;
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Creates a new fader reader.
|
||||||
|
* \param type The fading type.
|
||||||
|
* \param start The time where fading should start in seconds.
|
||||||
|
* \param length How long fading should last in seconds.
|
||||||
|
* \exception AUD_Exception Thrown if the reader specified is NULL.
|
||||||
|
*/
|
||||||
|
AUD_FaderReader(AUD_IReader* reader, AUD_FadeType type,
|
||||||
|
float start,float length);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destroys the reader.
|
||||||
|
*/
|
||||||
|
virtual ~AUD_FaderReader();
|
||||||
|
|
||||||
|
virtual bool notify(AUD_Message &message);
|
||||||
|
virtual void read(int & length, sample_t* & buffer);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //AUD_FADERREADER
|
||||||
67
intern/audaspace/FX/AUD_LimiterFactory.cpp
Normal file
67
intern/audaspace/FX/AUD_LimiterFactory.cpp
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* ***** BEGIN LGPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* Copyright 2009 Jörg Hermann Müller
|
||||||
|
*
|
||||||
|
* This file is part of AudaSpace.
|
||||||
|
*
|
||||||
|
* AudaSpace is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* AudaSpace is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with AudaSpace. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* ***** END LGPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "AUD_LimiterFactory.h"
|
||||||
|
#include "AUD_LimiterReader.h"
|
||||||
|
#include "AUD_Space.h"
|
||||||
|
|
||||||
|
AUD_LimiterFactory::AUD_LimiterFactory(AUD_IFactory* factory,
|
||||||
|
float start, float end) :
|
||||||
|
AUD_EffectFactory(factory),
|
||||||
|
m_start(start),
|
||||||
|
m_end(end) {}
|
||||||
|
|
||||||
|
float AUD_LimiterFactory::getStart()
|
||||||
|
{
|
||||||
|
return m_start;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AUD_LimiterFactory::setStart(float start)
|
||||||
|
{
|
||||||
|
m_start = start;
|
||||||
|
}
|
||||||
|
|
||||||
|
float AUD_LimiterFactory::getEnd()
|
||||||
|
{
|
||||||
|
return m_end;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AUD_LimiterFactory::setEnd(float end)
|
||||||
|
{
|
||||||
|
m_end = end;
|
||||||
|
}
|
||||||
|
|
||||||
|
AUD_IReader* AUD_LimiterFactory::createReader()
|
||||||
|
{
|
||||||
|
AUD_IReader* reader = getReader();
|
||||||
|
|
||||||
|
if(reader != 0)
|
||||||
|
{
|
||||||
|
reader = new AUD_LimiterReader(reader, m_start, m_end);
|
||||||
|
AUD_NEW("reader")
|
||||||
|
}
|
||||||
|
|
||||||
|
return reader;
|
||||||
|
}
|
||||||
84
intern/audaspace/FX/AUD_LimiterFactory.h
Normal file
84
intern/audaspace/FX/AUD_LimiterFactory.h
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* ***** BEGIN LGPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* Copyright 2009 Jörg Hermann Müller
|
||||||
|
*
|
||||||
|
* This file is part of AudaSpace.
|
||||||
|
*
|
||||||
|
* AudaSpace is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* AudaSpace is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with AudaSpace. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* ***** END LGPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef AUD_LIMITERFACTORY
|
||||||
|
#define AUD_LIMITERFACTORY
|
||||||
|
|
||||||
|
#include "AUD_EffectFactory.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This factory limits another factory in start and end time.
|
||||||
|
*/
|
||||||
|
class AUD_LimiterFactory : public AUD_EffectFactory
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* The start time.
|
||||||
|
*/
|
||||||
|
float m_start;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The end time.
|
||||||
|
*/
|
||||||
|
float m_end;
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Creates a new limiter factory.
|
||||||
|
* \param factory The input factory.
|
||||||
|
* \param start The desired start time.
|
||||||
|
* \param end The desired end time, a negative value signals that it should
|
||||||
|
* play to the end.
|
||||||
|
*/
|
||||||
|
AUD_LimiterFactory(AUD_IFactory* factory = 0,
|
||||||
|
float start = 0, float end = -1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the start time.
|
||||||
|
*/
|
||||||
|
float getStart();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the start time.
|
||||||
|
* \param start The new start time.
|
||||||
|
*/
|
||||||
|
void setStart(float start);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the end time.
|
||||||
|
*/
|
||||||
|
float getEnd();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the end time.
|
||||||
|
* \param end The new end time, a negative value signals that it should play
|
||||||
|
* to the end.
|
||||||
|
*/
|
||||||
|
void setEnd(float end);
|
||||||
|
|
||||||
|
virtual AUD_IReader* createReader();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //AUD_LIMITERFACTORY
|
||||||
95
intern/audaspace/FX/AUD_LimiterReader.cpp
Normal file
95
intern/audaspace/FX/AUD_LimiterReader.cpp
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* ***** BEGIN LGPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* Copyright 2009 Jörg Hermann Müller
|
||||||
|
*
|
||||||
|
* This file is part of AudaSpace.
|
||||||
|
*
|
||||||
|
* AudaSpace is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* AudaSpace is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with AudaSpace. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* ***** END LGPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "AUD_LimiterReader.h"
|
||||||
|
#include "AUD_Buffer.h"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
AUD_LimiterReader::AUD_LimiterReader(AUD_IReader* reader,
|
||||||
|
float start, float end) :
|
||||||
|
AUD_EffectReader(reader)
|
||||||
|
{
|
||||||
|
m_end = (int)(end * reader->getSpecs().rate);
|
||||||
|
|
||||||
|
if(start <= 0)
|
||||||
|
m_start = 0;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_start = (int)(start * reader->getSpecs().rate);
|
||||||
|
if(m_reader->isSeekable())
|
||||||
|
m_reader->seek(m_start);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// skip first m_start samples by reading them
|
||||||
|
int length;
|
||||||
|
sample_t* buffer;
|
||||||
|
for(int i = m_start;
|
||||||
|
i >= AUD_DEFAULT_BUFFER_SIZE;
|
||||||
|
i -= AUD_DEFAULT_BUFFER_SIZE)
|
||||||
|
{
|
||||||
|
length = AUD_DEFAULT_BUFFER_SIZE;
|
||||||
|
m_reader->read(length, buffer);
|
||||||
|
length = i;
|
||||||
|
}
|
||||||
|
m_reader->read(length, buffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AUD_LimiterReader::seek(int position)
|
||||||
|
{
|
||||||
|
m_reader->seek(position + m_start);
|
||||||
|
}
|
||||||
|
|
||||||
|
int AUD_LimiterReader::getLength()
|
||||||
|
{
|
||||||
|
int len = m_reader->getLength();
|
||||||
|
if(m_reader->getType() != AUD_TYPE_BUFFER || len < 0 ||
|
||||||
|
(len > m_end && m_end >= 0))
|
||||||
|
len = m_end;
|
||||||
|
return len - m_start;
|
||||||
|
}
|
||||||
|
|
||||||
|
int AUD_LimiterReader::getPosition()
|
||||||
|
{
|
||||||
|
return m_reader->getPosition() - m_start;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AUD_LimiterReader::read(int & length, sample_t* & buffer)
|
||||||
|
{
|
||||||
|
if(m_end >= 0)
|
||||||
|
{
|
||||||
|
int position = m_reader->getPosition();
|
||||||
|
if(position+length > m_end)
|
||||||
|
length = m_end - position;
|
||||||
|
if(length < 0)
|
||||||
|
{
|
||||||
|
length = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_reader->read(length, buffer);
|
||||||
|
}
|
||||||
64
intern/audaspace/FX/AUD_LimiterReader.h
Normal file
64
intern/audaspace/FX/AUD_LimiterReader.h
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* ***** BEGIN LGPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* Copyright 2009 Jörg Hermann Müller
|
||||||
|
*
|
||||||
|
* This file is part of AudaSpace.
|
||||||
|
*
|
||||||
|
* AudaSpace is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* AudaSpace is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with AudaSpace. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* ***** END LGPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef AUD_LIMITERREADER
|
||||||
|
#define AUD_LIMITERREADER
|
||||||
|
|
||||||
|
#include "AUD_EffectReader.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This reader limits another reader in start and end sample.
|
||||||
|
*/
|
||||||
|
class AUD_LimiterReader : public AUD_EffectReader
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* The start sample: inclusive.
|
||||||
|
*/
|
||||||
|
int m_start;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The end sample: exlusive.
|
||||||
|
*/
|
||||||
|
int m_end;
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Creates a new limiter reader.
|
||||||
|
* \param reader The reader to read from.
|
||||||
|
* \param start The desired start sample (inclusive).
|
||||||
|
* \param end The desired end sample (exklusive), a negative value signals
|
||||||
|
* that it should play to the end.
|
||||||
|
* \exception AUD_Exception Thrown if the reader specified is NULL.
|
||||||
|
*/
|
||||||
|
AUD_LimiterReader(AUD_IReader* reader, float start = 0, float end = -1);
|
||||||
|
|
||||||
|
virtual void seek(int position);
|
||||||
|
virtual int getLength();
|
||||||
|
virtual int getPosition();
|
||||||
|
virtual void read(int & length, sample_t* & buffer);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //AUD_LIMITERREADER
|
||||||
57
intern/audaspace/FX/AUD_LoopFactory.cpp
Normal file
57
intern/audaspace/FX/AUD_LoopFactory.cpp
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* ***** BEGIN LGPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* Copyright 2009 Jörg Hermann Müller
|
||||||
|
*
|
||||||
|
* This file is part of AudaSpace.
|
||||||
|
*
|
||||||
|
* AudaSpace is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* AudaSpace is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with AudaSpace. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* ***** END LGPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "AUD_LoopFactory.h"
|
||||||
|
#include "AUD_LoopReader.h"
|
||||||
|
|
||||||
|
AUD_LoopFactory::AUD_LoopFactory(AUD_IFactory* factory, int loop) :
|
||||||
|
AUD_EffectFactory(factory),
|
||||||
|
m_loop(loop) {}
|
||||||
|
|
||||||
|
AUD_LoopFactory::AUD_LoopFactory(int loop) :
|
||||||
|
AUD_EffectFactory(0),
|
||||||
|
m_loop(loop) {}
|
||||||
|
|
||||||
|
int AUD_LoopFactory::getLoop()
|
||||||
|
{
|
||||||
|
return m_loop;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AUD_LoopFactory::setLoop(int loop)
|
||||||
|
{
|
||||||
|
m_loop = loop;
|
||||||
|
}
|
||||||
|
|
||||||
|
AUD_IReader* AUD_LoopFactory::createReader()
|
||||||
|
{
|
||||||
|
AUD_IReader* reader = getReader();
|
||||||
|
|
||||||
|
if(reader != 0)
|
||||||
|
{
|
||||||
|
reader = new AUD_LoopReader(reader, m_loop); AUD_NEW("reader")
|
||||||
|
}
|
||||||
|
|
||||||
|
return reader;
|
||||||
|
}
|
||||||
74
intern/audaspace/FX/AUD_LoopFactory.h
Normal file
74
intern/audaspace/FX/AUD_LoopFactory.h
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* ***** BEGIN LGPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* Copyright 2009 Jörg Hermann Müller
|
||||||
|
*
|
||||||
|
* This file is part of AudaSpace.
|
||||||
|
*
|
||||||
|
* AudaSpace is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* AudaSpace is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with AudaSpace. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* ***** END LGPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef AUD_LOOPFACTORY
|
||||||
|
#define AUD_LOOPFACTORY
|
||||||
|
|
||||||
|
#include "AUD_EffectFactory.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This factory loops another factory.
|
||||||
|
* \note The reader has to be seekable.
|
||||||
|
*/
|
||||||
|
class AUD_LoopFactory : public AUD_EffectFactory
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* The loop count.
|
||||||
|
*/
|
||||||
|
float m_loop;
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Creates a new loop factory.
|
||||||
|
* \param factory The input factory.
|
||||||
|
* \param loop The desired loop count, negative values result in endless
|
||||||
|
* looping.
|
||||||
|
*/
|
||||||
|
AUD_LoopFactory(AUD_IFactory* factory = 0, int loop = -1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new loop factory.
|
||||||
|
* \param loop The desired loop count, negative values result in endless
|
||||||
|
* looping.
|
||||||
|
*/
|
||||||
|
AUD_LoopFactory(int loop);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the loop count.
|
||||||
|
*/
|
||||||
|
int getLoop();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the loop count.
|
||||||
|
* \param loop The desired loop count, negative values result in endless
|
||||||
|
* looping.
|
||||||
|
*/
|
||||||
|
void setLoop(int loop);
|
||||||
|
|
||||||
|
virtual AUD_IReader* createReader();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //AUD_LOOPFACTORY
|
||||||
107
intern/audaspace/FX/AUD_LoopReader.cpp
Normal file
107
intern/audaspace/FX/AUD_LoopReader.cpp
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* ***** BEGIN LGPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* Copyright 2009 Jörg Hermann Müller
|
||||||
|
*
|
||||||
|
* This file is part of AudaSpace.
|
||||||
|
*
|
||||||
|
* AudaSpace is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* AudaSpace is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with AudaSpace. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* ***** END LGPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "AUD_LoopReader.h"
|
||||||
|
#include "AUD_Buffer.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
AUD_LoopReader::AUD_LoopReader(AUD_IReader* reader, int loop) :
|
||||||
|
AUD_EffectReader(reader), m_loop(loop)
|
||||||
|
{
|
||||||
|
m_buffer = new AUD_Buffer(); AUD_NEW("buffer")
|
||||||
|
}
|
||||||
|
|
||||||
|
AUD_LoopReader::~AUD_LoopReader()
|
||||||
|
{
|
||||||
|
delete m_buffer; AUD_DELETE("buffer")
|
||||||
|
}
|
||||||
|
|
||||||
|
AUD_ReaderType AUD_LoopReader::getType()
|
||||||
|
{
|
||||||
|
if(m_loop < 0)
|
||||||
|
return AUD_TYPE_STREAM;
|
||||||
|
return m_reader->getType();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AUD_LoopReader::notify(AUD_Message &message)
|
||||||
|
{
|
||||||
|
if(message.type == AUD_MSG_LOOP)
|
||||||
|
{
|
||||||
|
m_loop = message.loopcount;
|
||||||
|
|
||||||
|
m_reader->notify(message);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return m_reader->notify(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AUD_LoopReader::read(int & length, sample_t* & buffer)
|
||||||
|
{
|
||||||
|
int samplesize = AUD_SAMPLE_SIZE(m_reader->getSpecs());
|
||||||
|
|
||||||
|
int len = length;
|
||||||
|
|
||||||
|
m_reader->read(len, buffer);
|
||||||
|
|
||||||
|
if(len < length && m_loop != 0)
|
||||||
|
{
|
||||||
|
int pos = 0;
|
||||||
|
|
||||||
|
if(m_buffer->getSize() < length*samplesize)
|
||||||
|
m_buffer->resize(length*samplesize);
|
||||||
|
|
||||||
|
memcpy(m_buffer->getBuffer() + pos * samplesize,
|
||||||
|
buffer, len * samplesize);
|
||||||
|
|
||||||
|
pos += len;
|
||||||
|
|
||||||
|
while(pos < length && m_loop != 0)
|
||||||
|
{
|
||||||
|
if(m_loop > 0)
|
||||||
|
m_loop--;
|
||||||
|
|
||||||
|
m_reader->seek(0);
|
||||||
|
|
||||||
|
len = length - pos;
|
||||||
|
m_reader->read(len, buffer);
|
||||||
|
// prevent endless loop
|
||||||
|
if(!len)
|
||||||
|
break;
|
||||||
|
|
||||||
|
memcpy(m_buffer->getBuffer() + pos * samplesize,
|
||||||
|
buffer, len * samplesize);
|
||||||
|
|
||||||
|
pos += len;
|
||||||
|
}
|
||||||
|
|
||||||
|
length = pos;
|
||||||
|
buffer = m_buffer->getBuffer();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
length = len;
|
||||||
|
}
|
||||||
69
intern/audaspace/FX/AUD_LoopReader.h
Normal file
69
intern/audaspace/FX/AUD_LoopReader.h
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* ***** BEGIN LGPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* Copyright 2009 Jörg Hermann Müller
|
||||||
|
*
|
||||||
|
* This file is part of AudaSpace.
|
||||||
|
*
|
||||||
|
* AudaSpace is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* AudaSpace is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with AudaSpace. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* ***** END LGPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef AUD_LOOPREADER
|
||||||
|
#define AUD_LOOPREADER
|
||||||
|
|
||||||
|
#include "AUD_EffectReader.h"
|
||||||
|
class AUD_Buffer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class reads another reader and loops it.
|
||||||
|
* \note The other reader must be seekable.
|
||||||
|
*/
|
||||||
|
class AUD_LoopReader : public AUD_EffectReader
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* The playback buffer.
|
||||||
|
*/
|
||||||
|
AUD_Buffer *m_buffer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The left loop count.
|
||||||
|
*/
|
||||||
|
int m_loop;
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Creates a new loop reader.
|
||||||
|
* \param reader The reader to read from.
|
||||||
|
* \param loop The desired loop count, negative values result in endless
|
||||||
|
* looping.
|
||||||
|
* \exception AUD_Exception Thrown if the reader specified is NULL.
|
||||||
|
*/
|
||||||
|
AUD_LoopReader(AUD_IReader* reader, int loop);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destroys the reader.
|
||||||
|
*/
|
||||||
|
virtual ~AUD_LoopReader();
|
||||||
|
|
||||||
|
virtual AUD_ReaderType getType();
|
||||||
|
virtual bool notify(AUD_Message &message);
|
||||||
|
virtual void read(int & length, sample_t* & buffer);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //AUD_LOOPREADER
|
||||||
67
intern/audaspace/FX/AUD_PingPongFactory.cpp
Normal file
67
intern/audaspace/FX/AUD_PingPongFactory.cpp
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* ***** BEGIN LGPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* Copyright 2009 Jörg Hermann Müller
|
||||||
|
*
|
||||||
|
* This file is part of AudaSpace.
|
||||||
|
*
|
||||||
|
* AudaSpace is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* AudaSpace is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with AudaSpace. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* ***** END LGPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "AUD_PingPongFactory.h"
|
||||||
|
#include "AUD_DoubleReader.h"
|
||||||
|
#include "AUD_ReverseFactory.h"
|
||||||
|
|
||||||
|
AUD_PingPongFactory::AUD_PingPongFactory(AUD_IFactory* factory) :
|
||||||
|
AUD_EffectFactory(factory) {}
|
||||||
|
|
||||||
|
AUD_IReader* AUD_PingPongFactory::createReader()
|
||||||
|
{
|
||||||
|
if(m_factory == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
AUD_IReader* reader = m_factory->createReader();
|
||||||
|
|
||||||
|
if(reader != 0)
|
||||||
|
{
|
||||||
|
AUD_IReader* reader2;
|
||||||
|
AUD_ReverseFactory factory(m_factory);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
reader2 = factory.createReader();
|
||||||
|
}
|
||||||
|
catch(AUD_Exception e)
|
||||||
|
{
|
||||||
|
reader2 = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(reader2 != 0)
|
||||||
|
{
|
||||||
|
reader = new AUD_DoubleReader(reader, reader2);
|
||||||
|
AUD_NEW("reader")
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
delete reader; AUD_DELETE("reader")
|
||||||
|
reader = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return reader;
|
||||||
|
}
|
||||||
51
intern/audaspace/FX/AUD_PingPongFactory.h
Normal file
51
intern/audaspace/FX/AUD_PingPongFactory.h
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* ***** BEGIN LGPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* Copyright 2009 Jörg Hermann Müller
|
||||||
|
*
|
||||||
|
* This file is part of AudaSpace.
|
||||||
|
*
|
||||||
|
* AudaSpace is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* AudaSpace is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with AudaSpace. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* ***** END LGPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef AUD_PINGPONGFACTORY
|
||||||
|
#define AUD_PINGPONGFACTORY
|
||||||
|
|
||||||
|
#include "AUD_EffectFactory.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This factory plays another factory first normal, then reversed.
|
||||||
|
* \note Readers from the underlying factory must be from the buffer type.
|
||||||
|
*/
|
||||||
|
class AUD_PingPongFactory : public AUD_EffectFactory
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Creates a new ping pong factory.
|
||||||
|
* \param factory The input factory.
|
||||||
|
*/
|
||||||
|
AUD_PingPongFactory(AUD_IFactory* factory = 0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destroys the factory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
virtual AUD_IReader* createReader();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //AUD_PINGPONGFACTORY
|
||||||
48
intern/audaspace/FX/AUD_PitchFactory.cpp
Normal file
48
intern/audaspace/FX/AUD_PitchFactory.cpp
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* ***** BEGIN LGPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* Copyright 2009 Jörg Hermann Müller
|
||||||
|
*
|
||||||
|
* This file is part of AudaSpace.
|
||||||
|
*
|
||||||
|
* AudaSpace is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* AudaSpace is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with AudaSpace. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* ***** END LGPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "AUD_PitchFactory.h"
|
||||||
|
#include "AUD_PitchReader.h"
|
||||||
|
#include "AUD_Space.h"
|
||||||
|
|
||||||
|
AUD_PitchFactory::AUD_PitchFactory(AUD_IFactory* factory, float pitch) :
|
||||||
|
AUD_EffectFactory(factory),
|
||||||
|
m_pitch(pitch) {}
|
||||||
|
|
||||||
|
AUD_PitchFactory::AUD_PitchFactory(float pitch) :
|
||||||
|
AUD_EffectFactory(0),
|
||||||
|
m_pitch(pitch) {}
|
||||||
|
|
||||||
|
AUD_IReader* AUD_PitchFactory::createReader()
|
||||||
|
{
|
||||||
|
AUD_IReader* reader = getReader();
|
||||||
|
|
||||||
|
if(reader != 0)
|
||||||
|
{
|
||||||
|
reader = new AUD_PitchReader(reader, m_pitch); AUD_NEW("reader")
|
||||||
|
}
|
||||||
|
|
||||||
|
return reader;
|
||||||
|
}
|
||||||
70
intern/audaspace/FX/AUD_PitchFactory.h
Normal file
70
intern/audaspace/FX/AUD_PitchFactory.h
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* ***** BEGIN LGPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* Copyright 2009 Jörg Hermann Müller
|
||||||
|
*
|
||||||
|
* This file is part of AudaSpace.
|
||||||
|
*
|
||||||
|
* AudaSpace is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* AudaSpace is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with AudaSpace. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* ***** END LGPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef AUD_PITCHFACTORY
|
||||||
|
#define AUD_PITCHFACTORY
|
||||||
|
|
||||||
|
#include "AUD_EffectFactory.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This factory changes the pitch of another factory.
|
||||||
|
*/
|
||||||
|
class AUD_PitchFactory : public AUD_EffectFactory
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* The pitch.
|
||||||
|
*/
|
||||||
|
float m_pitch;
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Creates a new pitch factory.
|
||||||
|
* \param factory The input factory.
|
||||||
|
* \param pitch The desired pitch.
|
||||||
|
*/
|
||||||
|
AUD_PitchFactory(AUD_IFactory* factory = 0, float pitch = 1.0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new pitch factory.
|
||||||
|
* \param pitch The desired pitch.
|
||||||
|
*/
|
||||||
|
AUD_PitchFactory(float pitch);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the pitch.
|
||||||
|
*/
|
||||||
|
float getPitch();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the pitch.
|
||||||
|
* \param pitch The new pitch value. Should be between 0.0 and 1.0.
|
||||||
|
*/
|
||||||
|
void setPitch(float pitch);
|
||||||
|
|
||||||
|
virtual AUD_IReader* createReader();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //AUD_PITCHFACTORY
|
||||||
39
intern/audaspace/FX/AUD_PitchReader.cpp
Normal file
39
intern/audaspace/FX/AUD_PitchReader.cpp
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* ***** BEGIN LGPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* Copyright 2009 Jörg Hermann Müller
|
||||||
|
*
|
||||||
|
* This file is part of AudaSpace.
|
||||||
|
*
|
||||||
|
* AudaSpace is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* AudaSpace is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with AudaSpace. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* ***** END LGPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "AUD_PitchReader.h"
|
||||||
|
|
||||||
|
AUD_PitchReader::AUD_PitchReader(AUD_IReader* reader, float pitch) :
|
||||||
|
AUD_EffectReader(reader)
|
||||||
|
{
|
||||||
|
m_pitch = pitch;
|
||||||
|
}
|
||||||
|
|
||||||
|
AUD_Specs AUD_PitchReader::getSpecs()
|
||||||
|
{
|
||||||
|
AUD_Specs specs = m_reader->getSpecs();
|
||||||
|
specs.rate = (AUD_SampleRate)((int)(specs.rate * m_pitch));
|
||||||
|
return specs;
|
||||||
|
}
|
||||||
54
intern/audaspace/FX/AUD_PitchReader.h
Normal file
54
intern/audaspace/FX/AUD_PitchReader.h
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* ***** BEGIN LGPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* Copyright 2009 Jörg Hermann Müller
|
||||||
|
*
|
||||||
|
* This file is part of AudaSpace.
|
||||||
|
*
|
||||||
|
* AudaSpace is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* AudaSpace is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with AudaSpace. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* ***** END LGPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef AUD_PITCHREADER
|
||||||
|
#define AUD_PITCHREADER
|
||||||
|
|
||||||
|
#include "AUD_EffectReader.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class reads another reader and changes it's pitch.
|
||||||
|
*/
|
||||||
|
class AUD_PitchReader : public AUD_EffectReader
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* The pitch level.
|
||||||
|
*/
|
||||||
|
float m_pitch;
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Creates a new pitch reader.
|
||||||
|
* \param reader The reader to read from.
|
||||||
|
* \param pitch The size of the buffer.
|
||||||
|
* \exception AUD_Exception Thrown if the reader specified is NULL.
|
||||||
|
*/
|
||||||
|
AUD_PitchReader(AUD_IReader* reader, float pitch);
|
||||||
|
|
||||||
|
virtual AUD_Specs getSpecs();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //AUD_PITCHREADER
|
||||||
43
intern/audaspace/FX/AUD_ReverseFactory.cpp
Normal file
43
intern/audaspace/FX/AUD_ReverseFactory.cpp
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* ***** BEGIN LGPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* Copyright 2009 Jörg Hermann Müller
|
||||||
|
*
|
||||||
|
* This file is part of AudaSpace.
|
||||||
|
*
|
||||||
|
* AudaSpace is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* AudaSpace is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with AudaSpace. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* ***** END LGPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "AUD_ReverseFactory.h"
|
||||||
|
#include "AUD_ReverseReader.h"
|
||||||
|
#include "AUD_Space.h"
|
||||||
|
|
||||||
|
AUD_ReverseFactory::AUD_ReverseFactory(AUD_IFactory* factory) :
|
||||||
|
AUD_EffectFactory(factory) {}
|
||||||
|
|
||||||
|
AUD_IReader* AUD_ReverseFactory::createReader()
|
||||||
|
{
|
||||||
|
AUD_IReader* reader = getReader();
|
||||||
|
|
||||||
|
if(reader != 0)
|
||||||
|
{
|
||||||
|
reader = new AUD_ReverseReader(reader); AUD_NEW("reader")
|
||||||
|
}
|
||||||
|
|
||||||
|
return reader;
|
||||||
|
}
|
||||||
50
intern/audaspace/FX/AUD_ReverseFactory.h
Normal file
50
intern/audaspace/FX/AUD_ReverseFactory.h
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* ***** BEGIN LGPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* Copyright 2009 Jörg Hermann Müller
|
||||||
|
*
|
||||||
|
* This file is part of AudaSpace.
|
||||||
|
*
|
||||||
|
* AudaSpace is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* AudaSpace is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with AudaSpace. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* ***** END LGPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef AUD_REVERSEFACTORY
|
||||||
|
#define AUD_REVERSEFACTORY
|
||||||
|
|
||||||
|
#include "AUD_EffectFactory.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This factory reads another factory reverted.
|
||||||
|
* \note Readers from the underlying factory must be from the buffer type.
|
||||||
|
*/
|
||||||
|
class AUD_ReverseFactory : public AUD_EffectFactory
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Creates a new reverse factory.
|
||||||
|
* \param factory The input factory.
|
||||||
|
*/
|
||||||
|
AUD_ReverseFactory(AUD_IFactory* factory = 0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destroys the factory.
|
||||||
|
*/
|
||||||
|
virtual AUD_IReader* createReader();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //AUD_REVERSEFACTORY
|
||||||
111
intern/audaspace/FX/AUD_ReverseReader.cpp
Normal file
111
intern/audaspace/FX/AUD_ReverseReader.cpp
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* ***** BEGIN LGPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* Copyright 2009 Jörg Hermann Müller
|
||||||
|
*
|
||||||
|
* This file is part of AudaSpace.
|
||||||
|
*
|
||||||
|
* AudaSpace is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* AudaSpace is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with AudaSpace. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* ***** END LGPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "AUD_ReverseReader.h"
|
||||||
|
#include "AUD_Buffer.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
AUD_ReverseReader::AUD_ReverseReader(AUD_IReader* reader) :
|
||||||
|
AUD_EffectReader(reader)
|
||||||
|
{
|
||||||
|
if(reader->getType() != AUD_TYPE_BUFFER)
|
||||||
|
AUD_THROW(AUD_ERROR_READER);
|
||||||
|
|
||||||
|
m_length = reader->getLength();
|
||||||
|
if(m_length < 0)
|
||||||
|
AUD_THROW(AUD_ERROR_READER);
|
||||||
|
|
||||||
|
m_position = 0;
|
||||||
|
m_buffer = new AUD_Buffer(); AUD_NEW("buffer")
|
||||||
|
}
|
||||||
|
|
||||||
|
AUD_ReverseReader::~AUD_ReverseReader()
|
||||||
|
{
|
||||||
|
delete m_buffer; AUD_DELETE("buffer")
|
||||||
|
}
|
||||||
|
|
||||||
|
void AUD_ReverseReader::seek(int position)
|
||||||
|
{
|
||||||
|
m_position = position;
|
||||||
|
}
|
||||||
|
|
||||||
|
int AUD_ReverseReader::getLength()
|
||||||
|
{
|
||||||
|
return m_length;
|
||||||
|
}
|
||||||
|
|
||||||
|
int AUD_ReverseReader::getPosition()
|
||||||
|
{
|
||||||
|
return m_position;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AUD_ReverseReader::read(int & length, sample_t* & buffer)
|
||||||
|
{
|
||||||
|
// first correct the length
|
||||||
|
if(m_position+length > m_length)
|
||||||
|
length = m_length-m_position;
|
||||||
|
|
||||||
|
if(length <= 0)
|
||||||
|
{
|
||||||
|
length = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int samplesize = AUD_SAMPLE_SIZE(getSpecs());
|
||||||
|
|
||||||
|
// resize buffer if needed
|
||||||
|
if(m_buffer->getSize() < length * samplesize)
|
||||||
|
m_buffer->resize(length * samplesize);
|
||||||
|
|
||||||
|
buffer = m_buffer->getBuffer();
|
||||||
|
|
||||||
|
sample_t* buf;
|
||||||
|
int len = length;
|
||||||
|
|
||||||
|
// read from reader
|
||||||
|
m_reader->seek(m_length-m_position-len);
|
||||||
|
m_reader->read(len, buf);
|
||||||
|
|
||||||
|
// set null if reader didn't give enough data
|
||||||
|
if(len < length)
|
||||||
|
{
|
||||||
|
if(getSpecs().format == AUD_FORMAT_U8)
|
||||||
|
memset(buffer, 0x80, (length-len)*samplesize);
|
||||||
|
else
|
||||||
|
memset(buffer, 0, (length-len)*samplesize);
|
||||||
|
buffer += length-len;
|
||||||
|
}
|
||||||
|
|
||||||
|
// copy the samples reverted
|
||||||
|
for(int i = 0; i < len; i++)
|
||||||
|
memcpy(buffer + i * samplesize,
|
||||||
|
buf + (len - 1 - i) * samplesize,
|
||||||
|
samplesize);
|
||||||
|
|
||||||
|
m_position += length;
|
||||||
|
|
||||||
|
buffer = m_buffer->getBuffer();
|
||||||
|
}
|
||||||
74
intern/audaspace/FX/AUD_ReverseReader.h
Normal file
74
intern/audaspace/FX/AUD_ReverseReader.h
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* ***** BEGIN LGPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* Copyright 2009 Jörg Hermann Müller
|
||||||
|
*
|
||||||
|
* This file is part of AudaSpace.
|
||||||
|
*
|
||||||
|
* AudaSpace is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* AudaSpace is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with AudaSpace. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* ***** END LGPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef AUD_REVERSEREADER
|
||||||
|
#define AUD_REVERSEREADER
|
||||||
|
|
||||||
|
#include "AUD_EffectReader.h"
|
||||||
|
class AUD_Buffer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class reads another reader from back to front.
|
||||||
|
* \note The underlying reader must be a buffer.
|
||||||
|
*/
|
||||||
|
class AUD_ReverseReader : public AUD_EffectReader
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* The current position.
|
||||||
|
*/
|
||||||
|
int m_position;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The sample count.
|
||||||
|
*/
|
||||||
|
int m_length;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The playback buffer.
|
||||||
|
*/
|
||||||
|
AUD_Buffer* m_buffer;
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Creates a new reverse reader.
|
||||||
|
* \param reader The reader to read from.
|
||||||
|
* \exception AUD_Exception Thrown if the reader specified is NULL or not
|
||||||
|
* a buffer.
|
||||||
|
*/
|
||||||
|
AUD_ReverseReader(AUD_IReader* reader);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destroys the reader.
|
||||||
|
*/
|
||||||
|
virtual ~AUD_ReverseReader();
|
||||||
|
|
||||||
|
virtual void seek(int position);
|
||||||
|
virtual int getLength();
|
||||||
|
virtual int getPosition();
|
||||||
|
virtual void read(int & length, sample_t* & buffer);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //AUD_REVERSEREADER
|
||||||
57
intern/audaspace/FX/AUD_VolumeFactory.cpp
Normal file
57
intern/audaspace/FX/AUD_VolumeFactory.cpp
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* ***** BEGIN LGPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* Copyright 2009 Jörg Hermann Müller
|
||||||
|
*
|
||||||
|
* This file is part of AudaSpace.
|
||||||
|
*
|
||||||
|
* AudaSpace is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* AudaSpace is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with AudaSpace. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* ***** END LGPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "AUD_VolumeFactory.h"
|
||||||
|
#include "AUD_VolumeReader.h"
|
||||||
|
|
||||||
|
AUD_VolumeFactory::AUD_VolumeFactory(AUD_IFactory* factory, float volume) :
|
||||||
|
AUD_EffectFactory(factory),
|
||||||
|
m_volume(volume) {}
|
||||||
|
|
||||||
|
AUD_VolumeFactory::AUD_VolumeFactory(float volume) :
|
||||||
|
AUD_EffectFactory(0),
|
||||||
|
m_volume(volume) {}
|
||||||
|
|
||||||
|
float AUD_VolumeFactory::getVolume()
|
||||||
|
{
|
||||||
|
return m_volume;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AUD_VolumeFactory::setVolume(float volume)
|
||||||
|
{
|
||||||
|
m_volume = volume;
|
||||||
|
}
|
||||||
|
|
||||||
|
AUD_IReader* AUD_VolumeFactory::createReader()
|
||||||
|
{
|
||||||
|
AUD_IReader* reader = getReader();
|
||||||
|
|
||||||
|
if(reader != 0)
|
||||||
|
{
|
||||||
|
reader = new AUD_VolumeReader(reader, m_volume); AUD_NEW("reader")
|
||||||
|
}
|
||||||
|
|
||||||
|
return reader;
|
||||||
|
}
|
||||||
72
intern/audaspace/FX/AUD_VolumeFactory.h
Normal file
72
intern/audaspace/FX/AUD_VolumeFactory.h
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* ***** BEGIN LGPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* Copyright 2009 Jörg Hermann Müller
|
||||||
|
*
|
||||||
|
* This file is part of AudaSpace.
|
||||||
|
*
|
||||||
|
* AudaSpace is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* AudaSpace is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with AudaSpace. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* ***** END LGPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef AUD_VOLUMEFACTORY
|
||||||
|
#define AUD_VOLUMEFACTORY
|
||||||
|
|
||||||
|
#include "AUD_EffectFactory.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This factory changes the volume of another factory.
|
||||||
|
* The set volume should be a value between 0.0 and 1.0, higher values at your
|
||||||
|
* own risk!
|
||||||
|
*/
|
||||||
|
class AUD_VolumeFactory : public AUD_EffectFactory
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* The volume.
|
||||||
|
*/
|
||||||
|
float m_volume;
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Creates a new volume factory.
|
||||||
|
* \param factory The input factory.
|
||||||
|
* \param volume The desired volume.
|
||||||
|
*/
|
||||||
|
AUD_VolumeFactory(AUD_IFactory* factory = 0, float volume = 1.0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new volume factory.
|
||||||
|
* \param volume The desired volume.
|
||||||
|
*/
|
||||||
|
AUD_VolumeFactory(float volume);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the volume.
|
||||||
|
*/
|
||||||
|
float getVolume();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the volume.
|
||||||
|
* \param volume The new volume value. Should be between 0.0 and 1.0.
|
||||||
|
*/
|
||||||
|
void setVolume(float volume);
|
||||||
|
|
||||||
|
virtual AUD_IReader* createReader();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //AUD_VOLUMEFACTORY
|
||||||
97
intern/audaspace/FX/AUD_VolumeReader.cpp
Normal file
97
intern/audaspace/FX/AUD_VolumeReader.cpp
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* ***** BEGIN LGPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* Copyright 2009 Jörg Hermann Müller
|
||||||
|
*
|
||||||
|
* This file is part of AudaSpace.
|
||||||
|
*
|
||||||
|
* AudaSpace is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* AudaSpace is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with AudaSpace. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* ***** END LGPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "AUD_VolumeReader.h"
|
||||||
|
#include "AUD_Buffer.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
AUD_VolumeReader::AUD_VolumeReader(AUD_IReader* reader, float volume) :
|
||||||
|
AUD_EffectReader(reader),
|
||||||
|
m_volume(volume)
|
||||||
|
{
|
||||||
|
int bigendian = 1;
|
||||||
|
bigendian = (((char*)&bigendian)[0]) ? 0: 1; // 1 if Big Endian
|
||||||
|
|
||||||
|
switch(m_reader->getSpecs().format)
|
||||||
|
{
|
||||||
|
case AUD_FORMAT_S16:
|
||||||
|
m_adjust = AUD_volume_adjust<int16_t>;
|
||||||
|
break;
|
||||||
|
case AUD_FORMAT_S32:
|
||||||
|
m_adjust = AUD_volume_adjust<int32_t>;
|
||||||
|
break;
|
||||||
|
case AUD_FORMAT_FLOAT32:
|
||||||
|
m_adjust = AUD_volume_adjust<float>;
|
||||||
|
break;
|
||||||
|
case AUD_FORMAT_FLOAT64:
|
||||||
|
m_adjust = AUD_volume_adjust<double>;
|
||||||
|
break;
|
||||||
|
case AUD_FORMAT_U8:
|
||||||
|
m_adjust = AUD_volume_adjust_u8;
|
||||||
|
break;
|
||||||
|
case AUD_FORMAT_S24:
|
||||||
|
m_adjust = bigendian ? AUD_volume_adjust_s24_be :
|
||||||
|
AUD_volume_adjust_s24_le;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
delete m_reader;
|
||||||
|
AUD_THROW(AUD_ERROR_READER);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_buffer = new AUD_Buffer(); AUD_NEW("buffer")
|
||||||
|
}
|
||||||
|
|
||||||
|
AUD_VolumeReader::~AUD_VolumeReader()
|
||||||
|
{
|
||||||
|
delete m_buffer; AUD_DELETE("buffer")
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AUD_VolumeReader::notify(AUD_Message &message)
|
||||||
|
{
|
||||||
|
if(message.type == AUD_MSG_VOLUME)
|
||||||
|
{
|
||||||
|
m_volume = message.volume;
|
||||||
|
|
||||||
|
m_reader->notify(message);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return m_reader->notify(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AUD_VolumeReader::read(int & length, sample_t* & buffer)
|
||||||
|
{
|
||||||
|
sample_t* buf;
|
||||||
|
AUD_Specs specs = m_reader->getSpecs();
|
||||||
|
|
||||||
|
m_reader->read(length, buf);
|
||||||
|
if(m_buffer->getSize() < length*AUD_SAMPLE_SIZE(specs))
|
||||||
|
m_buffer->resize(length*AUD_SAMPLE_SIZE(specs));
|
||||||
|
|
||||||
|
buffer = m_buffer->getBuffer();
|
||||||
|
|
||||||
|
m_adjust(buffer, buf, length * specs.channels, m_volume);
|
||||||
|
}
|
||||||
72
intern/audaspace/FX/AUD_VolumeReader.h
Normal file
72
intern/audaspace/FX/AUD_VolumeReader.h
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* ***** BEGIN LGPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* Copyright 2009 Jörg Hermann Müller
|
||||||
|
*
|
||||||
|
* This file is part of AudaSpace.
|
||||||
|
*
|
||||||
|
* AudaSpace is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* AudaSpace is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with AudaSpace. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* ***** END LGPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef AUD_VOLUMEREADER
|
||||||
|
#define AUD_VOLUMEREADER
|
||||||
|
|
||||||
|
#include "AUD_EffectReader.h"
|
||||||
|
#include "AUD_ConverterFunctions.h"
|
||||||
|
class AUD_Buffer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class reads another reader and changes it's volume.
|
||||||
|
*/
|
||||||
|
class AUD_VolumeReader : public AUD_EffectReader
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* The playback buffer.
|
||||||
|
*/
|
||||||
|
AUD_Buffer *m_buffer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The volume level.
|
||||||
|
*/
|
||||||
|
float m_volume;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Volume adjustment function.
|
||||||
|
*/
|
||||||
|
AUD_volume_adjust_f m_adjust;
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Creates a new volume reader.
|
||||||
|
* \param reader The reader to read from.
|
||||||
|
* \param volume The size of the buffer.
|
||||||
|
* \exception AUD_Exception Thrown if the reader specified is NULL.
|
||||||
|
*/
|
||||||
|
AUD_VolumeReader(AUD_IReader* reader, float volume);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destroys the reader.
|
||||||
|
*/
|
||||||
|
virtual ~AUD_VolumeReader();
|
||||||
|
|
||||||
|
virtual bool notify(AUD_Message &message);
|
||||||
|
virtual void read(int & length, sample_t* & buffer);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //AUD_VOLUMEREADER
|
||||||
43
intern/audaspace/FX/Makefile
Normal file
43
intern/audaspace/FX/Makefile
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
#
|
||||||
|
# $Id$
|
||||||
|
#
|
||||||
|
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software Foundation,
|
||||||
|
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
#
|
||||||
|
# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# The Original Code is: all of this file.
|
||||||
|
#
|
||||||
|
# Contributor(s): none yet.
|
||||||
|
#
|
||||||
|
# ***** END GPL LICENSE BLOCK *****
|
||||||
|
#
|
||||||
|
#
|
||||||
|
|
||||||
|
LIBNAME = aud_fx
|
||||||
|
DIR = $(OCGDIR)/intern/audaspace
|
||||||
|
|
||||||
|
include nan_compile.mk
|
||||||
|
|
||||||
|
CCFLAGS += $(LEVEL_1_CPP_WARNINGS)
|
||||||
|
|
||||||
|
CPPFLAGS += -I../ffmpeg
|
||||||
|
CPPFLAGS += -I../intern
|
||||||
|
CPPFLAGS += -I../SDL
|
||||||
|
CPPFLAGS += -I../SRC
|
||||||
|
CPPFLAGS += -I..
|
||||||
|
CPPFLAGS += -I.
|
||||||
106
intern/audaspace/Makefile
Normal file
106
intern/audaspace/Makefile
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
# -*- mode: gnumakefile; tab-width: 8; indent-tabs-mode: t; -*-
|
||||||
|
# vim: tabstop=8
|
||||||
|
#
|
||||||
|
# $Id$
|
||||||
|
#
|
||||||
|
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software Foundation,
|
||||||
|
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
#
|
||||||
|
# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# The Original Code is: all of this file.
|
||||||
|
#
|
||||||
|
# Contributor(s): GSR
|
||||||
|
#
|
||||||
|
# ***** END GPL LICENSE BLOCK *****
|
||||||
|
#
|
||||||
|
#
|
||||||
|
|
||||||
|
include nan_definitions.mk
|
||||||
|
|
||||||
|
LIBNAME = audaspace
|
||||||
|
SOURCEDIR = intern/audaspace
|
||||||
|
DIR = $(OCGDIR)/$(SOURCEDIR)
|
||||||
|
DIRS = intern
|
||||||
|
DIRS += FX
|
||||||
|
DIRS += SDL
|
||||||
|
DIRS += SRC
|
||||||
|
|
||||||
|
ifeq ($(WITH_FFMPEG),true)
|
||||||
|
DIRS += ffmpeg
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(WITH_OPENAL),true)
|
||||||
|
DIRS += OpenAL
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(WITH_JACK),true)
|
||||||
|
DIRS += jack
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(WITH_SNDFILE),true)
|
||||||
|
DIRS += sndfile
|
||||||
|
endif
|
||||||
|
|
||||||
|
include nan_subdirs.mk
|
||||||
|
|
||||||
|
install: $(ALL_OR_DEBUG)
|
||||||
|
@[ -d $(NAN_AUDASPACE) ] || mkdir $(NAN_AUDASPACE)
|
||||||
|
@[ -d $(NAN_AUDASPACE)/include ] || mkdir $(NAN_AUDASPACE)/include
|
||||||
|
@[ -d $(NAN_AUDASPACE)/lib/$(DEBUG_DIR) ] || mkdir $(NAN_AUDASPACE)/lib/$(DEBUG_DIR)
|
||||||
|
@../tools/cpifdiff.sh $(DIR)/$(DEBUG_DIR)libaudaspace.a $(DIR)/$(DEBUG_DIR)libaud_sdl.a $(DIR)/$(DEBUG_DIR)libaud_fx.a $(DIR)/$(DEBUG_DIR)libaud_src.a $(NAN_AUDASPACE)/lib/$(DEBUG_DIR)
|
||||||
|
|
||||||
|
ifeq ($(WITH_FFMPEG),true)
|
||||||
|
@../tools/cpifdiff.sh $(DIR)/$(DEBUG_DIR)libaud_ffmpeg.a $(NAN_AUDASPACE)/lib/$(DEBUG_DIR)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(WITH_OPENAL),true)
|
||||||
|
@../tools/cpifdiff.sh $(DIR)/$(DEBUG_DIR)libaud_openal.a $(NAN_AUDASPACE)/lib/$(DEBUG_DIR)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(WITH_JACK),true)
|
||||||
|
@../tools/cpifdiff.sh $(DIR)/$(DEBUG_DIR)libaud_jack.a $(NAN_AUDASPACE)/lib/$(DEBUG_DIR)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(WITH_SNDFILE),true)
|
||||||
|
@../tools/cpifdiff.sh $(DIR)/$(DEBUG_DIR)libaud_sndfile.a $(NAN_AUDASPACE)/lib/$(DEBUG_DIR)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(OS),darwin)
|
||||||
|
ranlib $(NAN_AUDASPACE)/lib/$(DEBUG_DIR)libaudaspace.a
|
||||||
|
ranlib $(NAN_AUDASPACE)/lib/$(DEBUG_DIR)libaud_src.a
|
||||||
|
ranlib $(NAN_AUDASPACE)/lib/$(DEBUG_DIR)libaud_fx.a
|
||||||
|
ranlib $(NAN_AUDASPACE)/lib/$(DEBUG_DIR)libaud_sdl.a
|
||||||
|
|
||||||
|
ifeq ($(WITH_FFMPEG),true)
|
||||||
|
ranlib $(NAN_AUDASPACE)/lib/$(DEBUG_DIR)libaud_ffmpeg.a
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(WITH_OPENAL),true)
|
||||||
|
ranlib $(NAN_AUDASPACE)/lib/$(DEBUG_DIR)libaud_openal.a
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(WITH_JACK),true)
|
||||||
|
ranlib $(NAN_AUDASPACE)/lib/$(DEBUG_DIR)libaud_jack.a
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(WITH_SNDFILE),true)
|
||||||
|
ranlib $(NAN_AUDASPACE)/lib/$(DEBUG_DIR)libaud_sndfile.a
|
||||||
|
endif
|
||||||
|
|
||||||
|
endif
|
||||||
|
@../tools/cpifdiff.sh intern/*.h $(NAN_AUDASPACE)/include/
|
||||||
1362
intern/audaspace/OpenAL/AUD_OpenALDevice.cpp
Normal file
1362
intern/audaspace/OpenAL/AUD_OpenALDevice.cpp
Normal file
File diff suppressed because it is too large
Load Diff
171
intern/audaspace/OpenAL/AUD_OpenALDevice.h
Normal file
171
intern/audaspace/OpenAL/AUD_OpenALDevice.h
Normal file
@@ -0,0 +1,171 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* ***** BEGIN LGPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* Copyright 2009 Jörg Hermann Müller
|
||||||
|
*
|
||||||
|
* This file is part of AudaSpace.
|
||||||
|
*
|
||||||
|
* AudaSpace is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* AudaSpace is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with AudaSpace. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* ***** END LGPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef AUD_OPENALDEVICE
|
||||||
|
#define AUD_OPENALDEVICE
|
||||||
|
|
||||||
|
#include "AUD_IDevice.h"
|
||||||
|
#include "AUD_I3DDevice.h"
|
||||||
|
struct AUD_OpenALHandle;
|
||||||
|
struct AUD_OpenALBufferedFactory;
|
||||||
|
class AUD_ConverterFactory;
|
||||||
|
|
||||||
|
#include <AL/al.h>
|
||||||
|
#include <AL/alc.h>
|
||||||
|
#include <list>
|
||||||
|
#include <pthread.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This device plays through OpenAL.
|
||||||
|
*/
|
||||||
|
class AUD_OpenALDevice : public AUD_IDevice, public AUD_I3DDevice
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* The OpenAL device handle.
|
||||||
|
*/
|
||||||
|
ALCdevice* m_device;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The OpenAL context.
|
||||||
|
*/
|
||||||
|
ALCcontext* m_context;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The specification of the device.
|
||||||
|
*/
|
||||||
|
AUD_Specs m_specs;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the device has the AL_EXT_MCFORMATS extension.
|
||||||
|
*/
|
||||||
|
bool m_useMC;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The converter factory for readers with wrong input format.
|
||||||
|
*/
|
||||||
|
AUD_ConverterFactory* m_converter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The list of sounds that are currently playing.
|
||||||
|
*/
|
||||||
|
std::list<AUD_OpenALHandle*>* m_playingSounds;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The list of sounds that are currently paused.
|
||||||
|
*/
|
||||||
|
std::list<AUD_OpenALHandle*>* m_pausedSounds;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The list of buffered factories.
|
||||||
|
*/
|
||||||
|
std::list<AUD_OpenALBufferedFactory*>* m_bufferedFactories;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The mutex for locking.
|
||||||
|
*/
|
||||||
|
pthread_mutex_t m_mutex;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The streaming thread.
|
||||||
|
*/
|
||||||
|
pthread_t m_thread;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The condition for streaming thread wakeup.
|
||||||
|
*/
|
||||||
|
bool m_playing;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Buffer size.
|
||||||
|
*/
|
||||||
|
int m_buffersize;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Starts the streaming thread.
|
||||||
|
*/
|
||||||
|
void start();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if a handle is valid.
|
||||||
|
* \param handle The handle to check.
|
||||||
|
* \return Whether the handle is valid.
|
||||||
|
*/
|
||||||
|
bool isValid(AUD_Handle* handle);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the format according to the specs.
|
||||||
|
* \param format The variable to put the format into.
|
||||||
|
* \param specs The specs to read the format from.
|
||||||
|
* \return Whether the format is valid or not.
|
||||||
|
*/
|
||||||
|
bool getFormat(ALenum &format, AUD_Specs specs);
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Opens the OpenAL audio device for playback.
|
||||||
|
* \param specs The wanted audio specification.
|
||||||
|
* \param buffersize The size of the internal buffer.
|
||||||
|
* \note The specification really used for opening the device may differ.
|
||||||
|
* \note The buffersize will be multiplicated by three for this device.
|
||||||
|
* \exception AUD_Exception Thrown if the audio device cannot be opened.
|
||||||
|
*/
|
||||||
|
AUD_OpenALDevice(AUD_Specs specs, int buffersize = AUD_DEFAULT_BUFFER_SIZE);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Streaming thread main function.
|
||||||
|
*/
|
||||||
|
void updateStreams();
|
||||||
|
|
||||||
|
virtual ~AUD_OpenALDevice();
|
||||||
|
|
||||||
|
virtual AUD_Specs getSpecs();
|
||||||
|
virtual AUD_Handle* play(AUD_IFactory* factory, bool keep = false);
|
||||||
|
virtual bool pause(AUD_Handle* handle);
|
||||||
|
virtual bool resume(AUD_Handle* handle);
|
||||||
|
virtual bool stop(AUD_Handle* handle);
|
||||||
|
virtual bool setKeep(AUD_Handle* handle, bool keep);
|
||||||
|
virtual bool sendMessage(AUD_Handle* handle, AUD_Message &message);
|
||||||
|
virtual bool seek(AUD_Handle* handle, float position);
|
||||||
|
virtual float getPosition(AUD_Handle* handle);
|
||||||
|
virtual AUD_Status getStatus(AUD_Handle* handle);
|
||||||
|
virtual void lock();
|
||||||
|
virtual void unlock();
|
||||||
|
virtual bool checkCapability(int capability);
|
||||||
|
virtual bool setCapability(int capability, void *value);
|
||||||
|
virtual bool getCapability(int capability, void *value);
|
||||||
|
|
||||||
|
virtual AUD_Handle* play3D(AUD_IFactory* factory, bool keep = false);
|
||||||
|
virtual bool updateListener(AUD_3DData &data);
|
||||||
|
virtual bool setSetting(AUD_3DSetting setting, float value);
|
||||||
|
virtual float getSetting(AUD_3DSetting setting);
|
||||||
|
virtual bool updateSource(AUD_Handle* handle, AUD_3DData &data);
|
||||||
|
virtual bool setSourceSetting(AUD_Handle* handle,
|
||||||
|
AUD_3DSourceSetting setting, float value);
|
||||||
|
virtual float getSourceSetting(AUD_Handle* handle,
|
||||||
|
AUD_3DSourceSetting setting);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //AUD_OPENALDEVICE
|
||||||
39
intern/audaspace/OpenAL/Makefile
Normal file
39
intern/audaspace/OpenAL/Makefile
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
#
|
||||||
|
# $Id$
|
||||||
|
#
|
||||||
|
# ***** BEGIN GPL LICENSE BLOCK *****
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software Foundation,
|
||||||
|
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
#
|
||||||
|
# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# The Original Code is: all of this file.
|
||||||
|
#
|
||||||
|
# Contributor(s): none yet.
|
||||||
|
#
|
||||||
|
# ***** END GPL LICENSE BLOCK *****
|
||||||
|
#
|
||||||
|
#
|
||||||
|
|
||||||
|
LIBNAME = aud_openal
|
||||||
|
DIR = $(OCGDIR)/intern/audaspace
|
||||||
|
|
||||||
|
include nan_compile.mk
|
||||||
|
|
||||||
|
CCFLAGS += $(LEVEL_1_CPP_WARNINGS)
|
||||||
|
|
||||||
|
CPPFLAGS += -I../intern
|
||||||
|
CPPFLAGS += -I.
|
||||||
34
intern/audaspace/SConscript
Normal file
34
intern/audaspace/SConscript
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
Import ('env')
|
||||||
|
|
||||||
|
sources = env.Glob('intern/*.cpp') + env.Glob('FX/*.cpp') + env.Glob('SRC/*.cpp')
|
||||||
|
incs = '. intern FX SRC ' + env['BF_PTHREADS_INC'] + ' ' + env['BF_LIBSAMPLERATE_INC']
|
||||||
|
defs = []
|
||||||
|
|
||||||
|
if env['WITH_BF_FFMPEG']:
|
||||||
|
sources += env.Glob('ffmpeg/*.cpp')
|
||||||
|
incs += ' ffmpeg ' + env['BF_FFMPEG_INC']
|
||||||
|
defs.append('WITH_FFMPEG')
|
||||||
|
|
||||||
|
if env['WITH_BF_SDL']:
|
||||||
|
sources += env.Glob('SDL/*.cpp')
|
||||||
|
incs += ' SDL ' + env['BF_SDL_INC']
|
||||||
|
defs.append('WITH_SDL')
|
||||||
|
|
||||||
|
if env['WITH_BF_OPENAL']:
|
||||||
|
sources += env.Glob('OpenAL/*.cpp')
|
||||||
|
incs += ' OpenAL ' + env['BF_OPENAL_INC']
|
||||||
|
defs.append('WITH_OPENAL')
|
||||||
|
|
||||||
|
if env['WITH_BF_JACK']:
|
||||||
|
sources += env.Glob('jack/*.cpp')
|
||||||
|
incs += ' jack ' + env['BF_JACK_INC']
|
||||||
|
defs.append('WITH_JACK')
|
||||||
|
|
||||||
|
if env['WITH_BF_SNDFILE']:
|
||||||
|
sources += env.Glob('sndfile/*.cpp')
|
||||||
|
incs += ' sndfile ' + env['BF_SNDFILE_INC']
|
||||||
|
defs.append('WITH_SNDFILE')
|
||||||
|
|
||||||
|
env.BlenderLib ('bf_audaspace', sources, Split(incs), defs, libtype=['intern'], priority = [25] )
|
||||||
90
intern/audaspace/SDL/AUD_SDLDevice.cpp
Normal file
90
intern/audaspace/SDL/AUD_SDLDevice.cpp
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* ***** BEGIN LGPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* Copyright 2009 Jörg Hermann Müller
|
||||||
|
*
|
||||||
|
* This file is part of AudaSpace.
|
||||||
|
*
|
||||||
|
* AudaSpace is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* AudaSpace is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with AudaSpace. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* ***** END LGPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "AUD_SDLMixer.h"
|
||||||
|
#include "AUD_SDLDevice.h"
|
||||||
|
#include "AUD_IReader.h"
|
||||||
|
|
||||||
|
void AUD_SDLDevice::SDL_mix(void *data, Uint8* buffer, int length)
|
||||||
|
{
|
||||||
|
AUD_SDLDevice* device = (AUD_SDLDevice*)data;
|
||||||
|
|
||||||
|
device->mix((sample_t*)buffer, length/AUD_SAMPLE_SIZE(device->m_specs));
|
||||||
|
}
|
||||||
|
|
||||||
|
AUD_SDLDevice::AUD_SDLDevice(AUD_Specs specs, int buffersize)
|
||||||
|
{
|
||||||
|
if(specs.channels == AUD_CHANNELS_INVALID)
|
||||||
|
specs.channels = AUD_CHANNELS_STEREO;
|
||||||
|
if(specs.format == AUD_FORMAT_INVALID)
|
||||||
|
specs.format = AUD_FORMAT_S16;
|
||||||
|
if(specs.rate == AUD_RATE_INVALID)
|
||||||
|
specs.rate = AUD_RATE_44100;
|
||||||
|
|
||||||
|
m_specs = specs;
|
||||||
|
|
||||||
|
SDL_AudioSpec format, obtained;
|
||||||
|
|
||||||
|
format.freq = m_specs.rate;
|
||||||
|
if(m_specs.format == AUD_FORMAT_U8)
|
||||||
|
format.format = AUDIO_U8;
|
||||||
|
else
|
||||||
|
format.format = AUDIO_S16SYS;
|
||||||
|
format.channels = m_specs.channels;
|
||||||
|
format.samples = buffersize;
|
||||||
|
format.callback = AUD_SDLDevice::SDL_mix;
|
||||||
|
format.userdata = this;
|
||||||
|
|
||||||
|
if(SDL_OpenAudio(&format, &obtained) != 0)
|
||||||
|
AUD_THROW(AUD_ERROR_SDL);
|
||||||
|
|
||||||
|
m_specs.rate = (AUD_SampleRate)obtained.freq;
|
||||||
|
m_specs.channels = (AUD_Channels)obtained.channels;
|
||||||
|
if(obtained.format == AUDIO_U8)
|
||||||
|
m_specs.format = AUD_FORMAT_U8;
|
||||||
|
else if(obtained.format == AUDIO_S16LSB || obtained.format == AUDIO_S16MSB)
|
||||||
|
m_specs.format = AUD_FORMAT_S16;
|
||||||
|
else
|
||||||
|
AUD_THROW(AUD_ERROR_SDL);
|
||||||
|
|
||||||
|
m_mixer = new AUD_SDLMixer(); AUD_NEW("mixer")
|
||||||
|
m_mixer->setSpecs(m_specs);
|
||||||
|
|
||||||
|
create();
|
||||||
|
}
|
||||||
|
|
||||||
|
AUD_SDLDevice::~AUD_SDLDevice()
|
||||||
|
{
|
||||||
|
lock();
|
||||||
|
SDL_CloseAudio();
|
||||||
|
unlock();
|
||||||
|
|
||||||
|
destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AUD_SDLDevice::playing(bool playing)
|
||||||
|
{
|
||||||
|
SDL_PauseAudio(playing ? 0 : 1);
|
||||||
|
}
|
||||||
66
intern/audaspace/SDL/AUD_SDLDevice.h
Normal file
66
intern/audaspace/SDL/AUD_SDLDevice.h
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* ***** BEGIN LGPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* Copyright 2009 Jörg Hermann Müller
|
||||||
|
*
|
||||||
|
* This file is part of AudaSpace.
|
||||||
|
*
|
||||||
|
* AudaSpace is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* AudaSpace is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with AudaSpace. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* ***** END LGPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef AUD_SDLDEVICE
|
||||||
|
#define AUD_SDLDEVICE
|
||||||
|
|
||||||
|
#include "AUD_SoftwareDevice.h"
|
||||||
|
|
||||||
|
#include <SDL.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This device plays back through SDL, the simple direct media layer.
|
||||||
|
*/
|
||||||
|
class AUD_SDLDevice : public AUD_SoftwareDevice
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* Mixes the next bytes into the buffer.
|
||||||
|
* \param data The SDL device.
|
||||||
|
* \param buffer The target buffer.
|
||||||
|
* \param length The length in bytes to be filled.
|
||||||
|
*/
|
||||||
|
static void SDL_mix(void *data, Uint8* buffer, int length);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void playing(bool playing);
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Opens the SDL audio device for playback.
|
||||||
|
* \param specs The wanted audio specification.
|
||||||
|
* \param buffersize The size of the internal buffer.
|
||||||
|
* \note The specification really used for opening the device may differ.
|
||||||
|
* \exception AUD_Exception Thrown if the audio device cannot be opened.
|
||||||
|
*/
|
||||||
|
AUD_SDLDevice(AUD_Specs specs, int buffersize = AUD_DEFAULT_BUFFER_SIZE);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Closes the SDL audio device.
|
||||||
|
*/
|
||||||
|
virtual ~AUD_SDLDevice();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //AUD_SDLDEVICE
|
||||||
83
intern/audaspace/SDL/AUD_SDLMixer.cpp
Normal file
83
intern/audaspace/SDL/AUD_SDLMixer.cpp
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* ***** BEGIN LGPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* Copyright 2009 Jörg Hermann Müller
|
||||||
|
*
|
||||||
|
* This file is part of AudaSpace.
|
||||||
|
*
|
||||||
|
* AudaSpace is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* AudaSpace is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with AudaSpace. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* ***** END LGPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "AUD_SDLMixer.h"
|
||||||
|
#include "AUD_SDLMixerFactory.h"
|
||||||
|
|
||||||
|
#include <SDL.h>
|
||||||
|
|
||||||
|
AUD_SDLMixer::AUD_SDLMixer()
|
||||||
|
{
|
||||||
|
m_factory = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
AUD_SDLMixer::~AUD_SDLMixer()
|
||||||
|
{
|
||||||
|
if(m_factory)
|
||||||
|
{
|
||||||
|
delete m_factory; AUD_DELETE("factory")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
AUD_IReader* AUD_SDLMixer::prepare(AUD_IReader* reader)
|
||||||
|
{
|
||||||
|
m_factory->setReader(reader);
|
||||||
|
return m_factory->createReader();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AUD_SDLMixer::setSpecs(AUD_Specs specs)
|
||||||
|
{
|
||||||
|
m_samplesize = AUD_SAMPLE_SIZE(specs);
|
||||||
|
if(m_factory)
|
||||||
|
{
|
||||||
|
delete m_factory; AUD_DELETE("factory")
|
||||||
|
}
|
||||||
|
m_factory = new AUD_SDLMixerFactory(specs); AUD_NEW("factory")
|
||||||
|
}
|
||||||
|
|
||||||
|
void AUD_SDLMixer::add(sample_t* buffer, AUD_Specs specs, int length,
|
||||||
|
float volume)
|
||||||
|
{
|
||||||
|
AUD_SDLMixerBuffer buf;
|
||||||
|
buf.buffer = buffer;
|
||||||
|
buf.length = length;
|
||||||
|
buf.volume = volume;
|
||||||
|
m_buffers.push_back(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AUD_SDLMixer::superpose(sample_t* buffer, int length, float volume)
|
||||||
|
{
|
||||||
|
AUD_SDLMixerBuffer buf;
|
||||||
|
|
||||||
|
while(!m_buffers.empty())
|
||||||
|
{
|
||||||
|
buf = m_buffers.front();
|
||||||
|
m_buffers.pop_front();
|
||||||
|
SDL_MixAudio((Uint8*)buffer,
|
||||||
|
(Uint8*)buf.buffer,
|
||||||
|
buf.length * m_samplesize,
|
||||||
|
(int)(SDL_MIX_MAXVOLUME * volume * buf.volume));
|
||||||
|
}
|
||||||
|
}
|
||||||
76
intern/audaspace/SDL/AUD_SDLMixer.h
Normal file
76
intern/audaspace/SDL/AUD_SDLMixer.h
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* ***** BEGIN LGPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* Copyright 2009 Jörg Hermann Müller
|
||||||
|
*
|
||||||
|
* This file is part of AudaSpace.
|
||||||
|
*
|
||||||
|
* AudaSpace is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* AudaSpace is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with AudaSpace. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* ***** END LGPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef AUD_SDLMIXER
|
||||||
|
#define AUD_SDLMIXER
|
||||||
|
|
||||||
|
#include "AUD_IMixer.h"
|
||||||
|
class AUD_SDLMixerFactory;
|
||||||
|
#include <list>
|
||||||
|
|
||||||
|
struct AUD_SDLMixerBuffer
|
||||||
|
{
|
||||||
|
sample_t* buffer;
|
||||||
|
int length;
|
||||||
|
float volume;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class is able to mix audiosignals with the help of SDL.
|
||||||
|
*/
|
||||||
|
class AUD_SDLMixer : public AUD_IMixer
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* The mixer factory that prepares all readers for superposition.
|
||||||
|
*/
|
||||||
|
AUD_SDLMixerFactory* m_factory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The list of buffers to superpose.
|
||||||
|
*/
|
||||||
|
std::list<AUD_SDLMixerBuffer> m_buffers;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The size of an output sample.
|
||||||
|
*/
|
||||||
|
int m_samplesize;
|
||||||
|
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Creates the mixer.
|
||||||
|
*/
|
||||||
|
AUD_SDLMixer();
|
||||||
|
|
||||||
|
virtual ~AUD_SDLMixer();
|
||||||
|
|
||||||
|
virtual AUD_IReader* prepare(AUD_IReader* reader);
|
||||||
|
virtual void setSpecs(AUD_Specs specs);
|
||||||
|
virtual void add(sample_t* buffer, AUD_Specs specs, int length,
|
||||||
|
float volume);
|
||||||
|
virtual void superpose(sample_t* buffer, int length, float volume);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //AUD_SDLMIXER
|
||||||
65
intern/audaspace/SDL/AUD_SDLMixerFactory.cpp
Normal file
65
intern/audaspace/SDL/AUD_SDLMixerFactory.cpp
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* ***** BEGIN LGPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* Copyright 2009 Jörg Hermann Müller
|
||||||
|
*
|
||||||
|
* This file is part of AudaSpace.
|
||||||
|
*
|
||||||
|
* AudaSpace is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* AudaSpace is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with AudaSpace. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* ***** END LGPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "AUD_SDLMixerFactory.h"
|
||||||
|
#include "AUD_SDLMixerReader.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
AUD_SDLMixerFactory::AUD_SDLMixerFactory(AUD_IReader* reader, AUD_Specs specs) :
|
||||||
|
AUD_MixerFactory(reader, specs) {}
|
||||||
|
|
||||||
|
AUD_SDLMixerFactory::AUD_SDLMixerFactory(AUD_IFactory* factory, AUD_Specs specs) :
|
||||||
|
AUD_MixerFactory(factory, specs) {}
|
||||||
|
|
||||||
|
AUD_SDLMixerFactory::AUD_SDLMixerFactory(AUD_Specs specs) :
|
||||||
|
AUD_MixerFactory(specs) {}
|
||||||
|
|
||||||
|
AUD_IReader* AUD_SDLMixerFactory::createReader()
|
||||||
|
{
|
||||||
|
AUD_IReader* reader = getReader();
|
||||||
|
|
||||||
|
if(reader != 0)
|
||||||
|
{
|
||||||
|
AUD_Specs specs = reader->getSpecs();
|
||||||
|
if(memcmp(&m_specs, &specs, sizeof(AUD_Specs)) != 0)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
reader = new AUD_SDLMixerReader(reader, m_specs);
|
||||||
|
AUD_NEW("reader")
|
||||||
|
}
|
||||||
|
catch(AUD_Exception e)
|
||||||
|
{
|
||||||
|
// return 0 in case SDL cannot mix the source
|
||||||
|
if(e.error != AUD_ERROR_SDL)
|
||||||
|
throw;
|
||||||
|
else
|
||||||
|
reader = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return reader;
|
||||||
|
}
|
||||||
45
intern/audaspace/SDL/AUD_SDLMixerFactory.h
Normal file
45
intern/audaspace/SDL/AUD_SDLMixerFactory.h
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* ***** BEGIN LGPL LICENSE BLOCK *****
|
||||||
|
*
|
||||||
|
* Copyright 2009 Jörg Hermann Müller
|
||||||
|
*
|
||||||
|
* This file is part of AudaSpace.
|
||||||
|
*
|
||||||
|
* AudaSpace is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* AudaSpace is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with AudaSpace. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* ***** END LGPL LICENSE BLOCK *****
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef AUD_SDLMIXERFACTORY
|
||||||
|
#define AUD_SDLMIXERFACTORY
|
||||||
|
|
||||||
|
#include "AUD_MixerFactory.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This factory creates a resampling reader that uses SDL's resampling
|
||||||
|
* functionality which unfortunately is very very very limited.
|
||||||
|
*/
|
||||||
|
class AUD_SDLMixerFactory : public AUD_MixerFactory
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AUD_SDLMixerFactory(AUD_IReader* reader, AUD_Specs specs);
|
||||||
|
AUD_SDLMixerFactory(AUD_IFactory* factory, AUD_Specs specs);
|
||||||
|
AUD_SDLMixerFactory(AUD_Specs specs);
|
||||||
|
|
||||||
|
virtual AUD_IReader* createReader();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //AUD_SDLMIXERFACTORY
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user