r2915 - in trunk/libminisip: include/libminisip/sdp include/libminisip/sip include/libminisip/soundcard source/soundcard

erik at minisip.org erik at minisip.org
Fri Nov 17 17:33:58 CET 2006


Author: erik
Date: 2006-11-17 17:33:57 +0100 (Fri, 17 Nov 2006)
New Revision: 2915

Modified:
   trunk/libminisip/include/libminisip/sdp/SdpPacket.h
   trunk/libminisip/include/libminisip/sip/SipDialogVoip.h
   trunk/libminisip/include/libminisip/sip/SipDialogVoipClient.h
   trunk/libminisip/include/libminisip/sip/SipDialogVoipServer.h
   trunk/libminisip/include/libminisip/sip/SipSoftPhoneConfiguration.h
   trunk/libminisip/include/libminisip/soundcard/AudioMixerSimple.h
   trunk/libminisip/include/libminisip/soundcard/SoundDriver.h
   trunk/libminisip/source/soundcard/AudioMixerSimple.cxx
   trunk/libminisip/source/soundcard/SoundDriver.cxx
Log:

 libminisip: move code from .h to .cxx



Modified: trunk/libminisip/include/libminisip/sdp/SdpPacket.h
===================================================================
--- trunk/libminisip/include/libminisip/sdp/SdpPacket.h	2006-11-17 16:29:13 UTC (rev 2914)
+++ trunk/libminisip/include/libminisip/sdp/SdpPacket.h	2006-11-17 16:33:57 UTC (rev 2915)
@@ -54,8 +54,6 @@
 	public:
 		SdpPacket();
 		SdpPacket(std::string build_from);
-	//	SdpPacket(string ipAddr, int32_t local_media_port, vector<CODECInterface *> &codecs);
-	//	SdpPacket(string ipAddr, int32_t local_media_port, vector<CODECInterface *> &codecs, string key_mgmt);
 	
 		virtual std::string getMemObjectType() const {return "SdpPacket";}
 		
@@ -68,7 +66,6 @@
 
 		std::vector<MRef<SdpHeader*> > getHeaders();
 		int32_t getCodecMatch(SdpPacket &pack);
-//		int32_t getCodecMatch(vector<CODECInterface *> codecs);
 		int32_t getFirstMediaFormat();
 		bool mediaFormatAvailable(int32_t f);
 		

Modified: trunk/libminisip/include/libminisip/sip/SipDialogVoip.h
===================================================================
--- trunk/libminisip/include/libminisip/sip/SipDialogVoip.h	2006-11-17 16:29:13 UTC (rev 2914)
+++ trunk/libminisip/include/libminisip/sip/SipDialogVoip.h	2006-11-17 16:33:57 UTC (rev 2915)
@@ -59,8 +59,6 @@
 					);
 		virtual ~SipDialogVoip();
 
-		virtual void dummy()=0;
-
 		virtual std::string getMemObjectType() const {return "SipDialogVoip";}
 		
 		virtual std::string getName(){return "SipDialogVoip[callid="+dialogState.callId +"]";}

Modified: trunk/libminisip/include/libminisip/sip/SipDialogVoipClient.h
===================================================================
--- trunk/libminisip/include/libminisip/sip/SipDialogVoipClient.h	2006-11-17 16:29:13 UTC (rev 2914)
+++ trunk/libminisip/include/libminisip/sip/SipDialogVoipClient.h	2006-11-17 16:33:57 UTC (rev 2915)
@@ -57,8 +57,6 @@
 
 		virtual ~SipDialogVoipClient();
 
-		virtual void dummy(){}
-
 		virtual std::string getMemObjectType() const {return "SipDialogVoipClient";}
 		
 		virtual std::string getName(){return "SipDialogVoipClient[callid="+dialogState.callId +"]";}

Modified: trunk/libminisip/include/libminisip/sip/SipDialogVoipServer.h
===================================================================
--- trunk/libminisip/include/libminisip/sip/SipDialogVoipServer.h	2006-11-17 16:29:13 UTC (rev 2914)
+++ trunk/libminisip/include/libminisip/sip/SipDialogVoipServer.h	2006-11-17 16:33:57 UTC (rev 2915)
@@ -56,8 +56,6 @@
 
 		virtual ~SipDialogVoipServer();
 
-		virtual void dummy(){}
-
 		virtual std::string getMemObjectType() const {return "SipDialogVoipServer";}
 		
 		virtual std::string getName(){return "SipDialogVoipServer[callid="+dialogState.callId +"]";}

