summaryrefslogtreecommitdiffstats
path: root/libao2/ao_sgi.c
diff options
context:
space:
mode:
Diffstat (limited to 'libao2/ao_sgi.c')
-rw-r--r--libao2/ao_sgi.c62
1 files changed, 31 insertions, 31 deletions
diff --git a/libao2/ao_sgi.c b/libao2/ao_sgi.c
index 46b79c1e2e..9853b7e12d 100644
--- a/libao2/ao_sgi.c
+++ b/libao2/ao_sgi.c
@@ -32,7 +32,7 @@
#include "help_mp.h"
#include "libaf/af_format.h"
-static const ao_info_t info =
+static const ao_info_t info =
{
"sgi audio output",
"sgi",
@@ -116,9 +116,9 @@ static int fmt2sgial(int *format, int *width) {
// to set/get/query special features/parameters
static int control(int cmd, void *arg){
-
+
mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_SGI_INFO);
-
+
switch(cmd) {
case AOCONTROL_QUERY_FORMAT:
/* Do not reject any format: return the closest matching
@@ -139,9 +139,9 @@ static int init(int rate, int channels, int format, int flags) {
smpfmt = fmt2sgial(&format, &smpwidth);
mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_SGI_InitInfo, rate, (channels > 1) ? "Stereo" : "Mono", af_fmt2str_short(format));
-
+
{ /* from /usr/share/src/dmedia/audio/setrate.c */
-
+
double frate, realrate;
ALpv x[2];
@@ -152,9 +152,9 @@ static int init(int rate, int channels, int format, int flags) {
return 0;
}
}
-
+
frate = rate;
-
+
x[0].param = AL_RATE;
x[0].value.ll = alDoubleToFixed(rate);
x[1].param = AL_MASTER_CLOCK;
@@ -163,7 +163,7 @@ static int init(int rate, int channels, int format, int flags) {
if (alSetParams(rv,x, 2)<0) {
mp_msg(MSGT_AO, MSGL_WARN, MSGTR_AO_SGI_CantSetParms_Samplerate, alGetErrorString(oserror()));
}
-
+
if (x[0].sizeOut < 0) {
mp_msg(MSGT_AO, MSGL_WARN, MSGTR_AO_SGI_CantSetAlRate);
}
@@ -171,14 +171,14 @@ static int init(int rate, int channels, int format, int flags) {
if (alGetParams(rv,x, 1)<0) {
mp_msg(MSGT_AO, MSGL_WARN, MSGTR_AO_SGI_CantGetParms, alGetErrorString(oserror()));
}
-
+
realrate = alFixedToDouble(x[0].value.ll);
if (frate != realrate) {
mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_SGI_SampleRateInfo, realrate, frate);
- }
+ }
sample_rate = (int)realrate;
}
-
+
bytes_per_frame = channels * smpwidth;
ao_data.samplerate = sample_rate;
@@ -187,14 +187,14 @@ static int init(int rate, int channels, int format, int flags) {
ao_data.bps = sample_rate * bytes_per_frame;
ao_data.buffersize=131072;
ao_data.outburst = ao_data.buffersize/16;
-
+
ao_config = alNewConfig();
-
+
if (!ao_config) {
mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_SGI_InitConfigError, alGetErrorString(oserror()));
return 0;
}
-
+
if(alSetChannels(ao_config, channels) < 0 ||
alSetWidth(ao_config, smpwidth) < 0 ||
alSetSampFmt(ao_config, smpfmt) < 0 ||
@@ -203,17 +203,17 @@ static int init(int rate, int channels, int format, int flags) {
mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_SGI_InitConfigError, alGetErrorString(oserror()));
return 0;
}
-
+
ao_port = alOpenPort("mplayer", "w", ao_config);
-
+
if (!ao_port) {
mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_SGI_InitOpenAudioFailed, alGetErrorString(oserror()));
return 0;
}
-
+
// printf("ao_sgi, init: port %d config %d\n", ao_port, ao_config);
queue_size = alGetQueueSize(ao_config);
- return 1;
+ return 1;
}
@@ -231,26 +231,26 @@ static void uninit(int immed) {
if (ao_port) {
if (!immed)
- while(alGetFilled(ao_port) > 0) sginap(1);
+ while(alGetFilled(ao_port) > 0) sginap(1);
alClosePort(ao_port);
ao_port = NULL;
}
-
+
}
// stop playing and empty buffers (for seeking/pause)
static void reset(void) {
-
+
mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_SGI_Reset);
-
+
alDiscardFrames(ao_port, queue_size);
}
// stop playing, keep buffers (for pause)
static void audio_pause(void) {
-
+
mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_SGI_PauseInfo);
-
+
}
// resume playing, after audio_pause()
@@ -262,12 +262,12 @@ static void audio_resume(void) {
// return: how many bytes can be played without blocking
static int get_space(void) {
-
+
// printf("ao_sgi, get_space: (ao_outburst %d)\n", ao_data.outburst);
// printf("ao_sgi, get_space: alGetFillable [%d] \n", alGetFillable(ao_port));
-
+
return alGetFillable(ao_port) * bytes_per_frame;
-
+
}
@@ -275,7 +275,7 @@ static int get_space(void) {
// it should round it down to outburst*n
// return: number of bytes played
static int play(void* data, int len, int flags) {
-
+
/* Always process data in quadword-aligned chunks (64-bits). */
const int plen = len / (sizeof(uint64_t) * bytes_per_frame);
const int framecount = plen * sizeof(uint64_t);
@@ -294,14 +294,14 @@ static int play(void* data, int len, int flags) {
alWriteFrames(ao_port, data, framecount);
return framecount * bytes_per_frame;
-
+
}
// return: delay in seconds between first and last sample in buffer
static float get_delay(void){
-
+
// printf("ao_sgi, get_delay: (ao_buffersize %d)\n", ao_buffersize);
-
+
// return (float)queue_size/((float)sample_rate);
const int outstanding = alGetFilled(ao_port);
return (float)((outstanding < 0) ? queue_size : outstanding) /