Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
DeepSpeech
提交
602e18e2
D
DeepSpeech
项目概览
PaddlePaddle
/
DeepSpeech
大约 1 年 前同步成功
通知
207
Star
8425
Fork
1598
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
245
列表
看板
标记
里程碑
合并请求
3
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
DeepSpeech
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
245
Issue
245
列表
看板
标记
里程碑
合并请求
3
合并请求
3
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
602e18e2
编写于
6月 20, 2022
作者:
H
Hui Zhang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
put audio into paddlespeech
上级
f94cb483
变更
16
展开全部
隐藏空白更改
内联
并排
Showing
16 changed file
with
4277 addition
and
0 deletion
+4277
-0
.gitignore
.gitignore
+1
-0
CMakeLists.txt
CMakeLists.txt
+17
-0
paddlespeech/audio/README.md
paddlespeech/audio/README.md
+9
-0
paddlespeech/audio/csrc/CMakeLists.txt
paddlespeech/audio/csrc/CMakeLists.txt
+34
-0
paddlespeech/audio/csrc/pybind/pybind.cpp
paddlespeech/audio/csrc/pybind/pybind.cpp
+11
-0
paddlespeech/audio/csrc/pybind/sox/io.cpp
paddlespeech/audio/csrc/pybind/sox/io.cpp
+61
-0
paddlespeech/audio/csrc/pybind/sox/io.h
paddlespeech/audio/csrc/pybind/sox/io.h
+21
-0
paddlespeech/audio/csrc/pybind/sox/utils.cpp
paddlespeech/audio/csrc/pybind/sox/utils.cpp
+100
-0
paddlespeech/audio/csrc/pybind/sox/utils.h
paddlespeech/audio/csrc/pybind/sox/utils.h
+45
-0
paddlespeech/audio/third_party/.gitignore
paddlespeech/audio/third_party/.gitignore
+2
-0
paddlespeech/audio/third_party/CMakeLists.txt
paddlespeech/audio/third_party/CMakeLists.txt
+8
-0
paddlespeech/audio/third_party/patches/config.guess
paddlespeech/audio/third_party/patches/config.guess
+1754
-0
paddlespeech/audio/third_party/patches/config.sub
paddlespeech/audio/third_party/patches/config.sub
+1890
-0
paddlespeech/audio/third_party/patches/libmad.patch
paddlespeech/audio/third_party/patches/libmad.patch
+86
-0
paddlespeech/audio/third_party/patches/sox.patch
paddlespeech/audio/third_party/patches/sox.patch
+16
-0
paddlespeech/audio/third_party/sox/CMakeLists.txt
paddlespeech/audio/third_party/sox/CMakeLists.txt
+222
-0
未找到文件。
.gitignore
浏览文件 @
602e18e2
...
...
@@ -42,6 +42,7 @@ tools/python-soundfile/
tools/onnx
tools/onnxruntime
tools/Paddle2ONNX
tools/onnx-simplifier/
speechx/fc_patch/
...
...
CMakeLists.txt
0 → 100644
浏览文件 @
602e18e2
cmake_minimum_required
(
VERSION 3.16 FATAL_ERROR
)
project
(
paddlespeech
)
# check and set CMAKE_CXX_STANDARD
string
(
FIND
"
${
CMAKE_CXX_FLAGS
}
"
"-std=c++"
env_cxx_standard
)
set
(
CMAKE_CXX_STANDARD 14
)
set
(
CMAKE_C_STANDARD 11
)
set
(
CMAKE_EXPORT_COMPILE_COMMANDS ON
)
set
(
CMAKE_POSITION_INDEPENDENT_CODE ON
)
# Options
option
(
BUILD_SOX
"Build libsox statically"
ON
)
add_subdirectory
(
paddlespeech/audio/third_party
)
add_subdirectory
(
paddlespeech/audio//csrc
)
paddlespeech/audio/README.md
0 → 100644
浏览文件 @
602e18e2
# PaddleAudio
## Reference
`csrc`
code is reference of
`torchaudio`
.
BSD 2-Clause License
Copyright (c) 2017 Facebook Inc. (Soumith Chintala),
All rights reserved.
paddlespeech/audio/csrc/CMakeLists.txt
0 → 100644
浏览文件 @
602e18e2
find_package
(
Python3 COMPONENTS Interpreter Development
)
find_package
(
pybind11 CONFIG
)
function
(
define_extension name sources libraries
)
add_library
(
${
name
}
SHARED
${
sources
}
)
target_include_directories
(
${
name
}
PRIVATE
${
PROJECT_SOURCE_DIR
}
${
CMAKE_CURRENT_SOURCE_DIR
}
${
Python3_INCLUDE_DIRS
}
${
pybind11_INCLUDE_DIR
}
)
target_link_libraries
(
${
name
}
${
libraries
}
)
set_target_properties
(
${
name
}
PROPERTIES PREFIX
""
)
install
(
TARGETS
${
name
}
LIBRARY DESTINATION .
)
endfunction
()
if
(
BUILD_SOX
)
set
(
EXTENSION_SOURCES
pybind/pybind.cpp
pybind/sox/io.cpp
pybind/sox/utils.cpp
)
set
(
LINK_LIBRARIES
libsox
)
define_extension
(
_paddleaudio
"
${
EXTENSION_SOURCES
}
"
"
${
LINK_LIBRARIES
}
"
)
endif
()
paddlespeech/audio/csrc/pybind/pybind.cpp
0 → 100644
浏览文件 @
602e18e2
//Copyright (c) 2017 Facebook Inc. (Soumith Chintala),
//All rights reserved.
#include "pybind/sox/io.h"
PYBIND11_MODULE
(
_paddleaudio
,
m
)
{
m
.
def
(
"get_info_file"
,
&
paddleaudio
::
sox_io
::
get_info_file
,
"Get metadata of audio file."
);
m
.
def
(
"get_info_fileobj"
,
&
paddleaudio
::
sox_io
::
get_info_fileobj
,
"Get metadata of audio in file object."
);
}
\ No newline at end of file
paddlespeech/audio/csrc/pybind/sox/io.cpp
0 → 100644
浏览文件 @
602e18e2
//Copyright (c) 2017 Facebook Inc. (Soumith Chintala),
//All rights reserved.
#include "pybind/sox/io.h"
#include "pybind/sox/utils.h"
using
namespace
paddleaudio
::
sox_utils
;
namespace
paddleaudio
{
namespace
sox_io
{
auto
get_info_file
(
const
std
::
string
&
path
,
const
std
::
string
&
format
)
->
std
::
tuple
<
int64_t
,
int64_t
,
int64_t
,
int64_t
,
std
::
string
>
{
SoxFormat
sf
(
sox_open_read
(
path
.
data
(),
/*signal=*/
nullptr
,
/*encoding=*/
nullptr
,
/*filetype=*/
format
.
empty
()
?
nullptr
:
format
.
data
()));
validate_input_file
(
sf
,
path
);
return
std
::
make_tuple
(
static_cast
<
int64_t
>
(
sf
->
signal
.
rate
),
static_cast
<
int64_t
>
(
sf
->
signal
.
length
/
sf
->
signal
.
channels
),
static_cast
<
int64_t
>
(
sf
->
signal
.
channels
),
static_cast
<
int64_t
>
(
sf
->
encoding
.
bits_per_sample
),
get_encoding
(
sf
->
encoding
.
encoding
));
}
auto
get_info_fileobj
(
py
::
object
fileobj
,
const
std
::
string
&
format
)
->
std
::
tuple
<
int64_t
,
int64_t
,
int64_t
,
int64_t
,
std
::
string
>
{
const
auto
capacity
=
[
&
]()
{
const
auto
bufsiz
=
get_buffer_size
();
const
int64_t
kDefaultCapacityInBytes
=
4096
;
return
(
bufsiz
>
kDefaultCapacityInBytes
)
?
bufsiz
:
kDefaultCapacityInBytes
;
}();
std
::
string
buffer
(
capacity
,
'\0'
);
auto
*
buf
=
const_cast
<
char
*>
(
buffer
.
data
());
auto
num_read
=
read_fileobj
(
&
fileobj
,
capacity
,
buf
);
// If the file is shorter than 256, then libsox cannot read the header.
auto
buf_size
=
(
num_read
>
256
)
?
num_read
:
256
;
SoxFormat
sf
(
sox_open_mem_read
(
buf
,
buf_size
,
/*signal=*/
nullptr
,
/*encoding=*/
nullptr
,
/*filetype=*/
format
.
empty
()
?
nullptr
:
format
.
data
()));
// In case of streamed data, length can be 0
validate_input_memfile
(
sf
);
return
std
::
make_tuple
(
static_cast
<
int64_t
>
(
sf
->
signal
.
rate
),
static_cast
<
int64_t
>
(
sf
->
signal
.
length
/
sf
->
signal
.
channels
),
static_cast
<
int64_t
>
(
sf
->
signal
.
channels
),
static_cast
<
int64_t
>
(
sf
->
encoding
.
bits_per_sample
),
get_encoding
(
sf
->
encoding
.
encoding
));
}
}
// namespace paddleaudio
}
// namespace sox_io
paddlespeech/audio/csrc/pybind/sox/io.h
0 → 100644
浏览文件 @
602e18e2
//Copyright (c) 2017 Facebook Inc. (Soumith Chintala),
//All rights reserved.
#ifndef PADDLEAUDIO_PYBIND_SOX_IO_H
#define PADDLEAUDIO_PYBIND_SOX_IO_H
#include "pybind/sox/utils.h"
namespace
paddleaudio
{
namespace
sox_io
{
auto
get_info_file
(
const
std
::
string
&
path
,
const
std
::
string
&
format
)
->
std
::
tuple
<
int64_t
,
int64_t
,
int64_t
,
int64_t
,
std
::
string
>
;
auto
get_info_fileobj
(
py
::
object
fileobj
,
const
std
::
string
&
format
)
->
std
::
tuple
<
int64_t
,
int64_t
,
int64_t
,
int64_t
,
std
::
string
>
;
}
// namespace paddleaudio
}
// namespace sox_io
#endif
paddlespeech/audio/csrc/pybind/sox/utils.cpp
0 → 100644
浏览文件 @
602e18e2
//Copyright (c) 2017 Facebook Inc. (Soumith Chintala),
//All rights reserved.
#include "pybind/sox/utils.h"
#include <sstream>
namespace
paddleaudio
{
namespace
sox_utils
{
SoxFormat
::
SoxFormat
(
sox_format_t
*
fd
)
noexcept
:
fd_
(
fd
)
{}
SoxFormat
::~
SoxFormat
()
{
close
();
}
sox_format_t
*
SoxFormat
::
operator
->
()
const
noexcept
{
return
fd_
;
}
SoxFormat
::
operator
sox_format_t
*
()
const
noexcept
{
return
fd_
;
}
void
SoxFormat
::
close
()
{
if
(
fd_
!=
nullptr
)
{
sox_close
(
fd_
);
fd_
=
nullptr
;
}
}
auto
read_fileobj
(
py
::
object
*
fileobj
,
const
uint64_t
size
,
char
*
buffer
)
->
uint64_t
{
uint64_t
num_read
=
0
;
while
(
num_read
<
size
)
{
auto
request
=
size
-
num_read
;
auto
chunk
=
static_cast
<
std
::
string
>
(
static_cast
<
py
::
bytes
>
(
fileobj
->
attr
(
"read"
)(
request
)));
auto
chunk_len
=
chunk
.
length
();
if
(
chunk_len
==
0
)
{
break
;
}
if
(
chunk_len
>
request
)
{
std
::
ostringstream
message
;
message
<<
"Requested up to "
<<
request
<<
" bytes but, "
<<
"received "
<<
chunk_len
<<
" bytes. "
<<
"The given object does not confirm to read protocol of file "
"object."
;
throw
std
::
runtime_error
(
message
.
str
());
}
memcpy
(
buffer
,
chunk
.
data
(),
chunk_len
);
buffer
+=
chunk_len
;
num_read
+=
chunk_len
;
}
return
num_read
;
}
int64_t
get_buffer_size
()
{
return
sox_get_globals
()
->
bufsiz
;
}
void
validate_input_file
(
const
SoxFormat
&
sf
,
const
std
::
string
&
path
)
{
if
(
static_cast
<
sox_format_t
*>
(
sf
)
==
nullptr
)
{
throw
std
::
runtime_error
(
"Error loading audio file: failed to open file "
+
path
);
}
if
(
sf
->
encoding
.
encoding
==
SOX_ENCODING_UNKNOWN
)
{
throw
std
::
runtime_error
(
"Error loading audio file: unknown encoding."
);
}
}
void
validate_input_memfile
(
const
SoxFormat
&
sf
)
{
return
validate_input_file
(
sf
,
"<in memory buffer>"
);
}
std
::
string
get_encoding
(
sox_encoding_t
encoding
)
{
switch
(
encoding
)
{
case
SOX_ENCODING_UNKNOWN
:
return
"UNKNOWN"
;
case
SOX_ENCODING_SIGN2
:
return
"PCM_S"
;
case
SOX_ENCODING_UNSIGNED
:
return
"PCM_U"
;
case
SOX_ENCODING_FLOAT
:
return
"PCM_F"
;
case
SOX_ENCODING_FLAC
:
return
"FLAC"
;
case
SOX_ENCODING_ULAW
:
return
"ULAW"
;
case
SOX_ENCODING_ALAW
:
return
"ALAW"
;
case
SOX_ENCODING_MP3
:
return
"MP3"
;
case
SOX_ENCODING_VORBIS
:
return
"VORBIS"
;
case
SOX_ENCODING_AMR_WB
:
return
"AMR_WB"
;
case
SOX_ENCODING_AMR_NB
:
return
"AMR_NB"
;
case
SOX_ENCODING_OPUS
:
return
"OPUS"
;
case
SOX_ENCODING_GSM
:
return
"GSM"
;
default:
return
"UNKNOWN"
;
}
}
}
// namespace paddleaudio
}
// namespace sox_utils
paddlespeech/audio/csrc/pybind/sox/utils.h
0 → 100644
浏览文件 @
602e18e2
//Copyright (c) 2017 Facebook Inc. (Soumith Chintala),
//All rights reserved.
#ifndef PADDLEAUDIO_PYBIND_SOX_UTILS_H
#define PADDLEAUDIO_PYBIND_SOX_UTILS_H
#include <pybind11/pybind11.h>
#include <sox.h>
namespace
py
=
pybind11
;
namespace
paddleaudio
{
namespace
sox_utils
{
/// helper class to automatically close sox_format_t*
struct
SoxFormat
{
explicit
SoxFormat
(
sox_format_t
*
fd
)
noexcept
;
SoxFormat
(
const
SoxFormat
&
other
)
=
delete
;
SoxFormat
(
SoxFormat
&&
other
)
=
delete
;
SoxFormat
&
operator
=
(
const
SoxFormat
&
other
)
=
delete
;
SoxFormat
&
operator
=
(
SoxFormat
&&
other
)
=
delete
;
~
SoxFormat
();
sox_format_t
*
operator
->
()
const
noexcept
;
operator
sox_format_t
*
()
const
noexcept
;
void
close
();
private:
sox_format_t
*
fd_
;
};
auto
read_fileobj
(
py
::
object
*
fileobj
,
uint64_t
size
,
char
*
buffer
)
->
uint64_t
;
int64_t
get_buffer_size
();
void
validate_input_file
(
const
SoxFormat
&
sf
,
const
std
::
string
&
path
);
void
validate_input_memfile
(
const
SoxFormat
&
sf
);
std
::
string
get_encoding
(
sox_encoding_t
encoding
);
}
// namespace paddleaudio
}
// namespace sox_utils
#endif
paddlespeech/audio/third_party/.gitignore
0 → 100644
浏览文件 @
602e18e2
archives/
install/
paddlespeech/audio/third_party/CMakeLists.txt
0 → 100644
浏览文件 @
602e18e2
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-fvisibility=hidden"
)
add_library
(
libsox INTERFACE
)
if
(
BUILD_SOX
)
add_subdirectory
(
sox
)
target_include_directories
(
libsox INTERFACE
${
SOX_INCLUDE_DIR
}
)
target_link_libraries
(
libsox INTERFACE
${
SOX_LIBRARIES
}
)
endif
()
paddlespeech/audio/third_party/patches/config.guess
0 → 100644
浏览文件 @
602e18e2
此差异已折叠。
点击以展开。
paddlespeech/audio/third_party/patches/config.sub
0 → 100644
浏览文件 @
602e18e2
此差异已折叠。
点击以展开。
paddlespeech/audio/third_party/patches/libmad.patch
0 → 100644
浏览文件 @
602e18e2
See the followings for the origin of this patch
http://www.linuxfromscratch.org/blfs/view/svn/multimedia/libmad.html
http://www.linuxfromscratch.org/patches/blfs/svn/libmad-0.15.1b-fixes-1.patch
--- src/libmad/configure 2004-02-05 09:34:07.000000000 +0000
+++ src/libmad/configure.new 2020-06-30 21:10:28.528018931 +0000
@@ -19083,71 +19083,7 @@
if test "$GCC" = yes
then
- if test -z "$arch"
- then
- case "$host" in
- i386-*) ;;
- i?86-*) arch="-march=i486" ;;
- arm*-empeg-*) arch="-march=armv4 -mtune=strongarm1100" ;;
- armv4*-*) arch="-march=armv4 -mtune=strongarm" ;;
- powerpc-*) ;;
- mips*-agenda-*) arch="-mcpu=vr4100" ;;
- mips*-luxsonor-*) arch="-mips1 -mcpu=r3000 -Wa,-m4010" ;;
- esac
- fi
-
- case "$optimize" in
- -O|"-O "*)
- optimize="-O"
- optimize="$optimize -fforce-mem"
- optimize="$optimize -fforce-addr"
- : #x optimize="$optimize -finline-functions"
- : #- optimize="$optimize -fstrength-reduce"
- optimize="$optimize -fthread-jumps"
- optimize="$optimize -fcse-follow-jumps"
- optimize="$optimize -fcse-skip-blocks"
- : #x optimize="$optimize -frerun-cse-after-loop"
- : #x optimize="$optimize -frerun-loop-opt"
- : #x optimize="$optimize -fgcse"
- optimize="$optimize -fexpensive-optimizations"
- optimize="$optimize -fregmove"
- : #* optimize="$optimize -fdelayed-branch"
- : #x optimize="$optimize -fschedule-insns"
- optimize="$optimize -fschedule-insns2"
- : #? optimize="$optimize -ffunction-sections"
- : #? optimize="$optimize -fcaller-saves"
- : #> optimize="$optimize -funroll-loops"
- : #> optimize="$optimize -funroll-all-loops"
- : #x optimize="$optimize -fmove-all-movables"
- : #x optimize="$optimize -freduce-all-givs"
- : #? optimize="$optimize -fstrict-aliasing"
- : #* optimize="$optimize -fstructure-noalias"
-
- case "$host" in
- arm*-*)
- optimize="$optimize -fstrength-reduce"
- ;;
- mips*-*)
- optimize="$optimize -fstrength-reduce"
- optimize="$optimize -finline-functions"
- ;;
- i?86-*)
- optimize="$optimize -fstrength-reduce"
- ;;
- powerpc-apple-*)
- # this triggers an internal compiler error with gcc2
- : #optimize="$optimize -fstrength-reduce"
-
- # this is really only beneficial with gcc3
- : #optimize="$optimize -finline-functions"
- ;;
- *)
- # this sometimes provokes bugs in gcc 2.95.2
- : #optimize="$optimize -fstrength-reduce"
- ;;
- esac
- ;;
- esac
+ optimize="-O2"
fi
case "$host" in
@@ -21497,6 +21433,7 @@
then
case "$host" in
i?86-*) FPM="INTEL" ;;
+ x86_64*) FPM="64BIT" ;;
arm*-*) FPM="ARM" ;;
mips*-*) FPM="MIPS" ;;
sparc*-*) FPM="SPARC" ;;
paddlespeech/audio/third_party/patches/sox.patch
0 → 100644
浏览文件 @
602e18e2
See https://github.com/pytorch/audio/pull/1297
diff -ru sox/src/formats.c sox/src/formats.c
--- sox/src/formats.c 2014-10-26 19:55:50.000000000 -0700
+++ sox/src/formats.c 2021-02-22 16:01:02.833144070 -0800
@@ -333,6 +333,10 @@
assert(ft);
if (!ft->fp)
return sox_false;
- fstat(fileno((FILE*)ft->fp), &st);
+ int fd = fileno((FILE*)ft->fp);
+ if (fd < 0)
+ return sox_false;
+ if (fstat(fd, &st) < 0)
+ return sox_false;
return ((st.st_mode & S_IFMT) == S_IFREG);
}
paddlespeech/audio/third_party/sox/CMakeLists.txt
0 → 100644
浏览文件 @
602e18e2
find_package
(
PkgConfig REQUIRED
)
include
(
ExternalProject
)
set
(
INSTALL_DIR
${
CMAKE_CURRENT_SOURCE_DIR
}
/../install
)
set
(
ARCHIVE_DIR
${
CMAKE_CURRENT_SOURCE_DIR
}
/../archives
)
set
(
patch_dir
${
CMAKE_CURRENT_SOURCE_DIR
}
/../patches
)
set
(
COMMON_ARGS --quiet --disable-shared --enable-static --prefix=
${
INSTALL_DIR
}
--with-pic --disable-dependency-tracking --disable-debug --disable-examples --disable-doc
)
# To pass custom environment variables to ExternalProject_Add command,
# we need to do `${CMAKE_COMMAND} -E env ${envs} <COMMANAD>`.
# https://stackoverflow.com/a/62437353
# We constrcut the custom environment variables here
set
(
envs
"PKG_CONFIG_PATH=
${
INSTALL_DIR
}
/lib/pkgconfig"
"LDFLAGS=-L
${
INSTALL_DIR
}
/lib $ENV{LDFLAGS}"
"CFLAGS=-I
${
INSTALL_DIR
}
/include -fvisibility=hidden $ENV{CFLAGS}"
)
ExternalProject_Add
(
mad
PREFIX
${
CMAKE_CURRENT_BINARY_DIR
}
DOWNLOAD_DIR
${
ARCHIVE_DIR
}
URL https://downloads.sourceforge.net/project/mad/libmad/0.15.1b/libmad-0.15.1b.tar.gz
URL_HASH SHA256=bbfac3ed6bfbc2823d3775ebb931087371e142bb0e9bb1bee51a76a6e0078690
PATCH_COMMAND patch <
${
patch_dir
}
/libmad.patch && cp
${
patch_dir
}
/config.guess
${
patch_dir
}
/config.sub
${
CMAKE_CURRENT_BINARY_DIR
}
/src/mad/
CONFIGURE_COMMAND
${
CMAKE_COMMAND
}
-E env
${
envs
}
${
CMAKE_CURRENT_BINARY_DIR
}
/src/mad/configure
${
COMMON_ARGS
}
DOWNLOAD_NO_PROGRESS ON
LOG_DOWNLOAD ON
LOG_UPDATE ON
LOG_CONFIGURE ON
LOG_BUILD ON
LOG_INSTALL ON
LOG_MERGED_STDOUTERR ON
LOG_OUTPUT_ON_FAILURE ON
)
ExternalProject_Add
(
amr
PREFIX
${
CMAKE_CURRENT_BINARY_DIR
}
DOWNLOAD_DIR
${
ARCHIVE_DIR
}
URL https://sourceforge.net/projects/opencore-amr/files/opencore-amr/opencore-amr-0.1.5.tar.gz
URL_HASH SHA256=2c006cb9d5f651bfb5e60156dbff6af3c9d35c7bbcc9015308c0aff1e14cd341
PATCH_COMMAND cp
${
patch_dir
}
/config.guess
${
patch_dir
}
/config.sub
${
CMAKE_CURRENT_BINARY_DIR
}
/src/amr/
CONFIGURE_COMMAND
${
CMAKE_COMMAND
}
-E env
${
envs
}
${
CMAKE_CURRENT_BINARY_DIR
}
/src/amr/configure
${
COMMON_ARGS
}
DOWNLOAD_NO_PROGRESS ON
LOG_DOWNLOAD ON
LOG_UPDATE ON
LOG_CONFIGURE ON
LOG_BUILD ON
LOG_INSTALL ON
LOG_MERGED_STDOUTERR ON
LOG_OUTPUT_ON_FAILURE ON
)
ExternalProject_Add
(
lame
PREFIX
${
CMAKE_CURRENT_BINARY_DIR
}
DOWNLOAD_DIR
${
ARCHIVE_DIR
}
URL https://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
URL_HASH SHA256=24346b4158e4af3bd9f2e194bb23eb473c75fb7377011523353196b19b9a23ff
PATCH_COMMAND cp
${
patch_dir
}
/config.guess
${
patch_dir
}
/config.sub
${
CMAKE_CURRENT_BINARY_DIR
}
/src/lame/
CONFIGURE_COMMAND
${
CMAKE_COMMAND
}
-E env
${
envs
}
${
CMAKE_CURRENT_BINARY_DIR
}
/src/lame/configure
${
COMMON_ARGS
}
--enable-nasm
DOWNLOAD_NO_PROGRESS ON
LOG_DOWNLOAD ON
LOG_UPDATE ON
LOG_CONFIGURE ON
LOG_BUILD ON
LOG_INSTALL ON
LOG_MERGED_STDOUTERR ON
LOG_OUTPUT_ON_FAILURE ON
)
ExternalProject_Add
(
ogg
PREFIX
${
CMAKE_CURRENT_BINARY_DIR
}
DOWNLOAD_DIR
${
ARCHIVE_DIR
}
URL https://ftp.osuosl.org/pub/xiph/releases/ogg/libogg-1.3.3.tar.gz
URL_HASH SHA256=c2e8a485110b97550f453226ec644ebac6cb29d1caef2902c007edab4308d985
PATCH_COMMAND cp
${
patch_dir
}
/config.guess
${
patch_dir
}
/config.sub
${
CMAKE_CURRENT_BINARY_DIR
}
/src/ogg/
CONFIGURE_COMMAND
${
CMAKE_COMMAND
}
-E env
${
envs
}
${
CMAKE_CURRENT_BINARY_DIR
}
/src/ogg/configure
${
COMMON_ARGS
}
DOWNLOAD_NO_PROGRESS ON
LOG_DOWNLOAD ON
LOG_UPDATE ON
LOG_CONFIGURE ON
LOG_BUILD ON
LOG_INSTALL ON
LOG_MERGED_STDOUTERR ON
LOG_OUTPUT_ON_FAILURE ON
)
ExternalProject_Add
(
flac
PREFIX
${
CMAKE_CURRENT_BINARY_DIR
}
DEPENDS ogg
DOWNLOAD_DIR
${
ARCHIVE_DIR
}
URL https://ftp.osuosl.org/pub/xiph/releases/flac/flac-1.3.2.tar.xz
URL_HASH SHA256=91cfc3ed61dc40f47f050a109b08610667d73477af6ef36dcad31c31a4a8d53f
PATCH_COMMAND cp
${
patch_dir
}
/config.guess
${
patch_dir
}
/config.sub
${
CMAKE_CURRENT_BINARY_DIR
}
/src/flac/
CONFIGURE_COMMAND
${
CMAKE_COMMAND
}
-E env
${
envs
}
${
CMAKE_CURRENT_BINARY_DIR
}
/src/flac/configure
${
COMMON_ARGS
}
--with-ogg --disable-cpplibs
DOWNLOAD_NO_PROGRESS ON
LOG_DOWNLOAD ON
LOG_UPDATE ON
LOG_CONFIGURE ON
LOG_BUILD ON
LOG_INSTALL ON
LOG_MERGED_STDOUTERR ON
LOG_OUTPUT_ON_FAILURE ON
)
ExternalProject_Add
(
vorbis
PREFIX
${
CMAKE_CURRENT_BINARY_DIR
}
DEPENDS ogg
DOWNLOAD_DIR
${
ARCHIVE_DIR
}
URL https://ftp.osuosl.org/pub/xiph/releases/vorbis/libvorbis-1.3.6.tar.gz
URL_HASH SHA256=6ed40e0241089a42c48604dc00e362beee00036af2d8b3f46338031c9e0351cb
PATCH_COMMAND cp
${
patch_dir
}
/config.guess
${
patch_dir
}
/config.sub
${
CMAKE_CURRENT_BINARY_DIR
}
/src/vorbis/
CONFIGURE_COMMAND
${
CMAKE_COMMAND
}
-E env
${
envs
}
${
CMAKE_CURRENT_BINARY_DIR
}
/src/vorbis/configure
${
COMMON_ARGS
}
--with-ogg
DOWNLOAD_NO_PROGRESS ON
LOG_DOWNLOAD ON
LOG_UPDATE ON
LOG_CONFIGURE ON
LOG_BUILD ON
LOG_INSTALL ON
LOG_MERGED_STDOUTERR ON
LOG_OUTPUT_ON_FAILURE ON
)
ExternalProject_Add
(
opus
PREFIX
${
CMAKE_CURRENT_BINARY_DIR
}
DEPENDS ogg
DOWNLOAD_DIR
${
ARCHIVE_DIR
}
URL https://ftp.osuosl.org/pub/xiph/releases/opus/opus-1.3.1.tar.gz
URL_HASH SHA256=65b58e1e25b2a114157014736a3d9dfeaad8d41be1c8179866f144a2fb44ff9d
PATCH_COMMAND cp
${
patch_dir
}
/config.guess
${
patch_dir
}
/config.sub
${
CMAKE_CURRENT_BINARY_DIR
}
/src/opus/
CONFIGURE_COMMAND
${
CMAKE_COMMAND
}
-E env
${
envs
}
${
CMAKE_CURRENT_BINARY_DIR
}
/src/opus/configure
${
COMMON_ARGS
}
--with-ogg
DOWNLOAD_NO_PROGRESS ON
LOG_DOWNLOAD ON
LOG_UPDATE ON
LOG_CONFIGURE ON
LOG_BUILD ON
LOG_INSTALL ON
LOG_MERGED_STDOUTERR ON
LOG_OUTPUT_ON_FAILURE ON
)
ExternalProject_Add
(
opusfile
PREFIX
${
CMAKE_CURRENT_BINARY_DIR
}
DEPENDS opus
DOWNLOAD_DIR
${
ARCHIVE_DIR
}
URL https://ftp.osuosl.org/pub/xiph/releases/opus/opusfile-0.12.tar.gz
URL_HASH SHA256=118d8601c12dd6a44f52423e68ca9083cc9f2bfe72da7a8c1acb22a80ae3550b
PATCH_COMMAND cp
${
patch_dir
}
/config.guess
${
patch_dir
}
/config.sub
${
CMAKE_CURRENT_BINARY_DIR
}
/src/opusfile/
CONFIGURE_COMMAND
${
CMAKE_COMMAND
}
-E env
${
envs
}
${
CMAKE_CURRENT_BINARY_DIR
}
/src/opusfile/configure
${
COMMON_ARGS
}
--disable-http
DOWNLOAD_NO_PROGRESS ON
LOG_DOWNLOAD ON
LOG_UPDATE ON
LOG_CONFIGURE ON
LOG_BUILD ON
LOG_INSTALL ON
LOG_MERGED_STDOUTERR ON
LOG_OUTPUT_ON_FAILURE ON
)
set
(
SOX_OPTIONS
--disable-openmp
--with-amrnb
--with-amrwb
--with-flac
--with-lame
--with-mad
--with-oggvorbis
--with-opus
--without-alsa
--without-ao
--without-coreaudio
--without-oss
--without-id3tag
--without-ladspa
--without-magic
--without-png
--without-pulseaudio
--without-sndfile
--without-sndio
--without-sunaudio
--without-waveaudio
--without-wavpack
--without-twolame
)
set
(
SOX_LIBRARIES
${
INSTALL_DIR
}
/lib/libsox.a
${
INSTALL_DIR
}
/lib/libopencore-amrnb.a
${
INSTALL_DIR
}
/lib/libopencore-amrwb.a
${
INSTALL_DIR
}
/lib/libmad.a
${
INSTALL_DIR
}
/lib/libmp3lame.a
${
INSTALL_DIR
}
/lib/libFLAC.a
${
INSTALL_DIR
}
/lib/libopusfile.a
${
INSTALL_DIR
}
/lib/libopus.a
${
INSTALL_DIR
}
/lib/libvorbisenc.a
${
INSTALL_DIR
}
/lib/libvorbisfile.a
${
INSTALL_DIR
}
/lib/libvorbis.a
${
INSTALL_DIR
}
/lib/libogg.a
)
ExternalProject_Add
(
sox
PREFIX
${
CMAKE_CURRENT_BINARY_DIR
}
DEPENDS ogg flac vorbis opusfile lame mad amr
DOWNLOAD_DIR
${
ARCHIVE_DIR
}
URL https://downloads.sourceforge.net/project/sox/sox/14.4.2/sox-14.4.2.tar.bz2
URL_HASH SHA256=81a6956d4330e75b5827316e44ae381e6f1e8928003c6aa45896da9041ea149c
PATCH_COMMAND patch -p1 <
${
patch_dir
}
/sox.patch && cp
${
patch_dir
}
/config.guess
${
patch_dir
}
/config.sub
${
CMAKE_CURRENT_BINARY_DIR
}
/src/sox/
CONFIGURE_COMMAND
${
CMAKE_COMMAND
}
-E env
${
envs
}
${
CMAKE_CURRENT_BINARY_DIR
}
/src/sox/configure
${
COMMON_ARGS
}
${
SOX_OPTIONS
}
BUILD_BYPRODUCTS
${
SOX_LIBRARIES
}
DOWNLOAD_NO_PROGRESS ON
LOG_DOWNLOAD ON
LOG_UPDATE ON
LOG_CONFIGURE ON
LOG_BUILD ON
LOG_INSTALL ON
LOG_MERGED_STDOUTERR ON
LOG_OUTPUT_ON_FAILURE ON
)
add_dependencies
(
libsox sox
)
set
(
SOX_INCLUDE_DIR
${
INSTALL_DIR
}
/include PARENT_SCOPE
)
set
(
SOX_LIBRARIES
${
SOX_LIBRARIES
}
PARENT_SCOPE
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录