Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • xiph/opusfile
  • rillian/opusfile
  • TD-Linux/opusfile
  • tterribe/opusfile
  • ePirat/opusfile
  • steils/opusfile
  • markh/opusfile
  • traud/opusfile
  • thesamesam/opusfile
  • martinwguy/opusfile
10 results
Show changes
Commits on Source (437)
image: Visual Studio 2015
configuration:
- Debug
- Release
- Release-NoHTTP
platform:
- Win32
- x64
environment:
opus_url: https://ci.appveyor.com/api/projects/$(APPVEYOR_ACCOUNT_NAME)/opus/artifacts/opus.zip
install:
- cd %APPVEYOR_BUILD_FOLDER%\..
- 'curl -LOG --data-urlencode "job=Configuration: %CONFIGURATION:-NoHTTP=%; Platform: %PLATFORM%" %OPUS_URL%'
- 7z x opus.zip -oopus-artifacts
- move /Y opus-artifacts opus
- git clone -q https://github.com/xiph/ogg.git ogg
- msbuild ogg\win32\VS2015\libogg.sln /p:Configuration=%CONFIGURATION:-NoHTTP=%;Platform=%PLATFORM% /m /v:minimal /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
- if %CONFIGURATION:-NoHTTP=%==%CONFIGURATION% git clone -q --branch=OpenSSL_1_0_2-stable https://github.com/openssl/openssl.git openssl
- ps: >-
If ($env:Platform -Match "Win32") {
$env:VCVARS_PLATFORM="x86"
$env:OPENSSL_TARGET="VC-WIN32"
$env:DO="do_nasm"
} Else {
$env:VCVARS_PLATFORM="amd64"
$env:OPENSSL_TARGET="VC-WIN64A"
$env:DO="do_win64a"
}
- if %CONFIGURATION:-NoHTTP=%==%CONFIGURATION% chocolatey install -y nasm
- if %CONFIGURATION:-NoHTTP=%==%CONFIGURATION% set PATH=%PROGRAMFILES%\nasm;%PATH%
- if %CONFIGURATION:-NoHTTP=%==%CONFIGURATION% call "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" %VCVARS_PLATFORM%
- if %CONFIGURATION:-NoHTTP=%==%CONFIGURATION% cd openssl
# without prefix, libs end up in out32 for both 32 and 64-bit
- if %CONFIGURATION:-NoHTTP=%==%CONFIGURATION% perl Configure %OPENSSL_TARGET% --prefix=%CD%\%PLATFORM%\Release
- if %CONFIGURATION:-NoHTTP=%==%CONFIGURATION% call ms\%DO%
- if %CONFIGURATION:-NoHTTP=%==%CONFIGURATION% nmake /f ms\nt.mak
- if %CONFIGURATION:-NoHTTP=%==%CONFIGURATION% nmake /f ms\nt.mak install
# prevents warning 4099 on linking
- if %CONFIGURATION:-NoHTTP=%==%CONFIGURATION% copy /B tmp32\lib.pdb %CD%\%PLATFORM%\Release\lib\lib.pdb
- cd %APPVEYOR_BUILD_FOLDER%
build:
project: win32\VS2015\opusfile.sln
parallel: true
verbosity: minimal
after_build:
- if %CONFIGURATION:-NoHTTP=%==%CONFIGURATION% copy /B %APPVEYOR_BUILD_FOLDER%\..\openssl\%PLATFORM%\Release\lib\* win32\VS2015\%PLATFORM%\%CONFIGURATION%\
- if %CONFIGURATION:-NoHTTP=%==%CONFIGURATION% mkdir include\openssl
- if %CONFIGURATION:-NoHTTP=%==%CONFIGURATION% copy /B %APPVEYOR_BUILD_FOLDER%\..\openssl\inc32\openssl include\openssl\
- 7z a opusfile.zip win32\VS2015\%PLATFORM%\%CONFIGURATION%\opusfile.??? include\
- if %CONFIGURATION:-NoHTTP=%==%CONFIGURATION% 7z a opusfile.zip win32\VS2015\%PLATFORM%\%CONFIGURATION%\lib.pdb win32\VS2015\%PLATFORM%\%CONFIGURATION%\*.lib
artifacts:
- path: opusfile.zip
.gitignore export-ignore
.gitattributes export-ignore
update_version export-ignore
*.bat eol=crlf
*.sln eol=crlf
*.vcxproj eol=crlf
*.vcxproj.filters eol=crlf
common.props eol=crlf
*.a
*.exe
*.la
*.lo
*.o
*.sw*
*~
.deps
.dirstamp
.libs
/Makefile
Makefile.in
aclocal.m4
autom4te.cache/
config.guess
config.log
config.status
config.sub
configure
config.h.in
config.h
compile
depcomp
doc/Doxyfile
doc/doxygen-build.stamp
doc/html
doc/latex
examples/opusfile_example
examples/seeking_example
install-sh
libopusfile-*.tar.*
libtool
ltmain.sh
m4/libtool.m4
m4/ltoptions.m4
m4/ltsugar.m4
m4/ltversion.m4
m4/lt~obsolete.m4
missing
opusfile.pc
opusfile-uninstalled.pc
opusurl.pc
opusurl-uninstalled.pc
package_version
stamp-h1
test-driver
unix/objs
unix/opusfile_example
unix/seeking_example
build
default:
tags:
- docker
# Image from https://hub.docker.com/_/gcc/ based on Debian
image: gcc:9
autotools:
stage: build
before_script:
- apt-get update &&
apt-get install -y libopus-dev libogg-dev libssl-dev
zip
script:
- ./autogen.sh
- ./configure
- make
- make distcheck
cmake:
stage: build
before_script:
- apt-get update &&
apt-get install -y libopus-dev libogg-dev libssl-dev
doxygen
script:
- curl -O https://cmake.org/files/v3.16/cmake-3.16.9-Linux-x86_64.tar.gz
- tar xzf cmake-3.16.9-Linux-x86_64.tar.gz
- cmake-3.16.9-Linux-x86_64/bin/cmake -Bbuild -H.
- cmake-3.16.9-Linux-x86_64/bin/cmake --build build
tags:
- docker
makefile:
stage: build
before_script:
- apt-get update &&
apt-get install -y libopus-dev libogg-dev libssl-dev
script:
- make -C unix
- make -C unix check
doc:
stage: build
before_script:
- apt-get update &&
apt-get install -y doxygen graphviz
script:
- make -C doc
language: c
compiler:
- gcc
- clang
os:
- linux
- osx
osx_image: xcode11.3
addons:
apt:
packages:
- doxygen
- libogg-dev
- libopus-dev
- libssl-dev
homebrew:
brewfile: true
env: PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/opt/openssl/lib/pkgconfig
before_script:
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then
curl -O https://cmake.org/files/v3.16/cmake-3.16.9-Linux-x86_64.tar.gz;
tar xzf cmake-3.16.9-Linux-x86_64.tar.gz;
export PATH="${PWD}/cmake-3.16.9-Linux-x86_64/bin:${PATH}";
fi
script:
- cmake -Bbuild -H.
- cmake --build build
- ./autogen.sh
- ./configure
- make
- make distcheck
Timothy B. Terriberry <tterribe@xiph.org>
Ralph Giles <giles@xiph.org>
Christopher "Monty" Montgomery <xiphmont@xiph.org> (original libvorbisfile)
Gregory Maxwell <greg@xiph.org> (noise shaping dithering)
nu774 <honeycomb77@gmail.com> (original winsock support)
brew 'opus'
brew 'libogg'
brew 'openssl'
brew 'autoconf'
brew 'automake'
brew 'libtool'
brew 'pkg-config'
brew 'cmake@3.16'
brew 'doxygen'
cmake_minimum_required(VERSION 3.16)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
include(OpusFilePackageVersion)
get_package_version(PACKAGE_VERSION PROJECT_VERSION)
string(REPLACE "." ";" PROJECT_VERSION_LIST ${PROJECT_VERSION})
list(GET PROJECT_VERSION_LIST 0 PROJECT_VERSION_MAJOR)
list(GET PROJECT_VERSION_LIST 1 PROJECT_VERSION_MINOR)
project(OpusFile
VERSION ${PROJECT_VERSION}
LANGUAGES C
)
option(OP_DISABLE_HTTP "Disable HTTP support" OFF)
option(OP_DISABLE_FLOAT_API "Disable floating-point API" OFF)
option(OP_FIXED_POINT "Enable fixed-point calculation" OFF)
option(OP_ENABLE_ASSERTIONS "Enable assertions in code" OFF)
option(OP_DISABLE_EXAMPLES "Do not build example applications" OFF)
option(OP_DISABLE_DOCS "Do not build API documentation" OFF)
include(GNUInstallDirs)
find_package(Ogg REQUIRED)
find_package(Opus REQUIRED)
include(CMakePushCheckState)
include(CheckSymbolExists)
cmake_push_check_state(RESET)
include(CheckLibraryExists)
check_library_exists(m lrintf "" OP_HAVE_LIBM)
if(OP_HAVE_LIBM)
list(APPEND CMAKE_REQUIRED_LIBRARIES "m")
endif()
check_symbol_exists(lrintf "math.h" OP_HAVE_LRINTF)
cmake_pop_check_state()
add_library(opusfile
"${CMAKE_CURRENT_SOURCE_DIR}/include/opusfile.h"
"${CMAKE_CURRENT_SOURCE_DIR}/src/info.c"
"${CMAKE_CURRENT_SOURCE_DIR}/src/internal.c"
"${CMAKE_CURRENT_SOURCE_DIR}/src/internal.h"
"${CMAKE_CURRENT_SOURCE_DIR}/src/opusfile.c"
"${CMAKE_CURRENT_SOURCE_DIR}/src/stream.c"
)
add_library(OpusFile::opusfile ALIAS opusfile)
set_target_properties(opusfile PROPERTIES
PUBLIC_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/include/opusfile.h"
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR}
)
target_include_directories(opusfile
PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/include"
INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/opus>
)
target_link_libraries(opusfile
PUBLIC
Ogg::ogg
Opus::opus
$<$<BOOL:${OP_HAVE_LIBM}>:m>
)
target_compile_options(opusfile
PRIVATE
$<$<C_COMPILER_ID:MSVC>:/wd4267>
$<$<C_COMPILER_ID:MSVC>:/wd4244>
$<$<C_COMPILER_ID:MSVC>:/wd4090>
$<$<C_COMPILER_ID:Clang,GNU>:-std=c89>
$<$<C_COMPILER_ID:Clang,GNU>:-pedantic>
$<$<C_COMPILER_ID:Clang,GNU>:-Wall>
$<$<C_COMPILER_ID:Clang,GNU>:-Wextra>
$<$<C_COMPILER_ID:Clang,GNU>:-Wno-parentheses>
$<$<C_COMPILER_ID:Clang,GNU>:-Wno-long-long>
$<$<C_COMPILER_ID:Clang,GNU>:-fvisibility=hidden>
)
target_compile_definitions(opusfile
PRIVATE
$<$<BOOL:${OP_DISABLE_FLOAT_API}>:OP_DISABLE_FLOAT_API>
$<$<BOOL:${OP_FIXED_POINT}>:OP_FIXED_POINT>
$<$<BOOL:${OP_ENABLE_ASSERTIONS}>:OP_ENABLE_ASSERTIONS>
$<$<BOOL:${OP_HAVE_LRINTF}>:OP_HAVE_LRINTF>
)
install(TARGETS opusfile
EXPORT OpusFileTargets
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/opus"
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/opus"
)
if(NOT OP_DISABLE_HTTP)
find_package(OpenSSL REQUIRED)
include(CheckIncludeFile)
include(CheckCSourceCompiles)
cmake_push_check_state(RESET)
if(NOT WIN32)
check_include_file("sys/socket.h" OP_HAVE_SYS_SOCKET_H)
if(NOT OP_HAVE_SYS_SOCKET_H)
message(FATAL_ERROR "HTTP support requires a POSIX socket library")
endif()
endif()
check_c_source_compiles(
"#include <time.h>
int main(void)
{
struct timespec ts;
return clock_gettime(CLOCK_REALTIME, &ts);
}"
OP_HAVE_CLOCK_GETTIME
)
if(NOT OP_HAVE_CLOCK_GETTIME)
check_symbol_exists(ftime "sys/timeb.h" OP_HAVE_FTIME)
if(NOT OP_HAVE_FTIME)
message(FATAL_ERROR "HTTP support requires either clock_gettime() or ftime()")
endif()
endif()
cmake_pop_check_state()
add_library(opusurl
"${CMAKE_CURRENT_SOURCE_DIR}/include/opusfile.h"
"${CMAKE_CURRENT_SOURCE_DIR}/src/http.c"
"${CMAKE_CURRENT_SOURCE_DIR}/src/internal.c"
"${CMAKE_CURRENT_SOURCE_DIR}/src/internal.h"
)
add_library(OpusFile::opusurl ALIAS opusurl)
if(WIN32)
target_sources(opusurl PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/src/wincerts.c"
"${CMAKE_CURRENT_SOURCE_DIR}/src/winerrno.h"
)
endif()
set_target_properties(opusurl PROPERTIES
PUBLIC_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/include/opusfile.h"
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR}
)
target_include_directories(opusurl
PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/include"
INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/opus>
)
target_compile_definitions(opusurl
PRIVATE
$<$<BOOL:${OP_DISABLE_FLOAT_API}>:OP_DISABLE_FLOAT_API>
$<$<BOOL:${OP_FIXED_POINT}>:OP_FIXED_POINT>
$<$<BOOL:${OP_ENABLE_ASSERTIONS}>:OP_ENABLE_ASSERTIONS>
$<$<BOOL:${OP_HAVE_LRINTF}>:OP_HAVE_LRINTF>
$<$<BOOL:${OP_HAVE_CLOCK_GETTIME}>:OP_HAVE_CLOCK_GETTIME>
$<$<BOOL:${OP_HAVE_FTIME}>:OP_HAVE_FTIME>
OP_ENABLE_HTTP
)
target_link_libraries(opusurl
PRIVATE
opusfile
OpenSSL::SSL
$<$<C_COMPILER_ID:MSVC>:ws2_32>
$<$<C_COMPILER_ID:MSVC>:crypt32>
$<$<BOOL:${OP_HAVE_LIBM}>:m>
)
target_compile_options(opusurl
PRIVATE
$<$<C_COMPILER_ID:MSVC>:/wd4267>
$<$<C_COMPILER_ID:MSVC>:/wd4244>
$<$<C_COMPILER_ID:MSVC>:/wd4090>
$<$<C_COMPILER_ID:Clang,GNU>:-std=c89>
$<$<C_COMPILER_ID:Clang,GNU>:-pedantic>
$<$<C_COMPILER_ID:Clang,GNU>:-Wall>
$<$<C_COMPILER_ID:Clang,GNU>:-Wextra>
$<$<C_COMPILER_ID:Clang,GNU>:-Wno-parentheses>
$<$<C_COMPILER_ID:Clang,GNU>:-Wno-long-long>
$<$<C_COMPILER_ID:Clang,GNU>:-fvisibility=hidden>
)
install(TARGETS opusurl
EXPORT OpusFileTargets
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/opus"
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/opus"
)
endif()
if(NOT OP_DISABLE_EXAMPLES)
add_executable(opusfile_example
"${CMAKE_CURRENT_SOURCE_DIR}/examples/opusfile_example.c"
)
add_executable(OpusFile::opusfile_example ALIAS opusfile_example)
if(WIN32)
target_sources(opusfile_example PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/examples/win32utf8.c"
"${CMAKE_CURRENT_SOURCE_DIR}/examples/win32utf8.h"
)
endif()
target_include_directories(opusfile_example
PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/examples"
)
target_link_libraries(opusfile_example
PRIVATE
opusfile
opusurl
)
target_compile_options(opusfile_example
PRIVATE
$<$<C_COMPILER_ID:MSVC>:/wd4267>
$<$<C_COMPILER_ID:MSVC>:/wd4244>
$<$<C_COMPILER_ID:MSVC>:/wd4090>
$<$<C_COMPILER_ID:Clang,GNU>:-std=c89>
$<$<C_COMPILER_ID:Clang,GNU>:-pedantic>
$<$<C_COMPILER_ID:Clang,GNU>:-Wall>
$<$<C_COMPILER_ID:Clang,GNU>:-Wextra>
$<$<C_COMPILER_ID:Clang,GNU>:-Wno-parentheses>
$<$<C_COMPILER_ID:Clang,GNU>:-Wno-long-long>
$<$<C_COMPILER_ID:Clang,GNU>:-fvisibility=hidden>
)
add_executable(seeking_example
"${CMAKE_CURRENT_SOURCE_DIR}/examples/seeking_example.c"
)
add_executable(OpusFile::seeking_example ALIAS seeking_example)
if(WIN32)
target_sources(seeking_example PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/examples/win32utf8.c"
"${CMAKE_CURRENT_SOURCE_DIR}/examples/win32utf8.h"
)
endif()
target_include_directories(seeking_example
PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/examples"
)
target_link_libraries(seeking_example
PRIVATE
opusfile
opusurl
)
target_compile_options(seeking_example
PRIVATE
$<$<C_COMPILER_ID:MSVC>:/wd4267>
$<$<C_COMPILER_ID:MSVC>:/wd4244>
$<$<C_COMPILER_ID:MSVC>:/wd4090>
$<$<C_COMPILER_ID:Clang,GNU>:-std=c89>
$<$<C_COMPILER_ID:Clang,GNU>:-pedantic>
$<$<C_COMPILER_ID:Clang,GNU>:-Wall>
$<$<C_COMPILER_ID:Clang,GNU>:-Wextra>
$<$<C_COMPILER_ID:Clang,GNU>:-Wno-parentheses>
$<$<C_COMPILER_ID:Clang,GNU>:-Wno-long-long>
$<$<C_COMPILER_ID:Clang,GNU>:-fvisibility=hidden>
)
endif()
if(NOT OP_DISABLE_DOCS)
find_package(Doxygen OPTIONAL_COMPONENTS dot)
set(DOXYGEN_PROJECT_BRIEF "Stand-alone decoder library for .opus files.")
set(DOXYGEN_OPTIMIZE_OUTPUT_FOR_C YES)
set(DOXYGEN_QUIET YES)
set(DOXYGEN_WARNINGS YES)
set(DOXYGEN_WARN_IF_UNDOCUMENTED YES)
set(DOXYGEN_WARN_IF_DOC_ERROR YES)
set(DOXYGEN_WARN_NO_PARAMDOC YES)
set(DOXYGEN_JAVADOC_AUTOBRIEF YES)
set(DOXYGEN_SORT_MEMBER_DOCS NO)
set(DOXYGEN_PROJECT_LOGO "${CMAKE_CURRENT_SOURCE_DIR}/doc/opus_logo.svg")
set(DOXYGEN_FULL_PATH_NAMES NO)
doxygen_add_docs(doxygen "${CMAKE_CURRENT_SOURCE_DIR}/include/opusfile.h" ALL USE_STAMP_FILE)
endif()
install(EXPORT OpusFileTargets
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/opusfile"
NAMESPACE OpusFile::
)
include(CMakePackageConfigHelpers)
configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/OpusFileConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/OpusFileConfig.cmake"
INSTALL_DESTINATION
"${CMAKE_INSTALL_LIBDIR}/cmake/opusfile"
)
write_basic_package_version_file(
"OpusFileConfigVersion.cmake"
VERSION "${PACKAGE_VERSION}"
COMPATIBILITY AnyNewerVersion
)
install(
FILES
"${CMAKE_CURRENT_BINARY_DIR}/OpusFileConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/OpusFileConfigVersion.cmake"
DESTINATION
"${CMAKE_INSTALL_LIBDIR}/cmake/opusfile"
)
Copyright (c) 1994-2013 Xiph.Org Foundation and contributors
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Xiph.Org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
ACLOCAL_AMFLAGS = -I m4
AM_CFLAGS = -I$(top_srcdir)/include $(DEPS_CFLAGS)
dist_doc_DATA = COPYING AUTHORS README.md
opusincludedir = ${includedir}/opus
opusinclude_HEADERS = include/opusfile.h
lib_LTLIBRARIES = libopusfile.la libopusurl.la
libopusfile_la_SOURCES = \
src/info.c \
src/internal.c src/internal.h \
src/opusfile.c src/stream.c
libopusfile_la_LIBADD = $(DEPS_LIBS) $(lrintf_lib)
libopusfile_la_LDFLAGS = -no-undefined \
-version-info @OP_LT_CURRENT@:@OP_LT_REVISION@:@OP_LT_AGE@
libopusurl_la_SOURCES = src/http.c src/internal.c src/internal.h
libopusurl_la_CFLAGS = $(AM_CFLAGS) $(URL_DEPS_CFLAGS)
libopusurl_la_LIBADD = libopusfile.la $(URL_DEPS_LIBS)
libopusurl_la_LDFLAGS = -no-undefined \
-version-info @OP_LT_CURRENT@:@OP_LT_REVISION@:@OP_LT_AGE@
if OP_ENABLE_EXAMPLES
noinst_PROGRAMS = examples/opusfile_example examples/seeking_example
endif
examples_opusfile_example_SOURCES = examples/opusfile_example.c
examples_seeking_example_SOURCES = examples/seeking_example.c
examples_opusfile_example_LDADD = libopusurl.la libopusfile.la
examples_seeking_example_LDADD = libopusurl.la libopusfile.la
if OP_WIN32
if OP_ENABLE_HTTP
libopusurl_la_SOURCES += src/wincerts.c src/winerrno.h
libopusurl_la_LIBADD += -lws2_32 -lcrypt32
endif
examples_opusfile_example_SOURCES += examples/win32utf8.c examples/win32utf8.h
examples_seeking_example_SOURCES += examples/win32utf8.c examples/win32utf8.h
endif
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = opusfile.pc opusurl.pc
debug:
$(MAKE) CFLAGS="${CFLAGS} -O0 -ggdb -DOP_ENABLE_ASSERTIONS" all
EXTRA_DIST = \
opusfile.pc.in \
opusurl.pc.in \
opusfile-uninstalled.pc.in \
opusurl-uninstalled.pc.in \
doc/Doxyfile.in \
doc/opus_logo.svg \
doc/Makefile \
unix/Makefile \
win32/VS2015/opusfile.sln \
win32/VS2015/opusfile.vcxproj \
win32/VS2015/opusfile.vcxproj.filters \
win32/VS2015/opusfile_example.vcxproj \
win32/VS2015/opusfile_example.vcxproj.filters \
win32/VS2015/seeking_example.vcxproj \
win32/VS2015/seeking_example.vcxproj.filters
# Targets to build and install just the library without the docs
opusfile install-opusfile: NO_DOXYGEN = 1
opusfile: all
install-opusfile: install
# Or just the docs
docs: doc/doxygen-build.stamp
install-docs:
@if [ -z "$(NO_DOXYGEN)" ]; then \
( cd doc && \
echo "Installing documentation in $(DESTDIR)$(docdir)"; \
$(INSTALL) -d $(DESTDIR)$(docdir)/html/search; \
for f in `find html -type f \! -name "installdox"` ; do \
$(INSTALL_DATA) $$f $(DESTDIR)$(docdir)/$$f; \
done ) \
fi
doc/doxygen-build.stamp: doc/Doxyfile $(top_srcdir)/doc/opus_logo.svg \
$(top_srcdir)/include/*.h
@[ -n "$(NO_DOXYGEN)" ] || ( cd doc && doxygen && touch $(@F) )
if HAVE_DOXYGEN
# Or everything (by default)
all-local: docs
install-data-local: install-docs
clean-local:
$(RM) -r doc/html
$(RM) -r doc/latex
$(RM) doc/doxygen-build.stamp
uninstall-local:
$(RM) -r $(DESTDIR)$(docdir)/html
endif
# We check this every time make is run, with configure.ac being touched to
# trigger an update of the build system files if update_version changes the
# current PACKAGE_VERSION (or if package_version was modified manually by a
# user with either AUTO_UPDATE=no or no update_version script present - the
# latter being the normal case for tarball releases).
#
# We can't just add the package_version file to CONFIGURE_DEPENDENCIES since
# simply running autoconf will not actually regenerate configure for us when
# the content of that file changes (due to autoconf dependency checking not
# knowing about that without us creating yet another file for it to include).
#
# The MAKECMDGOALS check is a gnu-make'ism, but will degrade 'gracefully' for
# makes that don't support it. The only loss of functionality is not forcing
# an update of package_version for `make dist` if AUTO_UPDATE=no, but that is
# unlikely to be a real problem for any real user.
$(top_srcdir)/configure.ac: force
@case "$(MAKECMDGOALS)" in \
dist-hook) exit 0 ;; \
dist-* | dist | distcheck | distclean) _arg=release ;; \
esac; \
if ! $(top_srcdir)/update_version $$_arg 2> /dev/null; then \
if [ ! -e $(top_srcdir)/package_version ]; then \
echo 'PACKAGE_VERSION="unknown"' > $(top_srcdir)/package_version; \
fi; \
. $(top_srcdir)/package_version || exit 1; \
[ "$(PACKAGE_VERSION)" != "$$PACKAGE_VERSION" ] || exit 0; \
fi; \
touch $@
force:
# Create a minimal package_version file when make dist is run.
dist-hook:
echo 'PACKAGE_VERSION="$(PACKAGE_VERSION)"' > $(top_distdir)/package_version
.PHONY: opusfile install-opusfile docs install-docs
# Opusfile
[![GitLab Pipeline Status](https://gitlab.xiph.org/xiph/opusfile/badges/master/pipeline.svg)](https://gitlab.xiph.org/xiph/opusfile/commits/master)
[![Travis Build Status](https://travis-ci.org/xiph/opusfile.svg?branch=master)](https://travis-ci.org/xiph/opusfile)
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/xiph/opusfile?branch=master&svg=true)](https://ci.appveyor.com/project/rillian/opusfile)
The opusfile and opusurl libraries provide a high-level API for
decoding and seeking within .opus files on disk or over http(s).
opusfile depends on libopus and libogg.
opusurl depends on opusfile and openssl.
The library is functional, but there are likely issues
we didn't find in our own testing. Please give feedback
in #opus on irc.libera.chat or at opus@xiph.org.
Programming documentation is available in tree and online at
https://opus-codec.org/docs/
== Opusfile ==
Library for decoding .opus files, including seeking support.
#!/bin/sh
# Run this to set up the build system: configure, makefiles, etc.
set -e
srcdir=`dirname $0`
test -n "$srcdir" && cd "$srcdir"
echo "Updating build configuration files for opusfile, please wait...."
autoreconf -isf
# Continuous integration build script for opusfile.
# This script is run by automated frameworks to verify commits
# see https://mf4.xiph.org/jenkins/job/opusfile-autotools/
# This is intended to be run from the top-level source directory.
set -x
# WARNING: clobbers outside the current tree!
rm -f ../opus
ln -s /srv/jenkins/jobs/opus/workspace ../opus
rm -f ../ogg
ln -s /srv/jenkins/jobs/libogg/workspace ../ogg
# HACK: libtool can't link a dynamic library to a static
# library, and the 'unix' makefile build can't link to
# a libopus.la. As a work around, hack our own pkg-config
# file for the uninstalled opus library we want to build
# against.
cat <<EOF > opus-uninstalled.pc
# Opus codec uninstalled pkg-config file
# hacked up for the opusfile autotools build.
libdir=\${pcfiledir}/../opus
includedir=\${libdir}/include
Name: opus uninstalled for opusfile
Description: Opus IETF audio codec (not installed)
Version: 1.0.1
Requires:
Conflicts:
Libs: \${libdir}/libopus.la -lm
Cflags: -I\${includedir}
EOF
cat <<EOF > ogg-uninstalled.pc
# ogg uninstalled pkg-config file
# hacked up for the opusfile autotools build
libdir=\${pcfiledir}/../ogg/src
includedir=\${pcfiledir}/../ogg/include
Name: ogg uninstalled for opusfile
Description: ogg is a library for manipulating ogg bitstreams (not installed)
Version: 1.3.0
Requires:
Conflicts:
Libs: \${libdir}/libogg.la
Cflags: -I\${includedir}
EOF
PKG_CONFIG_PATH=$PWD
# compile
./autogen.sh
./configure PKG_CONFIG_PATH=${PKG_CONFIG_PATH}
make clean
make
# verify distribution target
make distcheck PKG_CONFIG_PATH=${PKG_CONFIG_PATH}
# build the documentation
# currently fails on jenkins (debian stretch)
# make -C doc/latex
# Continuous integration build script for opusfile.
# This script is run by automated frameworks to verify commits
# see https://mf4.xiph.org/jenkins/job/opusfile-unix/
# This is intended to be run from the top-level source directory.
set -x
# WARNING: clobbers outside the current tree!
rm -f ../opus
ln -s /srv/jenkins/jobs/opus/workspace ../opus
# compile
make -C unix PKG_CONFIG_PATH=$PWD/../opus clean
make -C unix PKG_CONFIG_PATH=$PWD/../opus
# run any built-in tests
make -C unix PKG_CONFIG_PATH=$PWD/../opus check
# build the documentation
make -C doc
# currently fails on jenkins (debian stretch)
# make -C doc/latex
find_package(Ogg CONFIG)
if(NOT TARGET Ogg::ogg)
find_package(PkgConfig REQUIRED)
pkg_check_modules(Ogg REQUIRED IMPORTED_TARGET ogg)
set_target_properties(PkgConfig::Ogg PROPERTIES IMPORTED_GLOBAL TRUE)
add_library(Ogg::ogg ALIAS PkgConfig::Ogg)
endif()
find_package(Opus CONFIG)
if(NOT TARGET Opus::opus)
find_package(PkgConfig REQUIRED)
pkg_check_modules(Opus REQUIRED IMPORTED_TARGET opus)
set_target_properties(PkgConfig::Opus PROPERTIES IMPORTED_GLOBAL TRUE)
add_library(Opus::opus ALIAS PkgConfig::Opus)
endif()
@PACKAGE_INIT@
# Ported from CMakeFindDependencyMacro.cmake (finding configs and using pkgconfig as fallback)
set(cmake_quiet_arg)
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
set(cmake_quiet_arg QUIET)
endif()
set(cmake_required_arg)
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED)
set(cmake_required_arg REQUIRED)
endif()
find_package(Ogg CONFIG ${cmake_quiet_arg})
if(NOT TARGET Ogg::ogg)
find_package(PkgConfig REQUIRED ${cmake_quiet_arg})
pkg_check_modules(Ogg ${cmake_required_arg} ${cmake_quiet_arg} IMPORTED_TARGET ogg)
set_target_properties(PkgConfig::Ogg PROPERTIES IMPORTED_GLOBAL TRUE)
add_library(Ogg::ogg ALIAS PkgConfig::Ogg)
endif()
if (NOT TARGET Ogg::ogg)
set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "${CMAKE_FIND_PACKAGE_NAME} could not be found because dependency Ogg could not be found.")
set(${CMAKE_FIND_PACKAGE_NAME}_FOUND False)
return()
endif()
find_package(Opus CONFIG ${cmake_quiet_arg})
if(NOT TARGET Opus::opus)
find_package(PkgConfig REQUIRED ${cmake_quiet_arg})
pkg_check_modules(Opus ${cmake_required_arg} ${cmake_quiet_arg} IMPORTED_TARGET opus)
set_target_properties(PkgConfig::Opus PROPERTIES IMPORTED_GLOBAL TRUE)
add_library(Opus::opus ALIAS PkgConfig::Opus)
endif()
if (NOT TARGET Opus::opus)
set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "${CMAKE_FIND_PACKAGE_NAME} could not be found because dependency Opus could not be found.")
set(${CMAKE_FIND_PACKAGE_NAME}_FOUND False)
return()
endif()
set(cmake_fd_required_arg)
set(cmake_fd_quiet_arg)
if (NOT @OP_DISABLE_HTTP@)
include(CMakeFindDependencyMacro)
find_dependency(OpenSSL)
endif()
# Including targets of opusfile
include("${CMAKE_CURRENT_LIST_DIR}/opusfileTargets.cmake")
check_required_components(opusfile)
if(__opusfile_version)
return()
endif()
set(__opusfile_version INCLUDED)
function(get_package_version PACKAGE_VERSION PROJECT_VERSION)
find_package(Git)
if(GIT_FOUND AND EXISTS "${CMAKE_CURRENT_LIST_DIR}/.git")
execute_process(COMMAND ${GIT_EXECUTABLE}
--git-dir=${CMAKE_CURRENT_LIST_DIR}/.git describe
--tags --match "v*" OUTPUT_VARIABLE OPUSFILE_PACKAGE_VERSION)
if(OPUSFILE_PACKAGE_VERSION)
string(STRIP ${OPUSFILE_PACKAGE_VERSION}, OPUSFILE_PACKAGE_VERSION)
string(REPLACE \n
""
OPUSFILE_PACKAGE_VERSION
${OPUSFILE_PACKAGE_VERSION})
string(REPLACE ,
""
OPUSFILE_PACKAGE_VERSION
${OPUSFILE_PACKAGE_VERSION})
string(SUBSTRING ${OPUSFILE_PACKAGE_VERSION}
1
-1
OPUSFILE_PACKAGE_VERSION)
message(STATUS "Opus package version from git repo: ${OPUSFILE_PACKAGE_VERSION}")
endif()
elseif(EXISTS "${CMAKE_CURRENT_LIST_DIR}/package_version"
AND NOT OPUSFILE_PACKAGE_VERSION)
# Not a git repo, lets' try to parse it from package_version file if exists
file(STRINGS package_version OPUSFILE_PACKAGE_VERSION
LIMIT_COUNT 1
REGEX "PACKAGE_VERSION=")
string(REPLACE "PACKAGE_VERSION="
""
OPUSFILE_PACKAGE_VERSION
${OPUSFILE_PACKAGE_VERSION})
string(REPLACE "\""
""
OPUSFILE_PACKAGE_VERSION
${OPUSFILE_PACKAGE_VERSION})
# In case we have a unknown dist here we just replace it with 0
string(REPLACE "unknown"
"0"
OPUSFILE_PACKAGE_VERSION
${OPUSFILE_PACKAGE_VERSION})
message(STATUS "Opus package version from package_version file: ${OPUSFILE_PACKAGE_VERSION}")
endif()
if(OPUSFILE_PACKAGE_VERSION)
string(REGEX
REPLACE "^([0-9]+.[0-9]+\\.?([0-9]+)?).*"
"\\1"
OPUSFILE_PROJECT_VERSION
${OPUSFILE_PACKAGE_VERSION})
else()
# fail to parse version from git and package version
message(WARNING "Could not get package version.")
set(OPUSFILE_PACKAGE_VERSION 0)
set(OPUSFILE_PROJECT_VERSION 0)
endif()
message(STATUS "Opus project version: ${OPUSFILE_PROJECT_VERSION}")
set(PACKAGE_VERSION ${OPUSFILE_PACKAGE_VERSION} PARENT_SCOPE)
set(PROJECT_VERSION ${OPUSFILE_PROJECT_VERSION} PARENT_SCOPE)
endfunction()
# autoconf source script for generating configure
dnl The package_version file will be automatically synced to the git revision
dnl by the update_version script when configured in the repository, but will
dnl remain constant in tarball releases unless it is manually edited.
m4_define([CURRENT_VERSION],
m4_esyscmd([ ./update_version 2>/dev/null || true
if test -e package_version; then
. ./package_version
printf "$PACKAGE_VERSION"
else
printf "unknown"
fi ]))
AC_INIT([opusfile],[CURRENT_VERSION],[opus@xiph.org])
AC_CONFIG_SRCDIR([src/opusfile.c])
AC_CONFIG_MACRO_DIR([m4])
AC_USE_SYSTEM_EXTENSIONS
AC_SYS_LARGEFILE
AM_INIT_AUTOMAKE([1.11 foreign no-define dist-zip subdir-objects])
AM_MAINTAINER_MODE([enable])
LT_INIT
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
dnl Library versioning for libtool.
dnl Please update these for releases.
dnl CURRENT, REVISION, AGE
dnl - library source changed -> increment REVISION
dnl - interfaces added/removed/changed -> increment CURRENT, REVISION = 0
dnl - interfaces added -> increment AGE
dnl - interfaces removed -> AGE = 0
OP_LT_CURRENT=4
OP_LT_REVISION=5
OP_LT_AGE=4
AC_SUBST(OP_LT_CURRENT)
AC_SUBST(OP_LT_REVISION)
AC_SUBST(OP_LT_AGE)
CC_CHECK_CFLAGS_APPEND(
[-std=c89 -pedantic -Wall -Wextra -Wno-parentheses -Wno-long-long])
# Platform-specific tweaks
case $host in
*-mingw*)
# -std=c89 causes some warnings under mingw.
CC_CHECK_CFLAGS_APPEND([-U__STRICT_ANSI__])
# We need WINNT>=0x501 (WindowsXP) for getaddrinfo/freeaddrinfo.
# It's okay to define this even when HTTP support is disabled, as it only
# affects header declarations, not linking (unless we actually use some
# XP-only functions).
AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x501,
[We need at least WindowsXP for getaddrinfo/freeaddrinfo])
host_mingw=true
;;
esac
AM_CONDITIONAL(OP_WIN32, [test "$host_mingw" = "true"])
AC_ARG_ENABLE([assertions],
AS_HELP_STRING([--enable-assertions], [Enable assertions in code]),,
enable_assertions=no)
AS_IF([test "$enable_assertions" = "yes"], [
AC_DEFINE([OP_ENABLE_ASSERTIONS], [1], [Enable assertions in code])
])
AC_ARG_ENABLE([http],
AS_HELP_STRING([--disable-http], [Disable HTTP support]),,
enable_http=yes)
AM_COND_IF(OP_WIN32, [
AS_IF([test "$enable_http" != "no"], [
AC_CHECK_HEADER([winsock2.h],, [
AC_MSG_WARN([HTTP support requires a Winsock socket library.])
enable_http=no
])
])
], [
AS_IF([test "$enable_http" != "no"], [
AC_CHECK_HEADER([sys/socket.h],, [
AC_MSG_WARN([HTTP support requires a POSIX socket library.])
enable_http=no
])
])
])
# HTTP support requires either clock_gettime or ftime. clock_gettime is
# used only if time.h defines CLOCK_REALTIME and the function is available
# in the standard library; on platforms such as glibc < 2.17 where -lrt
# or another library would be required, ftime will be used.
AS_IF([test "$enable_http" != "no"], [
AC_MSG_CHECKING([for clock_gettime])
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[#include <time.h>]], [[
struct timespec ts;
return clock_gettime(CLOCK_REALTIME, &ts);
]])
], [
AC_MSG_RESULT([yes])
AC_DEFINE([OP_HAVE_CLOCK_GETTIME], [1],
[Enable use of clock_gettime function])
], [
AC_MSG_RESULT([no])
AC_SEARCH_LIBS(ftime, [compat], , [enable_http=no])
])
])
m4_ifndef([PKG_PROG_PKG_CONFIG],
[m4_fatal([Could not locate the pkg-config autoconf macros.
Please make sure pkg-config is installed and, if necessary, set the environment
variable ACLOCAL="aclocal -I/path/to/pkg.m4".])])
AS_IF([test "$enable_http" != "no"], [
openssl="openssl"
AC_DEFINE([OP_ENABLE_HTTP], [1], [Enable HTTP support])
PKG_CHECK_MODULES([URL_DEPS], [openssl])
])
AM_CONDITIONAL(OP_ENABLE_HTTP, [test "$enable_http" != "no"])
AC_SUBST([openssl])
PKG_CHECK_MODULES([DEPS], [ogg >= 1.3 opus >= 1.0.1])
AC_ARG_ENABLE([fixed-point],
AS_HELP_STRING([--enable-fixed-point], [Enable fixed-point calculation]),,
enable_fixed_point=no)
AC_ARG_ENABLE([float],
AS_HELP_STRING([--disable-float], [Disable floating-point API]),,
enable_float=yes)
AS_IF([test "$enable_float" = "no"],
[enable_fixed_point=yes
AC_DEFINE([OP_DISABLE_FLOAT_API], [1], [Disable floating-point API])
]
)
AS_IF([test "$enable_fixed_point" = "yes"],
[AC_DEFINE([OP_FIXED_POINT], [1], [Enable fixed-point calculation])],
[dnl This only has to be tested for if float->fixed conversions are required
saved_LIBS="$LIBS"
AC_SEARCH_LIBS([lrintf], [m], [
AC_DEFINE([OP_HAVE_LRINTF], [1], [Enable use of lrintf function])
lrintf_notice="
Library for lrintf() ......... ${ac_cv_search_lrintf}"
])
LIBS="$saved_LIBS"
]
)
AC_ARG_ENABLE([examples],
AS_HELP_STRING([--disable-examples], [Do not build example applications]),,
enable_examples=yes)
AM_CONDITIONAL([OP_ENABLE_EXAMPLES], [test "$enable_examples" = "yes"])
AS_CASE(["$ac_cv_search_lrintf"],
["no"],[],
["none required"],[],
[lrintf_lib="$ac_cv_search_lrintf"])
AC_SUBST([lrintf_lib])
CC_ATTRIBUTE_VISIBILITY([default], [
CC_FLAG_VISIBILITY([CFLAGS="${CFLAGS} -fvisibility=hidden"])
])
dnl Check for doxygen
AC_ARG_ENABLE([doc],
AS_HELP_STRING([--disable-doc], [Do not build API documentation]),,
[enable_doc=yes]
)
AS_IF([test "$enable_doc" = "yes"], [
AC_CHECK_PROG([HAVE_DOXYGEN], [doxygen], [yes], [no])
AC_CHECK_PROG([HAVE_DOT], [dot], [yes], [no])
],[
HAVE_DOXYGEN=no
])
AM_CONDITIONAL([HAVE_DOXYGEN], [test "$HAVE_DOXYGEN" = "yes"])
AC_CONFIG_FILES([
Makefile
opusfile.pc
opusurl.pc
opusfile-uninstalled.pc
opusurl-uninstalled.pc
doc/Doxyfile
])
AC_CONFIG_HEADERS([config.h])
AC_OUTPUT
AC_MSG_NOTICE([
------------------------------------------------------------------------
$PACKAGE_NAME $PACKAGE_VERSION: Automatic configuration OK.
Assertions ................... ${enable_assertions}
HTTP support ................. ${enable_http}
Fixed-point .................. ${enable_fixed_point}
Floating-point API ........... ${enable_float}${lrintf_notice}
Hidden visibility ............ ${cc_cv_flag_visibility}
API code examples ............ ${enable_examples}
API documentation ............ ${enable_doc}
------------------------------------------------------------------------
])