summaryrefslogtreecommitdiff
path: root/orkbasecxx/EventStreaming.cpp
diff options
context:
space:
mode:
authorGerald Begumisa <ben_g@users.sourceforge.net>2009-01-07 13:07:31 +0000
committerGerald Begumisa <ben_g@users.sourceforge.net>2009-01-07 13:07:31 +0000
commit0e2a2e49077b79bd52d6c83c5202e452e7eea091 (patch)
tree58ae466e2c74be585548f10ffff96560099c9370 /orkbasecxx/EventStreaming.cpp
parentded03e95a1eb78cb16ef3a4a0dc9bb140bd748ba (diff)
Modified the orkaudio API, adding the record and pause HTTP commands. The record command commences or un-pauses recording while the pause command pauses recording - discarding RTP packets from when the pause command is issued. Both commands require the orkuid and party to be specified as HTTP parameters. Note that this represents a change in the arguments required for the StartCapture function in DLLs. Also added an event streaming feature which streams out all tape messages as they are reported in real-time to a client connected. Clients should connect via HTTP, on port 59150. The port is configurable by setting the parameter EventStreamingServerPort in config.xml
git-svn-id: https://oreka.svn.sourceforge.net/svnroot/oreka/trunk@590 09dcff7a-b715-0410-9601-b79a96267cd0
Diffstat (limited to 'orkbasecxx/EventStreaming.cpp')
-rw-r--r--orkbasecxx/EventStreaming.cpp109
1 files changed, 109 insertions, 0 deletions
diff --git a/orkbasecxx/EventStreaming.cpp b/orkbasecxx/EventStreaming.cpp
new file mode 100644
index 0000000..4074e14
--- /dev/null
+++ b/orkbasecxx/EventStreaming.cpp
@@ -0,0 +1,109 @@
+/*
+ * Oreka -- A media capture and retrieval platform
+ *
+ * Copyright (C) 2005, orecx LLC
+ *
+ * http://www.orecx.com
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License.
+ * Please refer to http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+#pragma warning( disable: 4786 ) // disables truncated symbols in browse-info warning
+
+#define _WINSOCKAPI_ // prevents the inclusion of winsock.h
+
+#include "EventStreaming.h"
+#include "ConfigManager.h"
+
+//==========================================================
+
+EventStreamingSession::EventStreamingSession()
+{
+}
+
+void EventStreamingSession::AddTapeMessage(MessageRef& message)
+{
+ if(m_messages.size() > 10000)
+ {
+ m_messages.pop_front();
+ }
+ m_messages.push_back(message);
+ m_semaphore.release();
+}
+
+void EventStreamingSession::GetTapeMessage(MessageRef& message)
+{
+ MutexSentinel mutexSentinel(m_mutex);
+
+ if(m_messages.size() > 0)
+ {
+ message = m_messages.front();
+ m_messages.pop_front();
+ }
+}
+
+int EventStreamingSession::GetNumMessages()
+{
+ MutexSentinel mutexSentinel(m_mutex);
+
+ return m_messages.size();
+}
+
+void EventStreamingSession::WaitForMessages()
+{
+ m_semaphore.acquire();
+}
+
+//==============================================
+
+EventStreaming::EventStreaming()
+{
+}
+
+void EventStreaming::GetLiveSessions(std::list<EventStreamingSessionRef>& sessions)
+{
+ MutexSentinel sentinel(m_mutex);
+
+ for(std::list<EventStreamingSessionRef>::iterator it = m_sessions.begin(); it != m_sessions.end(); it++)
+ {
+ EventStreamingSessionRef session = *it;
+
+ sessions.push_back(session);
+ }
+}
+
+void EventStreaming::AddSession(EventStreamingSessionRef& session)
+{
+ MutexSentinel sentinel(m_mutex);
+ m_sessions.push_back(session);
+}
+
+void EventStreaming::RemoveSession(EventStreamingSessionRef& session)
+{
+ MutexSentinel sentinel(m_mutex);
+ m_sessions.remove(session);
+}
+
+int EventStreaming::GetNumSessions()
+{
+ MutexSentinel sentinel(m_mutex);
+ return m_sessions.size();
+}
+
+CStdString EventStreaming::GetNewSessionId()
+{
+ return m_alphaCounter.GetNext();
+}
+
+void EventStreaming::AddTapeMessage(MessageRef& message)
+{
+ MutexSentinel sentinel(m_mutex);
+
+ for(std::list<EventStreamingSessionRef>::iterator it = m_sessions.begin(); it != m_sessions.end(); it++)
+ {
+ (*it)->AddTapeMessage(message);
+ }
+}
+