[MPlayer-cvslog] CVS: main/libao2 ao_macosx.c,1.14,1.15

Nicolas Plourde CVS syncmail at mplayerhq.hu
Mon May 16 02:16:46 CEST 2005


CVS change done by Nicolas Plourde CVS

Update of /cvsroot/mplayer/main/libao2
In directory mail:/var2/tmp/cvs-serv8579/libao2

Modified Files:
	ao_macosx.c 
Log Message:
simplifies the format matching logic. Chris Roccati <roccati at pobox.com>

Index: ao_macosx.c
===================================================================
RCS file: /cvsroot/mplayer/main/libao2/ao_macosx.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- ao_macosx.c	14 May 2005 01:14:58 -0000	1.14
+++ ao_macosx.c	16 May 2005 00:16:43 -0000	1.15
@@ -176,7 +176,7 @@
 	  return CONTROL_FALSE;
 	case AOCONTROL_GET_VOLUME:
 	    propertySize=sizeof(stereoChannels);
-	    status = AudioDeviceGetProperty(ao->outputDeviceID, NULL, 0,
+	    status = AudioDeviceGetProperty(ao->outputDeviceID, 0, false,
 		kAudioDevicePropertyPreferredChannelsForStereo, &propertySize,
 		&stereoChannels);
 //	    printf("OSX: stereochannels %d ; %d \n",stereoChannels[0],stereoChannels[1]);
@@ -189,7 +189,7 @@
 	  return CONTROL_TRUE;
 	case AOCONTROL_SET_VOLUME:
 	    propertySize=sizeof(stereoChannels);
-	    status = AudioDeviceGetProperty(ao->outputDeviceID, NULL, 0,
+	    status = AudioDeviceGetProperty(ao->outputDeviceID, 0, false,
 		kAudioDevicePropertyPreferredChannelsForStereo, &propertySize,
 		&stereoChannels);
 //	    printf("OSX: stereochannels %d ; %d \n",stereoChannels[0],stereoChannels[1]);
@@ -299,28 +299,6 @@
     ao->outputStreamBasicDescription.mSampleRate=rate;
     ao->outputStreamBasicDescription.mFormatID=kAudioFormatLinearPCM;
     ao->outputStreamBasicDescription.mChannelsPerFrame=channels;
-    switch(format&AF_FORMAT_BITS_MASK){
-    case AF_FORMAT_8BIT:  ao->outputStreamBasicDescription.mBitsPerChannel=8; break;
-    case AF_FORMAT_16BIT: ao->outputStreamBasicDescription.mBitsPerChannel=16; break;
-    case AF_FORMAT_24BIT: ao->outputStreamBasicDescription.mBitsPerChannel=24; break;
-    case AF_FORMAT_32BIT: ao->outputStreamBasicDescription.mBitsPerChannel=32; break;
-    }
-    if((format&AF_FORMAT_POINT_MASK)==AF_FORMAT_F){
-	// float
-	ao->outputStreamBasicDescription.mFormatFlags=kAudioFormatFlagIsFloat|kAudioFormatFlagIsPacked;
-    } else if((format&AF_FORMAT_SIGN_MASK)==AF_FORMAT_SI){
-	// signed int
-	ao->outputStreamBasicDescription.mFormatFlags=kAudioFormatFlagIsSignedInteger|kAudioFormatFlagIsPacked;
-    } else {
-	// unsigned int
-	ao->outputStreamBasicDescription.mFormatFlags=kAudioFormatFlagIsPacked;
-    }
-    if((format&AF_FORMAT_END_MASK)==AF_FORMAT_BE)
-	ao->outputStreamBasicDescription.mFormatFlags|=kAudioFormatFlagIsBigEndian;
-
-    ao->outputStreamBasicDescription.mBytesPerPacket=
-    ao->outputStreamBasicDescription.mBytesPerFrame=channels*(ao->outputStreamBasicDescription.mBitsPerChannel/8);
-    ao->outputStreamBasicDescription.mFramesPerPacket=1;
 
     print_format("wanted: ",&ao->outputStreamBasicDescription);
 
@@ -328,31 +306,9 @@
     propertySize = sizeof(ao->outputStreamBasicDescription);
 //    status = AudioDeviceGetProperty(ao->outputDeviceID, 0, false, kAudioStreamPropertyPhysicalFormatMatch, &propertySize, &ao->outputStreamBasicDescription);
     status = AudioDeviceGetProperty(ao->outputDeviceID, 0, false, kAudioDevicePropertyStreamFormatMatch, &propertySize, &ao->outputStreamBasicDescription);
-    if (status || ao->outputStreamBasicDescription.mSampleRate!=rate
-	       || ao->outputStreamBasicDescription.mFormatID!=kAudioFormatLinearPCM) {
+    if (status) {
         ao_msg(MSGT_AO,MSGL_V, "AudioDeviceGetProperty returned 0x%X when getting kAudioDevicePropertyStreamFormatMatch\n", (int)status);
-	// failed (error, bad rate or bad type)
-	// try 2: set only rate & type, no format details (bits, channels etc)
-	propertySize = sizeof(ao->outputStreamBasicDescription);
-	memset(&ao->outputStreamBasicDescription,0,propertySize);
-	ao->outputStreamBasicDescription.mSampleRate=rate;
-	ao->outputStreamBasicDescription.mFormatID=kAudioFormatLinearPCM;
-	ao->outputStreamBasicDescription.mChannelsPerFrame=channels;
-//	status = AudioDeviceGetProperty(ao->outputDeviceID, 0, false, kAudioStreamPropertyPhysicalFormatMatch, &propertySize, &ao->outputStreamBasicDescription);
-	status = AudioDeviceGetProperty(ao->outputDeviceID, 0, false, kAudioDevicePropertyStreamFormatMatch, &propertySize, &ao->outputStreamBasicDescription);
-	if (status || ao->outputStreamBasicDescription.mFormatID!=kAudioFormatLinearPCM) {
-    	    ao_msg(MSGT_AO,MSGL_V, "AudioDeviceGetProperty returned 0x%X when getting kAudioDevicePropertyStreamFormatMatch\n", (int)status);
-	    // failed again. (error or bad type)
-	    // giving up... just read the default.
-	    propertySize = sizeof(ao->outputStreamBasicDescription);
-//	    status = AudioDeviceGetProperty(ao->outputDeviceID, 0, false, kAudioStreamPropertyPhysicalFormat, &propertySize, &ao->outputStreamBasicDescription);
-	    status = AudioDeviceGetProperty(ao->outputDeviceID, 0, false, kAudioDevicePropertyStreamFormat, &propertySize, &ao->outputStreamBasicDescription);
-	    if (status) {
-		// failed to read the default format - WTF?
-    		ao_msg(MSGT_AO,MSGL_WARN, "AudioDeviceGetProperty returned 0x%X when getting kAudioDevicePropertyStreamFormat\n", (int)status);
 		return CONTROL_FALSE;
-	    }
-	}
     }
 
 //    propertySize = sizeof(ao->outputStreamBasicDescription);




More information about the MPlayer-cvslog mailing list