Package init

This commit is contained in:
dogsheng 2019-12-14 18:56:37 +08:00
parent b7447f396b
commit 70bb613197
6 changed files with 276 additions and 75 deletions

View File

@ -0,0 +1,26 @@
From de5547ebc2b0ed37d69889c3c3aec6553d2d84cb Mon Sep 17 00:00:00 2001
From: Stas Sergeev <stsp@users.sourceforge.net>
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

View File

@ -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/)

View File

@ -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/)

View File

@ -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(count<maxchannels){
char *h,*t;
int m=0;
@@ -706,6 +710,15 @@ static int _find_channel(int needle, char *haystack){
return -1;
}
+static void _free_map(char **m){
+ char **in=m;
+ while(m && *m){
+ free(*m);
+ m++;
+ }
+ if(in)free(in);
+}
+
static char **_tokenize_matrix(char *matrix){
char **ret=NULL;
char *p=matrix;
@@ -730,6 +743,8 @@ static char **_tokenize_matrix(char *matrix){
}
ret = calloc(count+1,sizeof(*ret));
+ if(!ret)
+ return NULL;
p=matrix;
count=0;
@@ -748,6 +763,10 @@ static char **_tokenize_matrix(char *matrix){
while(t>p && 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;i<ch;i++) perm[i] = -1;
i=0;
@@ -810,6 +826,9 @@ static char *_channelmask_to_matrix(unsigned int mask, char *premap){
char buffer[257]={0};
char **map = _tokenize_matrix(premap);
+ if(!map)
+ return NULL;
+
while(map[m]){
if(mask & (1<<m)){
if(count)
@@ -849,6 +868,9 @@ static char *_matrix_intersect(char *matrix,char *premap){
int count=0;
char **map = _tokenize_matrix(premap);
+ if(!map)
+ return NULL;
+
while(1){
char *h=p;
int m=0;
@@ -1039,7 +1061,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;
@@ -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(count<device->output_channels){
@@ -1157,8 +1183,10 @@ static ao_device* _open_device(int driver_id, ao_sample_format *format,
for(i=0;i<device->output_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;

BIN
libao-1.2.0.tar.gz Normal file

Binary file not shown.

73
libao.spec Normal file
View File

@ -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 <hu.huyan@huawei.com> - 1.2.0-14
- Package Initialization