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 (41)
...@@ -47,3 +47,4 @@ test-driver ...@@ -47,3 +47,4 @@ test-driver
unix/objs unix/objs
unix/opusfile_example unix/opusfile_example
unix/seeking_example unix/seeking_example
build
# Image from https://hub.docker.com/_/gcc/ based on Debian default:
image: gcc:9 tags:
- docker
# Image from https://hub.docker.com/_/gcc/ based on Debian
image: gcc:9
autotools: autotools:
stage: build stage: build
...@@ -12,6 +15,18 @@ autotools: ...@@ -12,6 +15,18 @@ autotools:
- ./configure - ./configure
- make - make
- make distcheck - 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: tags:
- docker - docker
...@@ -23,8 +38,6 @@ makefile: ...@@ -23,8 +38,6 @@ makefile:
script: script:
- make -C unix - make -C unix
- make -C unix check - make -C unix check
tags:
- docker
doc: doc:
stage: build stage: build
...@@ -33,5 +46,3 @@ doc: ...@@ -33,5 +46,3 @@ doc:
apt-get install -y doxygen graphviz apt-get install -y doxygen graphviz
script: script:
- make -C doc - make -C doc
tags:
- docker
...@@ -13,14 +13,25 @@ osx_image: xcode11.3 ...@@ -13,14 +13,25 @@ osx_image: xcode11.3
addons: addons:
apt: apt:
packages: packages:
- doxygen
- libogg-dev - libogg-dev
- libopus-dev - libopus-dev
- libssl-dev
homebrew: homebrew:
brewfile: true brewfile: true
env: PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/opt/openssl/lib/pkgconfig 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: script:
- cmake -Bbuild -H.
- cmake --build build
- ./autogen.sh - ./autogen.sh
- ./configure - ./configure
- make - make
......
...@@ -5,3 +5,5 @@ brew 'autoconf' ...@@ -5,3 +5,5 @@ brew 'autoconf'
brew 'automake' brew 'automake'
brew 'libtool' brew 'libtool'
brew 'pkg-config' 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"
)
...@@ -12,7 +12,7 @@ opusurl depends on opusfile and openssl. ...@@ -12,7 +12,7 @@ opusurl depends on opusfile and openssl.
The library is functional, but there are likely issues The library is functional, but there are likely issues
we didn't find in our own testing. Please give feedback we didn't find in our own testing. Please give feedback
in #opus on irc.freenode.net or at opus@xiph.org. in #opus on irc.libera.chat or at opus@xiph.org.
Programming documentation is available in tree and online at Programming documentation is available in tree and online at
https://opus-codec.org/docs/ https://opus-codec.org/docs/
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()
...@@ -147,18 +147,18 @@ typedef struct OggOpusFile OggOpusFile; ...@@ -147,18 +147,18 @@ typedef struct OggOpusFile OggOpusFile;
/**@endcond*/ /**@endcond*/
/**\defgroup error_codes Error Codes*/ /**\defgroup error_codes Error Codes*/
/*@{*/ /**@{*/
/**\name List of possible error codes /**\name List of possible error codes
Many of the functions in this library return a negative error code when a Many of the functions in this library return a negative error code when a
function fails. function fails.
This list provides a brief explanation of the common errors. This list provides a brief explanation of the common errors.
See each individual function for more details on what a specific error code See each individual function for more details on what a specific error code
means in that context.*/ means in that context.*/
/*@{*/ /**@{*/
/**A request did not succeed.*/ /**A request did not succeed.*/
#define OP_FALSE (-1) #define OP_FALSE (-1)
/*Currently not used externally.*/ /**Currently not used externally.**/
#define OP_EOF (-2) #define OP_EOF (-2)
/**There was a hole in the page sequence numbers (e.g., a page was corrupt or /**There was a hole in the page sequence numbers (e.g., a page was corrupt or
missing).*/ missing).*/
...@@ -185,7 +185,7 @@ typedef struct OggOpusFile OggOpusFile; ...@@ -185,7 +185,7 @@ typedef struct OggOpusFile OggOpusFile;
#define OP_EBADHEADER (-133) #define OP_EBADHEADER (-133)
/**The ID header contained an unrecognized version number.*/ /**The ID header contained an unrecognized version number.*/
#define OP_EVERSION (-134) #define OP_EVERSION (-134)
/*Currently not used at all.*/ /**Currently not used at all.**/
#define OP_ENOTAUDIO (-135) #define OP_ENOTAUDIO (-135)
/**An audio packet failed to decode properly. /**An audio packet failed to decode properly.
This is usually caused by a multistream Ogg packet where the durations of This is usually caused by a multistream Ogg packet where the durations of
...@@ -200,11 +200,11 @@ typedef struct OggOpusFile OggOpusFile; ...@@ -200,11 +200,11 @@ typedef struct OggOpusFile OggOpusFile;
/**The first or last granule position of a link failed basic validity checks.*/ /**The first or last granule position of a link failed basic validity checks.*/
#define OP_EBADTIMESTAMP (-139) #define OP_EBADTIMESTAMP (-139)
/*@}*/ /**@}*/
/*@}*/ /**@}*/
/**\defgroup header_info Header Information*/ /**\defgroup header_info Header Information*/
/*@{*/ /**@{*/
/**The maximum number of channels in an Ogg Opus stream.*/ /**The maximum number of channels in an Ogg Opus stream.*/
#define OPUS_CHANNEL_COUNT_MAX (255) #define OPUS_CHANNEL_COUNT_MAX (255)
...@@ -311,7 +311,7 @@ struct OpusTags{ ...@@ -311,7 +311,7 @@ struct OpusTags{
}; };
/**\name Picture tag image formats*/ /**\name Picture tag image formats*/
/*@{*/ /**@{*/
/**The MIME type was not recognized, or the image data did not match the /**The MIME type was not recognized, or the image data did not match the
declared MIME type.*/ declared MIME type.*/
...@@ -325,7 +325,7 @@ struct OpusTags{ ...@@ -325,7 +325,7 @@ struct OpusTags{
/**The image is a GIF.*/ /**The image is a GIF.*/
#define OP_PIC_FORMAT_GIF (3) #define OP_PIC_FORMAT_GIF (3)
/*@}*/ /**@}*/
/**The contents of a METADATA_BLOCK_PICTURE tag.*/ /**The contents of a METADATA_BLOCK_PICTURE tag.*/
struct OpusPictureTag{ struct OpusPictureTag{
...@@ -398,7 +398,7 @@ struct OpusPictureTag{ ...@@ -398,7 +398,7 @@ struct OpusPictureTag{
These can be used to query the headers returned by <tt>libopusfile</tt>, or These can be used to query the headers returned by <tt>libopusfile</tt>, or
to parse Opus headers from sources other than an Ogg Opus stream, provided to parse Opus headers from sources other than an Ogg Opus stream, provided
they use the same format.*/ they use the same format.*/
/*@{*/ /**@{*/
/**Parses the contents of the ID header packet of an Ogg Opus stream. /**Parses the contents of the ID header packet of an Ogg Opus stream.
\param[out] _head Returns the contents of the parsed packet. \param[out] _head Returns the contents of the parsed packet.
...@@ -671,12 +671,12 @@ void opus_picture_tag_init(OpusPictureTag *_pic) OP_ARG_NONNULL(1); ...@@ -671,12 +671,12 @@ void opus_picture_tag_init(OpusPictureTag *_pic) OP_ARG_NONNULL(1);
\param _pic The #OpusPictureTag structure to clear.*/ \param _pic The #OpusPictureTag structure to clear.*/
void opus_picture_tag_clear(OpusPictureTag *_pic) OP_ARG_NONNULL(1); void opus_picture_tag_clear(OpusPictureTag *_pic) OP_ARG_NONNULL(1);
/*@}*/ /**@}*/
/*@}*/ /**@}*/
/**\defgroup url_options URL Reading Options*/ /**\defgroup url_options URL Reading Options*/
/*@{*/ /**@{*/
/**\name URL reading options /**\name URL reading options
Options for op_url_stream_create() and associated functions. Options for op_url_stream_create() and associated functions.
These allow you to provide proxy configuration parameters, skip SSL These allow you to provide proxy configuration parameters, skip SSL
...@@ -685,7 +685,7 @@ void opus_picture_tag_clear(OpusPictureTag *_pic) OP_ARG_NONNULL(1); ...@@ -685,7 +685,7 @@ void opus_picture_tag_clear(OpusPictureTag *_pic) OP_ARG_NONNULL(1);
times, only the value specified by the last occurrence has an effect times, only the value specified by the last occurrence has an effect
(unless otherwise specified). (unless otherwise specified).
They may be expanded in the future.*/ They may be expanded in the future.*/
/*@{*/ /**@{*/
/**@cond PRIVATE*/ /**@cond PRIVATE*/
...@@ -843,11 +843,11 @@ void opus_server_info_clear(OpusServerInfo *_info) OP_ARG_NONNULL(1); ...@@ -843,11 +843,11 @@ void opus_server_info_clear(OpusServerInfo *_info) OP_ARG_NONNULL(1);
#define OP_GET_SERVER_INFO(_info) \ #define OP_GET_SERVER_INFO(_info) \
OP_URL_OPT(OP_GET_SERVER_INFO_REQUEST),OP_CHECK_SERVER_INFO_PTR(_info) OP_URL_OPT(OP_GET_SERVER_INFO_REQUEST),OP_CHECK_SERVER_INFO_PTR(_info)
/*@}*/ /**@}*/
/*@}*/ /**@}*/
/**\defgroup stream_callbacks Abstract Stream Reading Interface*/ /**\defgroup stream_callbacks Abstract Stream Reading Interface*/
/*@{*/ /**@{*/
/**\name Functions for reading from streams /**\name Functions for reading from streams
These functions define the interface used to read from and seek in a stream These functions define the interface used to read from and seek in a stream
of data. of data.
...@@ -856,7 +856,7 @@ void opus_server_info_clear(OpusServerInfo *_info) OP_ARG_NONNULL(1); ...@@ -856,7 +856,7 @@ void opus_server_info_clear(OpusServerInfo *_info) OP_ARG_NONNULL(1);
These functions also include some convenience routines for working with These functions also include some convenience routines for working with
standard <code>FILE</code> pointers, complete streams stored in a single standard <code>FILE</code> pointers, complete streams stored in a single
block of memory, or URLs.*/ block of memory, or URLs.*/
/*@{*/ /**@{*/
/**Reads up to \a _nbytes bytes of data from \a _stream. /**Reads up to \a _nbytes bytes of data from \a _stream.
\param _stream The stream to read from. \param _stream The stream to read from.
...@@ -1034,18 +1034,18 @@ OP_WARN_UNUSED_RESULT void *op_url_stream_vcreate(OpusFileCallbacks *_cb, ...@@ -1034,18 +1034,18 @@ OP_WARN_UNUSED_RESULT void *op_url_stream_vcreate(OpusFileCallbacks *_cb,
OP_WARN_UNUSED_RESULT void *op_url_stream_create(OpusFileCallbacks *_cb, OP_WARN_UNUSED_RESULT void *op_url_stream_create(OpusFileCallbacks *_cb,
const char *_url,...) OP_ARG_NONNULL(1) OP_ARG_NONNULL(2); const char *_url,...) OP_ARG_NONNULL(1) OP_ARG_NONNULL(2);
/*@}*/ /**@}*/
/*@}*/ /**@}*/
/**\defgroup stream_open_close Opening and Closing*/ /**\defgroup stream_open_close Opening and Closing*/
/*@{*/ /**@{*/
/**\name Functions for opening and closing streams /**\name Functions for opening and closing streams
These functions allow you to test a stream to see if it is Opus, open it, These functions allow you to test a stream to see if it is Opus, open it,
and close it. and close it.
Several flavors are provided for each of the built-in stream types, plus a Several flavors are provided for each of the built-in stream types, plus a
more general version which takes a set of application-provided callbacks.*/ more general version which takes a set of application-provided callbacks.*/
/*@{*/ /**@{*/
/**Test to see if this is an Opus stream. /**Test to see if this is an Opus stream.
For good results, you will need at least 57 bytes (for a pure Opus-only For good results, you will need at least 57 bytes (for a pure Opus-only
...@@ -1159,20 +1159,16 @@ OP_WARN_UNUSED_RESULT OggOpusFile *op_open_url(const char *_url, ...@@ -1159,20 +1159,16 @@ OP_WARN_UNUSED_RESULT OggOpusFile *op_open_url(const char *_url,
This value will be passed verbatim as the first This value will be passed verbatim as the first
argument to all of the callbacks. argument to all of the callbacks.
\param _cb The callbacks with which to access the stream. \param _cb The callbacks with which to access the stream.
<code><a href="#op_read_func">read()</a></code> must \ref op_read_func "read()" must be implemented.
be implemented. \ref op_seek_func "seek()" and \ref op_tell_func
<code><a href="#op_seek_func">seek()</a></code> and "tell()" may be <code>NULL</code>, or may always
<code><a href="#op_tell_func">tell()</a></code> may return -1 to indicate a stream is unseekable, but if
be <code>NULL</code>, or may always return -1 to \ref op_seek_func "seek()" is implemented and
indicate a stream is unseekable, but if succeeds on a particular stream, then \ref
<code><a href="#op_seek_func">seek()</a></code> is op_tell_func "tell()" must also.
implemented and succeeds on a particular stream, then \ref op_close_func "close()" may be <code>NULL</code>,
<code><a href="#op_tell_func">tell()</a></code> must but if it is not, it will be called when the \c
also. OggOpusFile is destroyed by op_free().
<code><a href="#op_close_func">close()</a></code> may
be <code>NULL</code>, but if it is not, it will be
called when the \c OggOpusFile is destroyed by
op_free().
It will not be called if op_open_callbacks() fails It will not be called if op_open_callbacks() fails
with an error. with an error.
\param _initial_data An initial buffer of data from the start of the \param _initial_data An initial buffer of data from the start of the
...@@ -1183,10 +1179,8 @@ OP_WARN_UNUSED_RESULT OggOpusFile *op_open_url(const char *_url, ...@@ -1183,10 +1179,8 @@ OP_WARN_UNUSED_RESULT OggOpusFile *op_open_url(const char *_url,
stream to be opened, even if it is unseekable. stream to be opened, even if it is unseekable.
\param _initial_bytes The number of bytes in \a _initial_data. \param _initial_bytes The number of bytes in \a _initial_data.
If the stream is seekable, its current position (as If the stream is seekable, its current position (as
reported by reported by \ref op_tell_func "tell()" at the start
<code><a href="#opus_tell_func">tell()</a></code> of this function) must be equal to \a _initial_bytes.
at the start of this function) must be equal to
\a _initial_bytes.
Otherwise, seeking to absolute positions will Otherwise, seeking to absolute positions will
generate inconsistent results. generate inconsistent results.
\param[out] _error Returns 0 on success, or a failure code on error. \param[out] _error Returns 0 on success, or a failure code on error.
...@@ -1206,11 +1200,10 @@ OP_WARN_UNUSED_RESULT OggOpusFile *op_open_url(const char *_url, ...@@ -1206,11 +1200,10 @@ OP_WARN_UNUSED_RESULT OggOpusFile *op_open_url(const char *_url,
implemented, such as an unsupported channel implemented, such as an unsupported channel
family.</dd> family.</dd>
<dt>#OP_EINVAL</dt> <dt>#OP_EINVAL</dt>
<dd><code><a href="#op_seek_func">seek()</a></code> <dd>\ref op_seek_func "seek()" was implemented and
was implemented and succeeded on this source, but succeeded on this source, but \ref op_tell_func
<code><a href="#op_tell_func">tell()</a></code> "tell()" did not, or the starting position
did not, or the starting position indicator was indicator was not equal to \a _initial_bytes.</dd>
not equal to \a _initial_bytes.</dd>
<dt>#OP_ENOTFORMAT</dt> <dt>#OP_ENOTFORMAT</dt>
<dd>The stream contained a link that did not have <dd>The stream contained a link that did not have
any logical Opus streams in it.</dd> any logical Opus streams in it.</dd>
...@@ -1341,20 +1334,16 @@ OP_WARN_UNUSED_RESULT OggOpusFile *op_test_url(const char *_url, ...@@ -1341,20 +1334,16 @@ OP_WARN_UNUSED_RESULT OggOpusFile *op_test_url(const char *_url,
This value will be passed verbatim as the first This value will be passed verbatim as the first
argument to all of the callbacks. argument to all of the callbacks.
\param _cb The callbacks with which to access the stream. \param _cb The callbacks with which to access the stream.
<code><a href="#op_read_func">read()</a></code> must \ref op_read_func "read()" must be implemented.
be implemented. \ref op_seek_func "seek()" and \ref op_tell_func
<code><a href="#op_seek_func">seek()</a></code> and "tell()" may be <code>NULL</code>, or may always
<code><a href="#op_tell_func">tell()</a></code> may return -1 to indicate a stream is unseekable, but if
be <code>NULL</code>, or may always return -1 to \ref op_seek_func "seek()" is implemented and
indicate a stream is unseekable, but if succeeds on a particular stream, then \ref
<code><a href="#op_seek_func">seek()</a></code> is op_tell_func "tell()" must also.
implemented and succeeds on a particular stream, then \ref op_close_func "close()" may be <code>NULL</code>,
<code><a href="#op_tell_func">tell()</a></code> must but if it is not, it will be called when the \c
also. OggOpusFile is destroyed by op_free().
<code><a href="#op_close_func">close()</a></code> may
be <code>NULL</code>, but if it is not, it will be
called when the \c OggOpusFile is destroyed by
op_free().
It will not be called if op_open_callbacks() fails It will not be called if op_open_callbacks() fails
with an error. with an error.
\param _initial_data An initial buffer of data from the start of the \param _initial_data An initial buffer of data from the start of the
...@@ -1367,9 +1356,8 @@ OP_WARN_UNUSED_RESULT OggOpusFile *op_test_url(const char *_url, ...@@ -1367,9 +1356,8 @@ OP_WARN_UNUSED_RESULT OggOpusFile *op_test_url(const char *_url,
\param _initial_bytes The number of bytes in \a _initial_data. \param _initial_bytes The number of bytes in \a _initial_data.
If the stream is seekable, its current position (as If the stream is seekable, its current position (as
reported by reported by
<code><a href="#opus_tell_func">tell()</a></code> \ref op_tell_func "tell()" at the start of this
at the start of this function) must be equal to function) must be equal to \a _initial_bytes.
\a _initial_bytes.
Otherwise, seeking to absolute positions will Otherwise, seeking to absolute positions will
generate inconsistent results. generate inconsistent results.
\param[out] _error Returns 0 on success, or a failure code on error. \param[out] _error Returns 0 on success, or a failure code on error.
...@@ -1418,11 +1406,11 @@ int op_test_open(OggOpusFile *_of) OP_ARG_NONNULL(1); ...@@ -1418,11 +1406,11 @@ int op_test_open(OggOpusFile *_of) OP_ARG_NONNULL(1);
\param _of The \c OggOpusFile to free.*/ \param _of The \c OggOpusFile to free.*/
void op_free(OggOpusFile *_of); void op_free(OggOpusFile *_of);
/*@}*/ /**@}*/
/*@}*/ /**@}*/
/**\defgroup stream_info Stream Information*/ /**\defgroup stream_info Stream Information*/
/*@{*/ /**@{*/
/**\name Functions for obtaining information about streams /**\name Functions for obtaining information about streams
These functions allow you to get basic information about a stream, including These functions allow you to get basic information about a stream, including
...@@ -1437,18 +1425,17 @@ void op_free(OggOpusFile *_of); ...@@ -1437,18 +1425,17 @@ void op_free(OggOpusFile *_of);
streams returned by op_test_callbacks() or one of the associated streams returned by op_test_callbacks() or one of the associated
convenience functions. convenience functions.
Their documention will indicate so explicitly.*/ Their documention will indicate so explicitly.*/
/*@{*/ /**@{*/
/**Returns whether or not the stream being read is seekable. /**Returns whether or not the stream being read is seekable.
This is true if This is true if
<ol> <ol>
<li>The <code><a href="#op_seek_func">seek()</a></code> and <li>The \ref op_seek_func "seek()" and \ref op_tell_func "tell()"
<code><a href="#op_tell_func">tell()</a></code> callbacks are both callbacks are both non-<code>NULL</code>,</li>
non-<code>NULL</code>,</li> <li>The \ref op_seek_func "seek()" callback was successfully executed at
<li>The <code><a href="#op_seek_func">seek()</a></code> callback was least once, and</li>
successfully executed at least once, and</li> <li>The \ref op_tell_func "tell()" callback was successfully able to report
<li>The <code><a href="#op_tell_func">tell()</a></code> callback was the position indicator afterwards.</li>
successfully able to report the position indicator afterwards.</li>
</ol> </ol>
This function may be called on partially-opened streams. This function may be called on partially-opened streams.
\param _of The \c OggOpusFile whose seekable status is to be returned. \param _of The \c OggOpusFile whose seekable status is to be returned.
...@@ -1638,11 +1625,11 @@ opus_int64 op_raw_tell(const OggOpusFile *_of) OP_ARG_NONNULL(1); ...@@ -1638,11 +1625,11 @@ opus_int64 op_raw_tell(const OggOpusFile *_of) OP_ARG_NONNULL(1);
\retval #OP_EINVAL The stream was only partially open.*/ \retval #OP_EINVAL The stream was only partially open.*/
ogg_int64_t op_pcm_tell(const OggOpusFile *_of) OP_ARG_NONNULL(1); ogg_int64_t op_pcm_tell(const OggOpusFile *_of) OP_ARG_NONNULL(1);
/*@}*/ /**@}*/
/*@}*/ /**@}*/
/**\defgroup stream_seeking Seeking*/ /**\defgroup stream_seeking Seeking*/
/*@{*/ /**@{*/
/**\name Functions for seeking in Opus streams /**\name Functions for seeking in Opus streams
These functions let you seek in Opus streams, if the underlying stream These functions let you seek in Opus streams, if the underlying stream
...@@ -1667,7 +1654,7 @@ ogg_int64_t op_pcm_tell(const OggOpusFile *_of) OP_ARG_NONNULL(1); ...@@ -1667,7 +1654,7 @@ ogg_int64_t op_pcm_tell(const OggOpusFile *_of) OP_ARG_NONNULL(1);
values as would be obtained by decoding the stream straight through. values as would be obtained by decoding the stream straight through.
However, such differences are expected to be smaller than the loss However, such differences are expected to be smaller than the loss
introduced by Opus's lossy compression.*/ introduced by Opus's lossy compression.*/
/*@{*/ /**@{*/
/**Seek to a byte offset relative to the <b>compressed</b> data. /**Seek to a byte offset relative to the <b>compressed</b> data.
This also scans packets to update the PCM cursor. This also scans packets to update the PCM cursor.
...@@ -1702,11 +1689,11 @@ int op_raw_seek(OggOpusFile *_of,opus_int64 _byte_offset) OP_ARG_NONNULL(1); ...@@ -1702,11 +1689,11 @@ int op_raw_seek(OggOpusFile *_of,opus_int64 _byte_offset) OP_ARG_NONNULL(1);
seeking to the target destination was impossible.*/ seeking to the target destination was impossible.*/
int op_pcm_seek(OggOpusFile *_of,ogg_int64_t _pcm_offset) OP_ARG_NONNULL(1); int op_pcm_seek(OggOpusFile *_of,ogg_int64_t _pcm_offset) OP_ARG_NONNULL(1);
/*@}*/ /**@}*/
/*@}*/ /**@}*/
/**\defgroup stream_decoding Decoding*/ /**\defgroup stream_decoding Decoding*/
/*@{*/ /**@{*/
/**\name Functions for decoding audio data /**\name Functions for decoding audio data
These functions retrieve actual decoded audio data from the stream. These functions retrieve actual decoded audio data from the stream.
...@@ -1744,7 +1731,7 @@ int op_pcm_seek(OggOpusFile *_of,ogg_int64_t _pcm_offset) OP_ARG_NONNULL(1); ...@@ -1744,7 +1731,7 @@ int op_pcm_seek(OggOpusFile *_of,ogg_int64_t _pcm_offset) OP_ARG_NONNULL(1);
If you are reading from an <https:> URL (particularly if seeking is not If you are reading from an <https:> URL (particularly if seeking is not
supported), you should make sure to check for this error and warn the user supported), you should make sure to check for this error and warn the user
appropriately.*/ appropriately.*/
/*@{*/ /**@{*/
/**Indicates that the decoding callback should produce signed 16-bit /**Indicates that the decoding callback should produce signed 16-bit
native-endian output samples.*/ native-endian output samples.*/
...@@ -2150,8 +2137,8 @@ OP_WARN_UNUSED_RESULT int op_read_stereo(OggOpusFile *_of, ...@@ -2150,8 +2137,8 @@ OP_WARN_UNUSED_RESULT int op_read_stereo(OggOpusFile *_of,
OP_WARN_UNUSED_RESULT int op_read_float_stereo(OggOpusFile *_of, OP_WARN_UNUSED_RESULT int op_read_float_stereo(OggOpusFile *_of,
float *_pcm,int _buf_size) OP_ARG_NONNULL(1); float *_pcm,int _buf_size) OP_ARG_NONNULL(1);
/*@}*/ /**@}*/
/*@}*/ /**@}*/
# if OP_GNUC_PREREQ(4,0) # if OP_GNUC_PREREQ(4,0)
# pragma GCC visibility pop # pragma GCC visibility pop
......
...@@ -39,7 +39,7 @@ AC_DEFUN([CC_CHECK_CFLAGS_SILENT], [ ...@@ -39,7 +39,7 @@ AC_DEFUN([CC_CHECK_CFLAGS_SILENT], [
AC_CACHE_VAL(AS_TR_SH([cc_cv_cflags_$1]), AC_CACHE_VAL(AS_TR_SH([cc_cv_cflags_$1]),
[ac_save_CFLAGS="$CFLAGS" [ac_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $1" CFLAGS="$CFLAGS $1"
AC_LINK_IFELSE([AC_LANG_SOURCE([int main() { return 0; }])], AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) { return 0; }])],
[eval "AS_TR_SH([cc_cv_cflags_$1])='yes'"], [eval "AS_TR_SH([cc_cv_cflags_$1])='yes'"],
[eval "AS_TR_SH([cc_cv_cflags_$1])='no'"]) [eval "AS_TR_SH([cc_cv_cflags_$1])='no'"])
CFLAGS="$ac_save_CFLAGS" CFLAGS="$ac_save_CFLAGS"
...@@ -89,7 +89,7 @@ AC_DEFUN([CC_CHECK_LDFLAGS], [ ...@@ -89,7 +89,7 @@ AC_DEFUN([CC_CHECK_LDFLAGS], [
AS_TR_SH([cc_cv_ldflags_$1]), AS_TR_SH([cc_cv_ldflags_$1]),
[ac_save_LDFLAGS="$LDFLAGS" [ac_save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS $1" LDFLAGS="$LDFLAGS $1"
AC_LINK_IFELSE([AC_LANG_SOURCE([int main() { return 1; }])], AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) { return 1; }])],
[eval "AS_TR_SH([cc_cv_ldflags_$1])='yes'"], [eval "AS_TR_SH([cc_cv_ldflags_$1])='yes'"],
[eval "AS_TR_SH([cc_cv_ldflags_$1])="]) [eval "AS_TR_SH([cc_cv_ldflags_$1])="])
LDFLAGS="$ac_save_LDFLAGS" LDFLAGS="$ac_save_LDFLAGS"
...@@ -165,16 +165,16 @@ AC_DEFUN([CC_CHECK_ATTRIBUTE], [ ...@@ -165,16 +165,16 @@ AC_DEFUN([CC_CHECK_ATTRIBUTE], [
AC_DEFUN([CC_ATTRIBUTE_CONSTRUCTOR], [ AC_DEFUN([CC_ATTRIBUTE_CONSTRUCTOR], [
CC_CHECK_ATTRIBUTE( CC_CHECK_ATTRIBUTE(
[constructor],, [constructor],,
[extern void foo(); [extern void foo(void);
void __attribute__((constructor)) ctor() { foo(); }], void __attribute__((constructor)) ctor(void) { foo(); }],
[$1], [$2]) [$1], [$2])
]) ])
AC_DEFUN([CC_ATTRIBUTE_DESTRUCTOR], [ AC_DEFUN([CC_ATTRIBUTE_DESTRUCTOR], [
CC_CHECK_ATTRIBUTE( CC_CHECK_ATTRIBUTE(
[destructor],, [destructor],,
[extern void foo(); [extern void foo(void);
void __attribute__((destructor)) dtor() { foo(); }], void __attribute__((destructor)) dtor(void) { foo(); }],
[$1], [$2]) [$1], [$2])
]) ])
...@@ -195,7 +195,7 @@ AC_DEFUN([CC_ATTRIBUTE_FORMAT_ARG], [ ...@@ -195,7 +195,7 @@ AC_DEFUN([CC_ATTRIBUTE_FORMAT_ARG], [
AC_DEFUN([CC_ATTRIBUTE_VISIBILITY], [ AC_DEFUN([CC_ATTRIBUTE_VISIBILITY], [
CC_CHECK_ATTRIBUTE( CC_CHECK_ATTRIBUTE(
[visibility_$1], [visibility("$1")], [visibility_$1], [visibility("$1")],
[void __attribute__((visibility("$1"))) $1_function() { }], [void __attribute__((visibility("$1"))) $1_function(void) { }],
[$2], [$3]) [$2], [$3])
]) ])
...@@ -306,7 +306,7 @@ AC_DEFUN([CC_ATTRIBUTE_ALIGNED], [ ...@@ -306,7 +306,7 @@ AC_DEFUN([CC_ATTRIBUTE_ALIGNED], [
CFLAGS="$CFLAGS $cc_cv_werror" CFLAGS="$CFLAGS $cc_cv_werror"
for cc_attribute_align_try in 64 32 16 8 4 2; do for cc_attribute_align_try in 64 32 16 8 4 2; do
AC_COMPILE_IFELSE([AC_LANG_SOURCE([ AC_COMPILE_IFELSE([AC_LANG_SOURCE([
int main() { int main(void) {
static char c __attribute__ ((aligned($cc_attribute_align_try))) = 0; static char c __attribute__ ((aligned($cc_attribute_align_try))) = 0;
return c; return c;
}])], [cc_cv_attribute_aligned=$cc_attribute_align_try; break]) }])], [cc_cv_attribute_aligned=$cc_attribute_align_try; break])
......
8071b968475c1a17f54b6840d6de9d9ee20f930e827b0401abe3c4cf4f3bf30a opusfile-0.1.tar.gz
b4a678b3b6c4adfb6aff1f67ef658becfe146ea7c7ff228e99543762171557f9 opusfile-0.2.tar.gz
094b789ee975fbc5ac706b14e5c83f12b92448fa0a55c8a9f7d79afa7f962aae opusfile-0.1-win32.zip 094b789ee975fbc5ac706b14e5c83f12b92448fa0a55c8a9f7d79afa7f962aae opusfile-0.1-win32.zip
33521cef2ef341a938b386439e9879d3e8e916638ffdd5a7d11e09172f307d35 opusfile-0.2-win32.zip 33521cef2ef341a938b386439e9879d3e8e916638ffdd5a7d11e09172f307d35 opusfile-0.2-win32.zip
4248927f2c4e316ea5b84fb02bd100bfec8fa4624a6910d77f0af7f0c6cb8baa opusfile-0.3.tar.gz 4248927f2c4e316ea5b84fb02bd100bfec8fa4624a6910d77f0af7f0c6cb8baa opusfile-0.3.tar.gz
...@@ -21,3 +23,5 @@ e9591da4d4c9e857436c2d46a28a9e470fa5355ea5a76d4d582f137d18755d36 opusfile-0.9.z ...@@ -21,3 +23,5 @@ e9591da4d4c9e857436c2d46a28a9e470fa5355ea5a76d4d582f137d18755d36 opusfile-0.9.z
9d9e95d01817ecf48bf6daaea8f071f9b45bd1751ca1fc8ce50e5075eb2bc3c8 opusfile-0.10.zip 9d9e95d01817ecf48bf6daaea8f071f9b45bd1751ca1fc8ce50e5075eb2bc3c8 opusfile-0.10.zip
74ce9b6cf4da103133e7b5c95df810ceb7195471e1162ed57af415fabf5603bf opusfile-0.11.tar.gz 74ce9b6cf4da103133e7b5c95df810ceb7195471e1162ed57af415fabf5603bf opusfile-0.11.tar.gz
23c5168026c4f1fc34843650135b409d0fc8cf452508163b4ece8077256ac6ff opusfile-0.11.zip 23c5168026c4f1fc34843650135b409d0fc8cf452508163b4ece8077256ac6ff opusfile-0.11.zip
118d8601c12dd6a44f52423e68ca9083cc9f2bfe72da7a8c1acb22a80ae3550b opusfile-0.12.tar.gz
7f44575596b78d7787c1865b9653e2a71546ff1ae77d87c53ab16dcc7af295ba opusfile-0.12.zip
...@@ -1759,7 +1759,8 @@ static int op_http_verify_hostname(OpusHTTPStream *_stream,SSL *_ssl_conn){ ...@@ -1759,7 +1759,8 @@ static int op_http_verify_hostname(OpusHTTPStream *_stream,SSL *_ssl_conn){
char *host; char *host;
size_t host_len; size_t host_len;
unsigned char *ip; unsigned char *ip;
int ip_len; /* On AIX 7.3, ip_len is #defined to ip_ff.ip_flen and compilation fails */
int iplen;
int check_cn; int check_cn;
int ret; int ret;
host=_stream->url.host; host=_stream->url.host;
...@@ -1775,7 +1776,7 @@ static int op_http_verify_hostname(OpusHTTPStream *_stream,SSL *_ssl_conn){ ...@@ -1775,7 +1776,7 @@ static int op_http_verify_hostname(OpusHTTPStream *_stream,SSL *_ssl_conn){
/*Check to see if the host was specified as a simple IP address.*/ /*Check to see if the host was specified as a simple IP address.*/
addr=op_inet_pton(host); addr=op_inet_pton(host);
ip=NULL; ip=NULL;
ip_len=0; iplen=0;
if(addr!=NULL){ if(addr!=NULL){
switch(addr->ai_family){ switch(addr->ai_family){
case AF_INET:{ case AF_INET:{
...@@ -1783,7 +1784,7 @@ static int op_http_verify_hostname(OpusHTTPStream *_stream,SSL *_ssl_conn){ ...@@ -1783,7 +1784,7 @@ static int op_http_verify_hostname(OpusHTTPStream *_stream,SSL *_ssl_conn){
s=(struct sockaddr_in *)addr->ai_addr; s=(struct sockaddr_in *)addr->ai_addr;
OP_ASSERT(addr->ai_addrlen>=sizeof(*s)); OP_ASSERT(addr->ai_addrlen>=sizeof(*s));
ip=(unsigned char *)&s->sin_addr; ip=(unsigned char *)&s->sin_addr;
ip_len=sizeof(s->sin_addr); iplen=sizeof(s->sin_addr);
/*RFC 6125 says, "In this case, the iPAddress subjectAltName must [sic] /*RFC 6125 says, "In this case, the iPAddress subjectAltName must [sic]
be present in the certificate and must [sic] exactly match the IP in be present in the certificate and must [sic] exactly match the IP in
the URI." the URI."
...@@ -1795,7 +1796,7 @@ static int op_http_verify_hostname(OpusHTTPStream *_stream,SSL *_ssl_conn){ ...@@ -1795,7 +1796,7 @@ static int op_http_verify_hostname(OpusHTTPStream *_stream,SSL *_ssl_conn){
s=(struct sockaddr_in6 *)addr->ai_addr; s=(struct sockaddr_in6 *)addr->ai_addr;
OP_ASSERT(addr->ai_addrlen>=sizeof(*s)); OP_ASSERT(addr->ai_addrlen>=sizeof(*s));
ip=(unsigned char *)&s->sin6_addr; ip=(unsigned char *)&s->sin6_addr;
ip_len=sizeof(s->sin6_addr); iplen=sizeof(s->sin6_addr);
check_cn=0; check_cn=0;
}break; }break;
} }
...@@ -1879,8 +1880,8 @@ static int op_http_verify_hostname(OpusHTTPStream *_stream,SSL *_ssl_conn){ ...@@ -1879,8 +1880,8 @@ static int op_http_verify_hostname(OpusHTTPStream *_stream,SSL *_ssl_conn){
A match occurs if the reference identity octet string and the value A match occurs if the reference identity octet string and the value
octet strings are identical."*/ octet strings are identical."*/
cert_ip=ASN1_STRING_get0_data(name->d.iPAddress); cert_ip=ASN1_STRING_get0_data(name->d.iPAddress);
if(ip_len==ASN1_STRING_length(name->d.iPAddress) if(iplen==ASN1_STRING_length(name->d.iPAddress)
&&memcmp(ip,cert_ip,ip_len)==0){ &&memcmp(ip,cert_ip,iplen)==0){
ret=1; ret=1;
break; break;
} }
...@@ -1941,12 +1942,12 @@ static int op_http_conn_start_tls(OpusHTTPStream *_stream,OpusHTTPConn *_conn, ...@@ -1941,12 +1942,12 @@ static int op_http_conn_start_tls(OpusHTTPStream *_stream,OpusHTTPConn *_conn,
struct addrinfo *addr; struct addrinfo *addr;
char *host; char *host;
unsigned char *ip; unsigned char *ip;
int ip_len; int iplen;
param=SSL_get0_param(_ssl_conn); param=SSL_get0_param(_ssl_conn);
OP_ASSERT(param!=NULL); OP_ASSERT(param!=NULL);
host=_stream->url.host; host=_stream->url.host;
ip=NULL; ip=NULL;
ip_len=0; iplen=0;
/*Check to see if the host was specified as a simple IP address.*/ /*Check to see if the host was specified as a simple IP address.*/
addr=op_inet_pton(host); addr=op_inet_pton(host);
if(addr!=NULL){ if(addr!=NULL){
...@@ -1956,7 +1957,7 @@ static int op_http_conn_start_tls(OpusHTTPStream *_stream,OpusHTTPConn *_conn, ...@@ -1956,7 +1957,7 @@ static int op_http_conn_start_tls(OpusHTTPStream *_stream,OpusHTTPConn *_conn,
s=(struct sockaddr_in *)addr->ai_addr; s=(struct sockaddr_in *)addr->ai_addr;
OP_ASSERT(addr->ai_addrlen>=sizeof(*s)); OP_ASSERT(addr->ai_addrlen>=sizeof(*s));
ip=(unsigned char *)&s->sin_addr; ip=(unsigned char *)&s->sin_addr;
ip_len=sizeof(s->sin_addr); iplen=sizeof(s->sin_addr);
host=NULL; host=NULL;
}break; }break;
case AF_INET6:{ case AF_INET6:{
...@@ -1964,7 +1965,7 @@ static int op_http_conn_start_tls(OpusHTTPStream *_stream,OpusHTTPConn *_conn, ...@@ -1964,7 +1965,7 @@ static int op_http_conn_start_tls(OpusHTTPStream *_stream,OpusHTTPConn *_conn,
s=(struct sockaddr_in6 *)addr->ai_addr; s=(struct sockaddr_in6 *)addr->ai_addr;
OP_ASSERT(addr->ai_addrlen>=sizeof(*s)); OP_ASSERT(addr->ai_addrlen>=sizeof(*s));
ip=(unsigned char *)&s->sin6_addr; ip=(unsigned char *)&s->sin6_addr;
ip_len=sizeof(s->sin6_addr); iplen=sizeof(s->sin6_addr);
host=NULL; host=NULL;
}break; }break;
} }
...@@ -1972,7 +1973,7 @@ static int op_http_conn_start_tls(OpusHTTPStream *_stream,OpusHTTPConn *_conn, ...@@ -1972,7 +1973,7 @@ static int op_http_conn_start_tls(OpusHTTPStream *_stream,OpusHTTPConn *_conn,
/*Always set both host and ip to prevent matching against an old one. /*Always set both host and ip to prevent matching against an old one.
One of the two will always be NULL, clearing that parameter.*/ One of the two will always be NULL, clearing that parameter.*/
X509_VERIFY_PARAM_set1_host(param,host,0); X509_VERIFY_PARAM_set1_host(param,host,0);
X509_VERIFY_PARAM_set1_ip(param,ip,ip_len); X509_VERIFY_PARAM_set1_ip(param,ip,iplen);
if(addr!=NULL)freeaddrinfo(addr); if(addr!=NULL)freeaddrinfo(addr);
} }
# endif # endif
......
...@@ -148,6 +148,7 @@ static int op_get_data(OggOpusFile *_of,int _nbytes){ ...@@ -148,6 +148,7 @@ static int op_get_data(OggOpusFile *_of,int _nbytes){
int nbytes; int nbytes;
OP_ASSERT(_nbytes>0); OP_ASSERT(_nbytes>0);
buffer=(unsigned char *)ogg_sync_buffer(&_of->oy,_nbytes); buffer=(unsigned char *)ogg_sync_buffer(&_of->oy,_nbytes);
if(OP_UNLIKELY(buffer==NULL))return OP_EFAULT;
nbytes=(int)(*_of->callbacks.read)(_of->stream,buffer,_nbytes); nbytes=(int)(*_of->callbacks.read)(_of->stream,buffer,_nbytes);
OP_ASSERT(nbytes<=_nbytes); OP_ASSERT(nbytes<=_nbytes);
if(OP_LIKELY(nbytes>0))ogg_sync_wrote(&_of->oy,nbytes); if(OP_LIKELY(nbytes>0))ogg_sync_wrote(&_of->oy,nbytes);
...@@ -1057,9 +1058,11 @@ static opus_int64 op_predict_link_start(const OpusSeekRecord *_sr,int _nsr, ...@@ -1057,9 +1058,11 @@ static opus_int64 op_predict_link_start(const OpusSeekRecord *_sr,int _nsr,
ogg_uint32_t serialno1; ogg_uint32_t serialno1;
opus_int64 offset1; opus_int64 offset1;
/*If the granule position is negative, either it's invalid or we'd cause /*If the granule position is negative, either it's invalid or we'd cause
overflow.*/ overflow.
If it is larger than OP_INT64_MAX-OP_GP_SPACING_MIN, then no positive
granule position would satisfy our minimum spacing requirements below.*/
gp1=_sr[sri].gp; gp1=_sr[sri].gp;
if(gp1<0)continue; if(gp1<0||gp1>OP_INT64_MAX-OP_GP_SPACING_MIN)continue;
/*We require some minimum distance between granule positions to make an /*We require some minimum distance between granule positions to make an
estimate. estimate.
We don't actually know what granule position scheme is being used, We don't actually know what granule position scheme is being used,
...@@ -1067,10 +1070,7 @@ static opus_int64 op_predict_link_start(const OpusSeekRecord *_sr,int _nsr, ...@@ -1067,10 +1070,7 @@ static opus_int64 op_predict_link_start(const OpusSeekRecord *_sr,int _nsr,
Therefore we require a minimum spacing between them, with the Therefore we require a minimum spacing between them, with the
expectation that while bitrates and granule position increments might expectation that while bitrates and granule position increments might
vary locally in quite complex ways, they are globally smooth.*/ vary locally in quite complex ways, they are globally smooth.*/
if(OP_UNLIKELY(op_granpos_add(&gp2_min,gp1,OP_GP_SPACING_MIN)<0)){ gp2_min=gp1+OP_GP_SPACING_MIN;
/*No granule position would satisfy us.*/
continue;
}
offset1=_sr[sri].offset; offset1=_sr[sri].offset;
serialno1=_sr[sri].serialno; serialno1=_sr[sri].serialno;
for(srj=sri;srj-->0;){ for(srj=sri;srj-->0;){
...@@ -1267,6 +1267,8 @@ static int op_bisect_forward_serialno(OggOpusFile *_of, ...@@ -1267,6 +1267,8 @@ static int op_bisect_forward_serialno(OggOpusFile *_of,
ret=op_fetch_headers(_of,&links[nlinks].head,&links[nlinks].tags, ret=op_fetch_headers(_of,&links[nlinks].head,&links[nlinks].tags,
_serialnos,_nserialnos,_cserialnos,last!=next?NULL:&og); _serialnos,_nserialnos,_cserialnos,last!=next?NULL:&og);
if(OP_UNLIKELY(ret<0))return ret; if(OP_UNLIKELY(ret<0))return ret;
/*Mark the current link count so it can be cleaned up on error.*/
_of->nlinks=nlinks+1;
links[nlinks].offset=next; links[nlinks].offset=next;
links[nlinks].data_offset=_of->offset; links[nlinks].data_offset=_of->offset;
links[nlinks].serialno=_of->os.serialno; links[nlinks].serialno=_of->os.serialno;
...@@ -1277,8 +1279,7 @@ static int op_bisect_forward_serialno(OggOpusFile *_of, ...@@ -1277,8 +1279,7 @@ static int op_bisect_forward_serialno(OggOpusFile *_of,
if(OP_UNLIKELY(ret<0))return ret; if(OP_UNLIKELY(ret<0))return ret;
links[nlinks].pcm_file_offset=total_duration; links[nlinks].pcm_file_offset=total_duration;
_searched=_of->offset; _searched=_of->offset;
/*Mark the current link count so it can be cleaned up on error.*/ ++nlinks;
_of->nlinks=++nlinks;
} }
/*Last page is in the starting serialno list, so we've reached the last link. /*Last page is in the starting serialno list, so we've reached the last link.
Now find the last granule position for it (if we didn't the first time we Now find the last granule position for it (if we didn't the first time we
...@@ -1527,6 +1528,7 @@ static int op_open1(OggOpusFile *_of, ...@@ -1527,6 +1528,7 @@ static int op_open1(OggOpusFile *_of,
if(_initial_bytes>0){ if(_initial_bytes>0){
char *buffer; char *buffer;
buffer=ogg_sync_buffer(&_of->oy,(long)_initial_bytes); buffer=ogg_sync_buffer(&_of->oy,(long)_initial_bytes);
if(OP_UNLIKELY(buffer==NULL))return OP_EFAULT;
memcpy(buffer,_initial_data,_initial_bytes*sizeof(*buffer)); memcpy(buffer,_initial_data,_initial_bytes*sizeof(*buffer));
ogg_sync_wrote(&_of->oy,(long)_initial_bytes); ogg_sync_wrote(&_of->oy,(long)_initial_bytes);
} }
...@@ -1753,7 +1755,7 @@ ogg_int64_t op_pcm_total(const OggOpusFile *_of,int _li){ ...@@ -1753,7 +1755,7 @@ ogg_int64_t op_pcm_total(const OggOpusFile *_of,int _li){
} }
OP_ALWAYS_TRUE(!op_granpos_diff(&diff, OP_ALWAYS_TRUE(!op_granpos_diff(&diff,
links[_li].pcm_end,links[_li].pcm_start)); links[_li].pcm_end,links[_li].pcm_start));
return pcm_total+diff-links[_li].head.pre_skip; return pcm_total+(diff-links[_li].head.pre_skip);
} }
const OpusHead *op_head(const OggOpusFile *_of,int _li){ const OpusHead *op_head(const OggOpusFile *_of,int _li){
...@@ -2310,13 +2312,18 @@ static int op_pcm_seek_page(OggOpusFile *_of, ...@@ -2310,13 +2312,18 @@ static int op_pcm_seek_page(OggOpusFile *_of,
opus_int64 offset; opus_int64 offset;
int op_count; int op_count;
op_count=_of->op_count; op_count=_of->op_count;
/*The only way the offset can be invalid _and_ we can fail the granule /*The offset can be out of range if we were reading through the stream
and encountered a page with the granule position for another link
outside of the data range identified during link enumeration when we
were opening the file.
We will just ignore the current position in that case.
The only way the offset can be valid _and_ we can fail the granule
position checks below is if someone changed the contents of the last position checks below is if someone changed the contents of the last
page since we read it. page since we read it.
We'd be within our rights to just return OP_EBADLINK in that case, but We'd be within our rights to just return OP_EBADLINK, but instead we'll
we'll simply ignore the current position instead.*/ simply ignore the current position in that case, too.*/
offset=_of->offset; offset=_of->offset;
if(op_count>0&&OP_LIKELY(offset<=end)){ if(op_count>0&&OP_LIKELY(begin<=offset&&offset<=end)){
ogg_int64_t gp; ogg_int64_t gp;
/*Make sure the timestamp is valid. /*Make sure the timestamp is valid.
The granule position might be -1 if we collected the packets from a The granule position might be -1 if we collected the packets from a
...@@ -2332,7 +2339,6 @@ static int op_pcm_seek_page(OggOpusFile *_of, ...@@ -2332,7 +2339,6 @@ static int op_pcm_seek_page(OggOpusFile *_of,
Otherwise it appears using the whole link range to estimate the Otherwise it appears using the whole link range to estimate the
first seek location gives better results, on average.*/ first seek location gives better results, on average.*/
if(diff<0){ if(diff<0){
OP_ASSERT(offset>=begin);
if(offset-begin>=end-begin>>1||diff>-OP_CUR_TIME_THRESH){ if(offset-begin>=end-begin>>1||diff>-OP_CUR_TIME_THRESH){
best=begin=offset; best=begin=offset;
best_gp=pcm_start=gp; best_gp=pcm_start=gp;
...@@ -2358,8 +2364,19 @@ static int op_pcm_seek_page(OggOpusFile *_of, ...@@ -2358,8 +2364,19 @@ static int op_pcm_seek_page(OggOpusFile *_of,
For very small files (with all of the data in a single page, For very small files (with all of the data in a single page,
generally 1 second or less), we can loop them continuously generally 1 second or less), we can loop them continuously
without seeking at all.*/ without seeking at all.*/
OP_ALWAYS_TRUE(!op_granpos_add(&prev_page_gp,_of->op[0].granulepos, if(op_granpos_add(&prev_page_gp,_of->op[0].granulepos,
-op_get_packet_duration(_of->op[0].packet,_of->op[0].bytes))); -op_get_packet_duration(_of->op[0].packet,_of->op[0].bytes))<0) {
/*We validate/sanitize the per-packet timestamps, so the only way
we should fail to calculate a granule position for the
previous page is if the first page with completed packets in
the stream is also the last, and end-trimming causes the
apparent granule position preceding the first sample in the
first packet to underflow.
The starting PCM offset is then 0 by spec mandate (see also:
op_find_initial_pcm_offset()).*/
OP_ASSERT(_of->op[0].e_o_s);
prev_page_gp=0;
}
if(op_granpos_cmp(prev_page_gp,_target_gp)<=0){ if(op_granpos_cmp(prev_page_gp,_target_gp)<=0){
/*Don't call op_decode_clear(), because it will dump our /*Don't call op_decode_clear(), because it will dump our
packets.*/ packets.*/
......