Modified: trunk/libminisip/include/libminisip/sip/SipSoftPhoneConfiguration.h
===================================================================
--- trunk/libminisip/include/libminisip/sip/SipSoftPhoneConfiguration.h	2006-11-17 16:29:13 UTC (rev 2914)
+++ trunk/libminisip/include/libminisip/sip/SipSoftPhoneConfiguration.h	2006-11-17 16:33:57 UTC (rev 2915)
@@ -141,7 +141,6 @@
 		std::string ringtone;
 		
 		std::list<std::string> audioCodecs;
-		
 		//not used anymore ... it was used in mediahandler ... 
 // 		bool muteAllButOne;
 		

Modified: trunk/libminisip/include/libminisip/soundcard/AudioMixerSimple.h
===================================================================
--- trunk/libminisip/include/libminisip/soundcard/AudioMixerSimple.h	2006-11-17 16:29:13 UTC (rev 2914)
+++ trunk/libminisip/include/libminisip/soundcard/AudioMixerSimple.h	2006-11-17 16:33:57 UTC (rev 2915)
@@ -144,132 +144,7 @@
 
 	
 };
-
-bool AudioMixerSimple::normalize( int32_t length) {
-	bool ret = false;
-	if( numChannels < 1 ) 
-		ret = false;
-	else if (numChannels == 1 ) {
-		ret = normalizeMono( length );
-	} else if( numChannels == 2 ) {
-		ret = normalizeStereo( length );
-	} else {
-		ret = normalizeMulti( length );
-	}
-	return ret;
-}
-
-bool AudioMixerSimple::normalizeMono( int32_t length ) {
-	//we need running pointers ...
-	short * outbuff = outputBuffer;
-	int32_t * inbuff = mixBuffer;
 	
-	//indicates the end ...
-	short * end = outbuff + length;
-	
-	if( normalizeFactor < 64 )
-		normalizeFactor++;
-		
-	while( outbuff != end ) {
-		int32_t sample = (*inbuff * normalizeFactor) >> 6;
-		if( abs(sample) > NORMALIZE_MAX_RANGE) {
-			normalizeFactor = abs( (NORMALIZE_MAX_RANGE<<6) / (*inbuff) );
-			if( sample < 0 )
-				sample = -NORMALIZE_MAX_RANGE;
-			else 
-				sample = NORMALIZE_MAX_RANGE;
-		}
-		*(outbuff++) = short(sample);
-		inbuff++;
-	}
-	return true;
-}	
 
-bool AudioMixerSimple::normalizeStereo( int32_t length ) {
-	//we need running pointers ...
-	short * outbuff = outputBuffer;
-	int32_t * inbuff = mixBuffer;
-	int32_t * sample = new int32_t[2];
-	
-	//indicates the end ...
-	short * end = outbuff + length;
-	
-	if( normalizeFactor < 64 )
-		normalizeFactor++;
-		
-	while( outbuff != end ) {
-		sample[0] = (*inbuff * normalizeFactor) >> 6;
-		inbuff++;
-		sample[1] = (*inbuff * normalizeFactor) >> 6;
-		
-		if( abs(sample[0]) > NORMALIZE_MAX_RANGE) {
-			normalizeFactor = abs( (NORMALIZE_MAX_RANGE<<6) / (*inbuff) );
-			if( sample[0] < 0 )
-				sample[0] = -NORMALIZE_MAX_RANGE;
-			else 
-				sample[0] = NORMALIZE_MAX_RANGE;
-			if( sample[1]< 0 )
-				sample[1] = -NORMALIZE_MAX_RANGE;
-			else 
-				sample[1] = NORMALIZE_MAX_RANGE;
-			#ifdef DEBUG_OUTPUT
-			merr << "n";
-			#endif
-		}
-		
-		*(outbuff++) = short(sample[0]);
-		*(outbuff++) = short(sample[1]);
-		
-		inbuff++;
-	}
-	if( sample )
-		delete [] sample;
-	return true;
-}	
-
-bool AudioMixerSimple::normalizeMulti( int32_t length ) {
-	//we need running pointers ...
-	short * outbuff = outputBuffer;
-	int32_t * inbuff = mixBuffer;
-	uint32_t i;
-	int32_t * sample = new int32_t[numChannels];
-	int32_t originalSample;
-	
-	//indicates the end ...
-	short * end = outbuff + length;
-	
-	if( normalizeFactor < 64 )
-		normalizeFactor++;
-		
-	while( outbuff != end ) {
-		originalSample = *inbuff; //keep it, we may need it to normalize
-		
-		for( i = 0; i<numChannels; i++ ) {
-			sample[i] = (*inbuff * normalizeFactor) >> 6;
-			inbuff++;
-		}
-		
-		if( abs(sample[0]) > NORMALIZE_MAX_RANGE) {
-			normalizeFactor = abs( (NORMALIZE_MAX_RANGE<<6) / originalSample );			
-			//after updating the norm factor ... 
-			//update all the samples from the channels
-			for( i = 0; i<numChannels; i++ ) {
-				if( sample[i]< 0 )
-					sample[i] = -NORMALIZE_MAX_RANGE;
-				else 
-					sample[i] = NORMALIZE_MAX_RANGE;
-			}
-		}
-		
-		for( i = 0; i<numChannels; i++ ) {
-			*outbuff = short(sample[i]);
-			outbuff++;
-		}
-	}
-	if( !sample )
-		delete [] sample;
-	return true;
-}	
-
 #endif
 

