[hydra-commits] hydra/media_rtp_pjmedia.git branch "master" created.
Commits to the Hydra project code repositories
hydra-commits at lists.digium.com
Sat Aug 14 18:13:59 CDT 2010
branch "master" has been created
at 50d69d0d746cc512941c7af89e04312978204fcd (commit)
- Log -----------------------------------------------------------------
commit 50d69d0d746cc512941c7af89e04312978204fcd
Author: Joshua Colp <jcolp at digium.com>
Date: Sat Aug 14 20:28:30 2010 -0300
Implement some of the StreamSinkRTP interface.
diff --git a/src/RTPSession.cpp b/src/RTPSession.cpp
index dcb6968..069628c 100644
--- a/src/RTPSession.cpp
+++ b/src/RTPSession.cpp
@@ -105,7 +105,7 @@ RTPSessionImpl::RTPSessionImpl(Ice::ObjectAdapterPtr adapter, const FormatSeq& f
mImpl->mStreamSourceProxy = StreamSourceRTPPrx::uncheckedCast(mImpl->mAdapter->addWithUUID(mImpl->mStreamSource));
/* And for my next trick a place for us to send media out. */
- mImpl->mStreamSink = new StreamSinkRTPImpl();
+ mImpl->mStreamSink = new StreamSinkRTPImpl(this);
mImpl->mStreamSinkProxy = StreamSinkRTPPrx::uncheckedCast(mImpl->mAdapter->addWithUUID(mImpl->mStreamSink));
}
diff --git a/src/RTPSink.cpp b/src/RTPSink.cpp
index 55e4fad..f39427f 100644
--- a/src/RTPSink.cpp
+++ b/src/RTPSink.cpp
@@ -38,9 +38,35 @@ using namespace Hydra::Media::RTP::V1;
class StreamSinkRTPImplPriv
{
public:
+ /**
+ * Constructor for our StreamSinkRTPImplPriv class.
+ */
+ StreamSinkRTPImplPriv(RTPSessionImplPtr session) : mSession(session) { pjmedia_rtp_session_init(&mOutgoingSession, 0, pj_rand()); };
+
+ /**
+ * A structure containing outgoing pjmedia session data.
+ */
+ pjmedia_rtp_session mOutgoingSession;
+
+ /**
+ * A pointer to the RTP session we are associated with.
+ */
+ RTPSessionImplPtr mSession;
+
+ /**
+ * A proxy to the sink that we are receiving media from.
+ */
+ StreamSourcePrx mSource;
};
/**
+ * Constructor for the StreamSinkRTPImpl class.
+ */
+StreamSinkRTPImpl::StreamSinkRTPImpl(RTPSessionImplPtr session) : mImpl(new StreamSinkRTPImplPriv(session))
+{
+}
+
+/**
* Implementation of the write method as defined in MediaIf.ice
*/
void StreamSinkRTPImpl::write(const Hydra::Media::V1::FrameSeq&, const Ice::Current&)
@@ -50,8 +76,9 @@ void StreamSinkRTPImpl::write(const Hydra::Media::V1::FrameSeq&, const Ice::Curr
/**
* Implementation of the setSource method as defined in MediaIf.ice
*/
-void StreamSinkRTPImpl::setSource(const Hydra::Media::V1::StreamSourcePrx&, const Ice::Current&)
+void StreamSinkRTPImpl::setSource(const Hydra::Media::V1::StreamSourcePrx& source, const Ice::Current&)
{
+ mImpl->mSource = source;
}
/**
@@ -59,8 +86,7 @@ void StreamSinkRTPImpl::setSource(const Hydra::Media::V1::StreamSourcePrx&, cons
*/
Hydra::Media::V1::StreamSourcePrx StreamSinkRTPImpl::getSource(const Ice::Current&)
{
- StreamSourcePrx proxy;
- return proxy;
+ return mImpl->mSource;
}
/**
@@ -68,16 +94,16 @@ Hydra::Media::V1::StreamSourcePrx StreamSinkRTPImpl::getSource(const Ice::Curren
*/
Hydra::Media::V1::FormatSeq StreamSinkRTPImpl::getFormats(const Ice::Current&)
{
- FormatSeq formats;
- return formats;
+ return mImpl->mSession->getFormats();
}
/**
* Implementation of the getId method as defined in MediaIf.ice
*/
-std::string StreamSinkRTPImpl::getId(const Ice::Current&)
+std::string StreamSinkRTPImpl::getId(const Ice::Current& current)
{
- return "bob";
+ /* For now utilize the id of the session */
+ return mImpl->mSession->getId(current);
}
/**
diff --git a/src/RTPSink.h b/src/RTPSink.h
index 92d67fd..99d0406 100644
--- a/src/RTPSink.h
+++ b/src/RTPSink.h
@@ -31,6 +31,7 @@ class StreamSinkRTPImplPriv;
class StreamSinkRTPImpl : public Hydra::Media::RTP::V1::StreamSinkRTP
{
public:
+ StreamSinkRTPImpl(RTPSessionImplPtr);
void write(const Hydra::Media::V1::FrameSeq&, const Ice::Current&);
void setSource(const Hydra::Media::V1::StreamSourcePrx&, const Ice::Current&);
Hydra::Media::V1::StreamSourcePrx getSource(const Ice::Current&);
commit 5fdae71ecd9458c9725c718328df13fbce01c24e
Author: Joshua Colp <jcolp at digium.com>
Date: Sat Aug 14 20:22:07 2010 -0300
Implement the StreamSourceRTP interface.
diff --git a/src/RTPSession.cpp b/src/RTPSession.cpp
index ed26f80..dcb6968 100644
--- a/src/RTPSession.cpp
+++ b/src/RTPSession.cpp
@@ -101,7 +101,7 @@ RTPSessionImpl::RTPSessionImpl(Ice::ObjectAdapterPtr adapter, const FormatSeq& f
/* Now create some transport we can use to actually send or receive the media. */
/* First up for our own stuff is... a source! Media needs to come from somewhere, you know. */
- mImpl->mStreamSource = new StreamSourceRTPImpl();
+ mImpl->mStreamSource = new StreamSourceRTPImpl(this);
mImpl->mStreamSourceProxy = StreamSourceRTPPrx::uncheckedCast(mImpl->mAdapter->addWithUUID(mImpl->mStreamSource));
/* And for my next trick a place for us to send media out. */
diff --git a/src/RTPSource.cpp b/src/RTPSource.cpp
index 17f0769..c104898 100644
--- a/src/RTPSource.cpp
+++ b/src/RTPSource.cpp
@@ -38,13 +38,40 @@ using namespace Hydra::Media::RTP::V1;
class StreamSourceRTPImplPriv
{
public:
+ /**
+ * Constructor for our StreamSourceRTPImplPriv class.
+ */
+ StreamSourceRTPImplPriv(RTPSessionImplPtr session) : mSession(session) { pjmedia_rtp_session_init(&mIncomingSession, 0, 0); };
+
+ /**
+ * A structure containing incoming pjmedia session data.
+ */
+ pjmedia_rtp_session mIncomingSession;
+
+ /**
+ * A pointer to the RTP session we are associated with.
+ */
+ RTPSessionImplPtr mSession;
+
+ /**
+ * A proxy to the sink that we are writing incoming media to.
+ */
+ StreamSinkPrx mSink;
};
/**
+ * Constructor for the StreamSourceRTPImpl class.
+ */
+StreamSourceRTPImpl::StreamSourceRTPImpl(RTPSessionImplPtr session) : mImpl(new StreamSourceRTPImplPriv(session))
+{
+}
+
+/**
* Implementation of the setSink method as defined in MediaIf.ice
*/
-void StreamSourceRTPImpl::setSink(const Hydra::Media::V1::StreamSinkPrx&, const Ice::Current&)
+void StreamSourceRTPImpl::setSink(const Hydra::Media::V1::StreamSinkPrx& sink, const Ice::Current&)
{
+ mImpl->mSink = sink;
}
/**
@@ -52,8 +79,7 @@ void StreamSourceRTPImpl::setSink(const Hydra::Media::V1::StreamSinkPrx&, const
*/
Hydra::Media::V1::StreamSinkPrx StreamSourceRTPImpl::getSink(const Ice::Current&)
{
- StreamSinkPrx proxy;
- return proxy;
+ return mImpl->mSink;
}
/**
@@ -61,16 +87,16 @@ Hydra::Media::V1::StreamSinkPrx StreamSourceRTPImpl::getSink(const Ice::Current&
*/
Hydra::Media::V1::FormatSeq StreamSourceRTPImpl::getFormats(const Ice::Current&)
{
- FormatSeq formats;
- return formats;
+ return mImpl->mSession->getFormats();
}
/**
* Implementation of the getId method as defined in MediaRTPIf.ice
*/
-std::string StreamSourceRTPImpl::getId(const Ice::Current&)
+std::string StreamSourceRTPImpl::getId(const Ice::Current& current)
{
- return "bob";
+ /* For now utilize the id of the session */
+ return mImpl->mSession->getId(current);
}
/**
@@ -78,6 +104,8 @@ std::string StreamSourceRTPImpl::getId(const Ice::Current&)
*/
void StreamSourceRTPImpl::requestFormat(const Hydra::Media::V1::FormatPtr&, const Ice::Current&)
{
+ /* We do not currently support switching formats. */
+ throw new MediaFormatSwitchException();
}
/**
@@ -85,7 +113,12 @@ void StreamSourceRTPImpl::requestFormat(const Hydra::Media::V1::FormatPtr&, cons
*/
std::string StreamSourceRTPImpl::getLocalAddress(const Ice::Current&)
{
- return "no";
+ pjmedia_transport_info transportInfo;
+
+ pjmedia_transport_info_init(&transportInfo);
+ pjmedia_transport_get_info(mImpl->mSession->getTransport(), &transportInfo);
+
+ return pj_inet_ntoa(transportInfo.sock_info.rtp_addr_name.ipv4.sin_addr);
}
/**
@@ -93,5 +126,10 @@ std::string StreamSourceRTPImpl::getLocalAddress(const Ice::Current&)
*/
Ice::Int StreamSourceRTPImpl::getLocalPort(const Ice::Current&)
{
- return 5060;
+ pjmedia_transport_info transportInfo;
+
+ pjmedia_transport_info_init(&transportInfo);
+ pjmedia_transport_get_info(mImpl->mSession->getTransport(), &transportInfo);
+
+ return pj_ntohs(transportInfo.sock_info.rtp_addr_name.ipv4.sin_port);
}
diff --git a/src/RTPSource.h b/src/RTPSource.h
index 3cb0e29..f5f6f3d 100644
--- a/src/RTPSource.h
+++ b/src/RTPSource.h
@@ -31,6 +31,7 @@ class StreamSourceRTPImplPriv;
class StreamSourceRTPImpl : public Hydra::Media::RTP::V1::StreamSourceRTP
{
public:
+ StreamSourceRTPImpl(RTPSessionImplPtr);
void setSink(const Hydra::Media::V1::StreamSinkPrx&, const Ice::Current&);
Hydra::Media::V1::StreamSinkPrx getSink(const Ice::Current&);
Hydra::Media::V1::FormatSeq getFormats(const Ice::Current&);
commit c54ab4005bbd1179c5d4edb140af581c48833e29
Author: Joshua Colp <jcolp at digium.com>
Date: Sat Aug 14 20:01:40 2010 -0300
More skeleton work for source and sink implementations.
diff --git a/src/RTPSession.cpp b/src/RTPSession.cpp
index 1cc521e..ed26f80 100644
--- a/src/RTPSession.cpp
+++ b/src/RTPSession.cpp
@@ -100,8 +100,13 @@ RTPSessionImpl::RTPSessionImpl(Ice::ObjectAdapterPtr adapter, const FormatSeq& f
/* Now create some transport we can use to actually send or receive the media. */
- /* Now that our external stuff is taken care of set a source and sink up internally for
- * media transport. */
+ /* First up for our own stuff is... a source! Media needs to come from somewhere, you know. */
+ mImpl->mStreamSource = new StreamSourceRTPImpl();
+ mImpl->mStreamSourceProxy = StreamSourceRTPPrx::uncheckedCast(mImpl->mAdapter->addWithUUID(mImpl->mStreamSource));
+
+ /* And for my next trick a place for us to send media out. */
+ mImpl->mStreamSink = new StreamSinkRTPImpl();
+ mImpl->mStreamSinkProxy = StreamSinkRTPPrx::uncheckedCast(mImpl->mAdapter->addWithUUID(mImpl->mStreamSink));
}
/**
@@ -195,3 +200,13 @@ pjmedia_transport* RTPSessionImpl::getTransport()
{
return mImpl->mTransport;
}
+
+/**
+ * API call which returns the formats the RTP session is expected to carry.
+ *
+ * @return A sequence of media formats.
+ */
+FormatSeq RTPSessionImpl::getFormats()
+{
+ return mImpl->mFormats;
+}
diff --git a/src/RTPSession.h b/src/RTPSession.h
index 99a5d93..9ea05bb 100644
--- a/src/RTPSession.h
+++ b/src/RTPSession.h
@@ -40,6 +40,7 @@ public:
void release(const Ice::Current&);
Hydra::Media::RTP::V1::RTPSessionPrx getProxy();
pjmedia_transport* getTransport();
+ Hydra::Media::V1::FormatSeq getFormats();
private:
/**
* Private implementation data for RTPSessionImpl.
diff --git a/src/RTPSink.cpp b/src/RTPSink.cpp
index 0dc4a56..55e4fad 100644
--- a/src/RTPSink.cpp
+++ b/src/RTPSink.cpp
@@ -39,3 +39,73 @@ class StreamSinkRTPImplPriv
{
public:
};
+
+/**
+ * Implementation of the write method as defined in MediaIf.ice
+ */
+void StreamSinkRTPImpl::write(const Hydra::Media::V1::FrameSeq&, const Ice::Current&)
+{
+}
+
+/**
+ * Implementation of the setSource method as defined in MediaIf.ice
+ */
+void StreamSinkRTPImpl::setSource(const Hydra::Media::V1::StreamSourcePrx&, const Ice::Current&)
+{
+}
+
+/**
+ * Implementation of the getSource method as defined in MediaIf.ice
+ */
+Hydra::Media::V1::StreamSourcePrx StreamSinkRTPImpl::getSource(const Ice::Current&)
+{
+ StreamSourcePrx proxy;
+ return proxy;
+}
+
+/**
+ * Implementation of the getFormats method as defined in MediaIf.ice
+ */
+Hydra::Media::V1::FormatSeq StreamSinkRTPImpl::getFormats(const Ice::Current&)
+{
+ FormatSeq formats;
+ return formats;
+}
+
+/**
+ * Implementation of the getId method as defined in MediaIf.ice
+ */
+std::string StreamSinkRTPImpl::getId(const Ice::Current&)
+{
+ return "bob";
+}
+
+/**
+ * Implementation of the setRemoteAddress method as defined in MediaRTPIf.ice
+ */
+void StreamSinkRTPImpl::setRemoteAddress(const std::string&, const Ice::Current&)
+{
+}
+
+/**
+ * Implementation of the setRemotePort method as defined in MediaRTPIf.ice
+ */
+void StreamSinkRTPImpl::setRemotePort(Ice::Int, const Ice::Current&)
+{
+}
+
+/**
+ * Implementation of the getRemoteAddress method as defined in MediaRTPIf.ice
+ */
+std::string StreamSinkRTPImpl::getRemoteAddress(const Ice::Current&)
+{
+ return "bob";
+}
+
+/**
+ * Implementation of the getRemotePort method as defined in MediaRTPIf.ice
+ */
+Ice::Int StreamSinkRTPImpl::getRemotePort(const Ice::Current&)
+{
+ return 5060;
+}
diff --git a/src/RTPSink.h b/src/RTPSink.h
index 2e11919..92d67fd 100644
--- a/src/RTPSink.h
+++ b/src/RTPSink.h
@@ -31,6 +31,15 @@ class StreamSinkRTPImplPriv;
class StreamSinkRTPImpl : public Hydra::Media::RTP::V1::StreamSinkRTP
{
public:
+ void write(const Hydra::Media::V1::FrameSeq&, const Ice::Current&);
+ void setSource(const Hydra::Media::V1::StreamSourcePrx&, const Ice::Current&);
+ Hydra::Media::V1::StreamSourcePrx getSource(const Ice::Current&);
+ Hydra::Media::V1::FormatSeq getFormats(const Ice::Current&);
+ std::string getId(const Ice::Current&);
+ void setRemoteAddress(const std::string&, const Ice::Current&);
+ void setRemotePort(Ice::Int, const Ice::Current&);
+ std::string getRemoteAddress(const Ice::Current&);
+ Ice::Int getRemotePort(const Ice::Current&);
private:
/**
* Private implementation data for StreamSinkRTPImpl.
diff --git a/src/RTPSource.cpp b/src/RTPSource.cpp
index 54787eb..17f0769 100644
--- a/src/RTPSource.cpp
+++ b/src/RTPSource.cpp
@@ -39,3 +39,59 @@ class StreamSourceRTPImplPriv
{
public:
};
+
+/**
+ * Implementation of the setSink method as defined in MediaIf.ice
+ */
+void StreamSourceRTPImpl::setSink(const Hydra::Media::V1::StreamSinkPrx&, const Ice::Current&)
+{
+}
+
+/**
+ * Implementation of the getSink method as defined in MediaIf.ice
+ */
+Hydra::Media::V1::StreamSinkPrx StreamSourceRTPImpl::getSink(const Ice::Current&)
+{
+ StreamSinkPrx proxy;
+ return proxy;
+}
+
+/**
+ * Implementation of the getFormats method as defined in MediaIf.ice
+ */
+Hydra::Media::V1::FormatSeq StreamSourceRTPImpl::getFormats(const Ice::Current&)
+{
+ FormatSeq formats;
+ return formats;
+}
+
+/**
+ * Implementation of the getId method as defined in MediaRTPIf.ice
+ */
+std::string StreamSourceRTPImpl::getId(const Ice::Current&)
+{
+ return "bob";
+}
+
+/**
+ * Implementation of the requestMethod method as defined in MediaIf.ice
+ */
+void StreamSourceRTPImpl::requestFormat(const Hydra::Media::V1::FormatPtr&, const Ice::Current&)
+{
+}
+
+/**
+ * Implementation of the getLocalAddress method as defined in MediaRTPIf.ice
+ */
+std::string StreamSourceRTPImpl::getLocalAddress(const Ice::Current&)
+{
+ return "no";
+}
+
+/**
+ * Implementation of the getLocalPort method as defined in MediaRTPIf.ice
+ */
+Ice::Int StreamSourceRTPImpl::getLocalPort(const Ice::Current&)
+{
+ return 5060;
+}
diff --git a/src/RTPSource.h b/src/RTPSource.h
index db8d9a1..3cb0e29 100644
--- a/src/RTPSource.h
+++ b/src/RTPSource.h
@@ -31,6 +31,13 @@ class StreamSourceRTPImplPriv;
class StreamSourceRTPImpl : public Hydra::Media::RTP::V1::StreamSourceRTP
{
public:
+ void setSink(const Hydra::Media::V1::StreamSinkPrx&, const Ice::Current&);
+ Hydra::Media::V1::StreamSinkPrx getSink(const Ice::Current&);
+ Hydra::Media::V1::FormatSeq getFormats(const Ice::Current&);
+ std::string getId(const Ice::Current&);
+ void requestFormat(const Hydra::Media::V1::FormatPtr&, const Ice::Current&);
+ std::string getLocalAddress(const Ice::Current&);
+ Ice::Int getLocalPort(const Ice::Current&);
private:
/**
* Private implementation data for StreamSourceRTPImpl.
commit 8043d7b4931c6f05058cf1d7cab5adbf7774be1b
Author: Joshua Colp <jcolp at digium.com>
Date: Sat Aug 14 19:28:42 2010 -0300
Add TBD to places where search and replace will occur.
diff --git a/src/MediaRTPpjmedia.cpp b/src/MediaRTPpjmedia.cpp
index f51e1e8..229465c 100644
--- a/src/MediaRTPpjmedia.cpp
+++ b/src/MediaRTPpjmedia.cpp
@@ -1,12 +1,12 @@
/*
- * ZOMGZHYDRA?!? -- An open source telephony framework.
+ * TBD -- An open source telephony framework.
*
* Copyright (C) 2010, Digium, Inc.
*
* Joshua Colp <jcolp at digium.com>
*
- * See http://www.IcanhazURL.org for more information about
- * the ZOMGZHYDRA?!? project. Please do not directly contact
+ * See TBD for more information about
+ * the TBD project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
diff --git a/src/RTPSession.cpp b/src/RTPSession.cpp
index 2bf93c2..1cc521e 100644
--- a/src/RTPSession.cpp
+++ b/src/RTPSession.cpp
@@ -1,12 +1,12 @@
/*
- * ZOMGZHYDRA?!? -- An open source telephony framework.
+ * TBD -- An open source telephony framework.
*
* Copyright (C) 2010, Digium, Inc.
*
* Joshua Colp <jcolp at digium.com>
*
- * See http://www.IcanhazURL.org for more information about
- * the ZOMGZHYDRA?!? project. Please do not directly contact
+ * See TBD for more information about
+ * the TBD project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
diff --git a/src/RTPSink.cpp b/src/RTPSink.cpp
index 3537f58..0dc4a56 100644
--- a/src/RTPSink.cpp
+++ b/src/RTPSink.cpp
@@ -1,12 +1,12 @@
/*
- * ZOMGZHYDRA?!? -- An open source telephony framework.
+ * TBD -- An open source telephony framework.
*
* Copyright (C) 2010, Digium, Inc.
*
* Joshua Colp <jcolp at digium.com>
*
- * See http://www.IcanhazURL.org for more information about
- * the ZOMGZHYDRA?!? project. Please do not directly contact
+ * See TBD for more information about
+ * the TBD project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
diff --git a/src/RTPSource.cpp b/src/RTPSource.cpp
index cee63a8..54787eb 100644
--- a/src/RTPSource.cpp
+++ b/src/RTPSource.cpp
@@ -1,12 +1,12 @@
/*
- * ZOMGZHYDRA?!? -- An open source telephony framework.
+ * TBD -- An open source telephony framework.
*
* Copyright (C) 2010, Digium, Inc.
*
* Joshua Colp <jcolp at digium.com>
*
- * See http://www.IcanhazURL.org for more information about
- * the ZOMGZHYDRA?!? project. Please do not directly contact
+ * See TBD for more information about
+ * the TBD project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
commit 4b86afde152d3d198e7781bde629c739556605a8
Author: Joshua Colp <jcolp at digium.com>
Date: Sat Aug 14 19:27:18 2010 -0300
Add skeleton files for sink and source implementations.
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6edae08..e2de69e 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -4,6 +4,8 @@ hydra_component_add_slice(media_rtp_pjmedia MediaIf)
hydra_component_add_slice(media_rtp_pjmedia MediaRTPIf)
hydra_component_add_file(media_rtp_pjmedia MediaRTPpjmedia.cpp)
hydra_component_add_file(media_rtp_pjmedia RTPSession.cpp)
+hydra_component_add_file(media_rtp_pjmedia RTPSource.cpp)
+hydra_component_add_file(media_rtp_pjmedia RTPSink.cpp)
hydra_component_build_standalone(media_rtp_pjmedia)
pjproject_link(media_rtp_pjmedia pjlib)
pjproject_link(media_rtp_pjmedia pjlib-util)
diff --git a/src/RTPSession.cpp b/src/RTPSession.cpp
index 4488987..2bf93c2 100644
--- a/src/RTPSession.cpp
+++ b/src/RTPSession.cpp
@@ -25,6 +25,8 @@
#include "Media/RTP/MediaRTPIf.h"
#include "RTPSession.h"
+#include "RTPSource.h"
+#include "RTPSink.h"
using namespace std;
using namespace Hydra::Core::Discovery::V1;
@@ -38,6 +40,7 @@ class RTPSessionImplPriv
{
public:
RTPSessionImplPriv(Ice::ObjectAdapterPtr adapter, const FormatSeq& formats) : mAdapter(adapter), mFormats(formats) { };
+ ~RTPSessionImplPriv();
/**
* A pointer to the object adapter that objects should be added to.
@@ -63,6 +66,26 @@ public:
* pjmedia transport for transmission/reception of RTP.
*/
pjmedia_transport* mTransport;
+
+ /**
+ * A stream source for this RTP session.
+ */
+ StreamSourceRTPPtr mStreamSource;
+
+ /**
+ * A proxy to the above mentioned stream source.
+ */
+ StreamSourceRTPPrx mStreamSourceProxy;
+
+ /**
+ * A stream sink for this RTP session.
+ */
+ StreamSinkRTPPtr mStreamSink;
+
+ /**
+ * A proxy to the above mentioned stream sink.
+ */
+ StreamSinkRTPPrx mStreamSinkProxy;
};
/**
@@ -72,16 +95,25 @@ RTPSessionImpl::RTPSessionImpl(Ice::ObjectAdapterPtr adapter, const FormatSeq& f
{
/* Add ourselves to the ICE ASM so we can be used. */
mImpl->mProxy = RTPSessionPrx::uncheckedCast(adapter->addWithUUID(this));
+
+ /* Create an endpoint in pjmedia for our media. */
+
+ /* Now create some transport we can use to actually send or receive the media. */
+
+ /* Now that our external stuff is taken care of set a source and sink up internally for
+ * media transport. */
}
/**
- * Destructor for the RTPSessionImpl class.
+ * Destructor for the RTPSessionImplPriv class.
*/
-RTPSessionImpl::~RTPSessionImpl()
+RTPSessionImplPriv::~RTPSessionImplPriv()
{
/* Discontinue the media transport. */
+ pjmedia_transport_close(mTransport);
/* Discontinue the media endpoint. */
+ pjmedia_endpt_destroy(mEndpoint);
}
/**
@@ -89,7 +121,9 @@ RTPSessionImpl::~RTPSessionImpl()
*/
StreamSourceSeq RTPSessionImpl::getSources(const Ice::Current&)
{
+ /* We only support one stream source per RTP session right now, so just return the one. */
StreamSourceSeq sources;
+ sources.push_back(mImpl->mStreamSourceProxy);
return sources;
}
@@ -98,7 +132,9 @@ StreamSourceSeq RTPSessionImpl::getSources(const Ice::Current&)
*/
StreamSinkSeq RTPSessionImpl::getSinks(const Ice::Current&)
{
+ /* We only support one stream sink per RTP session right now, so just return the one. */
StreamSinkSeq sinks;
+ sinks.push_back(mImpl->mStreamSinkProxy);
return sinks;
}
@@ -149,3 +185,13 @@ RTPSessionPrx RTPSessionImpl::getProxy()
{
return mImpl->mProxy;
}
+
+/**
+ * API call which returns the transport used for this RTP session.
+ *
+ * @return A pointer to the pjmedia transport.
+ */
+pjmedia_transport* RTPSessionImpl::getTransport()
+{
+ return mImpl->mTransport;
+}
diff --git a/src/RTPSession.h b/src/RTPSession.h
index ff0cacf..99a5d93 100644
--- a/src/RTPSession.h
+++ b/src/RTPSession.h
@@ -32,7 +32,6 @@ class RTPSessionImpl : public Hydra::Media::RTP::V1::RTPSession
{
public:
RTPSessionImpl(Ice::ObjectAdapterPtr, const Hydra::Media::V1::FormatSeq&);
- ~RTPSessionImpl();
Hydra::Media::V1::StreamSourceSeq getSources(const Ice::Current&);
Hydra::Media::V1::StreamSinkSeq getSinks(const Ice::Current&);
std::string getId(const Ice::Current&);
@@ -40,6 +39,7 @@ public:
Hydra::Media::RTP::V1::RTCPSessionPrx getRTCPSession(const Ice::Current&);
void release(const Ice::Current&);
Hydra::Media::RTP::V1::RTPSessionPrx getProxy();
+ pjmedia_transport* getTransport();
private:
/**
* Private implementation data for RTPSessionImpl.
diff --git a/src/RTPSink.cpp b/src/RTPSink.cpp
new file mode 100644
index 0000000..3537f58
--- /dev/null
+++ b/src/RTPSink.cpp
@@ -0,0 +1,41 @@
+/*
+ * ZOMGZHYDRA?!? -- An open source telephony framework.
+ *
+ * Copyright (C) 2010, Digium, Inc.
+ *
+ * Joshua Colp <jcolp at digium.com>
+ *
+ * See http://www.IcanhazURL.org for more information about
+ * the ZOMGZHYDRA?!? project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+#include <Ice/Ice.h>
+
+#include <pjlib.h>
+#include <pjmedia.h>
+
+#include "Media/MediaIf.h"
+#include "Media/RTP/MediaRTPIf.h"
+
+#include "RTPSession.h"
+#include "RTPSink.h"
+
+using namespace std;
+using namespace Hydra::Core::Discovery::V1;
+using namespace Hydra::Media::V1;
+using namespace Hydra::Media::RTP::V1;
+
+/**
+ * Private implementation details for the StreamSinkRTPImpl class.
+ */
+class StreamSinkRTPImplPriv
+{
+public:
+};
diff --git a/src/RTPSink.h b/src/RTPSink.h
new file mode 100644
index 0000000..2e11919
--- /dev/null
+++ b/src/RTPSink.h
@@ -0,0 +1,39 @@
+/*
+ * TBD -- An open source telephony framework.
+ *
+ * Copyright (C) 2010, Digium, Inc.
+ *
+ * Joshua Colp <jcolp at digium.com>
+ *
+ * See TBD for more information about
+ * the TBD project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+#pragma once
+
+#include <boost/shared_ptr.hpp>
+
+/**
+ * Forward definition for our private implementation of StreamSinkRTP.
+ */
+class StreamSinkRTPImplPriv;
+
+/**
+ * Implementation of the StreamSourceRTP interface as defined in MediaRTPIf.ice
+ */
+class StreamSinkRTPImpl : public Hydra::Media::RTP::V1::StreamSinkRTP
+{
+public:
+private:
+ /**
+ * Private implementation data for StreamSinkRTPImpl.
+ */
+ boost::shared_ptr<StreamSinkRTPImplPriv> mImpl;
+};
diff --git a/src/RTPSource.cpp b/src/RTPSource.cpp
new file mode 100644
index 0000000..cee63a8
--- /dev/null
+++ b/src/RTPSource.cpp
@@ -0,0 +1,41 @@
+/*
+ * ZOMGZHYDRA?!? -- An open source telephony framework.
+ *
+ * Copyright (C) 2010, Digium, Inc.
+ *
+ * Joshua Colp <jcolp at digium.com>
+ *
+ * See http://www.IcanhazURL.org for more information about
+ * the ZOMGZHYDRA?!? project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+#include <Ice/Ice.h>
+
+#include <pjlib.h>
+#include <pjmedia.h>
+
+#include "Media/MediaIf.h"
+#include "Media/RTP/MediaRTPIf.h"
+
+#include "RTPSession.h"
+#include "RTPSource.h"
+
+using namespace std;
+using namespace Hydra::Core::Discovery::V1;
+using namespace Hydra::Media::V1;
+using namespace Hydra::Media::RTP::V1;
+
+/**
+ * Private implementation details for the StreamSourceRTPImpl class.
+ */
+class StreamSourceRTPImplPriv
+{
+public:
+};
diff --git a/src/RTPSource.h b/src/RTPSource.h
new file mode 100644
index 0000000..db8d9a1
--- /dev/null
+++ b/src/RTPSource.h
@@ -0,0 +1,39 @@
+/*
+ * TBD -- An open source telephony framework.
+ *
+ * Copyright (C) 2010, Digium, Inc.
+ *
+ * Joshua Colp <jcolp at digium.com>
+ *
+ * See TBD for more information about
+ * the TBD project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+#pragma once
+
+#include <boost/shared_ptr.hpp>
+
+/**
+ * Forward definition for our private implementation of StreamSourceRTP.
+ */
+class StreamSourceRTPImplPriv;
+
+/**
+ * Implementation of the StreamSourceRTP interface as defined in MediaRTPIf.ice
+ */
+class StreamSourceRTPImpl : public Hydra::Media::RTP::V1::StreamSourceRTP
+{
+public:
+private:
+ /**
+ * Private implementation data for StreamSourceRTPImpl.
+ */
+ boost::shared_ptr<StreamSourceRTPImplPriv> mImpl;
+};
commit e1077c1366e1fa1e00270c16a284001585832c78
Author: Joshua Colp <jcolp at digium.com>
Date: Sat Aug 14 19:27:02 2010 -0300
Disable building of pjproject with sound support, it is not needed.
diff --git a/pjproject.cmake b/pjproject.cmake
index 616c848..5856787 100644
--- a/pjproject.cmake
+++ b/pjproject.cmake
@@ -3,7 +3,7 @@
find_package(Threads)
# These are global targets which exist for all pjproject components, they are used for initial running of configure plus cleanup
-add_custom_command(OUTPUT "${CMAKE_SOURCE_DIR}/pjproject/build.mak" COMMAND "./configure" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/pjproject" COMMENT "Configuring pjproject")
+add_custom_command(OUTPUT "${CMAKE_SOURCE_DIR}/pjproject/build.mak" COMMAND "./configure" "--disable-sound" "--disable-ssl" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/pjproject" COMMENT "Configuring pjproject")
add_custom_target(pjproject-clean COMMAND "make" "clean" "TARGET_NAME=asteriskscf" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/pjproject" COMMENT "Cleaning pjproject")
add_custom_target(pjproject-distclean COMMAND "make" "distclean" "TARGET_NAME=asteriskscf" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/pjproject" COMMENT "Deep cleaning pjproject")
@@ -45,6 +45,7 @@ function(pjproject_link COMPONENT PJPROJECT_COMPONENT)
target_link_libraries(${COMPONENT} "pjmedia-asteriskscf")
target_link_libraries(${COMPONENT} "pjmedia-codec-asteriskscf")
target_link_libraries(${COMPONENT} "pjsdp-asteriskscf")
+ target_link_libraries(${COMPONENT} "pjmedia-audiodev-asteriskscf")
else()
target_link_libraries(${COMPONENT} "${PJPROJECT_COMPONENT}-asteriskscf")
endif()
commit e54176b0581aaf5dd77036ff74424079752c182e
Author: Joshua Colp <jcolp at digium.com>
Date: Sat Aug 14 19:00:12 2010 -0300
Add some implementation of the RTP session interface.
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 31f89ef..6edae08 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -3,6 +3,7 @@ hydra_component_add_slice(media_rtp_pjmedia ServiceLocatorIf)
hydra_component_add_slice(media_rtp_pjmedia MediaIf)
hydra_component_add_slice(media_rtp_pjmedia MediaRTPIf)
hydra_component_add_file(media_rtp_pjmedia MediaRTPpjmedia.cpp)
+hydra_component_add_file(media_rtp_pjmedia RTPSession.cpp)
hydra_component_build_standalone(media_rtp_pjmedia)
pjproject_link(media_rtp_pjmedia pjlib)
pjproject_link(media_rtp_pjmedia pjlib-util)
diff --git a/src/MediaRTPpjmedia.cpp b/src/MediaRTPpjmedia.cpp
index 0e6063a..f51e1e8 100644
--- a/src/MediaRTPpjmedia.cpp
+++ b/src/MediaRTPpjmedia.cpp
@@ -25,18 +25,36 @@
#include "Media/MediaIf.h"
#include "Media/RTP/MediaRTPIf.h"
+#include "RTPSession.h"
+
using namespace std;
using namespace Hydra::Core::Discovery::V1;
using namespace Hydra::Media::V1;
using namespace Hydra::Media::RTP::V1;
/**
- * Implementation of the RTPMediaService interface
+ * Implementation of the RTPMediaService interface as defined in MediaRTPIf.ice
*/
class RTPMediaServiceImpl : public RTPMediaService
{
public:
+ RTPMediaServiceImpl(Ice::ObjectAdapterPtr);
+ RTPSessionPrx allocate(const FormatSeq&, const Ice::Current&);
private:
+ /**
+ * A pointer to the object adapter that objects should be added to.
+ */
+ Ice::ObjectAdapterPtr mAdapter;
+
+ /**
+ * Memory caching pool.
+ */
+ pj_caching_pool mCachingPool;
+
+ /**
+ * Memory pool.
+ */
+ pj_pool_t* mMemoryPool;
};
/**
@@ -62,6 +80,27 @@ int main(int argc, char* argv[])
}
/**
+ * Constructor for the RTPMediaServiceImpl class.
+ */
+RTPMediaServiceImpl::RTPMediaServiceImpl(Ice::ObjectAdapterPtr adapter) : mAdapter(adapter)
+{
+ /* Initialize the memory caching pool using default policy as specified by pjlib. */
+ pj_caching_pool_init(&mCachingPool, &pj_pool_factory_default_policy, 0);
+
+ /* Initialize the memory pool that pjmedia will draw from. */
+ mMemoryPool = pj_pool_create(&mCachingPool.factory, "media_rtp_pjmedia", 1000, 1000, NULL);
+}
+
+/**
+ * Implementation of the allocate method as defined in MediaRTPIf.ice
+ */
+RTPSessionPrx RTPMediaServiceImpl::allocate(const FormatSeq& formats, const Ice::Current&)
+{
+ RTPSessionImplPtr session = new RTPSessionImpl(mAdapter, formats);
+ return session->getProxy();
+}
+
+/**
* Overload of the Ice::Application::run method.
*/
int MediaRTPpjmediaApp::run(int argc, char* argv[])
@@ -80,6 +119,33 @@ int MediaRTPpjmediaApp::run(int argc, char* argv[])
return EXIT_SUCCESS;
}
+ cout << "Initializing pjmedia rtp component" << endl;
+
+ Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("MediaRTPpjmediaAdapter");
+
+ RTPMediaServicePtr rtpmediaservice = new RTPMediaServiceImpl(adapter);
+
+ RTPMediaServicePrx RTPMediaServiceProxy = RTPMediaServicePrx::uncheckedCast(adapter->addWithUUID(rtpmediaservice));
+
+ adapter->activate();
+
+ cout << "Activated pjmedia rtp component media service." << endl;
+
+ ServiceLocatorManagementPrx management = ServiceLocatorManagementPrx::checkedCast(communicator()->propertyToProxy("ServiceLocatorManagementProxy"));
+
+ ServiceManagementPrx service_management = ServiceManagementPrx::uncheckedCast(management->addService(RTPMediaServiceProxy, "media_rtp_pjmedia"));
+
+ /* Now we can add some parameters to help find us. */
+ ServiceLocatorParamsPtr genericparams = new ServiceLocatorParams();
+ genericparams->category = "rtp";
+ service_management->addLocatorParams(genericparams, "");
+
+ /* 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;
}
diff --git a/src/RTPSession.cpp b/src/RTPSession.cpp
new file mode 100644
index 0000000..4488987
--- /dev/null
+++ b/src/RTPSession.cpp
@@ -0,0 +1,151 @@
+/*
+ * ZOMGZHYDRA?!? -- An open source telephony framework.
+ *
+ * Copyright (C) 2010, Digium, Inc.
+ *
+ * Joshua Colp <jcolp at digium.com>
+ *
+ * See http://www.IcanhazURL.org for more information about
+ * the ZOMGZHYDRA?!? project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+#include <Ice/Ice.h>
+
+#include <pjlib.h>
+#include <pjmedia.h>
+
+#include "Media/MediaIf.h"
+#include "Media/RTP/MediaRTPIf.h"
+
+#include "RTPSession.h"
+
+using namespace std;
+using namespace Hydra::Core::Discovery::V1;
+using namespace Hydra::Media::V1;
+using namespace Hydra::Media::RTP::V1;
+
+/**
+ * Private implementation details for the RTPSessionImpl class.
+ */
+class RTPSessionImplPriv
+{
+public:
+ RTPSessionImplPriv(Ice::ObjectAdapterPtr adapter, const FormatSeq& formats) : mAdapter(adapter), mFormats(formats) { };
+
+ /**
+ * A pointer to the object adapter that objects should be added to.
+ */
+ Ice::ObjectAdapterPtr mAdapter;
+
+ /**
+ * A sequence of formats that the session is expected to carry.
+ */
+ FormatSeq mFormats;
+
+ /**
+ * A proxy to ourselves.
+ */
+ RTPSessionPrx mProxy;
+
+ /**
+ * pjmedia endpoint for our media.
+ */
+ pjmedia_endpt* mEndpoint;
+
+ /**
+ * pjmedia transport for transmission/reception of RTP.
+ */
+ pjmedia_transport* mTransport;
+};
+
+/**
+ * Constructor for the RTPSessionImpl class.
+ */
+RTPSessionImpl::RTPSessionImpl(Ice::ObjectAdapterPtr adapter, const FormatSeq& formats) : mImpl(new RTPSessionImplPriv(adapter, formats))
+{
+ /* Add ourselves to the ICE ASM so we can be used. */
+ mImpl->mProxy = RTPSessionPrx::uncheckedCast(adapter->addWithUUID(this));
+}
+
+/**
+ * Destructor for the RTPSessionImpl class.
+ */
+RTPSessionImpl::~RTPSessionImpl()
+{
+ /* Discontinue the media transport. */
+
+ /* Discontinue the media endpoint. */
+}
+
+/**
+ * Implementation of the getSources method as defined in MediaRTPIf.ice
+ */
+StreamSourceSeq RTPSessionImpl::getSources(const Ice::Current&)
+{
+ StreamSourceSeq sources;
+ return sources;
+}
+
+/**
+ * Implementation of the getSinks method as defined in MediaRTPIf.ice
+ */
+StreamSinkSeq RTPSessionImpl::getSinks(const Ice::Current&)
+{
+ StreamSinkSeq sinks;
+ return sinks;
+}
+
+/**
+ * Implementation of the getId method as defined in MediaRTPIf.ice
+ */
+std::string RTPSessionImpl::getId(const Ice::Current&)
+{
+ /* Instead of having to maintain our own identifier for this RTP session we can use the identifier
+ * created when it was added to the ICE ASM.
+ */
+ return mImpl->mProxy->ice_getIdentity().name;
+}
+
+/**
+ * Implementation of the useRTCP method as defined in MediaRTPIf.ice
+ */
+void RTPSessionImpl::useRTCP(bool, const Ice::Current&)
+{
+}
+
+/**
+ * Implementation of the getRTCPSession method as defined in MediaRTPIf.ice
+ */
+RTCPSessionPrx RTPSessionImpl::getRTCPSession(const Ice::Current&)
+{
+ RTCPSessionPrx proxy;
+ return proxy;
+}
+
+/**
+ * Implementation of the release method as defined in MediaRTPIf.ice
+ */
+void RTPSessionImpl::release(const Ice::Current&)
+{
+ /* All we have to do is remove ourselves from the ASM, our smart pointerness will cause us to
+ * destruct and then cleanup will occur.
+ */
+ mImpl->mAdapter->remove(mImpl->mProxy->ice_getIdentity());
+}
+
+/**
+ * API call which returns a proxy to this RTP session.
+ *
+ * @return A proxy to this RTP session.
+ */
+RTPSessionPrx RTPSessionImpl::getProxy()
+{
+ return mImpl->mProxy;
+}
diff --git a/src/RTPSession.h b/src/RTPSession.h
new file mode 100644
index 0000000..ff0cacf
--- /dev/null
+++ b/src/RTPSession.h
@@ -0,0 +1,53 @@
+/*
+ * TBD -- An open source telephony framework.
+ *
+ * Copyright (C) 2010, Digium, Inc.
+ *
+ * Joshua Colp <jcolp at digium.com>
+ *
+ * See TBD for more information about
+ * the TBD project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+#pragma once
+
+#include <boost/shared_ptr.hpp>
+
+/**
+ * Forward definition for our private implementation of RTPSession.
+ */
+class RTPSessionImplPriv;
+
+/**
+ * Implementation of the RTPSession interface as defined in MediaRTPIf.ice
+ */
+class RTPSessionImpl : public Hydra::Media::RTP::V1::RTPSession
+{
+public:
+ RTPSessionImpl(Ice::ObjectAdapterPtr, const Hydra::Media::V1::FormatSeq&);
+ ~RTPSessionImpl();
+ Hydra::Media::V1::StreamSourceSeq getSources(const Ice::Current&);
+ Hydra::Media::V1::StreamSinkSeq getSinks(const Ice::Current&);
+ std::string getId(const Ice::Current&);
+ void useRTCP(bool, const Ice::Current&);
+ Hydra::Media::RTP::V1::RTCPSessionPrx getRTCPSession(const Ice::Current&);
+ void release(const Ice::Current&);
+ Hydra::Media::RTP::V1::RTPSessionPrx getProxy();
+private:
+ /**
+ * Private implementation data for RTPSessionImpl.
+ */
+ boost::shared_ptr<RTPSessionImplPriv> mImpl;
+};
+
+/**
+ * A typedef which creates a smart pointer type for RTPSessionImpl.
+ */
+typedef IceUtil::Handle<RTPSessionImpl> RTPSessionImplPtr;
commit 1f6b968008b7369131e6086660cb492f5a50ffe2
Author: Joshua Colp <jcolp at digium.com>
Date: Sat Aug 14 17:35:04 2010 -0300
Add skeleton for media_rtp_pjmedia.
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..b35270a
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,6 @@
+[submodule "cmake"]
+ path = cmake
+ url = git at git.asterisk.org:hydra/cmake
+[submodule "slice"]
+ path = slice
+ url = git at git.asterisk.org:hydra/slice
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..e079b70
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,28 @@
+# pjmedia RTP component build system
+
+# Minimum we require is 2.6, any lower and stuff would fail horribly
+cmake_minimum_required(VERSION 2.6)
+
+# Include common Hydra build infrastructure
+include(cmake/Hydra_v4.cmake)
+
+# Include pjproject build integration
+include(pjproject.cmake)
+
+# Add build targets for what we will need to link against
+pjproject_build(pjlib)
+pjproject_build(pjlib-util)
+pjproject_build(pjnath)
+pjproject_build(pjmedia)
+
+# This project is C++ based and requires a minimum of 3.4
+hydra_project(media_rtp_pjmedia 3.4 CXX)
+
+# Knock out slice definitions
+add_subdirectory(slice EXCLUDE_FROM_ALL)
+
+# Take care of the source code for this project
+add_subdirectory(src)
+
+# Finally take care of the test suite
+add_subdirectory(test)
diff --git a/cmake b/cmake
new file mode 160000
index 0000000..6f93993
--- /dev/null
+++ b/cmake
@@ -0,0 +1 @@
+Subproject commit 6f939932a3c35300208434795e42f5edae14e259
diff --git a/pjproject.cmake b/pjproject.cmake
new file mode 100644
index 0000000..616c848
--- /dev/null
+++ b/pjproject.cmake
@@ -0,0 +1,53 @@
+# We require threads for our usage of pjproject. Their build system will take care of finding stuff so it can build, but we need to find
+# out about threads for when we do our linking.
+find_package(Threads)
+
+# These are global targets which exist for all pjproject components, they are used for initial running of configure plus cleanup
+add_custom_command(OUTPUT "${CMAKE_SOURCE_DIR}/pjproject/build.mak" COMMAND "./configure" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/pjproject" COMMENT "Configuring pjproject")
+add_custom_target(pjproject-clean COMMAND "make" "clean" "TARGET_NAME=asteriskscf" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/pjproject" COMMENT "Cleaning pjproject")
+add_custom_target(pjproject-distclean COMMAND "make" "distclean" "TARGET_NAME=asteriskscf" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/pjproject" COMMENT "Deep cleaning pjproject")
+
+# Function which adds build targets for the following supported pjproject components: pjlib, pjlib-util, pjnath, pjmedia, pjsip.
+function(pjproject_build PJPROJECT_COMPONENT)
+ if (UNIX)
+ add_custom_target("pjproject-${PJPROJECT_COMPONENT}" COMMAND "make" "TARGET_NAME=asteriskscf" "DIRS=${PJPROJECT_COMPONENT}" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/pjproject" COMMENT "Building pjproject-${PJPROJECT_COMPONENT}" DEPENDS "${CMAKE_SOURCE_DIR}/pjproject/build.mak")
+ elseif (MSVC80 OR MSVC90)
+ if (${PJPROJECT_COMPONENT} STREQUAL "pjlib-util")
+ include_external_msproject(pjlib_util "${CMAKE_SOURCE_DIR}/pjproject/pjlib-util/build/pjlib_util.vcproj")
+ elseif (${PJPROJECT_COMPONENT} STREQUAL "pjsip")
+ include_external_msproject(pjsip_core "${CMAKE_SOURCE_DIR}/pjproject/pjsip/build/pjsip_core.vcproj")
+ include_external_msproject(pjsip_simple "${CMAKE_SOURCE_DIR}/pjproject/pjsip/build/pjsip_simple.vcproj")
+ include_external_msproject(pjsip_ua "${CMAKE_SOURCE_DIR}/pjproject/pjsip/build/pjsip_ua.vcproj")
+ include_external_msproject(pjsua_lib "${CMAKE_SOURCE_DIR}/pjproject/pjsip/build/pjsua_lib.vcproj")
+ else()
+ include_external_msproject(${PJPROJECT_COMPONENT} "${CMAKE_SOURCE_DIR}/pjproject/${PJPROJECT_COMPONENT}/build/${PJPROJECT_COMPONENT}.vcproj")
+ endif()
+ else()
+ message(STATUS "Unfortunately you are building on a platform which does not support automatic pjproject building. You will have to build pjproject manually.")
+ endif()
+ include_directories("${CMAKE_SOURCE_DIR}/pjproject/${PJPROJECT_COMPONENT}/include")
+ link_directories("${CMAKE_SOURCE_DIR}/pjproject/${PJPROJECT_COMPONENT}/lib")
+endfunction()
+
+# Function which links a component against a pjproject component
+function(pjproject_link COMPONENT PJPROJECT_COMPONENT)
+ if (UNIX)
+ add_dependencies(${COMPONENT} "pjproject-${PJPROJECT_COMPONENT}")
+ target_link_libraries(${COMPONENT} ${CMAKE_THREAD_LIBS_INIT})
+ if (${PJPROJECT_COMPONENT} STREQUAL "pjsip")
+ target_link_libraries(${COMPONENT} "pjsip-asteriskscf")
+ target_link_libraries(${COMPONENT} "pjsip-simple-asteriskscf")
+ target_link_libraries(${COMPONENT} "pjsip-ua-asteriskscf")
+ target_link_libraries(${COMPONENT} "pjsua-asteriskscf")
+ elseif (${PJPROJECT_COMPONENT} STREQUAL "pjlib")
+ target_link_libraries(${COMPONENT} "pj-asteriskscf")
+ elseif (${PJPROJECT_COMPONENT} STREQUAL "pjmedia")
+ target_link_libraries(${COMPONENT} "pjmedia-asteriskscf")
+ target_link_libraries(${COMPONENT} "pjmedia-codec-asteriskscf")
+ target_link_libraries(${COMPONENT} "pjsdp-asteriskscf")
+ else()
+ target_link_libraries(${COMPONENT} "${PJPROJECT_COMPONENT}-asteriskscf")
+ endif()
+ elseif (MSVC80 OR MSVC90)
+ endif()
+endfunction()
diff --git a/slice b/slice
new file mode 160000
index 0000000..b5f6c63
--- /dev/null
+++ b/slice
@@ -0,0 +1 @@
+Subproject commit b5f6c63f2ba9da7a94a3aea8affa6796de36dbea
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 0000000..31f89ef
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,11 @@
+hydra_component_init(media_rtp_pjmedia CXX)
+hydra_component_add_slice(media_rtp_pjmedia ServiceLocatorIf)
+hydra_component_add_slice(media_rtp_pjmedia MediaIf)
+hydra_component_add_slice(media_rtp_pjmedia MediaRTPIf)
+hydra_component_add_file(media_rtp_pjmedia MediaRTPpjmedia.cpp)
+hydra_component_build_standalone(media_rtp_pjmedia)
+pjproject_link(media_rtp_pjmedia pjlib)
+pjproject_link(media_rtp_pjmedia pjlib-util)
+pjproject_link(media_rtp_pjmedia pjmedia)
+pjproject_link(media_rtp_pjmedia pjnath)
+hydra_component_install(media_rtp_pjmedia RUNTIME bin "pjmedia RTP Media." Media)
diff --git a/src/MediaRTPpjmedia.cpp b/src/MediaRTPpjmedia.cpp
new file mode 100644
index 0000000..0e6063a
--- /dev/null
+++ b/src/MediaRTPpjmedia.cpp
@@ -0,0 +1,89 @@
+/*
+ * ZOMGZHYDRA?!? -- An open source telephony framework.
+ *
+ * Copyright (C) 2010, Digium, Inc.
+ *
+ * Joshua Colp <jcolp at digium.com>
+ *
+ * See http://www.IcanhazURL.org for more information about
+ * the ZOMGZHYDRA?!? project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+#include <Ice/Ice.h>
+
+#include <pjlib.h>
+#include <pjmedia.h>
+
+#include "Core/Discovery/ServiceLocatorIf.h"
+#include "Media/MediaIf.h"
+#include "Media/RTP/MediaRTPIf.h"
+
+using namespace std;
+using namespace Hydra::Core::Discovery::V1;
+using namespace Hydra::Media::V1;
+using namespace Hydra::Media::RTP::V1;
+
+/**
+ * Implementation of the RTPMediaService interface
+ */
+class RTPMediaServiceImpl : public RTPMediaService
+{
+public:
+private:
+};
+
+/**
+ * Implementation of the Ice::Application class
+ */
+class MediaRTPpjmediaApp : public Ice::Application
+{
+public:
+ int run(int, char*[]);
+ void interruptCallback(int);
+
+private:
+};
+
+/**
+ * Main entry point for our pjmedia rtp component.
+ */
+int main(int argc, char* argv[])
+{
+ MediaRTPpjmediaApp app;
+ app.callbackOnInterrupt();
+ return app.main(argc, argv);
+}
+
+/**
+ * Overload of the Ice::Application::run method.
+ */
+int MediaRTPpjmediaApp::run(int argc, char* argv[])
+{
+ /* Initialize pjlib as pjmedia will be using it */
+ pj_status_t status = pj_init();
+ if (status != PJ_SUCCESS)
+ {
+ cerr << "PJ library initialization failed." << endl;
+ return EXIT_SUCCESS;
+ }
+
+ if ((status = pjlib_util_init()) != PJ_SUCCESS)
+ {
+ cerr << "PJ Utility library initialization failed." << endl;
+ return EXIT_SUCCESS;
+ }
+
+ return EXIT_SUCCESS;
+}
+
+void MediaRTPpjmediaApp::interruptCallback(int val)
+{
+ _exit(EXIT_SUCCESS);
+}
-----------------------------------------------------------------------
--
hydra/media_rtp_pjmedia.git
More information about the asterisk-scf-commits
mailing list