initial import
This commit is contained in:
92
celt/sndio.patch
Normal file
92
celt/sndio.patch
Normal file
@@ -0,0 +1,92 @@
|
||||
diff --git a/tools/Makefile.in b/tools/Makefile.in
|
||||
index befe111..678f053 100644
|
||||
--- a/tools/Makefile.in
|
||||
+++ b/tools/Makefile.in
|
||||
@@ -236,7 +236,8 @@ noinst_HEADERS = wav_io.h
|
||||
celtenc_SOURCES = celtenc.c wav_io.c skeleton.c
|
||||
celtenc_LDADD = $(top_builddir)/libcelt/libcelt@LIBCELT_SUFFIX@.la $(OGG_LIBS)
|
||||
celtdec_SOURCES = celtdec.c wav_io.c
|
||||
-celtdec_LDADD = $(top_builddir)/libcelt/libcelt@LIBCELT_SUFFIX@.la $(OGG_LIBS)
|
||||
+celtdec_LDADD = $(top_builddir)/libcelt/libcelt@LIBCELT_SUFFIX@.la $(OGG_LIBS) \
|
||||
+ -lsndio
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
diff --git a/tools/celtdec.c b/tools/celtdec.c
|
||||
index 5edbd48..28d6fb8 100644
|
||||
--- a/tools/celtdec.c
|
||||
+++ b/tools/celtdec.c
|
||||
@@ -66,6 +66,9 @@
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
+#elif defined USE_SNDIO
|
||||
+#include <sndio.h>
|
||||
+
|
||||
#elif defined HAVE_SYS_AUDIOIO_H
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
@@ -88,6 +91,10 @@
|
||||
((buf[base+1]<<8)&0xff00)| \
|
||||
(buf[base]&0xff))
|
||||
|
||||
+#ifdef USE_SNDIO
|
||||
+struct sio_hdl *hdl;
|
||||
+#endif
|
||||
+
|
||||
static void print_comments(char *comments, int length)
|
||||
{
|
||||
char *c=comments;
|
||||
@@ -183,6 +190,32 @@ FILE *out_file_open(char *outFile, int rate, int *channels)
|
||||
exit(1);
|
||||
}
|
||||
fout = fdopen(audio_fd, "w");
|
||||
+#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;
|
||||
@@ -612,6 +645,10 @@ int main(int argc, char **argv)
|
||||
if (strlen(outFile)==0)
|
||||
WIN_Play_Samples (out+frame_offset*channels, sizeof(short) * new_frame_size*channels);
|
||||
else
|
||||
+#elif defined USE_SNDIO
|
||||
+ if (strlen(outFile)==0)
|
||||
+ sio_write (hdl, out+frame_offset*channels, sizeof(short) * new_frame_size*channels);
|
||||
+ else
|
||||
#endif
|
||||
fwrite(out+frame_offset*channels, sizeof(short), new_frame_size*channels, fout);
|
||||
|
||||
@@ -669,5 +706,8 @@ int main(int argc, char **argv)
|
||||
if (fout != NULL)
|
||||
fclose(fout);
|
||||
|
||||
+ if (print_bitrate)
|
||||
+ fprintf (stderr, "\n");
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user