Modified: trunk/libminisip/include/libminisip/soundcard/SoundDriver.h
===================================================================
--- trunk/libminisip/include/libminisip/soundcard/SoundDriver.h	2006-11-17 16:29:13 UTC (rev 2914)
+++ trunk/libminisip/include/libminisip/soundcard/SoundDriver.h	2006-11-17 16:33:57 UTC (rev 2915)
@@ -39,21 +39,22 @@
 	public:
 		SoundDeviceName(): maxInputChannels(0), maxOutputChannels(0) {}
 
-		SoundDeviceName(std::string name, std::string description, int maxInputChannels = 2, int maxOutputChannels = 2 ): name( name ), description( description ), maxInputChannels( maxInputChannels ), maxOutputChannels( maxOutputChannels ){}
+		SoundDeviceName(std::string name, 
+				std::string description, 
+				int maxInputChannels = 2, 
+				int maxOutputChannels = 2 );
 
 		/** Sound device name including driver id prefix */
-		std::string getName() const { return name; }
+		std::string getName() const;
 
 		/** Human readable string  */
-		std::string getDescription() const { return description; }
+		std::string getDescription() const;
 
-		int getMaxInputChannels() const { return maxInputChannels; }
+		int getMaxInputChannels() const;
 
-		int getMaxOutputChannels() const { return maxOutputChannels; }
+		int getMaxOutputChannels() const;
 
-		int operator==( const SoundDeviceName &dev ) const {
-			return name == dev.name;
-		}
+		int operator==( const SoundDeviceName &dev ) const;
 
 	private:
 		std::string name;
@@ -71,7 +72,7 @@
 		virtual ~SoundDriver();
 		virtual MRef<SoundDevice*> createDevice( std::string deviceName ) = 0;
 		/** Identification string used as prefix in device names */
-		std::string getId() const { return id; };
+		std::string getId() const;
 
 		/** Human readable string */
 		virtual std::string getDescription() const = 0;

Modified: trunk/libminisip/source/soundcard/AudioMixerSimple.cxx
===================================================================
--- trunk/libminisip/source/soundcard/AudioMixerSimple.cxx	2006-11-17 16:29:13 UTC (rev 2914)
+++ trunk/libminisip/source/soundcard/AudioMixerSimple.cxx	2006-11-17 16:33:57 UTC (rev 2915)
@@ -85,3 +85,130 @@
 	return true;
 }
 
