[hydra-commits] hydra/media_format_ulaw.git branch "master" updated.

Commits to the Hydra project code repositories hydra-commits at lists.digium.com
Mon Aug 2 14:05:51 CDT 2010


branch "master" has been updated
       via  77a09dac767cbba9243ab01bd4264e1292b60f6c (commit)
       via  2b3e92d340a06e278039e3f5b8782e0a46b8f306 (commit)
       via  ea7614e7cd4d89eedd387b4ea9b96806467c2298 (commit)
      from  7d897cf3857e5fb5ae913dc3aad86e7dcd67d1b7 (commit)

Summary of changes:
 config/test_media_format_ulaw.conf |   10 +++++++
 slice/service_locator.ice          |    2 +-
 src/MediaFormatULAW.cpp            |   51 +++++++++++++++++++++++++++++++++++-
 3 files changed, 61 insertions(+), 2 deletions(-)
 create mode 100644 config/test_media_format_ulaw.conf


- Log -----------------------------------------------------------------
commit 77a09dac767cbba9243ab01bd4264e1292b60f6c
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon Aug 2 16:21:30 2010 -0300

    Add a comparator implementation and also have ourselves added to the service locator.

diff --git a/src/MediaFormatULAW.cpp b/src/MediaFormatULAW.cpp
index e3285ba..ad321f3 100644
--- a/src/MediaFormatULAW.cpp
+++ b/src/MediaFormatULAW.cpp
@@ -63,6 +63,39 @@ public:
 	 */
 	bool isSupported(const Hydra::Location::V1::ServiceLocatorParamsPtr& params, const Ice::Current&)
 	{
+		if (params->ice_isA("::Hydra::Media::V1::FormatDiscoveryName"))
+		{
+			FormatDiscoveryNamePtr discoveryname = FormatDiscoveryNamePtr::dynamicCast(params);
+
+			if (discoveryname->name == "ulaw8 at 20")
+			{
+				return true;
+			}
+		}
+		else if (params->ice_isA("::Hydra::Media::V1::FormatDiscoverySDP"))
+		{
+			FormatDiscoverySDPPtr discoverysdp = FormatDiscoverySDPPtr::dynamicCast(params);
+
+			if (discoverysdp->payload == 0 &&
+			    discoverysdp->type == "audio" &&
+			    discoverysdp->subtype == "PCMU" &&
+			    discoverysdp->samplerate == 8000)
+			{
+				return true;
+			}
+		}
+		else if (params->ice_isA("::Hydra::Media::V1::FormatDiscoveryGenericAudio"))
+		{
+			FormatDiscoveryGenericAudioPtr discoverygenericaudio = FormatDiscoveryGenericAudioPtr::dynamicCast(params);
+
+			if (discoverygenericaudio->name == "ulaw" &&
+			    discoverygenericaudio->samplerate == 8000 &&
+			    discoverygenericaudio->channels == 1)
+			{
+				return true;
+			}
+		}
+
 		return false;
 	};
 };
@@ -115,10 +148,26 @@ int MediaFormatULAWApp::run(int argc, char* argv[])
 
 	cout << "Activated ulaw media format component." << endl;
 
-	/* Since we can now actually respond to requests we can add ourselves into the service locator. */
+	/* To the service locator management interface we gooooooooooo. */
+	ServiceLocatorManagementPrx management = ServiceLocatorManagementPrx::checkedCast(communicator()->propertyToProxy("ServiceLocatorManagementProxy"));
+
+	/* The comparator already has a UUID from when we added it to the object adapter so add it using that */
+	management->addCompare(ServiceLocatorParamsCompareProxy->ice_getIdentity().name, ServiceLocatorParamsCompareProxy);
+
+	/* Boom! In we go as a service. */
+	ServiceManagementPrx service_management = ServiceManagementPrx::uncheckedCast(management->addService(MediaFormatServiceProxy, "media_format_ulaw"));
 
+	/* Now we can add some parameters to help find us. */
+	ServiceLocatorParamsPtr genericparams = new ServiceLocatorParams();
+	genericparams->category = "media_format";
+	service_management->addLocatorParams(genericparams, ServiceLocatorParamsCompareProxy->ice_getIdentity().name);
+
+	/* Welp we are now in the service locator... they can find us! */
 	communicator()->waitForShutdown();
 
+	/* When all is said and done we have to leave the party */
+	service_management->unregister();
+
 	return EXIT_SUCCESS;
 }
 

commit 2b3e92d340a06e278039e3f5b8782e0a46b8f306
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon Aug 2 15:26:49 2010 -0300

    Bring us back up to date with the service locator.

diff --git a/slice/service_locator.ice b/slice/service_locator.ice
index 132403f..5b97a58 100644
--- a/slice/service_locator.ice
+++ b/slice/service_locator.ice
@@ -33,7 +33,7 @@ module V1
 	/**
 	 * Generic service locator parameters class that more specific parameter classes can extend.
 	 */
-	class ServiceLocatorParams
+	["preserved"] class ServiceLocatorParams
 	{
 		/**
 		 * Basic category for the service, such as bridge or channel service.

commit ea7614e7cd4d89eedd387b4ea9b96806467c2298
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon Aug 2 14:58:41 2010 -0300

    Add a configuration file used for testing.

diff --git a/config/test_media_format_ulaw.conf b/config/test_media_format_ulaw.conf
new file mode 100644
index 0000000..15aaf88
--- /dev/null
+++ b/config/test_media_format_ulaw.conf
@@ -0,0 +1,10 @@
+# This is a configuration file used in conjunction with the ulaw media format test driver
+
+# Adapter parameters for this component
+MediaFormatULAWAdapter.Endpoints=default
+
+# A proxy to the service locator management service
+ServiceLocatorManagementProxy=LocatorServiceManagement:tcp -p 5674
+
+# A proxy to the service locator service
+ServiceLocatorProxy=LocatorService:tcp -p 2657

-----------------------------------------------------------------------


-- 
hydra/media_format_ulaw.git




More information about the asterisk-scf-commits mailing list