changeset 63:023b3e4147c0 trunk

[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
author nenolod
date Sat, 30 Sep 2006 21:53:30 -0700
parents 4a352dd2a91c
children 755a71ca3c92
files ChangeLog src/CoreAudio/audio.c
diffstat 2 files changed, 34 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- 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 <nenolod@nenolod.net>
+  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 <nenolod@nenolod.net>
   revision [122]
   - conversion tables
--- 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;