+bool AudioMixerSimple::normalize( int32_t length) {
+	bool ret = false;
+	if( numChannels < 1 ) 
+		ret = false;
+	else if (numChannels == 1 ) {
+		ret = normalizeMono( length );
+	} else if( numChannels == 2 ) {
+		ret = normalizeStereo( length );
+	} else {
+		ret = normalizeMulti( length );
+	}
+	return ret;
+}
+
+bool AudioMixerSimple::normalizeMono( int32_t length ) {
+	//we need running pointers ...
+	short * outbuff = outputBuffer;
+	int32_t * inbuff = mixBuffer;
+	
+	//indicates the end ...
+	short * end = outbuff + length;
+	
+	if( normalizeFactor < 64 )
+		normalizeFactor++;
+		
+	while( outbuff != end ) {
+		int32_t sample = (*inbuff * normalizeFactor) >> 6;
+		if( abs(sample) > NORMALIZE_MAX_RANGE) {
+			normalizeFactor = abs( (NORMALIZE_MAX_RANGE<<6) / (*inbuff) );
+			if( sample < 0 )
+				sample = -NORMALIZE_MAX_RANGE;
+			else 
+				sample = NORMALIZE_MAX_RANGE;
+		}
+		*(outbuff++) = short(sample);
+		inbuff++;
+	}
+	return true;
+}	
+
+bool AudioMixerSimple::normalizeStereo( int32_t length ) {
+	//we need running pointers ...
+	short * outbuff = outputBuffer;
+	int32_t * inbuff = mixBuffer;
+	int32_t * sample = new int32_t[2];
+	
+	//indicates the end ...
+	short * end = outbuff + length;
+	
+	if( normalizeFactor < 64 )
+		normalizeFactor++;
+		
+	while( outbuff != end ) {
+		sample[0] = (*inbuff * normalizeFactor) >> 6;
+		inbuff++;
+		sample[1] = (*inbuff * normalizeFactor) >> 6;
+		
+		if( abs(sample[0]) > NORMALIZE_MAX_RANGE) {
+			normalizeFactor = abs( (NORMALIZE_MAX_RANGE<<6) / (*inbuff) );
+			if( sample[0] < 0 )
+				sample[0] = -NORMALIZE_MAX_RANGE;
+			else 
+				sample[0] = NORMALIZE_MAX_RANGE;
+			if( sample[1]< 0 )
+				sample[1] = -NORMALIZE_MAX_RANGE;
+			else 
+				sample[1] = NORMALIZE_MAX_RANGE;
+			#ifdef DEBUG_OUTPUT
+			merr << "n";
+			#endif
+		}
+		
+		*(outbuff++) = short(sample[0]);
+		*(outbuff++) = short(sample[1]);
+		
+		inbuff++;
+	}
+	if( sample )
+		delete [] sample;
+	return true;
+}	
+
+bool AudioMixerSimple::normalizeMulti( int32_t length ) {
+	//we need running pointers ...
+	short * outbuff = outputBuffer;
+	int32_t * inbuff = mixBuffer;
+	uint32_t i;
+	int32_t * sample = new int32_t[numChannels];
+	int32_t originalSample;
+	
+	//indicates the end ...
+	short * end = outbuff + length;
+	
+	if( normalizeFactor < 64 )
+		normalizeFactor++;
+		
+	while( outbuff != end ) {
+		originalSample = *inbuff; //keep it, we may need it to normalize
+		
+		for( i = 0; i<numChannels; i++ ) {
+			sample[i] = (*inbuff * normalizeFactor) >> 6;
+			inbuff++;
+		}
+		
+		if( abs(sample[0]) > NORMALIZE_MAX_RANGE) {
+			normalizeFactor = abs( (NORMALIZE_MAX_RANGE<<6) / originalSample );			
+			//after updating the norm factor ... 
+			//update all the samples from the channels
+			for( i = 0; i<numChannels; i++ ) {
+				if( sample[i]< 0 )
+					sample[i] = -NORMALIZE_MAX_RANGE;
+				else 
+					sample[i] = NORMALIZE_MAX_RANGE;
+			}
+		}
+		
+		for( i = 0; i<numChannels; i++ ) {
+			*outbuff = short(sample[i]);
+			outbuff++;
+		}
+	}
+	if( !sample )
+		delete [] sample;
+	return true;
+}	
+
+

Modified: trunk/libminisip/source/soundcard/SoundDriver.cxx
===================================================================
--- trunk/libminisip/source/soundcard/SoundDriver.cxx	2006-11-17 16:29:13 UTC (rev 2914)
+++ trunk/libminisip/source/soundcard/SoundDriver.cxx	2006-11-17 16:33:57 UTC (rev 2915)
@@ -26,6 +26,38 @@
 #include<libminisip/soundcard/SoundDriver.h>
 
 
+SoundDeviceName::SoundDeviceName(std::string name,
+		std::string description,
+		int maxInputChannels,
+		int maxOutputChannels) :
+			name( name ),
+			description( description ),
+			maxInputChannels( maxInputChannels ),
+			maxOutputChannels( maxOutputChannels )
+{
+}
+
+
+std::string SoundDeviceName::getDescription() const { 
+	return description;
+}
+
+int SoundDeviceName::getMaxInputChannels() const { 
+	return maxInputChannels;
+}
+
+int SoundDeviceName::getMaxOutputChannels() const {
+	return maxOutputChannels;
+}
+
+int SoundDeviceName::operator==( const SoundDeviceName &dev ) const {
+	return name == dev.name;
+}
+
+std::string SoundDeviceName::getName() const {
+	return name;
+}
+
 SoundDriver::SoundDriver( std::string driverId,  MRef<Library*> lib ) : MPlugin( lib ), id( driverId ){
 }
 
@@ -35,3 +67,9 @@
 int SoundDriver::operator==( const SoundDriver &driver ) const{
 	return id == driver.id;
 }
+
+std::string SoundDriver::getId() const {
+	return id;
+}
+
+



More information about the Minisip-devel mailing list