From e6819bc591fc5049cdcc1152f68ca8053b115486 Mon Sep 17 00:00:00 2001 From: rfelker Date: Thu, 24 Feb 2005 16:48:18 +0000 Subject: 100l for me, lrintf is better. now fixed so it should be prototyped, and should work even if there is no prototype git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@14792 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libaf/af_format.c | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) (limited to 'libaf/af_format.c') diff --git a/libaf/af_format.c b/libaf/af_format.c index 2777fdbc42..2969455ac1 100644 --- a/libaf/af_format.c +++ b/libaf/af_format.c @@ -3,6 +3,9 @@ AFMT_U16_LE, AFMT_U16_BE, AFMT_S32_LE and AFMT_S32_BE. */ +// Must be defined before any libc headers are included! +#define _ISOC9X_SOURCE + #include #include #include @@ -14,6 +17,14 @@ #include "../bswap.h" #include "../libvo/fastmemcpy.h" +// Integer to float conversion through lrintf() +#ifdef HAVE_LRINTF +#include +long int lrintf(float); +#else +#define lrintf(x) ((int)(x)) +#endif + /* Functions used by play to convert the input audio to the correct format */ @@ -31,9 +42,9 @@ static void us2si(void* in, void* out, int len, int bps); // Change the number of bits per sample static void change_bps(void* in, void* out, int len, int inbps, int outbps); // From float to int signed -static void float2int(void* in, void* out, int len, int bps); +static void float2int(float* in, void* out, int len, int bps); // From signed int to float -static void int2float(void* in, void* out, int len, int bps); +static void int2float(void* in, float* out, int len, int bps); static af_data_t* play(struct af_instance_s* af, af_data_t* data); static af_data_t* play_swapendian(struct af_instance_s* af, af_data_t* data); @@ -488,48 +499,48 @@ static void change_bps(void* in, void* out, int len, int inbps, int outbps) } } -static void float2int(void* in, void* out, int len, int bps) +static void float2int(float* in, void* out, int len, int bps) { register int i; switch(bps){ case(1): for(i=0;i