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 (340)
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
......@@ -14,7 +17,14 @@ 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
......@@ -27,3 +37,14 @@ 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
......@@ -2,3 +2,4 @@ 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-2012 Xiph.Org Foundation and contributors
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
......
......@@ -2,39 +2,66 @@ ACLOCAL_AMFLAGS = -I m4
AM_CFLAGS = -I$(top_srcdir)/include $(DEPS_CFLAGS)
dist_doc_DATA = COPYING AUTHORS README.txt
dist_doc_DATA = COPYING AUTHORS README.md
opusincludedir = ${includedir}/opus
opusinclude_HEADERS = include/opusfile.h
lib_LTLIBRARIES = libopusfile.la
lib_LTLIBRARIES = libopusfile.la libopusurl.la
libopusfile_la_SOURCES = \
src/http.c src/info.c \
src/info.c \
src/internal.c src/internal.h \
src/opusfile.c src/stream.c
libopusfile_la_LIBADD = $(DEPS_LIBS)
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_LDADD = libopusfile.la
examples_seeking_example_LDADD = libopusfile.la
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
debug:
$(MAKE) CFLAGS="${CFLAGS} -O0 -ggdb -DOP_ENABLE_ASSERTIONS" all
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
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/git-version.sh \
doc/opus_logo.svg \
doc/Makefile \
unix/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
......@@ -49,8 +76,8 @@ 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) -d $(DESTDIR)$(docdir)/html/search; \
$(INSTALL_DATA) $$f $(DESTDIR)$(docdir)/$$f; \
done ) \
fi
......@@ -77,4 +104,40 @@ uninstall-local:
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.
......@@ -7,5 +7,4 @@ test -n "$srcdir" && cd "$srcdir"
echo "Updating build configuration files for opusfile, please wait...."
ACLOCAL_FLAGS="-I m4"
autoreconf -isf
......@@ -61,4 +61,5 @@ make
make distcheck PKG_CONFIG_PATH=${PKG_CONFIG_PATH}
# build the documentation
make -C doc/latex
# currently fails on jenkins (debian stretch)
# make -C doc/latex
......@@ -19,4 +19,5 @@ make -C unix PKG_CONFIG_PATH=$PWD/../opus check
# build the documentation
make -C doc
make -C doc/latex
# 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
AC_INIT([opusfile], m4_esyscmd([doc/git-version.sh]))
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])
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])])
AC_CONFIG_MACRO_DIR([m4])
dnl Library versioning for libtool.
dnl Please update these for releases.
dnl CURRENT, REVISION, AGE
......@@ -21,19 +33,38 @@ dnl - interfaces added/removed/changed -> increment CURRENT, REVISION = 0
dnl - interfaces added -> increment AGE
dnl - interfaces removed -> AGE = 0
OP_LT_CURRENT=0
OP_LT_REVISION=1
OP_LT_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 "x$enable_assertions" = "xyes"], [
AS_IF([test "$enable_assertions" = "yes"], [
AC_DEFINE([OP_ENABLE_ASSERTIONS], [1], [Enable assertions in code])
])
......@@ -41,20 +72,57 @@ AC_ARG_ENABLE([http],
AS_HELP_STRING([--disable-http], [Disable HTTP support]),,
enable_http=yes)
AS_IF([test "x$enable_http" != "xno"],
AC_CHECK_HEADER([sys/socket.h],,
AC_MSG_WARN([HTTP support requires a posix socket library.])
enable_http=no
)
)
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 "x$enable_http" != "xno"], [
AS_IF([test "$enable_http" != "no"], [
openssl="openssl"
AC_DEFINE([OP_ENABLE_HTTP], [1], [Enable HTTP support])
PKG_CHECK_MODULES([URL_DEPS], [openssl])
])
AC_SUBST(openssl)
AM_CONDITIONAL(OP_ENABLE_HTTP, [test "$enable_http" != "no"])
AC_SUBST([openssl])
PKG_CHECK_MODULES([DEPS], [ogg >= 1.3 opus >= 1.0.1 ${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]),,
......@@ -63,60 +131,70 @@ AC_ARG_ENABLE([float],
AS_HELP_STRING([--disable-float], [Disable floating-point API]),,
enable_float=yes)
AS_IF([test "x$enable_float" = "xno"],
AS_IF([test "$enable_float" = "no"],
[enable_fixed_point=yes
AC_DEFINE([OP_DISABLE_FLOAT_API], [1], [Disable floating-point API])
]
)
AS_IF([test "x$enable_fixed_point" = "xyes"],
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_SUBST(ac_cv_search_lrintf)
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"])
])
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__])
;;
esac
dnl Check for doxygen
AC_ARG_ENABLE([doc],
AS_HELP_STRING([--disable-doc], [Do not build API documentation]),,
[enable_doc=yes]
)
AC_CHECK_PROG(HAVE_DOXYGEN, doxygen, yes, no)
if test "$HAVE_DOXYGEN" != "yes" -o "$enable_doc" != "yes" ; then
HAVE_DOXYGEN="no"
enable_doc="no"
fi
AM_CONDITIONAL(HAVE_DOXYGEN, [test $HAVE_DOXYGEN = yes])
AC_OUTPUT([
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 $VERSION: Automatic configuration OK.
$PACKAGE_NAME $PACKAGE_VERSION: Automatic configuration OK.
Assertions ................... ${enable_assertions}
......@@ -126,6 +204,7 @@ AC_MSG_NOTICE([
Hidden visibility ............ ${cc_cv_flag_visibility}
API code examples ............ ${enable_examples}
API documentation ............ ${enable_doc}
------------------------------------------------------------------------
])