[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 12:42:13 CDT 2010


branch "master" has been updated
       via  7d897cf3857e5fb5ae913dc3aad86e7dcd67d1b7 (commit)
       via  63444df0a9927b6483e1854dc52396b91f38b024 (commit)
      from  70b8b7d371335dba998a8f438269ed7977e661de (commit)

Summary of changes:
 src/MediaFormatULAW.cpp |   55 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 55 insertions(+), 0 deletions(-)


- Log -----------------------------------------------------------------
commit 7d897cf3857e5fb5ae913dc3aad86e7dcd67d1b7
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon Aug 2 14:34:37 2010 -0300

    Add the beginnings of a comparator implementation.

diff --git a/src/MediaFormatULAW.cpp b/src/MediaFormatULAW.cpp
index cfc97e1..e3285ba 100644
--- a/src/MediaFormatULAW.cpp
+++ b/src/MediaFormatULAW.cpp
@@ -26,10 +26,11 @@ using namespace Hydra::Location::V1;
 using namespace Hydra::Media::V1;
 
 /**
- * Implementation of the MediaFormatService as defined in media.ice
+ * Implementation of the MediaFormatService interface as defined in media.ice
  */
 class MediaFormatServiceImpl : public MediaFormatService
 {
+public:
 	/**
 	 * An implementation of the getFormat method as defined in media.ice which provides
 	 * ulaw media format concrete classes.
@@ -50,6 +51,23 @@ class MediaFormatServiceImpl : public MediaFormatService
 };
 
 /**
+ * Implementation of the ServiceLocatorParamsCompare interface as defined in service_locator.ice
+ */
+class ServiceLocatorParamsCompareImpl : public ServiceLocatorParamsCompare
+{
+public:
+	/**
+	 * An implementation of the isSupported method as defined in service_locator.ice which
+	 * performs checks on various types of discovery classes to determine if our component
+	 * should be chosen.
+	 */
+	bool isSupported(const Hydra::Location::V1::ServiceLocatorParamsPtr& params, const Ice::Current&)
+	{
+		return false;
+	};
+};
+
+/**
  * Implementation of the Ice::Application class
  */
 class MediaFormatULAWApp : public Ice::Application
@@ -86,6 +104,13 @@ int MediaFormatULAWApp::run(int argc, char* argv[])
 	/* Now that we have the above we can add it to the object adapter and eventually the service locator, yahoo! */
 	MediaFormatServicePrx MediaFormatServiceProxy = MediaFormatServicePrx::uncheckedCast(adapter->addWithUUID(MediaFormatService));
 
+	/* Instantiate an implementation of the service locator parameters comparator service which will help the service locator
+	 * find us. */
+	ServiceLocatorParamsComparePtr ServiceLocatorParamsCompareService = new ServiceLocatorParamsCompareImpl();
+
+	/* Yet another thing to add to the object adapter and eventually the service locator... */
+	ServiceLocatorParamsComparePrx ServiceLocatorParamsCompareProxy = ServiceLocatorParamsComparePrx::uncheckedCast(adapter->addWithUUID(ServiceLocatorParamsCompareService));
+
 	adapter->activate();
 
 	cout << "Activated ulaw media format component." << endl;

commit 63444df0a9927b6483e1854dc52396b91f38b024
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon Aug 2 14:13:09 2010 -0300

    Add an implementation of the MediaFormatService which provides ulaw media format concrete classes.

diff --git a/src/MediaFormatULAW.cpp b/src/MediaFormatULAW.cpp
index 3bf79d9..cfc97e1 100644
--- a/src/MediaFormatULAW.cpp
+++ b/src/MediaFormatULAW.cpp
@@ -26,6 +26,30 @@ using namespace Hydra::Location::V1;
 using namespace Hydra::Media::V1;
 
 /**
+ * Implementation of the MediaFormatService as defined in media.ice
+ */
+class MediaFormatServiceImpl : public MediaFormatService
+{
+	/**
+	 * An implementation of the getFormat method as defined in media.ice which provides
+	 * ulaw media format concrete classes.
+	 */
+	FormatPtr getFormat(const Hydra::Media::V1::FormatDiscoveryPtr&, const Ice::Current&)
+	{
+		/* Since ulaw is rather simple we don't need to interpret the parameters passed in. */
+		AudioFormatPtr format = new AudioFormat();
+
+		format->name = "ulaw";
+		format->sampleRate = 8000;
+		format->frameSize = 20;
+		format->maximumFrameSize = 20;
+		format->minimumFrameSize = 20;
+
+		return format;
+	};
+};
+
+/**
  * Implementation of the Ice::Application class
  */
 class MediaFormatULAWApp : public Ice::Application
@@ -56,6 +80,12 @@ int MediaFormatULAWApp::run(int argc, char* argv[])
 
 	Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("MediaFormatULAWAdapter");
 
+	/* Instantiate an implementation of the media format service which will provide ulaw media format classes. */
+	MediaFormatServicePtr MediaFormatService = new MediaFormatServiceImpl();
+
+	/* Now that we have the above we can add it to the object adapter and eventually the service locator, yahoo! */
+	MediaFormatServicePrx MediaFormatServiceProxy = MediaFormatServicePrx::uncheckedCast(adapter->addWithUUID(MediaFormatService));
+
 	adapter->activate();
 
 	cout << "Activated ulaw media format component." << endl;

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


-- 
hydra/media_format_ulaw.git




More information about the asterisk-scf-commits mailing list