diff options
Diffstat (limited to 'libao2')
-rw-r--r-- | libao2/ao_alsa.c | 48 | ||||
-rw-r--r-- | libao2/ao_alsa5.c | 16 | ||||
-rw-r--r-- | libao2/ao_coreaudio.c | 28 | ||||
-rw-r--r-- | libao2/ao_dsound.c | 74 | ||||
-rw-r--r-- | libao2/ao_dxr2.c | 8 | ||||
-rw-r--r-- | libao2/ao_esd.c | 24 | ||||
-rw-r--r-- | libao2/ao_ivtv.c | 10 | ||||
-rw-r--r-- | libao2/ao_jack.c | 2 | ||||
-rw-r--r-- | libao2/ao_mpegpes.c | 4 | ||||
-rw-r--r-- | libao2/ao_nas.c | 12 | ||||
-rw-r--r-- | libao2/ao_null.c | 6 | ||||
-rw-r--r-- | libao2/ao_openal.c | 2 | ||||
-rw-r--r-- | libao2/ao_oss.c | 18 | ||||
-rw-r--r-- | libao2/ao_pcm.c | 16 | ||||
-rw-r--r-- | libao2/ao_sdl.c | 22 | ||||
-rw-r--r-- | libao2/ao_sgi.c | 62 | ||||
-rw-r--r-- | libao2/ao_sun.c | 24 | ||||
-rw-r--r-- | libao2/ao_v4l2.c | 10 | ||||
-rw-r--r-- | libao2/ao_win32.c | 2 | ||||
-rw-r--r-- | libao2/audio_out.h | 4 |
20 files changed, 196 insertions, 196 deletions
diff --git a/libao2/ao_alsa.c b/libao2/ao_alsa.c index 032d1d132a..5e848446f2 100644 --- a/libao2/ao_alsa.c +++ b/libao2/ao_alsa.c @@ -57,7 +57,7 @@ #include "audio_out_internal.h" #include "libaf/af_format.h" -static const ao_info_t info = +static const ao_info_t info = { "ALSA-0.9.x-1.x audio output", "alsa", @@ -73,7 +73,7 @@ static snd_pcm_hw_params_t *alsa_hwparams; static snd_pcm_sw_params_t *alsa_swparams; /* 16 sets buffersize to 16 * chunksize is as default 1024 - * which seems to be good avarge for most situations + * which seems to be good avarge for most situations * so buffersize is 16384 frames by default */ static int alsa_fragcount = 16; static snd_pcm_uframes_t chunk_size = 1024; @@ -156,7 +156,7 @@ static int control(int cmd, void *arg) //allocate simple id snd_mixer_selem_id_alloca(&sid); - + //sets simple-mixer index and name snd_mixer_selem_id_set_index(sid, mix_index); snd_mixer_selem_id_set_name(sid, mix_name); @@ -172,7 +172,7 @@ static int control(int cmd, void *arg) } if ((err = snd_mixer_attach(handle, card)) < 0) { - mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_MixerAttachError, + mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_MixerAttachError, card, snd_strerror(err)); snd_mixer_close(handle); return CONTROL_ERROR; @@ -207,7 +207,7 @@ static int control(int cmd, void *arg) //setting channels if ((err = snd_mixer_selem_set_playback_volume(elem, SND_MIXER_SCHN_FRONT_LEFT, set_vol)) < 0) { - mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_ErrorSettingLeftChannel, + mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_ErrorSettingLeftChannel, snd_strerror(err)); return CONTROL_ERROR; } @@ -216,11 +216,11 @@ static int control(int cmd, void *arg) set_vol = vol->right / f_multi + pmin + 0.5; if ((err = snd_mixer_selem_set_playback_volume(elem, SND_MIXER_SCHN_FRONT_RIGHT, set_vol)) < 0) { - mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_ErrorSettingRightChannel, + mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_ErrorSettingRightChannel, snd_strerror(err)); return CONTROL_ERROR; } - mp_msg(MSGT_AO,MSGL_DBG2,"right=%li, pmin=%li, pmax=%li, mult=%f\n", + mp_msg(MSGT_AO,MSGL_DBG2,"right=%li, pmin=%li, pmax=%li, mult=%f\n", set_vol, pmin, pmax, f_multi); if (snd_mixer_selem_has_playback_switch(elem)) { @@ -245,7 +245,7 @@ static int control(int cmd, void *arg) snd_mixer_close(handle); return CONTROL_OK; } - + } //end switch return CONTROL_UNKNOWN; } @@ -349,7 +349,7 @@ static int init(int rate_hz, int channels, int format, int flags) #endif snd_lib_error_set_handler(alsa_error_handler); - + ao_data.samplerate = rate_hz; ao_data.format = format; ao_data.channels = channels; @@ -409,7 +409,7 @@ static int init(int rate_hz, int channels, int format, int flags) alsa_format = SND_PCM_FORMAT_MPEG; //? default should be -1 break; } - + //subdevice parsing // set defaults block = 1; @@ -537,11 +537,11 @@ static int init(int rate_hz, int channels, int format, int flags) snd_strerror(err)); return 0; } - + err = snd_pcm_hw_params_set_access(alsa_handler, alsa_hwparams, SND_PCM_ACCESS_RW_INTERLEAVED); if (err < 0) { - mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_UnableToSetAccessType, + mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_UnableToSetAccessType, snd_strerror(err)); return 0; } @@ -585,8 +585,8 @@ static int init(int rate_hz, int channels, int format, int flags) } #endif - if ((err = snd_pcm_hw_params_set_rate_near(alsa_handler, alsa_hwparams, - &ao_data.samplerate, NULL)) < 0) + if ((err = snd_pcm_hw_params_set_rate_near(alsa_handler, alsa_hwparams, + &ao_data.samplerate, NULL)) < 0) { mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_UnableToSetSamplerate2, snd_strerror(err)); @@ -602,7 +602,7 @@ static int init(int rate_hz, int channels, int format, int flags) int alsa_buffer_time = 500000; /* original 60 */ int alsa_period_time; alsa_period_time = alsa_buffer_time/4; - if ((err = snd_pcm_hw_params_set_buffer_time_near(alsa_handler, alsa_hwparams, + if ((err = snd_pcm_hw_params_set_buffer_time_near(alsa_handler, alsa_hwparams, &alsa_buffer_time, NULL)) < 0) { mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_UnableToSetBufferTimeNear, @@ -611,7 +611,7 @@ static int init(int rate_hz, int channels, int format, int flags) } else alsa_buffer_time = err; - if ((err = snd_pcm_hw_params_set_period_time_near(alsa_handler, alsa_hwparams, + if ((err = snd_pcm_hw_params_set_period_time_near(alsa_handler, alsa_hwparams, &alsa_period_time, NULL)) < 0) /* original: alsa_buffer_time/ao_data.bps */ { @@ -621,13 +621,13 @@ static int init(int rate_hz, int channels, int format, int flags) } mp_msg(MSGT_AO,MSGL_INFO,MSGTR_AO_ALSA_BufferTimePeriodTime, alsa_buffer_time, err); - } + } #endif//end SET_BUFFERTIME #ifdef SET_CHUNKSIZE { //set chunksize - if ((err = snd_pcm_hw_params_set_period_size_near(alsa_handler, alsa_hwparams, + if ((err = snd_pcm_hw_params_set_period_size_near(alsa_handler, alsa_hwparams, &chunk_size, NULL)) < 0) { mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_UnableToSetPeriodSize, @@ -639,7 +639,7 @@ static int init(int rate_hz, int channels, int format, int flags) } if ((err = snd_pcm_hw_params_set_periods_near(alsa_handler, alsa_hwparams, &alsa_fragcount, NULL)) < 0) { - mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_UnableToSetPeriods, + mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_UnableToSetPeriods, snd_strerror(err)); return 0; } @@ -870,15 +870,15 @@ static int get_space(void) { snd_pcm_status_t *status; int ret; - + snd_pcm_status_alloca(&status); - + if ((ret = snd_pcm_status(alsa_handler, status)) < 0) { mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_CannotGetPcmStatus, snd_strerror(ret)); return 0; } - + ret = snd_pcm_status_get_avail(status) * bytes_per_sample; if (ret > ao_data.buffersize) // Buffer underrun? ret = ao_data.buffersize; @@ -890,10 +890,10 @@ static float get_delay(void) { if (alsa_handler) { snd_pcm_sframes_t delay; - + if (snd_pcm_delay(alsa_handler, &delay) < 0) return 0; - + if (delay < 0) { /* underrun - move the application pointer forward to catch up */ #if SND_LIB_VERSION >= 0x000901 /* snd_pcm_forward() exists since 0.9.0rc8 */ diff --git a/libao2/ao_alsa5.c b/libao2/ao_alsa5.c index 007a5f1b4f..feb2919f1d 100644 --- a/libao2/ao_alsa5.c +++ b/libao2/ao_alsa5.c @@ -32,7 +32,7 @@ #include "mp_msg.h" #include "help_mp.h" -static const ao_info_t info = +static const ao_info_t info = { "ALSA-0.5.x audio output", "alsa5", @@ -117,7 +117,7 @@ static int init(int rate_hz, int channels, int format, int flags) alsa_format.format = SND_PCM_SFMT_MPEG; break; } - + switch(alsa_format.format) { case SND_PCM_SFMT_S16_LE: @@ -230,7 +230,7 @@ static int init(int rate_hz, int channels, int format, int flags) setup.format = alsa_format; setup.buf.stream.queue_size = ao_data.buffersize; setup.msbits_per_sample = ao_data.bps; - + if ((err = snd_pcm_channel_setup(alsa_handler, &setup)) < 0) { mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ALSA5_CantSetChan, snd_strerror(err)); @@ -333,10 +333,10 @@ static void audio_resume(void) static int play(void* data, int len, int flags) { int got_len; - + if (!len) return 0; - + if ((got_len = snd_pcm_write(alsa_handler, data, len)) < 0) { if (got_len == -EPIPE) /* underrun? */ @@ -365,7 +365,7 @@ static int play(void* data, int len, int flags) static int get_space(void) { snd_pcm_channel_status_t ch_stat; - + ch_stat.channel = SND_PCM_CHANNEL_PLAYBACK; if (snd_pcm_channel_status(alsa_handler, &ch_stat) < 0) @@ -378,9 +378,9 @@ static int get_space(void) static float get_delay(void) { snd_pcm_channel_status_t ch_stat; - + ch_stat.channel = SND_PCM_CHANNEL_PLAYBACK; - + if (snd_pcm_channel_status(alsa_handler, &ch_stat) < 0) return (float)ao_data.buffersize/(float)ao_data.bps; /* error occurred */ else diff --git a/libao2/ao_coreaudio.c b/libao2/ao_coreaudio.c index 3ef6d3367f..76cb9174be 100644 --- a/libao2/ao_coreaudio.c +++ b/libao2/ao_coreaudio.c @@ -174,7 +174,7 @@ Float32 vol; ao->b_muted = 0; return CONTROL_TRUE; } - + vol=(control_vol->left+control_vol->right)*4.0/200.0; err = AudioUnitSetParameter(ao->theOutputUnit, kHALOutputParam_Volume, kAudioUnitScope_Global, 0, vol, 0); if(err==0) { @@ -189,7 +189,7 @@ Float32 vol; default: return CONTROL_FALSE; } - + } @@ -237,8 +237,8 @@ static OSStatus DeviceListener( AudioDeviceID inDevice, static int init(int rate,int channels,int format,int flags) { AudioStreamBasicDescription inDesc; -ComponentDescription desc; -Component comp; +ComponentDescription desc; +Component comp; AURenderCallbackStruct renderCallback; OSStatus err; UInt32 size, maxFrames, i_param_size; @@ -396,20 +396,20 @@ int b_alive; desc.componentManufacturer = kAudioUnitManufacturer_Apple; desc.componentFlags = 0; desc.componentFlagsMask = 0; - + comp = FindNextComponent(NULL, &desc); //Finds an component that meets the desc spec's if (comp == NULL) { ao_msg(MSGT_AO, MSGL_WARN, "Unable to find Output Unit component\n"); goto err_out; } - + err = OpenAComponent(comp, &(ao->theOutputUnit)); //gains access to the services provided by the component if (err) { ao_msg(MSGT_AO, MSGL_WARN, "Unable to open Output Unit component: [%4.4s]\n", (char *)&err); goto err_out; } - // Initialize AudioUnit + // Initialize AudioUnit err = AudioUnitInitialize(ao->theOutputUnit); if (err) { ao_msg(MSGT_AO, MSGL_WARN, "Unable to initialize Output Unit component: [%4.4s]\n", (char *)&err); @@ -426,7 +426,7 @@ int b_alive; size = sizeof(UInt32); err = AudioUnitGetProperty(ao->theOutputUnit, kAudioDevicePropertyBufferSize, kAudioUnitScope_Input, 0, &maxFrames, &size); - + if (err) { ao_msg(MSGT_AO,MSGL_WARN, "AudioUnitGetProperty returned [%4.4s] when getting kAudioDevicePropertyBufferSize\n", (char *)&err); @@ -434,7 +434,7 @@ int b_alive; } ao->chunk_size = maxFrames;//*inDesc.mBytesPerFrame; - + ao_data.samplerate = inDesc.mSampleRate; ao_data.channels = inDesc.mChannelsPerFrame; ao_data.bps = ao_data.samplerate * inDesc.mBytesPerFrame; @@ -444,7 +444,7 @@ int b_alive; ao->num_chunks = (ao_data.bps+ao->chunk_size-1)/ao->chunk_size; ao->buffer_len = ao->num_chunks * ao->chunk_size; ao->buffer = av_fifo_alloc(ao->buffer_len); - + ao_msg(MSGT_AO,MSGL_V, "using %5d chunks of %d bytes (buffer len %d bytes)\n", (int)ao->num_chunks, (int)ao->chunk_size, (int)ao->buffer_len); renderCallback.inputProc = theRenderProc; @@ -456,7 +456,7 @@ int b_alive; } reset(); - + return CONTROL_OK; err_out2: @@ -467,7 +467,7 @@ err_out: av_fifo_free(ao->buffer); free(ao); ao = NULL; - return CONTROL_FALSE; + return CONTROL_FALSE; } /***************************************************************************** @@ -734,7 +734,7 @@ err_out: av_fifo_free(ao->buffer); free(ao); ao = NULL; - return CONTROL_FALSE; + return CONTROL_FALSE; } /***************************************************************************** @@ -943,7 +943,7 @@ static OSStatus RenderCallbackSPDIF( AudioDeviceID inDevice, static int play(void* output_samples,int num_bytes,int flags) -{ +{ int wrote, b_digital; // Check whether we need to reset the digital output stream. diff --git a/libao2/ao_dsound.c b/libao2/ao_dsound.c index 729084b145..4197c30e27 100644 --- a/libao2/ao_dsound.c +++ b/libao2/ao_dsound.c @@ -113,17 +113,17 @@ static const int channel_mask[] = { }; static HINSTANCE hdsound_dll = NULL; ///handle to the dll -static LPDIRECTSOUND hds = NULL; ///direct sound object +static LPDIRECTSOUND hds = NULL; ///direct sound object static LPDIRECTSOUNDBUFFER hdspribuf = NULL; ///primary direct sound buffer static LPDIRECTSOUNDBUFFER hdsbuf = NULL; ///secondary direct sound buffer (stream buffer) -static int buffer_size = 0; ///size in bytes of the direct sound buffer +static int buffer_size = 0; ///size in bytes of the direct sound buffer static int write_offset = 0; ///offset of the write cursor in the direct sound buffer static int min_free_space = 0; ///if the free space is below this value get_space() will return 0 ///there will always be at least this amout of free space to prevent ///get_space() from returning wrong values when buffer is 100% full. ///will be replaced with nBlockAlign in init() static int device_num = 0; ///wanted device number -static GUID device; ///guid of the device +static GUID device; ///guid of the device /***************************************************************************************/ @@ -221,17 +221,17 @@ static int InitDirectSound(void) // initialize directsound HRESULT (WINAPI *OurDirectSoundCreate)(LPGUID, LPDIRECTSOUND *, LPUNKNOWN); - HRESULT (WINAPI *OurDirectSoundEnumerate)(LPDSENUMCALLBACKA, LPVOID); + HRESULT (WINAPI *OurDirectSoundEnumerate)(LPDSENUMCALLBACKA, LPVOID); int device_index=0; opt_t subopts[] = { {"device", OPT_ARG_INT, &device_num,NULL}, {NULL} - }; + }; if (subopt_parse(ao_subdevice, subopts) != 0) { print_help(); return 0; } - + hdsound_dll = LoadLibrary("DSOUND.DLL"); if (hdsound_dll == NULL) { mp_msg(MSGT_AO, MSGL_ERR, "ao_dsound: cannot load DSOUND.DLL\n"); @@ -245,7 +245,7 @@ static int InitDirectSound(void) FreeLibrary(hdsound_dll); return 0; } - + // Enumerate all directsound devices mp_msg(MSGT_AO, MSGL_V,"ao_dsound: Output Devices:\n"); OurDirectSoundEnumerate(DirectSoundEnum,&device_index); @@ -310,22 +310,22 @@ static void DestroyBuffer(void) static int write_buffer(unsigned char *data, int len) { HRESULT res; - LPVOID lpvPtr1; - DWORD dwBytes1; - LPVOID lpvPtr2; - DWORD dwBytes2; - + LPVOID lpvPtr1; + DWORD dwBytes1; + LPVOID lpvPtr2; + DWORD dwBytes2; + // Lock the buffer - res = IDirectSoundBuffer_Lock(hdsbuf,write_offset, len, &lpvPtr1, &dwBytes1, &lpvPtr2, &dwBytes2, 0); - // If the buffer was lost, restore and retry lock. - if (DSERR_BUFFERLOST == res) - { + res = IDirectSoundBuffer_Lock(hdsbuf,write_offset, len, &lpvPtr1, &dwBytes1, &lpvPtr2, &dwBytes2, 0); + // If the buffer was lost, restore and retry lock. + if (DSERR_BUFFERLOST == res) + { IDirectSoundBuffer_Restore(hdsbuf); res = IDirectSoundBuffer_Lock(hdsbuf,write_offset, len, &lpvPtr1, &dwBytes1, &lpvPtr2, &dwBytes2, 0); } - - - if (SUCCEEDED(res)) + + + if (SUCCEEDED(res)) { if( (ao_data.channels == 6) && (ao_data.format!=AF_FORMAT_AC3) ) { // reorder channels while writing to pointers. @@ -354,27 +354,27 @@ static int write_buffer(unsigned char *data, int len) write_offset+=dwBytes1+dwBytes2; if(write_offset>=buffer_size)write_offset=dwBytes2; } else { - // Write to pointers without reordering. + // Write to pointers without reordering. fast_memcpy(lpvPtr1,data,dwBytes1); if (NULL != lpvPtr2 )fast_memcpy(lpvPtr2,data+dwBytes1,dwBytes2); write_offset+=dwBytes1+dwBytes2; if(write_offset>=buffer_size)write_offset=dwBytes2; } - - // Release the data back to DirectSound. + + // Release the data back to DirectSound. res = IDirectSoundBuffer_Unlock(hdsbuf,lpvPtr1,dwBytes1,lpvPtr2,dwBytes2); - if (SUCCEEDED(res)) - { - // Success. + if (SUCCEEDED(res)) + { + // Success. DWORD status; IDirectSoundBuffer_GetStatus(hdsbuf, &status); if (!(status & DSBSTATUS_PLAYING)){ res = IDirectSoundBuffer_Play(hdsbuf, 0, 0, DSBPLAY_LOOPING); } - return dwBytes1+dwBytes2; - } - } - // Lock, Unlock, or Restore failed. + return dwBytes1+dwBytes2; + } + } + // Lock, Unlock, or Restore failed. return 0; } @@ -408,7 +408,7 @@ static int control(int cmd, void *arg) return -1; } -/** +/** \brief setup sound device \param rate samplerate \param channels number of channels @@ -436,7 +436,7 @@ static int init(int rate, int channels, int format, int flags) default: mp_msg(MSGT_AO, MSGL_V,"ao_dsound: format %s not supported defaulting to Signed 16-bit Little-Endian\n",af_fmt2str_short(format)); format=AF_FORMAT_S16_LE; - } + } //fill global ao_data ao_data.channels = channels; ao_data.samplerate = rate; @@ -493,7 +493,7 @@ static int init(int rate, int channels, int format, int flags) ao_data.outburst = wformat.Format.nBlockAlign * 512; // create primary buffer and set its format - + res = IDirectSound_CreateSoundBuffer( hds, &dsbpridesc, &hdspribuf, NULL ); if ( res != DS_OK ) { UninitDirectSound(); @@ -553,7 +553,7 @@ static void audio_resume(void) IDirectSoundBuffer_Play(hdsbuf, 0, 0, DSBPLAY_LOOPING); } -/** +/** \brief close audio device \param immed stop playback immediately */ @@ -579,7 +579,7 @@ static int get_space(void) int space; DWORD play_offset; IDirectSoundBuffer_GetCurrentPosition(hdsbuf,&play_offset,NULL); - space=buffer_size-(write_offset-play_offset); + space=buffer_size-(write_offset-play_offset); // | | <-- const --> | | | // buffer start play_cursor write_cursor write_offset buffer end // play_cursor is the actual postion of the play cursor @@ -601,10 +601,10 @@ static int play(void* data, int len, int flags) { DWORD play_offset; int space; - + // make sure we have enough space to write data IDirectSoundBuffer_GetCurrentPosition(hdsbuf,&play_offset,NULL); - space=buffer_size-(write_offset-play_offset); + space=buffer_size-(write_offset-play_offset); if(space > buffer_size)space -= buffer_size; // write_offset < play_offset if(space < len) len = space; @@ -622,7 +622,7 @@ static float get_delay(void) DWORD play_offset; int space; IDirectSoundBuffer_GetCurrentPosition(hdsbuf,&play_offset,NULL); - space=play_offset-write_offset; + space=play_offset-write_offset; if(space <= 0)space += buffer_size; return (float)(buffer_size - space) / (float)ao_data.bps; } diff --git a/libao2/ao_dxr2.c b/libao2/ao_dxr2.c index 7f9594fb4d..136efd1a9e 100644 --- a/libao2/ao_dxr2.c +++ b/libao2/ao_dxr2.c @@ -67,7 +67,7 @@ static int control(int cmd,void *arg){ ao_control_vol_t* vol = (ao_control_vol_t*)arg; // We need this trick because the volume stepping is often too small diff = ((vol->left+vol->right) / 2 - (volume*19.0/100.0)) * 19.0 / 100.0; - v.arg = volume + (diff > 0 ? ceil(diff) : floor(diff)); + v.arg = volume + (diff > 0 ? ceil(diff) : floor(diff)); if(v.arg > 19) v.arg = 19; if(v.arg < 0) v.arg = 0; if(v.arg != volume) { @@ -95,7 +95,7 @@ static int init(int rate,int channels,int format,int flags){ return 0; last_freq_id = -1; - + ao_data.outburst=2048; ao_data.samplerate=rate; ao_data.channels=channels; @@ -178,11 +178,11 @@ static int get_space(void){ static void dxr2_send_lpcm_packet(unsigned char* data,int len,int id,unsigned int timestamp,int freq_id) { int write_dxr2(const unsigned char *data, int len); - + if(dxr2_fd < 0) { mp_msg(MSGT_AO,MSGL_ERR,"DXR2 fd is not valid\n"); return; - } + } if(last_freq_id != freq_id) { ioctl(dxr2_fd, DXR2_IOC_SET_AUDIO_SAMPLE_FREQUENCY, &freq_id); diff --git a/libao2/ao_esd.c b/libao2/ao_esd.c index d54f843c65..593d5a934a 100644 --- a/libao2/ao_esd.c +++ b/libao2/ao_esd.c @@ -122,7 +122,7 @@ static int control(int cmd, void *arg) vol_cache_time = now; } esd_free_all_info(esd_i); - + return CONTROL_OK; case AOCONTROL_SET_VOLUME: @@ -236,19 +236,19 @@ static int init(int rate_hz, int channels, int format, int flags) #ifdef CONFIG_ESD_LATENCY esd_latency = esd_get_latency(esd_fd); #else - esd_latency = ((channels == 1 ? 2 : 1) * ESD_DEFAULT_RATE * + esd_latency = ((channels == 1 ? 2 : 1) * ESD_DEFAULT_RATE * (ESD_BUF_SIZE + 64 * (4.0f / bytes_per_sample)) - ) / rate_hz; - esd_latency += ESD_BUF_SIZE * 2; + ) / rate_hz; + esd_latency += ESD_BUF_SIZE * 2; #endif if(esd_latency > 0) { lag_serv = (esd_latency * 4.0f) / (bytes_per_sample * rate_hz); lag_seconds = lag_net + lag_serv; audio_delay += lag_seconds; - mp_msg(MSGT_AO, MSGL_INFO,MSGTR_AO_ESD_LatencyInfo, + mp_msg(MSGT_AO, MSGL_INFO,MSGTR_AO_ESD_LatencyInfo, lag_serv, lag_net, lag_seconds); } - + esd_play_fd = esd_play_stream_fallback(esd_fmt, rate_hz, server, ESD_CLIENT_NAME); if (esd_play_fd < 0) { @@ -333,7 +333,7 @@ static int play(void* data, int len, int flags) */ n = write(esd_play_fd, (char*)data + offs, ESD_BUF_SIZE); if ( n < 0 ) { - if ( errno != EAGAIN ) + if ( errno != EAGAIN ) dprintf("esd play: write failed: %s\n", strerror(errno)); break; } else if ( n != ESD_BUF_SIZE ) { @@ -343,13 +343,13 @@ static int play(void* data, int len, int flags) nwritten += n; } #endif - + if (nwritten > 0) { if (!esd_play_start.tv_sec) gettimeofday(&esd_play_start, NULL); nsamples = nwritten / esd_bytes_per_sample; esd_samples_written += nsamples; - + dprintf("esd play: %d %lu\n", nsamples, esd_samples_written); } else { dprintf("esd play: blocked / %lu\n", esd_samples_written); @@ -395,7 +395,7 @@ static void reset(void) { #ifdef __svr4__ /* throw away data buffered in the esd connection */ - if (ioctl(esd_play_fd, I_FLUSH, FLUSHW)) + if (ioctl(esd_play_fd, I_FLUSH, FLUSHW)) perror("I_FLUSH"); #endif } @@ -411,7 +411,7 @@ static int get_space(void) float current_delay; int space; - /* + /* * Don't buffer too much data in the esd daemon. * * If we send too much, esd will block in write()s to the sound @@ -461,7 +461,7 @@ static float get_delay(void) gettimeofday(&now, NULL); play_time = now.tv_sec - esd_play_start.tv_sec; play_time += (now.tv_usec - esd_play_start.tv_usec) / 1000000.; - + /* dprintf("esd delay: %f %f\n", play_time, buffered_samples_time); */ if (play_time > buffered_samples_time) { diff --git a/libao2/ao_ivtv.c b/libao2/ao_ivtv.c index c2b367a414..b09e5308bb 100644 --- a/libao2/ao_ivtv.c +++ b/libao2/ao_ivtv.c @@ -41,7 +41,7 @@ static int freq = 0; -static const ao_info_t info = +static const ao_info_t info = { "IVTV MPEG Audio Decoder output", "ivtv", @@ -73,7 +73,7 @@ init (int rate, int channels, int format, int flags) "AO: [ivtv] can only handle MPEG audio streams.\n"); return 0; } - + ao_data.outburst = 2048; ao_data.samplerate = rate; ao_data.channels = channels; @@ -132,11 +132,11 @@ get_space (void) x = (float) (vo_pts - ao_data.pts) / 90000.0; if (x <= 0) return 0; - + y = freq * 4 * x; y /= ao_data.outburst; y *= ao_data.outburst; - + if (y > 32000) y = 32000; @@ -148,7 +148,7 @@ static int play (void *data, int len, int flags) { int ivtv_write (unsigned char *data, int len); - + if (ao_data.format != AF_FORMAT_MPEG2) return 0; diff --git a/libao2/ao_jack.c b/libao2/ao_jack.c index 8ee5550602..e92786c28d 100644 --- a/libao2/ao_jack.c +++ b/libao2/ao_jack.c @@ -40,7 +40,7 @@ #include <jack/jack.h> -static const ao_info_t info = +static const ao_info_t info = { "JACK audio output", "jack", diff --git a/libao2/ao_mpegpes.c b/libao2/ao_mpegpes.c index 3746d24b4e..64cb05fa03 100644 --- a/libao2/ao_mpegpes.c +++ b/libao2/ao_mpegpes.c @@ -63,7 +63,7 @@ int vo_mpegpes_fd2 = -1; #include <errno.h> -static const ao_info_t info = +static const ao_info_t info = { #ifdef CONFIG_DVB "DVB audio output", @@ -194,7 +194,7 @@ static int preinit(const char *arg) #ifdef CONFIG_DVB if(!ao_file) return init_device(card); -#else +#else if(!ao_file) return vo_mpegpes_fd; //video fd #endif diff --git a/libao2/ao_nas.c b/libao2/ao_nas.c index e5e675be3f..fb49c5e60e 100644 --- a/libao2/ao_nas.c +++ b/libao2/ao_nas.c @@ -119,7 +119,7 @@ static const char* nas_state(unsigned int state) { return nas_states[state]; } -static const ao_info_t info = +static const ao_info_t info = { "NAS audio output", "nas", @@ -201,7 +201,7 @@ static int nas_readBuffer(struct ao_nas_data *nas_data, unsigned int num) * Now write the new buffer to the network. */ AuWriteElement(nas_data->aud, nas_data->flow, 0, num, nas_data->server_buffer, AuFalse, &as); - if (as != AuSuccess) + if (as != AuSuccess) nas_print_error(nas_data->aud, "nas_readBuffer(): AuWriteElement", as); return num; @@ -229,7 +229,7 @@ static int nas_empty_event_queue(struct ao_nas_data *nas_data) { AuEvent ev; int result = 0; - + while (AuScanForTypedEvent(nas_data->aud, AuEventsQueuedAfterFlush, AuTrue, AuEventTypeElementNotify, &ev)) { AuDispatchEvent(nas_data->aud, &ev); @@ -462,7 +462,7 @@ static int init(int rate,int channels,int format,int flags) mp_msg(MSGT_AO, MSGL_V, "ao_nas: init(): Using audioserver %s\n", server); nas_data->aud = AuOpenServer(server, 0, NULL, 0, NULL, NULL); - if (!nas_data->aud) { + if (!nas_data->aud) { mp_msg(MSGT_AO, MSGL_ERR, "ao_nas: init(): Can't open nas audio server -> nosound\n"); return 0; } @@ -571,7 +571,7 @@ static void audio_resume(void) static int get_space(void) { int result; - + mp_msg(MSGT_AO, MSGL_DBG3, "ao_nas: get_space()\n"); pthread_mutex_lock(&nas_data->buffer_mutex); @@ -631,7 +631,7 @@ static int play(void* data,int len,int flags) static float get_delay(void) { float result; - + mp_msg(MSGT_AO, MSGL_DBG3, "ao_nas: get_delay()\n"); pthread_mutex_lock(&nas_data->buffer_mutex); diff --git a/libao2/ao_null.c b/libao2/ao_null.c index 20b715fb96..17b3bc7e4e 100644 --- a/libao2/ao_null.c +++ b/libao2/ao_null.c @@ -27,7 +27,7 @@ #include "audio_out.h" #include "audio_out_internal.h" -static const ao_info_t info = +static const ao_info_t info = { "Null audio output", "null", @@ -41,14 +41,14 @@ struct timeval last_tv; int buffer; static void drain(void){ - + struct timeval now_tv; int temp, temp2; gettimeofday(&now_tv, 0); temp = now_tv.tv_sec - last_tv.tv_sec; temp *= ao_data.bps; - + temp2 = now_tv.tv_usec - last_tv.tv_usec; temp2 /= 1000; temp2 *= ao_data.bps; diff --git a/libao2/ao_openal.c b/libao2/ao_openal.c index c80c49b27a..829eb7ae58 100644 --- a/libao2/ao_openal.c +++ b/libao2/ao_openal.c @@ -42,7 +42,7 @@ #include "osdep/timer.h" #include "subopt-helper.h" -static const ao_info_t info = +static const ao_info_t info = { "OpenAL audio output", "openal", diff --git a/libao2/ao_oss.c b/libao2/ao_oss.c index e4688d1723..4666c400e9 100644 --- a/libao2/ao_oss.c +++ b/libao2/ao_oss.c @@ -48,7 +48,7 @@ #include "audio_out.h" #include "audio_out_internal.h" -static const ao_info_t info = +static const ao_info_t info = { "OSS/ioctl audio output", "oss", @@ -199,7 +199,7 @@ static int control(int cmd,void *arg){ if(ao_data.format == AF_FORMAT_AC3) return CONTROL_TRUE; - + if ((fd = open(oss_mixer_device, O_RDONLY)) > 0) { ioctl(fd, SOUND_MIXER_READ_DEVMASK, &devs); @@ -260,17 +260,17 @@ static int init(int rate,int channels,int format,int flags){ oss_mixer_device=mdev; else oss_mixer_device=PATH_DEV_MIXER; - + if(mchan){ int fd, devs, i; - + if ((fd = open(oss_mixer_device, O_RDONLY)) == -1){ mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_OSS_CantOpenMixer, oss_mixer_device, strerror(errno)); }else{ ioctl(fd, SOUND_MIXE |