maintenance update to 0.1.4

This commit is contained in:
naddy 2012-08-04 15:41:44 +00:00
parent 1ebf521ccf
commit 928ef365e1
3 changed files with 4 additions and 78 deletions

View File

@ -1,8 +1,8 @@
# $OpenBSD: Makefile,v 1.2 2012/08/04 14:42:17 naddy Exp $
# $OpenBSD: Makefile,v 1.3 2012/08/04 15:41:44 naddy Exp $
COMMENT= encode, inspect, and decode Opus files
DISTNAME= opus-tools-0.1.2
DISTNAME= opus-tools-0.1.4
CATEGORIES= audio
HOMEPAGE= http://opus-codec.org/
@ -23,7 +23,5 @@ WANTLIB= c m ogg opus sndio
SEPARATE_BUILD= Yes
CONFIGURE_STYLE=gnu
CONFIGURE_ENV= CPPFLAGS="-DUSE_SNDIO"
MAKE_FLAGS= OSS_LIBS=-lsndio
.include <bsd.port.mk>

View File

@ -1,2 +1,2 @@
SHA256 (opus-tools-0.1.2.tar.gz) = XSuZdXvLYourJhHz7SevbzUnbOOryWwO1DmdbGRj3aU=
SIZE (opus-tools-0.1.2.tar.gz) = 263679
SHA256 (opus-tools-0.1.4.tar.gz) = 3oBIXFr6H9g8Dhag3UhgRwyHKZen3QpY6Zsu6Kk+UWg=
SIZE (opus-tools-0.1.4.tar.gz) = 276066

View File

@ -1,72 +0,0 @@
$OpenBSD: patch-src_opusdec_c,v 1.1.1.1 2012/07/10 12:12:37 naddy Exp $
--- src/opusdec.c.orig Wed Jun 13 00:01:52 2012
+++ src/opusdec.c Mon Jul 9 23:18:44 2012
@@ -63,7 +63,10 @@
#define I64FORMAT "lld"
#endif
-#if defined HAVE_SYS_SOUNDCARD_H || defined HAVE_MACHINE_SOUNDCARD_H || HAVE_SOUNDCARD_H
+#if defined USE_SNDIO
+#include <sndio.h>
+
+#elif defined HAVE_SYS_SOUNDCARD_H || defined HAVE_MACHINE_SOUNDCARD_H || HAVE_SOUNDCARD_H
#ifdef HAVE_SYS_SOUNDCARD_H
# include <sys/soundcard.h>
#elif HAVE_MACHINE_SOUNDCARD_H
@@ -105,6 +108,10 @@
((buf[base+1]<<8)&0xff00)| \
(buf[base]&0xff))
+#ifdef USE_SNDIO
+struct sio_hdl *hdl;
+#endif
+
typedef struct shapestate shapestate;
struct shapestate {
float * b_buf;
@@ -301,6 +308,32 @@ FILE *out_file_open(char *outFile, int rate, int *chan
perror("Cannot open output");
exit(1);
}
+#elif defined USE_SNDIO
+ struct sio_par par;
+
+ hdl = sio_open(NULL, SIO_PLAY, 0);
+ if (!hdl)
+ {
+ fprintf(stderr, "Cannot open sndio device\n");
+ exit(1);
+ }
+
+ sio_initpar(&par);
+ par.sig = 1;
+ par.bits = 16;
+ par.rate = rate;
+ par.pchan = *channels;
+
+ if (!sio_setpar(hdl, &par) || !sio_getpar(hdl, &par) ||
+ par.sig != 1 || par.bits != 16 || par.rate != rate) {
+ fprintf(stderr, "could not set sndio parameters\n");
+ exit(1);
+ }
+ *channels = par.pchan;
+ if (!sio_start(hdl)) {
+ fprintf(stderr, "could not start sndio\n");
+ exit(1);
+ }
#elif defined HAVE_SYS_AUDIOIO_H
audio_info_t info;
int audio_fd;
@@ -507,6 +540,12 @@ opus_int64 audio_write(float *pcm, int channels, int f
#if defined WIN32 || defined _WIN32
if(!file){
ret=WIN_Play_Samples (out, sizeof(short) * channels * (out_len<maxout?out_len:maxout));
+ if(ret>0)ret/=sizeof(short)*channels;
+ else fprintf(stderr, "Error playing audio.\n");
+ }else
+#elif defined USE_SNDIO
+ if(!file){
+ ret=sio_write (hdl, out, sizeof(short) * channels * (out_len<maxout?out_len:maxout));
if(ret>0)ret/=sizeof(short)*channels;
else fprintf(stderr, "Error playing audio.\n");
}else