summaryrefslogtreecommitdiff
path: root/orkaudio/messages/CaptureMsg.cpp
diff options
context:
space:
mode:
authorHenri Herscher <henri@oreka.org>2005-10-20 13:40:58 +0000
committerHenri Herscher <henri@oreka.org>2005-10-20 13:40:58 +0000
commit7e1d63dd9fd149e4934bf77095c8610fac786b04 (patch)
tree5fe486a1b0300c3b84fb559107a868e5cc2c95da /orkaudio/messages/CaptureMsg.cpp
parent467768fc956fc3e5a253373f26c71c681b31b6b8 (diff)
First checkin
git-svn-id: https://oreka.svn.sourceforge.net/svnroot/oreka/trunk@2 09dcff7a-b715-0410-9601-b79a96267cd0
Diffstat (limited to 'orkaudio/messages/CaptureMsg.cpp')
-rw-r--r--orkaudio/messages/CaptureMsg.cpp84
1 files changed, 84 insertions, 0 deletions
diff --git a/orkaudio/messages/CaptureMsg.cpp b/orkaudio/messages/CaptureMsg.cpp
new file mode 100644
index 0000000..f013e1f
--- /dev/null
+++ b/orkaudio/messages/CaptureMsg.cpp
@@ -0,0 +1,84 @@
+/*
+ * 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
+ *
+ */
+
+#include "Utils.h"
+#include "CaptureMsg.h"
+//#include "LogManager.h"
+#include "CapturePluginProxy.h"
+
+#define CAPTURE_CLASS "capture"
+#define CAPTURE_RESPONSE_CLASS "captureresponse"
+#define CAPTURE_STATE_PARAM "state"
+#define COMMENT_PARAM "comment"
+
+void CaptureResponseMsg::Define(Serializer* s)
+{
+ s->BoolValue(SUCCESS_PARAM, m_success);
+ s->StringValue(COMMENT_PARAM, m_comment);
+}
+
+CStdString CaptureResponseMsg::GetClassName()
+{
+ return CStdString(CAPTURE_RESPONSE_CLASS);
+}
+
+ObjectRef CaptureResponseMsg::NewInstance()
+{
+ return ObjectRef(new CaptureResponseMsg);
+}
+
+//===============================
+
+void CaptureMsg::Define(Serializer* s)
+{
+ CStdString captureClass(CAPTURE_CLASS);
+ s->StringValue(OBJECT_TYPE_TAG, captureClass, true);
+ s->StringValue(CAPTURE_PORT_PARAM, m_capturePort, true);
+ s->EnumValue(CAPTURE_STATE_PARAM, (int&)m_eventType, CaptureEvent::EventTypeToEnum, CaptureEvent::EventTypeToString, true);
+}
+
+
+CStdString CaptureMsg::GetClassName()
+{
+ return CStdString(CAPTURE_CLASS);
+}
+
+ObjectRef CaptureMsg::NewInstance()
+{
+ return ObjectRef(new CaptureMsg);
+}
+
+ObjectRef CaptureMsg::Process()
+{
+ CaptureResponseMsg* msg = new CaptureResponseMsg;
+ ObjectRef ref(msg);
+
+ if(m_eventType == CaptureEvent::EtStart)
+ {
+ CapturePluginProxySingleton::instance()->StartCapture(m_capturePort);
+ msg->m_success = true;
+ }
+ else if(m_eventType == CaptureEvent::EtStop)
+ {
+ CapturePluginProxySingleton::instance()->StopCapture(m_capturePort);
+ msg->m_success = true;
+ }
+ else
+ {
+ msg->m_success = false;
+ msg->m_comment = CAPTURE_STATE_PARAM;
+ msg->m_comment += " needs to be start or stop";
+ }
+ return ref;
+}
+