Mercurial > mplayer.hg
diff libao2/ao_sgi.c @ 29263:0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
author | diego |
---|---|
date | Wed, 13 May 2009 02:58:57 +0000 |
parents | 9a5b8c2ed6de |
children | 32725ca88fed |
line wrap: on
line diff
--- a/libao2/ao_sgi.c Tue May 12 19:25:35 2009 +0000 +++ b/libao2/ao_sgi.c Wed May 13 02:58:57 2009 +0000 @@ -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 @@ // 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ // 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 @@ // 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 @@ 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) /