ref: d9e0910fc05fbb6382a2d5e2361b7271e98e8e84
parent: 4f205d61a0073371f9b39a607cc5b878dce4eab0
author: rrt <rrt>
date: Mon Dec 11 21:49:25 EST 2006
Various Sun Audio fixes.
--- a/src/handlers.c
+++ b/src/handlers.c
@@ -53,7 +53,7 @@
st_smp_format_fn,
st_snd_format_fn,
st_sphere_format_fn,
-#ifdef HAVE_SUNAUDIO
+#ifdef HAVE_SUN_AUDIO
st_sun_format_fn,
#endif
st_svx_format_fn,
--- a/src/st_i.h
+++ b/src/st_i.h
@@ -208,7 +208,7 @@
extern const st_format_t *st_smp_format_fn(void);
extern const st_format_t *st_snd_format_fn(void);
extern const st_format_t *st_sphere_format_fn(void);
-#ifdef HAVE_SUNAUDIO
+#ifdef HAVE_SUN_AUDIO
extern const st_format_t *st_sun_format_fn(void);
#endif
extern const st_format_t *st_svx_format_fn(void);
--- a/src/sunaudio.c
+++ b/src/sunaudio.c
@@ -35,6 +35,8 @@
#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
+#include <string.h>
+
/*
* Do anything required before you start reading samples.
* Read file header.
@@ -42,9 +44,10 @@
* size and encoding of samples,
* mono/stereo/quad.
*/
-int st_sunstartread(ft_t ft)
+static int st_sunstartread(ft_t ft)
{
- int samplesize, encoding;
+ st_fileinfo_t *file = (st_fileinfo_t *)ft->priv;
+ st_size_t samplesize, encoding;
audio_info_t audio_if;
#ifdef __SVR4
audio_device_t audio_dev;
@@ -51,13 +54,13 @@
#endif
char simple_hw=0;
- /* Hard code for now. */
- ft->file.count = 0;
- ft->file.pos = 0;
- ft->file.eof = 0;
- ft->file.size = 1024;
- if ((ft->file.buf = malloc (ft->file.size)) == NULL) {
- st_fail_errno(ft,ST_ENOMEM,"unable to allocate input buffer of size %d", ft->file.size);
+ /* Hard-code for now. */
+ file->count = 0;
+ file->pos = 0;
+ file->eof = 0;
+ file->size = 1024;
+ if ((file->buf = malloc (file->size)) == NULL) {
+ st_fail_errno(ft,ST_ENOMEM,"unable to allocate input buffer of size %d", file->size);
return ST_EOF;
}
@@ -175,14 +178,15 @@
ioctl(fileno(ft->fp), I_FLUSH, FLUSHR);
#endif
/* Change to non-buffered I/O*/
- setvbuf(ft->fp, NULL, _IONBF, sizeof(char) * ft->file.size);
+ setvbuf(ft->fp, NULL, _IONBF, sizeof(char) * file->size);
return (ST_SUCCESS);
}
-int st_sunstartwrite(ft_t ft)
+static int st_sunstartwrite(ft_t ft)
{
- int samplesize, encoding;
+ st_fileinfo_t *file = (st_fileinfo_t *)ft->priv;
+ st_size_t samplesize, encoding;
audio_info_t audio_if;
#ifdef __SVR4
audio_device_t audio_dev;
@@ -189,13 +193,13 @@
#endif
char simple_hw=0;
- /* Hard code for now. */
- ft->file.count = 0;
- ft->file.pos = 0;
- ft->file.eof = 0;
- ft->file.size = 1024;
- if ((ft->file.buf = malloc (ft->file.size)) == NULL) {
- st_fail_errno(ft,ST_ENOMEM,"unable to allocate output buffer of size %d", ft->file.size);
+ /* Hard-code for now. */
+ file->count = 0;
+ file->pos = 0;
+ file->eof = 0;
+ file->size = 1024;
+ if ((file->buf = malloc (file->size)) == NULL) {
+ st_fail_errno(ft,ST_ENOMEM,"unable to allocate output buffer of size %d", file->size);
return(ST_EOF);
}
@@ -303,13 +307,13 @@
return(ST_EOF);
}
/* Change to non-buffered I/O */
- setvbuf(ft->fp, NULL, _IONBF, sizeof(char) * ft->file.size);
+ setvbuf(ft->fp, NULL, _IONBF, sizeof(char) * file->size);
return (ST_SUCCESS);
}
/* Sun /dev/audio player */
-static char *sunnames[] = {
+static const char *sunnames[] = {
"sunau",
NULL
};