summaryrefslogtreecommitdiff
path: root/orkbasecxx/AudioTape.h
diff options
context:
space:
mode:
authorHenri Herscher <henri@oreka.org>2006-07-03 19:00:21 +0000
committerHenri Herscher <henri@oreka.org>2006-07-03 19:00:21 +0000
commita6430b8cebf1d8b185f4884862aa85761437f2b8 (patch)
tree9544142ac220aa502b3299f8a6acb6bcffa13cf1 /orkbasecxx/AudioTape.h
parenta1b7c5edfd0fb268ed48398153aa95be7bff821c (diff)
Moving AudioTape.cpp and AudioTape.h to orkbasecxx
git-svn-id: https://oreka.svn.sourceforge.net/svnroot/oreka/trunk@291 09dcff7a-b715-0410-9601-b79a96267cd0
Diffstat (limited to 'orkbasecxx/AudioTape.h')
-rw-r--r--orkbasecxx/AudioTape.h110
1 files changed, 110 insertions, 0 deletions
diff --git a/orkbasecxx/AudioTape.h b/orkbasecxx/AudioTape.h
new file mode 100644
index 0000000..9e288fa
--- /dev/null
+++ b/orkbasecxx/AudioTape.h
@@ -0,0 +1,110 @@
+/*
+ * 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
+ *
+ */
+
+#ifndef __AUDIOTAPE_H__
+#define __AUDIOTAPE_H__
+
+#include "ace/Thread_Mutex.h"
+#include "time.h"
+#include "StdString.h"
+#include "boost/shared_ptr.hpp"
+#include <queue>
+#include "AudioCapture.h"
+#include "audiofile/AudioFile.h"
+#include "messages/Message.h"
+
+class AudioTapeDescription : public Object
+{
+public:
+ AudioTapeDescription();
+ void Define(Serializer* s);
+ void Validate();
+
+ CStdString GetClassName();
+ ObjectRef NewInstance();
+
+ ObjectRef Process();
+
+ CStdString m_capturePort;
+ CStdString m_localParty;
+ CStdString m_localEntryPoint;
+ CStdString m_remoteParty;
+ CaptureEvent::DirectionEnum m_direction;
+ time_t m_beginDate;
+ int m_duration;
+ CStdString m_localIp;
+ CStdString m_remoteIp;
+};
+
+class AudioTape
+{
+public:
+ typedef enum
+ {
+ StateUnknown = 0,
+ StateCreated = 1,
+ StateActive = 2,
+ StateStopped = 3,
+ StateError = 4,
+ StateInvalid = 5
+ } StateEnum;
+
+ AudioTape(CStdString &portId);
+
+ void AddAudioChunk(AudioChunkRef chunkRef);
+ void Write();
+ void SetShouldStop();
+ bool IsStoppedAndValid();
+ void AddCaptureEvent(CaptureEventRef eventRef, bool send = true);
+ void GetMessage(MessageRef& msg);
+ /** Returns an identifier for the tape which corresponds to the filename without extension */
+ CStdString GetIdentifier();
+ /** Returns the full filename (including relative path) to the post-compression audio file */
+ CStdString GetFilename();
+ CStdString GetPath();
+ AudioFileRef GetAudioFileRef();
+ bool IsReadyForBatchProcessing();
+
+ CStdString m_portId;
+ CStdString m_localParty;
+ CStdString m_localEntryPoint;
+ CStdString m_remoteParty;
+ CaptureEvent::DirectionEnum m_direction;
+ time_t m_beginDate;
+ time_t m_endDate;
+ time_t m_duration;
+ CStdString m_localIp;
+ CStdString m_remoteIp;
+private:
+ void GenerateFilePathAndIdentifier();
+
+ CStdString m_filePath;
+ CStdString m_fileIdentifier;
+ CStdString m_fileExtension; //Corresponds to the extension the tape will have after compression
+
+ std::queue<AudioChunkRef> m_chunkQueue;
+
+ std::queue<CaptureEventRef> m_eventQueue;
+ std::queue<CaptureEventRef> m_toSendEventQueue;
+
+ AudioFileRef m_audioFileRef;
+ ACE_Thread_Mutex m_mutex;
+ StateEnum m_state;
+ bool m_shouldStop;
+ bool m_readyForBatchProcessing;
+};
+
+typedef boost::shared_ptr<AudioTape> AudioTapeRef;
+
+#endif
+