# HG changeset patch # User nenolod # Date 1159678410 25200 # Node ID 023b3e4147c0ad9409cd0cdcca9019ca8a483473 # Parent 4a352dd2a91c63997f539f80e3de383941a42c9b [svn] - implement osx_format_is_neutral(), returns TRUE if endianness of the format is neutral, otherwise FALSE if conversion is needed. - only select a conversion strategy if endianness is not neutral diff -r 4a352dd2a91c -r 023b3e4147c0 ChangeLog --- a/ChangeLog Sat Sep 30 21:40:46 2006 -0700 +++ b/ChangeLog Sat Sep 30 21:53:30 2006 -0700 @@ -1,3 +1,11 @@ +2006-10-01 04:40:46 +0000 William Pitcock + revision [124] + - be a little smarter about this + + trunk/src/CoreAudio/audio.c | 38 ++++++++++++++++++++++++++++++++++++-- + 1 file changed, 36 insertions(+), 2 deletions(-) + + 2006-10-01 04:33:57 +0000 William Pitcock revision [122] - conversion tables diff -r 4a352dd2a91c -r 023b3e4147c0 src/CoreAudio/audio.c --- a/src/CoreAudio/audio.c Sat Sep 30 21:40:46 2006 -0700 +++ b/src/CoreAudio/audio.c Sat Sep 30 21:53:30 2006 -0700 @@ -93,6 +93,25 @@ return bitrate; } +static gboolean osx_format_is_neutral(AFormat fmt) +{ + gboolean ret = FALSE; + + switch (fmt) + { + case FMT_U16_NE: + case FMT_S16_NE: + case FMT_U8: + case FMT_S8: + ret = TRUE; + break; + default: + break; + } + + return ret; +} + static int osx_get_format(AFormat fmt) { int format = 0; @@ -118,7 +137,7 @@ break; } - printf("in: %d, out: %d\n", fmt, format); + printf("osx_get_format: in: %d, out: %d\n", fmt, format); return format; } @@ -176,7 +195,7 @@ break; } - printf("in: %d, out: %d\n", fmt, format); + printf("osx_conv_get_format: in: %d, out: %d\n", fmt, format); return format; } @@ -286,11 +305,6 @@ osx_set_audio_params(); - if (fmt != osx_get_conv_format(fmt)) - osx_convert_func = osx_get_convert_func(fmt, osx_get_conv_format(fmt)); - else - osx_convert_func = NULL; - output.bps = osx_calc_bitrate(output.format.osx, output.frequency,output.channels); } @@ -604,6 +618,11 @@ //printf("format is PCM\n"); + if (osx_format_is_neutral(fmt) == FALSE) + osx_convert_func = osx_get_convert_func(fmt, osx_get_conv_format(fmt)); + else + osx_convert_func = NULL; + input.format.xmms = fmt; input.frequency = rate; input.channels = nch;