diff options
author | Henri Herscher <henri@oreka.org> | 2005-10-20 13:40:58 +0000 |
---|---|---|
committer | Henri Herscher <henri@oreka.org> | 2005-10-20 13:40:58 +0000 |
commit | 7e1d63dd9fd149e4934bf77095c8610fac786b04 (patch) | |
tree | 5fe486a1b0300c3b84fb559107a868e5cc2c95da /orkaudio/CapturePort.h | |
parent | 467768fc956fc3e5a253373f26c71c681b31b6b8 (diff) |
First checkin
git-svn-id: https://oreka.svn.sourceforge.net/svnroot/oreka/trunk@2 09dcff7a-b715-0410-9601-b79a96267cd0
Diffstat (limited to 'orkaudio/CapturePort.h')
-rw-r--r-- | orkaudio/CapturePort.h | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/orkaudio/CapturePort.h b/orkaudio/CapturePort.h new file mode 100644 index 0000000..6d665b1 --- /dev/null +++ b/orkaudio/CapturePort.h @@ -0,0 +1,66 @@ +/* + * 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 ) + +#ifndef __PORT_H__ +#define __PORT_H__ + +#include <map> +#include "boost/shared_ptr.hpp" +#include "ace/Thread_Mutex.h" +#include "ace/Singleton.h" + +#include "StdString.h" + +#include "AudioCapture.h" +#include "AudioTape.h" + + +/** Base class for all types of capture ports. */ +class CapturePort +{ +public: + CapturePort(CStdString& Id); + CStdString ToString(); + + void AddAudioChunk(AudioChunkRef chunkRef, bool remote = false); + void AddCaptureEvent(CaptureEventRef eventRef); +private: + CStdString m_Id; + AudioTapeRef m_audioTapeRef; + ACE_Thread_Mutex m_mutex; + bool m_capturing; + double m_vadBelowThresholdSec; + bool m_vadUp; +}; + +typedef boost::shared_ptr<CapturePort> CapturePortRef; + +/** This singleton holds all dynamically created capture ports and allows convenient access. */ +class CapturePorts +{ +public: + void Initialize(); + CapturePortRef GetPort(CStdString & portId); + /** Tries to find a capture port from its ID. If unsuccessful, creates a new one and returns it */ + CapturePortRef AddAndReturnPort(CStdString & portId); +private: + std::map<CStdString, CapturePortRef> m_ports; + ACE_Thread_Mutex m_mutex; +}; + +typedef ACE_Singleton<CapturePorts, ACE_Thread_Mutex> CapturePortsSingleton; + +#endif + |