diff --git a/0001-ao_pulse.c-fix-latency-calculation.patch b/0001-ao_pulse.c-fix-latency-calculation.patch new file mode 100644 index 0000000..f6a61fc --- /dev/null +++ b/0001-ao_pulse.c-fix-latency-calculation.patch @@ -0,0 +1,26 @@ +From de5547ebc2b0ed37d69889c3c3aec6553d2d84cb Mon Sep 17 00:00:00 2001 +From: Stas Sergeev +Date: Wed, 18 Feb 2015 00:36:28 +0300 +Subject: [PATCH] ao_pulse.c: fix latency calculation + +This fixes periodic underruns with pa plugin. +--- + src/plugins/pulse/ao_pulse.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/plugins/pulse/ao_pulse.c b/src/plugins/pulse/ao_pulse.c +index ff5497f..9c0f64a 100644 +--- a/src/plugins/pulse/ao_pulse.c ++++ b/src/plugins/pulse/ao_pulse.c +@@ -259,7 +259,7 @@ int ao_plugin_open(ao_device *device, ao_sample_format *format) { + battr.prebuf = battr.minreq = battr.fragsize = -1; + + battr.tlength = (int)(internal->buffer_time * format->rate) / 1000000 * +- ((format->bits+7)/8) + device->output_channels; ++ ((format->bits+7)/8) * device->output_channels; + battr.minreq = battr.tlength/4; + battr.maxlength = battr.tlength+battr.minreq; + +-- +2.1.0 + diff --git a/README.en.md b/README.en.md deleted file mode 100644 index 5c0f193..0000000 --- a/README.en.md +++ /dev/null @@ -1,36 +0,0 @@ -# libao - -#### Description -{**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**} - -#### Software Architecture -Software architecture description - -#### Installation - -1. xxxx -2. xxxx -3. xxxx - -#### Instructions - -1. xxxx -2. xxxx -3. xxxx - -#### Contribution - -1. Fork the repository -2. Create Feat_xxx branch -3. Commit your code -4. Create Pull Request - - -#### Gitee Feature - -1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md -2. Gitee blog [blog.gitee.com](https://blog.gitee.com) -3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore) -4. The most valuable open source project [GVP](https://gitee.com/gvp) -5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help) -6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/README.md b/README.md deleted file mode 100644 index a20efea..0000000 --- a/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# libao - -#### 介绍 -{**以下是码云平台说明,您可以替换此简介** -码云是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN)。专为开发者提供稳定、高效、安全的云端软件开发协作平台 -无论是个人、团队、或是企业,都能够用码云实现代码托管、项目管理、协作开发。企业项目请看 [https://gitee.com/enterprises](https://gitee.com/enterprises)} - -#### 软件架构 -软件架构说明 - - -#### 安装教程 - -1. xxxx -2. xxxx -3. xxxx - -#### 使用说明 - -1. xxxx -2. xxxx -3. xxxx - -#### 参与贡献 - -1. Fork 本仓库 -2. 新建 Feat_xxx 分支 -3. 提交代码 -4. 新建 Pull Request - - -#### 码云特技 - -1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md -2. 码云官方博客 [blog.gitee.com](https://blog.gitee.com) -3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解码云上的优秀开源项目 -4. [GVP](https://gitee.com/gvp) 全称是码云最有价值开源项目,是码云综合评定出的优秀开源项目 -5. 码云官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) -6. 码云封面人物是一档用来展示码云会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/d5221655dfd1a2156aa6be83b5aadea7c1e0f5bd.diff b/d5221655dfd1a2156aa6be83b5aadea7c1e0f5bd.diff new file mode 100644 index 0000000..6f2aa7a --- /dev/null +++ b/d5221655dfd1a2156aa6be83b5aadea7c1e0f5bd.diff @@ -0,0 +1,177 @@ +diff --git a/src/audio_out.c b/src/audio_out.c +index bd8f6fc..f5942d6 100644 +--- a/src/audio_out.c ++++ b/src/audio_out.c +@@ -634,6 +634,10 @@ static char *_sanitize_matrix(int maxchannels, char *matrix, ao_device *device){ + char *ret = calloc(strlen(matrix)+1,1); /* can only get smaller */ + char *p=matrix; + int count=0; ++ ++ if(!ret) ++ return NULL; ++ + while(countp && isspace(*(t-1)))t--; + + ret[count] = calloc(t-p+1,1); ++ if(!ret[count]){ ++ _free_map(ret); ++ return NULL; ++ } + memcpy(ret[count],p,t-p); + count++; + if(!*h)break; +@@ -755,16 +774,6 @@ static char **_tokenize_matrix(char *matrix){ + } + + return ret; +- +-} +- +-static void _free_map(char **m){ +- char **in=m; +- while(m && *m){ +- free(*m); +- m++; +- } +- if(in)free(in); + } + + static unsigned int _matrix_to_channelmask(int ch, char *matrix, char *premap, int **mout){ +@@ -772,7 +781,14 @@ static unsigned int _matrix_to_channelmask(int ch, char *matrix, char *premap, i + char *p=matrix; + int *perm=(*mout=malloc(ch*sizeof(*mout))); + int i; +- char **map = _tokenize_matrix(premap); ++ char **map; ++ ++ if(!perm) ++ return 0; ++ ++ map = _tokenize_matrix(premap); ++ if(!map) ++ return 0; + + for(i=0;ioutput_matrix, + &device->input_map); + int channels = _channelmask_bits(mask); +- if(channels<0){ ++ if(channels<=0){ + aerror("Unable to map any channels from input matrix to output"); + errno = AO_EBADFORMAT; + goto error; +@@ -1060,7 +1082,7 @@ static ao_device* _open_device(int driver_id, ao_sample_format *format, + device->output_matrix, + &device->input_map); + int channels = _channelmask_bits(mask); +- if(channels<0){ ++ if(channels<=0){ + aerror("Unable to map any channels from input matrix to output"); + errno = AO_EBADFORMAT; + goto error; +@@ -1111,6 +1133,10 @@ static ao_device* _open_device(int driver_id, ao_sample_format *format, + int count=0; + device->inter_permute = calloc(device->output_channels,sizeof(int)); + ++ if (!device->inter_permute) { ++ errno = AO_EFAIL; ++ goto error; ++ } + adebug("\n"); + + while(countoutput_channels){ +@@ -1157,8 +1183,10 @@ static ao_device* _open_device(int driver_id, ao_sample_format *format, + for(i=0;ioutput_channels;i++) + if(device->inter_permute[i]==j)break; + if(i==device->output_channels){ +- adebug("input %d (%s)\t -> none\n", +- j,inch[j]); ++ if(inch){ ++ adebug("input %d (%s)\t -> none\n", ++ j,inch[j]); ++ } + unflag=1; + } + } +diff --git a/src/plugins/macosx/ao_macosx.c b/src/plugins/macosx/ao_macosx.c +index a3daf1b..129020d 100644 +--- a/src/plugins/macosx/ao_macosx.c ++++ b/src/plugins/macosx/ao_macosx.c +@@ -594,11 +594,11 @@ int ao_plugin_open(ao_device *device, ao_sample_format *format) + internal->firstValidByteOffset = 0; + internal->validByteCount = 0; + internal->buffer = malloc(internal->bufferByteCount); +- memset(internal->buffer, 0, internal->bufferByteCount); + if (!internal->buffer) { + aerror("Unable to allocate queue buffer.\n"); + return 0; + } ++ memset(internal->buffer, 0, internal->bufferByteCount); + + /* limited to stereo for now */ + //if(!device->output_matrix) +diff --git a/src/plugins/sndio/ao_sndio.c b/src/plugins/sndio/ao_sndio.c +index ec251fb..e23fd47 100644 +--- a/src/plugins/sndio/ao_sndio.c ++++ b/src/plugins/sndio/ao_sndio.c +@@ -67,6 +67,9 @@ int ao_plugin_device_init(ao_device *device) + { + ao_sndio_internal *internal; + internal = (ao_sndio_internal *) calloc(1,sizeof(*internal)); ++ if (internal == NULL) ++ return 0; ++ + internal->id=-1; + device->internal = internal; + device->output_matrix_order = AO_OUTPUT_MATRIX_FIXED; diff --git a/libao-1.2.0.tar.gz b/libao-1.2.0.tar.gz new file mode 100644 index 0000000..ab69432 Binary files /dev/null and b/libao-1.2.0.tar.gz differ diff --git a/libao.spec b/libao.spec new file mode 100644 index 0000000..a8f4d69 --- /dev/null +++ b/libao.spec @@ -0,0 +1,73 @@ +Name: libao +Version: 1.2.0 +Release: 14 +Summary: A cross platform audio library +License: GPLv2+ +URL: http://xiph.org/ao/ +Source0: http://downloads.xiph.org/releases/ao/libao-%{version}.tar.gz +Patch1: 0001-ao_pulse.c-fix-latency-calculation.patch +Patch2: d5221655dfd1a2156aa6be83b5aadea7c1e0f5bd.diff +BuildRequires: gcc alsa-lib-devel pkgconfig(libpulse) + +%description +Libao is a cross-platform audio library that allows programs to output audio +using a simple API on a wide variety of platforms. + + +%package devel +Summary: Including header files and library for the developing of libao +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description devel +This contains header files and dynamic libraries for the developing applications +that use libao. + + +%package help +Summary: Man files for libao +Requires: man +BuildArch: noarch + +%description help +This contains man files for the using of libao. + + +%prep +%autosetup -p1 +sed -i "s/-O20 -ffast-math//" configure + + +%build +%configure +%disable_rpath +%make_build + + +%install +%make_install INSTALL="install -p" +%delete_la +rm -rf %{buildroot}/%{_docdir}/libao* + +%ldconfig_scriptlets + + +%files +%doc AUTHORS CHANGES COPYING README +%{_libdir}/ao +%{_libdir}/libao.so.* + +%files devel +%doc doc/*.html doc/*.c doc/*.css +%{_datadir}/aclocal/* +%{_includedir}/ao +%{_libdir}/ckport +%{_libdir}/*.so +%{_libdir}/pkgconfig + +%files help +%{_mandir}/man*/* + + +%changelog +* Thu Nov 28 2019 huyan - 1.2.0-14 +- Package Initialization