init
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
PROJECT(openvibe-plugins-sdk-stream-codecs)
|
||||
|
||||
SET(PROJECT_VERSION_MAJOR ${OV_GLOBAL_VERSION_MAJOR})
|
||||
SET(PROJECT_VERSION_MINOR ${OV_GLOBAL_VERSION_MINOR})
|
||||
SET(PROJECT_VERSION_PATCH ${OV_GLOBAL_VERSION_PATCH})
|
||||
SET(PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
|
||||
|
||||
FILE(GLOB_RECURSE SRC_FILES src/*.cpp src/*.h src/*.hpp src/*.inl)
|
||||
INCLUDE("FindSourceRCProperties")
|
||||
ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRC_FILES})
|
||||
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES
|
||||
VERSION ${PROJECT_VERSION}
|
||||
SOVERSION ${PROJECT_VERSION_MAJOR}
|
||||
FOLDER ${PLUGINS_FOLDER}
|
||||
COMPILE_FLAGS "-DOVP_Exports -DOVP_Shared")
|
||||
|
||||
# ---------------------------------
|
||||
INCLUDE("FindOpenViBE")
|
||||
INCLUDE("FindOpenViBECommon")
|
||||
INCLUDE("FindOpenViBEToolkit")
|
||||
INCLUDE("FindOpenViBEModuleEBML")
|
||||
|
||||
# ---------------------------------
|
||||
# Target macros
|
||||
# Defines target operating system, architecture and compiler
|
||||
# ---------------------------------
|
||||
SET_BUILD_PLATFORM()
|
||||
|
||||
|
||||
# -----------------------------
|
||||
# Install files
|
||||
# -----------------------------
|
||||
INSTALL(TARGETS ${PROJECT_NAME}
|
||||
RUNTIME DESTINATION ${DIST_BINDIR}
|
||||
LIBRARY DESTINATION ${DIST_LIBDIR}
|
||||
ARCHIVE DESTINATION ${DIST_LIBDIR})
|
||||
|
||||
+144
@@ -0,0 +1,144 @@
|
||||
#include "ovpCAcquisitionDecoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Plugins {
|
||||
namespace StreamCodecs {
|
||||
|
||||
CAcquisitionDecoder::CAcquisitionDecoder() {}
|
||||
|
||||
// ________________________________________________________________________________________________________________
|
||||
//
|
||||
|
||||
bool CAcquisitionDecoder::initialize()
|
||||
{
|
||||
CEBMLBaseDecoder::initialize();
|
||||
|
||||
op_bufferDuration.initialize(getOutputParameter(OVP_Algorithm_AcquisitionDecoder_OutputParameterId_BufferDuration));
|
||||
op_experimentInfoStream.initialize(getOutputParameter(OVP_Algorithm_AcquisitionDecoder_OutputParameterId_ExperimentInfoStream));
|
||||
op_signalStream.initialize(getOutputParameter(OVP_Algorithm_AcquisitionDecoder_OutputParameterId_SignalStream));
|
||||
op_stimulationStream.initialize(getOutputParameter(OVP_Algorithm_AcquisitionDecoder_OutputParameterId_StimulationStream));
|
||||
op_channelLocalisationStream.initialize(getOutputParameter(OVP_Algorithm_AcquisitionDecoder_OutputParameterId_ChannelLocalisationStream));
|
||||
op_channelUnitsStream.initialize(getOutputParameter(OVP_Algorithm_AcquisitionDecoder_OutputParameterId_ChannelUnitsStream));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CAcquisitionDecoder::uninitialize()
|
||||
{
|
||||
op_channelUnitsStream.uninitialize();
|
||||
op_channelLocalisationStream.uninitialize();
|
||||
op_stimulationStream.uninitialize();
|
||||
op_signalStream.uninitialize();
|
||||
op_experimentInfoStream.uninitialize();
|
||||
op_bufferDuration.uninitialize();
|
||||
|
||||
CEBMLBaseDecoder::uninitialize();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ________________________________________________________________________________________________________________
|
||||
//
|
||||
|
||||
bool CAcquisitionDecoder::isMasterChild(const EBML::CIdentifier& identifier)
|
||||
{
|
||||
if (identifier == OVTK_NodeId_Acquisition_Header_BufferDuration) { return false; }
|
||||
if (identifier == OVTK_NodeId_Acquisition_Header_ExperimentInfo) { return false; }
|
||||
if (identifier == OVTK_NodeId_Acquisition_Header_Signal) { return false; }
|
||||
if (identifier == OVTK_NodeId_Acquisition_Header_Stimulation) { return false; }
|
||||
if (identifier == OVTK_NodeId_Acquisition_Header_ChannelLocalisation) { return false; }
|
||||
if (identifier == OVTK_NodeId_Acquisition_Header_ChannelUnits) { return false; }
|
||||
if (identifier == OVTK_NodeId_Acquisition_Buffer_ExperimentInfo) { return false; }
|
||||
if (identifier == OVTK_NodeId_Acquisition_Buffer_Signal) { return false; }
|
||||
if (identifier == OVTK_NodeId_Acquisition_Buffer_Stimulation) { return false; }
|
||||
if (identifier == OVTK_NodeId_Acquisition_Buffer_ChannelLocalisation) { return false; }
|
||||
if (identifier == OVTK_NodeId_Acquisition_Buffer_ChannelUnits) { return false; }
|
||||
return CEBMLBaseDecoder::isMasterChild(identifier);
|
||||
}
|
||||
|
||||
void CAcquisitionDecoder::openChild(const EBML::CIdentifier& identifier)
|
||||
{
|
||||
m_nodes.push(identifier);
|
||||
|
||||
EBML::CIdentifier& top = m_nodes.top();
|
||||
|
||||
if ((top == OVTK_NodeId_Acquisition_Header_BufferDuration)
|
||||
|| (top == OVTK_NodeId_Acquisition_Header_ExperimentInfo)
|
||||
|| (top == OVTK_NodeId_Acquisition_Header_Signal)
|
||||
|| (top == OVTK_NodeId_Acquisition_Header_Stimulation)
|
||||
|| (top == OVTK_NodeId_Acquisition_Header_ChannelLocalisation)
|
||||
|| (top == OVTK_NodeId_Acquisition_Header_ChannelUnits)
|
||||
|| (top == OVTK_NodeId_Acquisition_Buffer_ExperimentInfo)
|
||||
|| (top == OVTK_NodeId_Acquisition_Buffer_Signal)
|
||||
|| (top == OVTK_NodeId_Acquisition_Buffer_Stimulation)
|
||||
|| (top == OVTK_NodeId_Acquisition_Buffer_ChannelLocalisation)
|
||||
|| (top == OVTK_NodeId_Acquisition_Buffer_ChannelUnits)
|
||||
) { }
|
||||
else { CEBMLBaseDecoder::openChild(identifier); }
|
||||
}
|
||||
|
||||
void CAcquisitionDecoder::processChildData(const void* buffer, const size_t size)
|
||||
{
|
||||
EBML::CIdentifier& top = m_nodes.top();
|
||||
|
||||
if ((top == OVTK_NodeId_Acquisition_Header_BufferDuration)
|
||||
|| (top == OVTK_NodeId_Acquisition_Header_ExperimentInfo)
|
||||
|| (top == OVTK_NodeId_Acquisition_Header_Signal)
|
||||
|| (top == OVTK_NodeId_Acquisition_Header_Stimulation)
|
||||
|| (top == OVTK_NodeId_Acquisition_Header_ChannelLocalisation)
|
||||
|| (top == OVTK_NodeId_Acquisition_Header_ChannelUnits)
|
||||
|| (top == OVTK_NodeId_Acquisition_Buffer_ExperimentInfo)
|
||||
|| (top == OVTK_NodeId_Acquisition_Buffer_Signal)
|
||||
|| (top == OVTK_NodeId_Acquisition_Buffer_Stimulation)
|
||||
|| (top == OVTK_NodeId_Acquisition_Buffer_ChannelLocalisation)
|
||||
|| (top == OVTK_NodeId_Acquisition_Buffer_ChannelUnits)
|
||||
)
|
||||
{
|
||||
if (top == OVTK_NodeId_Acquisition_Header_BufferDuration) { op_bufferDuration = m_readerHelper->getUInt(buffer, size); }
|
||||
if (top == OVTK_NodeId_Acquisition_Header_ExperimentInfo) { appendMemoryBuffer(op_experimentInfoStream, buffer, size); }
|
||||
if (top == OVTK_NodeId_Acquisition_Header_Signal) { appendMemoryBuffer(op_signalStream, buffer, size); }
|
||||
if (top == OVTK_NodeId_Acquisition_Header_Stimulation) { appendMemoryBuffer(op_stimulationStream, buffer, size); }
|
||||
if (top == OVTK_NodeId_Acquisition_Header_ChannelLocalisation) { appendMemoryBuffer(op_channelLocalisationStream, buffer, size); }
|
||||
if (top == OVTK_NodeId_Acquisition_Header_ChannelUnits) { appendMemoryBuffer(op_channelUnitsStream, buffer, size); }
|
||||
if (top == OVTK_NodeId_Acquisition_Buffer_ExperimentInfo) { appendMemoryBuffer(op_experimentInfoStream, buffer, size); }
|
||||
if (top == OVTK_NodeId_Acquisition_Buffer_Signal) { appendMemoryBuffer(op_signalStream, buffer, size); }
|
||||
if (top == OVTK_NodeId_Acquisition_Buffer_Stimulation) { appendMemoryBuffer(op_stimulationStream, buffer, size); }
|
||||
if (top == OVTK_NodeId_Acquisition_Buffer_ChannelLocalisation) { appendMemoryBuffer(op_channelLocalisationStream, buffer, size); }
|
||||
if (top == OVTK_NodeId_Acquisition_Buffer_ChannelUnits) { appendMemoryBuffer(op_channelUnitsStream, buffer, size); }
|
||||
}
|
||||
else { CEBMLBaseDecoder::processChildData(buffer, size); }
|
||||
}
|
||||
|
||||
void CAcquisitionDecoder::closeChild()
|
||||
{
|
||||
EBML::CIdentifier& top = m_nodes.top();
|
||||
|
||||
if ((top == OVTK_NodeId_Acquisition_Header_BufferDuration)
|
||||
|| (top == OVTK_NodeId_Acquisition_Header_ExperimentInfo)
|
||||
|| (top == OVTK_NodeId_Acquisition_Header_Signal)
|
||||
|| (top == OVTK_NodeId_Acquisition_Header_Stimulation)
|
||||
|| (top == OVTK_NodeId_Acquisition_Header_ChannelLocalisation)
|
||||
|| (top == OVTK_NodeId_Acquisition_Header_ChannelUnits)
|
||||
|| (top == OVTK_NodeId_Acquisition_Buffer_ExperimentInfo)
|
||||
|| (top == OVTK_NodeId_Acquisition_Buffer_Signal)
|
||||
|| (top == OVTK_NodeId_Acquisition_Buffer_Stimulation)
|
||||
|| (top == OVTK_NodeId_Acquisition_Buffer_ChannelLocalisation)
|
||||
|| (top == OVTK_NodeId_Acquisition_Buffer_ChannelUnits)
|
||||
) { }
|
||||
else { CEBMLBaseDecoder::closeChild(); }
|
||||
|
||||
m_nodes.pop();
|
||||
}
|
||||
|
||||
void CAcquisitionDecoder::appendMemoryBuffer(IMemoryBuffer* memoryBuffer, const void* buffer, const size_t size)
|
||||
{
|
||||
if (memoryBuffer)
|
||||
{
|
||||
const size_t currentBufferSize = memoryBuffer->getSize();
|
||||
memoryBuffer->setSize(currentBufferSize + size, false);
|
||||
memcpy(memoryBuffer->getDirectPointer() + currentBufferSize, buffer, size);
|
||||
}
|
||||
}
|
||||
} // namespace StreamCodecs
|
||||
} // namespace Plugins
|
||||
} // namespace OpenViBE
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../ovp_defines.h"
|
||||
#include "ovpCEBMLBaseDecoder.h"
|
||||
#include <stack>
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Plugins {
|
||||
namespace StreamCodecs {
|
||||
class CAcquisitionDecoder final : public CEBMLBaseDecoder
|
||||
{
|
||||
public:
|
||||
|
||||
CAcquisitionDecoder();
|
||||
void release() override { delete this; }
|
||||
bool initialize() override;
|
||||
bool uninitialize() override;
|
||||
|
||||
_IsDerivedFromClass_Final_(StreamCodecs::CEBMLBaseDecoder, OVP_ClassId_Algorithm_AcquisitionDecoder)
|
||||
|
||||
// ebml callbacks
|
||||
bool isMasterChild(const EBML::CIdentifier& identifier) override;
|
||||
void openChild(const EBML::CIdentifier& identifier) override;
|
||||
void processChildData(const void* buffer, const size_t size) override;
|
||||
void closeChild() override;
|
||||
|
||||
protected:
|
||||
|
||||
static void appendMemoryBuffer(IMemoryBuffer* memoryBuffer, const void* buffer, size_t size);
|
||||
|
||||
Kernel::TParameterHandler<uint64_t> op_bufferDuration;
|
||||
Kernel::TParameterHandler<IMemoryBuffer*> op_experimentInfoStream;
|
||||
Kernel::TParameterHandler<IMemoryBuffer*> op_signalStream;
|
||||
Kernel::TParameterHandler<IMemoryBuffer*> op_stimulationStream;
|
||||
Kernel::TParameterHandler<IMemoryBuffer*> op_channelLocalisationStream;
|
||||
Kernel::TParameterHandler<IMemoryBuffer*> op_channelUnitsStream;
|
||||
|
||||
private:
|
||||
|
||||
std::stack<EBML::CIdentifier> m_nodes;
|
||||
};
|
||||
|
||||
class CAcquisitionDecoderDesc final : public CEBMLBaseDecoderDesc
|
||||
{
|
||||
public:
|
||||
void release() override { }
|
||||
CString getName() const override { return CString("Acquisition stream decoder"); }
|
||||
CString getAuthorName() const override { return CString("Yann Renard"); }
|
||||
CString getAuthorCompanyName() const override { return CString("INRIA/IRISA"); }
|
||||
CString getShortDescription() const override { return CString(""); }
|
||||
CString getDetailedDescription() const override { return CString(""); }
|
||||
CString getCategory() const override { return CString("Stream codecs/Decoders"); }
|
||||
CString getVersion() const override { return CString("1.1"); }
|
||||
CString getSoftwareComponent() const override { return CString("openvibe-sdk"); }
|
||||
CString getAddedSoftwareVersion() const override { return CString("0.0.0"); }
|
||||
CString getUpdatedSoftwareVersion() const override { return CString("0.0.0"); }
|
||||
CIdentifier getCreatedClass() const override { return OVP_ClassId_Algorithm_AcquisitionDecoder; }
|
||||
IPluginObject* create() override { return new CAcquisitionDecoder(); }
|
||||
|
||||
bool getAlgorithmPrototype(Kernel::IAlgorithmProto& prototype) const override
|
||||
{
|
||||
CEBMLBaseDecoderDesc::getAlgorithmPrototype(prototype);
|
||||
|
||||
prototype.addOutputParameter(OVP_Algorithm_AcquisitionDecoder_OutputParameterId_BufferDuration, "Buffer duration", Kernel::ParameterType_UInteger);
|
||||
prototype.addOutputParameter(OVP_Algorithm_AcquisitionDecoder_OutputParameterId_ExperimentInfoStream, "Experiment information stream",
|
||||
Kernel::ParameterType_MemoryBuffer);
|
||||
prototype.addOutputParameter(OVP_Algorithm_AcquisitionDecoder_OutputParameterId_SignalStream, "Signal stream", Kernel::ParameterType_MemoryBuffer);
|
||||
prototype.addOutputParameter(OVP_Algorithm_AcquisitionDecoder_OutputParameterId_StimulationStream, "Stimulation stream",
|
||||
Kernel::ParameterType_MemoryBuffer);
|
||||
prototype.addOutputParameter(OVP_Algorithm_AcquisitionDecoder_OutputParameterId_ChannelLocalisationStream, "Channel localisation stream",
|
||||
Kernel::ParameterType_MemoryBuffer);
|
||||
prototype.addOutputParameter(OVP_Algorithm_AcquisitionDecoder_OutputParameterId_ChannelUnitsStream, "Channel units stream",
|
||||
Kernel::ParameterType_MemoryBuffer);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
_IsDerivedFromClass_Final_(StreamCodecs::CEBMLBaseDecoderDesc, OVP_ClassId_Algorithm_AcquisitionDecoderDesc)
|
||||
};
|
||||
} // namespace StreamCodecs
|
||||
} // namespace Plugins
|
||||
} // namespace OpenViBE
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
#include "ovpCChannelLocalisationDecoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Plugins {
|
||||
namespace StreamCodecs {
|
||||
|
||||
// ________________________________________________________________________________________________________________
|
||||
//
|
||||
|
||||
bool CChannelLocalisationDecoder::initialize()
|
||||
{
|
||||
CStreamedMatrixDecoder::initialize();
|
||||
op_bDynamic.initialize(getOutputParameter(OVP_Algorithm_ChannelLocalisationDecoder_OutputParameterId_Dynamic));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CChannelLocalisationDecoder::uninitialize()
|
||||
{
|
||||
op_bDynamic.uninitialize();
|
||||
CStreamedMatrixDecoder::uninitialize();
|
||||
return true;
|
||||
}
|
||||
|
||||
// ________________________________________________________________________________________________________________
|
||||
//
|
||||
|
||||
bool CChannelLocalisationDecoder::isMasterChild(const EBML::CIdentifier& identifier)
|
||||
{
|
||||
if (identifier == OVTK_NodeId_Header_ChannelLocalisation) { return true; }
|
||||
if (identifier == OVTK_NodeId_Header_ChannelLocalisation_Dynamic) { return false; }
|
||||
return CStreamedMatrixDecoder::isMasterChild(identifier);
|
||||
}
|
||||
|
||||
void CChannelLocalisationDecoder::openChild(const EBML::CIdentifier& identifier)
|
||||
{
|
||||
m_nodes.push(identifier);
|
||||
|
||||
EBML::CIdentifier& top = m_nodes.top();
|
||||
|
||||
if ((top == OVTK_NodeId_Header_ChannelLocalisation) || (top == OVTK_NodeId_Header_ChannelLocalisation_Dynamic)) { }
|
||||
else { CStreamedMatrixDecoder::openChild(identifier); }
|
||||
}
|
||||
|
||||
void CChannelLocalisationDecoder::processChildData(const void* buffer, const size_t size)
|
||||
{
|
||||
EBML::CIdentifier& top = m_nodes.top();
|
||||
|
||||
if ((top == OVTK_NodeId_Header_ChannelLocalisation) || (top == OVTK_NodeId_Header_ChannelLocalisation_Dynamic))
|
||||
{
|
||||
if (top == OVTK_NodeId_Header_ChannelLocalisation_Dynamic) { op_bDynamic = (m_readerHelper->getUInt(buffer, size) ? true : false); }
|
||||
}
|
||||
else { CStreamedMatrixDecoder::processChildData(buffer, size); }
|
||||
}
|
||||
|
||||
void CChannelLocalisationDecoder::closeChild()
|
||||
{
|
||||
EBML::CIdentifier& top = m_nodes.top();
|
||||
|
||||
if ((top == OVTK_NodeId_Header_ChannelLocalisation) || (top == OVTK_NodeId_Header_ChannelLocalisation_Dynamic)) { }
|
||||
else { CStreamedMatrixDecoder::closeChild(); }
|
||||
|
||||
m_nodes.pop();
|
||||
}
|
||||
|
||||
} // namespace StreamCodecs
|
||||
} // namespace Plugins
|
||||
} // namespace OpenViBE
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../ovp_defines.h"
|
||||
#include "ovpCStreamedMatrixDecoder.h"
|
||||
#include <stack>
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Plugins {
|
||||
namespace StreamCodecs {
|
||||
class CChannelLocalisationDecoder final : public CStreamedMatrixDecoder
|
||||
{
|
||||
public:
|
||||
void release() override { delete this; }
|
||||
bool initialize() override;
|
||||
bool uninitialize() override;
|
||||
|
||||
_IsDerivedFromClass_Final_(StreamCodecs::CStreamedMatrixDecoder, OVP_ClassId_Algorithm_ChannelLocalisationDecoder)
|
||||
|
||||
// ebml callbacks
|
||||
bool isMasterChild(const EBML::CIdentifier& identifier) override;
|
||||
void openChild(const EBML::CIdentifier& identifier) override;
|
||||
void processChildData(const void* buffer, const size_t size) override;
|
||||
void closeChild() override;
|
||||
|
||||
protected:
|
||||
|
||||
Kernel::TParameterHandler<bool> op_bDynamic;
|
||||
|
||||
private:
|
||||
|
||||
std::stack<EBML::CIdentifier> m_nodes;
|
||||
};
|
||||
|
||||
class CChannelLocalisationDecoderDesc final : public CStreamedMatrixDecoderDesc
|
||||
{
|
||||
public:
|
||||
void release() override { }
|
||||
CString getName() const override { return CString("Channel localisation stream decoder"); }
|
||||
CString getAuthorName() const override { return CString("Yann Renard"); }
|
||||
CString getAuthorCompanyName() const override { return CString("INRIA/IRISA"); }
|
||||
CString getShortDescription() const override { return CString(""); }
|
||||
CString getDetailedDescription() const override { return CString(""); }
|
||||
CString getCategory() const override { return CString("Stream codecs/Decoders"); }
|
||||
CString getVersion() const override { return CString("1.0"); }
|
||||
CString getSoftwareComponent() const override { return CString("openvibe-sdk"); }
|
||||
CString getAddedSoftwareVersion() const override { return CString("0.0.0"); }
|
||||
CString getUpdatedSoftwareVersion() const override { return CString("0.0.0"); }
|
||||
CIdentifier getCreatedClass() const override { return OVP_ClassId_Algorithm_ChannelLocalisationDecoder; }
|
||||
IPluginObject* create() override { return new CChannelLocalisationDecoder(); }
|
||||
|
||||
bool getAlgorithmPrototype(Kernel::IAlgorithmProto& prototype) const override
|
||||
{
|
||||
CStreamedMatrixDecoderDesc::getAlgorithmPrototype(prototype);
|
||||
|
||||
prototype.addOutputParameter(OVP_Algorithm_ChannelLocalisationDecoder_OutputParameterId_Dynamic, "Dynamic", Kernel::ParameterType_Boolean);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
_IsDerivedFromClass_Final_(StreamCodecs::CStreamedMatrixDecoderDesc, OVP_ClassId_Algorithm_ChannelLocalisationDecoderDesc)
|
||||
};
|
||||
} // namespace StreamCodecs
|
||||
} // namespace Plugins
|
||||
} // namespace OpenViBE
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
#include "ovpCChannelUnitsDecoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Plugins {
|
||||
namespace StreamCodecs {
|
||||
|
||||
// ________________________________________________________________________________________________________________
|
||||
//
|
||||
|
||||
bool CChannelUnitsDecoder::initialize()
|
||||
{
|
||||
CStreamedMatrixDecoder::initialize();
|
||||
op_bDynamic.initialize(getOutputParameter(OVP_Algorithm_ChannelUnitsDecoder_OutputParameterId_Dynamic));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CChannelUnitsDecoder::uninitialize()
|
||||
{
|
||||
op_bDynamic.uninitialize();
|
||||
CStreamedMatrixDecoder::uninitialize();
|
||||
return true;
|
||||
}
|
||||
|
||||
// ________________________________________________________________________________________________________________
|
||||
//
|
||||
|
||||
bool CChannelUnitsDecoder::isMasterChild(const EBML::CIdentifier& identifier)
|
||||
{
|
||||
if (identifier == OVTK_NodeId_Header_ChannelUnits) { return true; }
|
||||
if (identifier == OVTK_NodeId_Header_ChannelUnits_Dynamic) { return false; }
|
||||
return CStreamedMatrixDecoder::isMasterChild(identifier);
|
||||
}
|
||||
|
||||
void CChannelUnitsDecoder::openChild(const EBML::CIdentifier& identifier)
|
||||
{
|
||||
m_nodes.push(identifier);
|
||||
|
||||
EBML::CIdentifier& top = m_nodes.top();
|
||||
|
||||
if ((top == OVTK_NodeId_Header_ChannelUnits)
|
||||
|| (top == OVTK_NodeId_Header_ChannelUnits_Dynamic)
|
||||
) { }
|
||||
else { CStreamedMatrixDecoder::openChild(identifier); }
|
||||
}
|
||||
|
||||
void CChannelUnitsDecoder::processChildData(const void* buffer, const size_t size)
|
||||
{
|
||||
EBML::CIdentifier& top = m_nodes.top();
|
||||
|
||||
if ((top == OVTK_NodeId_Header_ChannelUnits)
|
||||
|| (top == OVTK_NodeId_Header_ChannelUnits_Dynamic)
|
||||
)
|
||||
{
|
||||
if (top == OVTK_NodeId_Header_ChannelUnits_Dynamic) { op_bDynamic = (m_readerHelper->getUInt(buffer, size) ? true : false); }
|
||||
|
||||
//if(top==OVTK_NodeId_Header_ChannelUnits_MeasurementUnit_Unit) op_pMeasurementUnits->getBuffer()[m_unitIdx*2 ]=m_readerHelper->getDouble(buffer, size);
|
||||
//if(top==OVTK_NodeId_Header_ChannelUnits_MeasurementUnit_Factor) op_pMeasurementUnits->getBuffer()[m_unitIdx*2+1]=m_readerHelper->getDouble(buffer, size);
|
||||
}
|
||||
else { CStreamedMatrixDecoder::processChildData(buffer, size); }
|
||||
}
|
||||
|
||||
void CChannelUnitsDecoder::closeChild()
|
||||
{
|
||||
EBML::CIdentifier& top = m_nodes.top();
|
||||
|
||||
if ((top == OVTK_NodeId_Header_ChannelUnits)
|
||||
|| (top == OVTK_NodeId_Header_ChannelUnits_Dynamic)
|
||||
)
|
||||
{
|
||||
//if(top==OVTK_NodeId_Header_ChannelUnits_MeasurementUnit)
|
||||
//{
|
||||
// m_unitIdx++;
|
||||
//}
|
||||
}
|
||||
else { CStreamedMatrixDecoder::closeChild(); }
|
||||
|
||||
m_nodes.pop();
|
||||
}
|
||||
} // namespace StreamCodecs
|
||||
} // namespace Plugins
|
||||
} // namespace OpenViBE
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../ovp_defines.h"
|
||||
#include "ovpCStreamedMatrixDecoder.h"
|
||||
#include <stack>
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Plugins {
|
||||
namespace StreamCodecs {
|
||||
class CChannelUnitsDecoder final : public CStreamedMatrixDecoder
|
||||
{
|
||||
public:
|
||||
void release() override { delete this; }
|
||||
bool initialize() override;
|
||||
bool uninitialize() override;
|
||||
|
||||
_IsDerivedFromClass_Final_(StreamCodecs::CStreamedMatrixDecoder, OVP_ClassId_Algorithm_ChannelUnitsDecoder)
|
||||
|
||||
// ebml callbacks
|
||||
bool isMasterChild(const EBML::CIdentifier& identifier) override;
|
||||
void openChild(const EBML::CIdentifier& identifier) override;
|
||||
void processChildData(const void* buffer, const size_t size) override;
|
||||
void closeChild() override;
|
||||
|
||||
protected:
|
||||
|
||||
Kernel::TParameterHandler<bool> op_bDynamic;
|
||||
|
||||
private:
|
||||
|
||||
std::stack<EBML::CIdentifier> m_nodes;
|
||||
// size_t m_unitIdx = 0;
|
||||
};
|
||||
|
||||
class CChannelUnitsDecoderDesc final : public CStreamedMatrixDecoderDesc
|
||||
{
|
||||
public:
|
||||
void release() override { }
|
||||
CString getName() const override { return CString("Channel units stream decoder"); }
|
||||
CString getAuthorName() const override { return CString("Yann Renard"); }
|
||||
CString getAuthorCompanyName() const override { return CString("INRIA/IRISA"); }
|
||||
CString getShortDescription() const override { return CString(""); }
|
||||
CString getDetailedDescription() const override { return CString(""); }
|
||||
CString getCategory() const override { return CString("Stream codecs/Decoders"); }
|
||||
CString getVersion() const override { return CString("1.0"); }
|
||||
CString getSoftwareComponent() const override { return CString("openvibe-sdk"); }
|
||||
CString getAddedSoftwareVersion() const override { return CString("0.0.0"); }
|
||||
CString getUpdatedSoftwareVersion() const override { return CString("0.0.0"); }
|
||||
CIdentifier getCreatedClass() const override { return OVP_ClassId_Algorithm_ChannelUnitsDecoder; }
|
||||
IPluginObject* create() override { return new CChannelUnitsDecoder(); }
|
||||
|
||||
bool getAlgorithmPrototype(Kernel::IAlgorithmProto& prototype) const override
|
||||
{
|
||||
CStreamedMatrixDecoderDesc::getAlgorithmPrototype(prototype);
|
||||
|
||||
prototype.addOutputParameter(OVP_Algorithm_ChannelUnitsDecoder_OutputParameterId_Dynamic, "Dynamic", Kernel::ParameterType_Boolean);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
_IsDerivedFromClass_Final_(StreamCodecs::CStreamedMatrixDecoderDesc, OVP_ClassId_Algorithm_ChannelUnitsDecoderDesc)
|
||||
};
|
||||
} // namespace StreamCodecs
|
||||
} // namespace Plugins
|
||||
} // namespace OpenViBE
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
#include "ovpCEBMLBaseDecoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Plugins {
|
||||
namespace StreamCodecs {
|
||||
|
||||
CEBMLBaseDecoder::CEBMLBaseDecoder()
|
||||
: m_callbackProxy(*this, &CEBMLBaseDecoder::isMasterChild, &CEBMLBaseDecoder::openChild, &CEBMLBaseDecoder::processChildData,
|
||||
&CEBMLBaseDecoder::closeChild) {}
|
||||
|
||||
// ________________________________________________________________________________________________________________
|
||||
//
|
||||
|
||||
bool CEBMLBaseDecoder::initialize()
|
||||
{
|
||||
ip_bufferToDecode.initialize(getInputParameter(OVP_Algorithm_EBMLDecoder_InputParameterId_MemoryBufferToDecode));
|
||||
m_readerHelper = EBML::createReaderHelper();
|
||||
m_reader = createReader(m_callbackProxy);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CEBMLBaseDecoder::uninitialize()
|
||||
{
|
||||
m_reader->release();
|
||||
m_reader = nullptr;
|
||||
|
||||
m_readerHelper->release();
|
||||
m_readerHelper = nullptr;
|
||||
|
||||
ip_bufferToDecode.uninitialize();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ________________________________________________________________________________________________________________
|
||||
//
|
||||
|
||||
bool CEBMLBaseDecoder::process()
|
||||
{
|
||||
m_reader->processData(ip_bufferToDecode->getDirectPointer(), ip_bufferToDecode->getSize());
|
||||
return true;
|
||||
}
|
||||
|
||||
// ________________________________________________________________________________________________________________
|
||||
//
|
||||
|
||||
bool CEBMLBaseDecoder::isMasterChild(const EBML::CIdentifier& identifier)
|
||||
{
|
||||
if (identifier == OVTK_NodeId_Header) { return true; }
|
||||
if (identifier == OVTK_NodeId_Header_StreamVersion) { return false; }
|
||||
if (identifier == OVTK_NodeId_Header_StreamType) { return false; }
|
||||
if (identifier == OVTK_NodeId_Buffer) { return true; }
|
||||
if (identifier == OVTK_NodeId_End) { return true; }
|
||||
return false;
|
||||
}
|
||||
|
||||
void CEBMLBaseDecoder::openChild(const EBML::CIdentifier& identifier)
|
||||
{
|
||||
if (identifier == OVTK_NodeId_Header) { activateOutputTrigger(OVP_Algorithm_EBMLDecoder_OutputTriggerId_ReceivedHeader, true); }
|
||||
if (identifier == OVTK_NodeId_Buffer) { activateOutputTrigger(OVP_Algorithm_EBMLDecoder_OutputTriggerId_ReceivedBuffer, true); }
|
||||
if (identifier == OVTK_NodeId_End) { activateOutputTrigger(OVP_Algorithm_EBMLDecoder_OutputTriggerId_ReceivedEnd, true); }
|
||||
}
|
||||
|
||||
} // namespace StreamCodecs
|
||||
} // namespace Plugins
|
||||
} // namespace OpenViBE
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../ovp_defines.h"
|
||||
#include <openvibe/ov_all.h>
|
||||
#include <toolkit/ovtk_all.h>
|
||||
|
||||
#include <ebml/IReader.h>
|
||||
#include <ebml/IReaderHelper.h>
|
||||
#include <ebml/TReaderCallbackProxy.h>
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Plugins {
|
||||
namespace StreamCodecs {
|
||||
class CEBMLBaseDecoder : public Toolkit::TAlgorithm<IAlgorithm>
|
||||
{
|
||||
public:
|
||||
|
||||
CEBMLBaseDecoder();
|
||||
void release() override { delete this; }
|
||||
bool initialize() override;
|
||||
bool uninitialize() override;
|
||||
bool process() override;
|
||||
|
||||
_IsDerivedFromClass_Final_(Toolkit::TAlgorithm<IAlgorithm>, OVP_ClassId_Algorithm_EBMLBaseDecoder)
|
||||
|
||||
// ebml callbacks
|
||||
virtual bool isMasterChild(const EBML::CIdentifier& identifier);
|
||||
virtual void openChild(const EBML::CIdentifier& identifier);
|
||||
virtual void processChildData(const void* /*buffer*/, const size_t /*size*/) { }
|
||||
virtual void closeChild() { }
|
||||
|
||||
protected:
|
||||
|
||||
EBML::IReaderHelper* m_readerHelper = nullptr;
|
||||
EBML::IReader* m_reader = nullptr;
|
||||
EBML::TReaderCallbackProxy1<CEBMLBaseDecoder> m_callbackProxy;
|
||||
|
||||
Kernel::TParameterHandler<IMemoryBuffer*> ip_bufferToDecode;
|
||||
};
|
||||
|
||||
class CEBMLBaseDecoderDesc : public IAlgorithmDesc
|
||||
{
|
||||
public:
|
||||
bool getAlgorithmPrototype(Kernel::IAlgorithmProto& prototype) const override
|
||||
{
|
||||
prototype.addInputParameter(OVP_Algorithm_EBMLDecoder_InputParameterId_MemoryBufferToDecode, "Memory buffer to decode",
|
||||
Kernel::ParameterType_MemoryBuffer);
|
||||
|
||||
prototype.addOutputTrigger(OVP_Algorithm_EBMLDecoder_OutputTriggerId_ReceivedHeader, "Received header");
|
||||
prototype.addOutputTrigger(OVP_Algorithm_EBMLDecoder_OutputTriggerId_ReceivedBuffer, "Received buffer");
|
||||
prototype.addOutputTrigger(OVP_Algorithm_EBMLDecoder_OutputTriggerId_ReceivedEnd, "Received end");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
_IsDerivedFromClass_(IAlgorithmDesc, OVP_ClassId_Algorithm_EBMLBaseDecoderDesc)
|
||||
};
|
||||
} // namespace StreamCodecs
|
||||
} // namespace Plugins
|
||||
} // namespace OpenViBE
|
||||
+151
@@ -0,0 +1,151 @@
|
||||
#include "ovpCExperimentInfoDecoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Plugins {
|
||||
namespace StreamCodecs {
|
||||
|
||||
CExperimentInfoDecoder::CExperimentInfoDecoder() {}
|
||||
|
||||
// ________________________________________________________________________________________________________________
|
||||
//
|
||||
|
||||
bool CExperimentInfoDecoder::initialize()
|
||||
{
|
||||
CEBMLBaseDecoder::initialize();
|
||||
|
||||
op_ExperimentID.initialize(getOutputParameter(OVP_Algorithm_ExperimentInfoDecoder_OutputParameterId_ExperimentID));
|
||||
op_experimentDate.initialize(getOutputParameter(OVP_Algorithm_ExperimentInfoDecoder_OutputParameterId_ExperimentDate));
|
||||
op_subjectID.initialize(getOutputParameter(OVP_Algorithm_ExperimentInfoDecoder_OutputParameterId_SubjectID));
|
||||
op_subjectName.initialize(getOutputParameter(OVP_Algorithm_ExperimentInfoDecoder_OutputParameterId_SubjectName));
|
||||
op_subjectAge.initialize(getOutputParameter(OVP_Algorithm_ExperimentInfoDecoder_OutputParameterId_SubjectAge));
|
||||
op_subjectGender.initialize(getOutputParameter(OVP_Algorithm_ExperimentInfoDecoder_OutputParameterId_SubjectGender));
|
||||
op_LaboratoryID.initialize(getOutputParameter(OVP_Algorithm_ExperimentInfoDecoder_OutputParameterId_LaboratoryID));
|
||||
op_pLaboratoryName.initialize(getOutputParameter(OVP_Algorithm_ExperimentInfoDecoder_OutputParameterId_LaboratoryName));
|
||||
op_TechnicianID.initialize(getOutputParameter(OVP_Algorithm_ExperimentInfoDecoder_OutputParameterId_TechnicianID));
|
||||
op_pTechnicianName.initialize(getOutputParameter(OVP_Algorithm_ExperimentInfoDecoder_OutputParameterId_TechnicianName));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CExperimentInfoDecoder::uninitialize()
|
||||
{
|
||||
op_pTechnicianName.uninitialize();
|
||||
op_TechnicianID.uninitialize();
|
||||
op_pLaboratoryName.uninitialize();
|
||||
op_LaboratoryID.uninitialize();
|
||||
op_subjectGender.uninitialize();
|
||||
op_subjectAge.uninitialize();
|
||||
op_subjectName.uninitialize();
|
||||
op_subjectID.uninitialize();
|
||||
op_experimentDate.uninitialize();
|
||||
op_ExperimentID.uninitialize();
|
||||
|
||||
CEBMLBaseDecoder::uninitialize();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ________________________________________________________________________________________________________________
|
||||
//
|
||||
|
||||
bool CExperimentInfoDecoder::isMasterChild(const EBML::CIdentifier& identifier)
|
||||
{
|
||||
if (identifier == OVTK_NodeId_Header_ExperimentInfo) { return true; }
|
||||
if (identifier == OVTK_NodeId_Header_ExperimentInfo_Experiment) { return true; }
|
||||
if (identifier == OVTK_NodeId_Header_ExperimentInfo_Experiment_ID) { return false; }
|
||||
if (identifier == OVTK_NodeId_Header_ExperimentInfo_Experiment_Date) { return false; }
|
||||
if (identifier == OVTK_NodeId_Header_ExperimentInfo_Subject) { return true; }
|
||||
if (identifier == OVTK_NodeId_Header_ExperimentInfo_Subject_ID) { return false; }
|
||||
if (identifier == OVTK_NodeId_Header_ExperimentInfo_Subject_Name) { return false; }
|
||||
if (identifier == OVTK_NodeId_Header_ExperimentInfo_Subject_Age) { return false; }
|
||||
if (identifier == OVTK_NodeId_Header_ExperimentInfo_Subject_Gender) { return false; }
|
||||
if (identifier == OVTK_NodeId_Header_ExperimentInfo_Context) { return true; }
|
||||
if (identifier == OVTK_NodeId_Header_ExperimentInfo_Context_LaboratoryID) { return false; }
|
||||
if (identifier == OVTK_NodeId_Header_ExperimentInfo_Context_LaboratoryName) { return false; }
|
||||
if (identifier == OVTK_NodeId_Header_ExperimentInfo_Context_TechnicianID) { return false; }
|
||||
if (identifier == OVTK_NodeId_Header_ExperimentInfo_Context_TechnicianName) { return false; }
|
||||
return CEBMLBaseDecoder::isMasterChild(identifier);
|
||||
}
|
||||
|
||||
void CExperimentInfoDecoder::openChild(const EBML::CIdentifier& identifier)
|
||||
{
|
||||
m_nodes.push(identifier);
|
||||
|
||||
EBML::CIdentifier& top = m_nodes.top();
|
||||
|
||||
if ((top == OVTK_NodeId_Header_ExperimentInfo)
|
||||
|| (top == OVTK_NodeId_Header_ExperimentInfo_Experiment)
|
||||
|| (top == OVTK_NodeId_Header_ExperimentInfo_Experiment_ID)
|
||||
|| (top == OVTK_NodeId_Header_ExperimentInfo_Experiment_Date)
|
||||
|| (top == OVTK_NodeId_Header_ExperimentInfo_Subject)
|
||||
|| (top == OVTK_NodeId_Header_ExperimentInfo_Subject_ID)
|
||||
|| (top == OVTK_NodeId_Header_ExperimentInfo_Subject_Name)
|
||||
|| (top == OVTK_NodeId_Header_ExperimentInfo_Subject_Age)
|
||||
|| (top == OVTK_NodeId_Header_ExperimentInfo_Subject_Gender)
|
||||
|| (top == OVTK_NodeId_Header_ExperimentInfo_Context)
|
||||
|| (top == OVTK_NodeId_Header_ExperimentInfo_Context_LaboratoryID)
|
||||
|| (top == OVTK_NodeId_Header_ExperimentInfo_Context_LaboratoryName)
|
||||
|| (top == OVTK_NodeId_Header_ExperimentInfo_Context_TechnicianID)
|
||||
|| (top == OVTK_NodeId_Header_ExperimentInfo_Context_TechnicianName)) { }
|
||||
else { CEBMLBaseDecoder::openChild(identifier); }
|
||||
}
|
||||
|
||||
void CExperimentInfoDecoder::processChildData(const void* buffer, const size_t size)
|
||||
{
|
||||
EBML::CIdentifier& top = m_nodes.top();
|
||||
|
||||
if ((top == OVTK_NodeId_Header_ExperimentInfo)
|
||||
|| (top == OVTK_NodeId_Header_ExperimentInfo_Experiment)
|
||||
|| (top == OVTK_NodeId_Header_ExperimentInfo_Experiment_ID)
|
||||
|| (top == OVTK_NodeId_Header_ExperimentInfo_Experiment_Date)
|
||||
|| (top == OVTK_NodeId_Header_ExperimentInfo_Subject)
|
||||
|| (top == OVTK_NodeId_Header_ExperimentInfo_Subject_ID)
|
||||
|| (top == OVTK_NodeId_Header_ExperimentInfo_Subject_Name)
|
||||
|| (top == OVTK_NodeId_Header_ExperimentInfo_Subject_Age)
|
||||
|| (top == OVTK_NodeId_Header_ExperimentInfo_Subject_Gender)
|
||||
|| (top == OVTK_NodeId_Header_ExperimentInfo_Context)
|
||||
|| (top == OVTK_NodeId_Header_ExperimentInfo_Context_LaboratoryID)
|
||||
|| (top == OVTK_NodeId_Header_ExperimentInfo_Context_LaboratoryName)
|
||||
|| (top == OVTK_NodeId_Header_ExperimentInfo_Context_TechnicianID)
|
||||
|| (top == OVTK_NodeId_Header_ExperimentInfo_Context_TechnicianName))
|
||||
{
|
||||
if (top == OVTK_NodeId_Header_ExperimentInfo_Experiment_ID) { op_ExperimentID = m_readerHelper->getUInt(buffer, size); }
|
||||
if (top == OVTK_NodeId_Header_ExperimentInfo_Experiment_Date) { op_experimentDate->set(m_readerHelper->getStr(buffer, size)); }
|
||||
if (top == OVTK_NodeId_Header_ExperimentInfo_Subject_ID) { op_subjectID = m_readerHelper->getUInt(buffer, size); }
|
||||
if (top == OVTK_NodeId_Header_ExperimentInfo_Subject_Name) { op_subjectName->set(m_readerHelper->getStr(buffer, size)); }
|
||||
if (top == OVTK_NodeId_Header_ExperimentInfo_Subject_Age) { op_subjectAge = m_readerHelper->getUInt(buffer, size); }
|
||||
if (top == OVTK_NodeId_Header_ExperimentInfo_Subject_Gender) { op_subjectGender = m_readerHelper->getUInt(buffer, size); }
|
||||
if (top == OVTK_NodeId_Header_ExperimentInfo_Context_LaboratoryID) { op_LaboratoryID = m_readerHelper->getUInt(buffer, size); }
|
||||
if (top == OVTK_NodeId_Header_ExperimentInfo_Context_LaboratoryName) { op_pLaboratoryName->set(m_readerHelper->getStr(buffer, size)); }
|
||||
if (top == OVTK_NodeId_Header_ExperimentInfo_Context_TechnicianID) { op_TechnicianID = m_readerHelper->getUInt(buffer, size); }
|
||||
if (top == OVTK_NodeId_Header_ExperimentInfo_Context_TechnicianName) { op_pTechnicianName->set(m_readerHelper->getStr(buffer, size)); }
|
||||
}
|
||||
else { CEBMLBaseDecoder::processChildData(buffer, size); }
|
||||
}
|
||||
|
||||
void CExperimentInfoDecoder::closeChild()
|
||||
{
|
||||
EBML::CIdentifier& top = m_nodes.top();
|
||||
|
||||
if ((top == OVTK_NodeId_Header_ExperimentInfo)
|
||||
|| (top == OVTK_NodeId_Header_ExperimentInfo_Experiment)
|
||||
|| (top == OVTK_NodeId_Header_ExperimentInfo_Experiment_ID)
|
||||
|| (top == OVTK_NodeId_Header_ExperimentInfo_Experiment_Date)
|
||||
|| (top == OVTK_NodeId_Header_ExperimentInfo_Subject)
|
||||
|| (top == OVTK_NodeId_Header_ExperimentInfo_Subject_ID)
|
||||
|| (top == OVTK_NodeId_Header_ExperimentInfo_Subject_Name)
|
||||
|| (top == OVTK_NodeId_Header_ExperimentInfo_Subject_Age)
|
||||
|| (top == OVTK_NodeId_Header_ExperimentInfo_Subject_Gender)
|
||||
|| (top == OVTK_NodeId_Header_ExperimentInfo_Context)
|
||||
|| (top == OVTK_NodeId_Header_ExperimentInfo_Context_LaboratoryID)
|
||||
|| (top == OVTK_NodeId_Header_ExperimentInfo_Context_LaboratoryName)
|
||||
|| (top == OVTK_NodeId_Header_ExperimentInfo_Context_TechnicianID)
|
||||
|| (top == OVTK_NodeId_Header_ExperimentInfo_Context_TechnicianName)) { }
|
||||
else { CEBMLBaseDecoder::closeChild(); }
|
||||
|
||||
m_nodes.pop();
|
||||
}
|
||||
|
||||
} // namespace StreamCodecs
|
||||
} // namespace Plugins
|
||||
} // namespace OpenViBE
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../ovp_defines.h"
|
||||
#include "ovpCEBMLBaseDecoder.h"
|
||||
#include <stack>
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Plugins {
|
||||
namespace StreamCodecs {
|
||||
class CExperimentInfoDecoder final : public CEBMLBaseDecoder
|
||||
{
|
||||
public:
|
||||
|
||||
CExperimentInfoDecoder();
|
||||
void release() override { delete this; }
|
||||
bool initialize() override;
|
||||
bool uninitialize() override;
|
||||
|
||||
_IsDerivedFromClass_Final_(StreamCodecs::CEBMLBaseDecoder, OVP_ClassId_Algorithm_ExperimentInfoDecoder)
|
||||
|
||||
// ebml callbacks
|
||||
bool isMasterChild(const EBML::CIdentifier& identifier) override;
|
||||
void openChild(const EBML::CIdentifier& identifier) override;
|
||||
void processChildData(const void* buffer, const size_t size) override;
|
||||
void closeChild() override;
|
||||
|
||||
protected:
|
||||
|
||||
Kernel::TParameterHandler<uint64_t> op_ExperimentID;
|
||||
Kernel::TParameterHandler<CString*> op_experimentDate;
|
||||
|
||||
Kernel::TParameterHandler<uint64_t> op_subjectID;
|
||||
Kernel::TParameterHandler<CString*> op_subjectName;
|
||||
Kernel::TParameterHandler<uint64_t> op_subjectAge;
|
||||
Kernel::TParameterHandler<uint64_t> op_subjectGender;
|
||||
|
||||
Kernel::TParameterHandler<uint64_t> op_LaboratoryID;
|
||||
Kernel::TParameterHandler<CString*> op_pLaboratoryName;
|
||||
Kernel::TParameterHandler<uint64_t> op_TechnicianID;
|
||||
Kernel::TParameterHandler<CString*> op_pTechnicianName;
|
||||
|
||||
private:
|
||||
|
||||
std::stack<EBML::CIdentifier> m_nodes;
|
||||
};
|
||||
|
||||
class CExperimentInfoDecoderDesc final : public CEBMLBaseDecoderDesc
|
||||
{
|
||||
public:
|
||||
void release() override { }
|
||||
CString getName() const override { return CString("Experiment information stream decoder"); }
|
||||
CString getAuthorName() const override { return CString("Yann Renard"); }
|
||||
CString getAuthorCompanyName() const override { return CString("INRIA/IRISA"); }
|
||||
CString getShortDescription() const override { return CString(""); }
|
||||
CString getDetailedDescription() const override { return CString(""); }
|
||||
CString getCategory() const override { return CString("Stream codecs/Decoders"); }
|
||||
CString getVersion() const override { return CString("1.0"); }
|
||||
CString getSoftwareComponent() const override { return CString("openvibe-sdk"); }
|
||||
CString getAddedSoftwareVersion() const override { return CString("0.0.0"); }
|
||||
CString getUpdatedSoftwareVersion() const override { return CString("0.0.0"); }
|
||||
CIdentifier getCreatedClass() const override { return OVP_ClassId_Algorithm_ExperimentInfoDecoder; }
|
||||
IPluginObject* create() override { return new CExperimentInfoDecoder(); }
|
||||
|
||||
bool getAlgorithmPrototype(Kernel::IAlgorithmProto& prototype) const override
|
||||
{
|
||||
CEBMLBaseDecoderDesc::getAlgorithmPrototype(prototype);
|
||||
|
||||
prototype.addOutputParameter(OVP_Algorithm_ExperimentInfoDecoder_OutputParameterId_ExperimentID, "Experiment identifier",
|
||||
Kernel::ParameterType_UInteger);
|
||||
prototype.addOutputParameter(OVP_Algorithm_ExperimentInfoDecoder_OutputParameterId_ExperimentDate, "Experiment date", Kernel::ParameterType_String);
|
||||
prototype.addOutputParameter(OVP_Algorithm_ExperimentInfoDecoder_OutputParameterId_SubjectID, "Subject identifier", Kernel::ParameterType_UInteger);
|
||||
prototype.addOutputParameter(OVP_Algorithm_ExperimentInfoDecoder_OutputParameterId_SubjectName, "Subject name", Kernel::ParameterType_String);
|
||||
prototype.addOutputParameter(OVP_Algorithm_ExperimentInfoDecoder_OutputParameterId_SubjectAge, "Subject age", Kernel::ParameterType_UInteger);
|
||||
prototype.addOutputParameter(OVP_Algorithm_ExperimentInfoDecoder_OutputParameterId_SubjectGender, "Subject gender", Kernel::ParameterType_UInteger);
|
||||
prototype.addOutputParameter(OVP_Algorithm_ExperimentInfoDecoder_OutputParameterId_LaboratoryID, "Laboratory identifier",
|
||||
Kernel::ParameterType_UInteger);
|
||||
prototype.addOutputParameter(OVP_Algorithm_ExperimentInfoDecoder_OutputParameterId_LaboratoryName, "Laboratory name", Kernel::ParameterType_String);
|
||||
prototype.addOutputParameter(OVP_Algorithm_ExperimentInfoDecoder_OutputParameterId_TechnicianID, "Technician identifier",
|
||||
Kernel::ParameterType_UInteger);
|
||||
prototype.addOutputParameter(OVP_Algorithm_ExperimentInfoDecoder_OutputParameterId_TechnicianName, "Technician name", Kernel::ParameterType_String);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
_IsDerivedFromClass_Final_(StreamCodecs::CEBMLBaseDecoderDesc, OVP_ClassId_Algorithm_ExperimentInfoDecoderDesc)
|
||||
};
|
||||
} // namespace StreamCodecs
|
||||
} // namespace Plugins
|
||||
} // namespace OpenViBE
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
#include "ovpCFeatureVectorDecoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Plugins {
|
||||
namespace StreamCodecs {
|
||||
|
||||
|
||||
void CFeatureVectorDecoder::openChild(const EBML::CIdentifier& identifier)
|
||||
{
|
||||
m_oTop = identifier;
|
||||
CStreamedMatrixDecoder::openChild(identifier);
|
||||
}
|
||||
|
||||
void CFeatureVectorDecoder::processChildData(const void* buffer, const size_t size)
|
||||
{
|
||||
// Check for conforming dimension count, then pass to matrix decoder
|
||||
if (m_oTop == OVTK_NodeId_Header_StreamedMatrix_DimensionCount)
|
||||
{
|
||||
const size_t nDim = size_t(m_readerHelper->getUInt(buffer, size));
|
||||
OV_ERROR_UNLESS_KRV(nDim == 1, "Invalid feature vector: found " << nDim << " dimensions, 1 expected", Kernel::ErrorType::BadInput);
|
||||
}
|
||||
|
||||
CStreamedMatrixDecoder::processChildData(buffer, size);
|
||||
}
|
||||
|
||||
} // namespace StreamCodecs
|
||||
} // namespace Plugins
|
||||
} // namespace OpenViBE
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../ovp_defines.h"
|
||||
#include "ovpCStreamedMatrixDecoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Plugins {
|
||||
namespace StreamCodecs {
|
||||
class CFeatureVectorDecoder final : public CStreamedMatrixDecoder
|
||||
{
|
||||
public:
|
||||
void release() override { delete this; }
|
||||
void openChild(const EBML::CIdentifier& identifier) override;
|
||||
void processChildData(const void* buffer, const size_t size) override;
|
||||
|
||||
_IsDerivedFromClass_Final_(StreamCodecs::CStreamedMatrixDecoder, OVP_ClassId_Algorithm_FeatureVectorDecoder)
|
||||
|
||||
private:
|
||||
|
||||
EBML::CIdentifier m_oTop;
|
||||
};
|
||||
|
||||
class CFeatureVectorDecoderDesc final : public CStreamedMatrixDecoderDesc
|
||||
{
|
||||
public:
|
||||
void release() override { }
|
||||
CString getName() const override { return CString("Feature vector stream decoder"); }
|
||||
CString getAuthorName() const override { return CString("Yann Renard"); }
|
||||
CString getAuthorCompanyName() const override { return CString("INRIA/IRISA"); }
|
||||
CString getShortDescription() const override { return CString(""); }
|
||||
CString getDetailedDescription() const override { return CString(""); }
|
||||
CString getCategory() const override { return CString("Stream codecs/Decoders"); }
|
||||
CString getVersion() const override { return CString("1.0"); }
|
||||
CString getSoftwareComponent() const override { return CString("openvibe-sdk"); }
|
||||
CString getAddedSoftwareVersion() const override { return CString("0.0.0"); }
|
||||
CString getUpdatedSoftwareVersion() const override { return CString("0.0.0"); }
|
||||
CIdentifier getCreatedClass() const override { return OVP_ClassId_Algorithm_FeatureVectorDecoder; }
|
||||
IPluginObject* create() override { return new CFeatureVectorDecoder(); }
|
||||
|
||||
bool getAlgorithmPrototype(Kernel::IAlgorithmProto& prototype) const override
|
||||
{
|
||||
CStreamedMatrixDecoderDesc::getAlgorithmPrototype(prototype);
|
||||
return true;
|
||||
}
|
||||
|
||||
_IsDerivedFromClass_Final_(StreamCodecs::CStreamedMatrixDecoderDesc, OVP_ClassId_Algorithm_FeatureVectorDecoderDesc)
|
||||
};
|
||||
} // namespace StreamCodecs
|
||||
} // namespace Plugins
|
||||
} // namespace OpenViBE
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
#include "ovpCSignalDecoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Plugins {
|
||||
namespace StreamCodecs {
|
||||
|
||||
// ________________________________________________________________________________________________________________
|
||||
//
|
||||
|
||||
bool CSignalDecoder::initialize()
|
||||
{
|
||||
CStreamedMatrixDecoder::initialize();
|
||||
op_sampling.initialize(getOutputParameter(OVP_Algorithm_SignalDecoder_OutputParameterId_Sampling));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CSignalDecoder::uninitialize()
|
||||
{
|
||||
op_sampling.uninitialize();
|
||||
CStreamedMatrixDecoder::uninitialize();
|
||||
return true;
|
||||
}
|
||||
|
||||
// ________________________________________________________________________________________________________________
|
||||
//
|
||||
|
||||
bool CSignalDecoder::isMasterChild(const EBML::CIdentifier& identifier)
|
||||
{
|
||||
if (identifier == OVTK_NodeId_Header_Signal) { return true; }
|
||||
if (identifier == OVTK_NodeId_Header_Signal_Sampling) { return false; }
|
||||
return CStreamedMatrixDecoder::isMasterChild(identifier);
|
||||
}
|
||||
|
||||
void CSignalDecoder::openChild(const EBML::CIdentifier& identifier)
|
||||
{
|
||||
m_nodes.push(identifier);
|
||||
|
||||
EBML::CIdentifier& top = m_nodes.top();
|
||||
|
||||
if ((top == OVTK_NodeId_Header_Signal) || (top == OVTK_NodeId_Header_Signal_Sampling)) { }
|
||||
else { CStreamedMatrixDecoder::openChild(identifier); }
|
||||
}
|
||||
|
||||
void CSignalDecoder::processChildData(const void* buffer, const size_t size)
|
||||
{
|
||||
EBML::CIdentifier& top = m_nodes.top();
|
||||
|
||||
if ((top == OVTK_NodeId_Header_Signal) || (top == OVTK_NodeId_Header_Signal_Sampling))
|
||||
{
|
||||
if (top == OVTK_NodeId_Header_Signal_Sampling) { op_sampling = m_readerHelper->getUInt(buffer, size); }
|
||||
}
|
||||
else { CStreamedMatrixDecoder::processChildData(buffer, size); }
|
||||
}
|
||||
|
||||
void CSignalDecoder::closeChild()
|
||||
{
|
||||
EBML::CIdentifier& top = m_nodes.top();
|
||||
|
||||
if ((top == OVTK_NodeId_Header_Signal) || (top == OVTK_NodeId_Header_Signal_Sampling)) { }
|
||||
else { CStreamedMatrixDecoder::closeChild(); }
|
||||
|
||||
m_nodes.pop();
|
||||
}
|
||||
|
||||
} // namespace StreamCodecs
|
||||
} // namespace Plugins
|
||||
} // namespace OpenViBE
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../ovp_defines.h"
|
||||
#include "ovpCStreamedMatrixDecoder.h"
|
||||
#include <stack>
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Plugins {
|
||||
namespace StreamCodecs {
|
||||
class CSignalDecoder final : public CStreamedMatrixDecoder
|
||||
{
|
||||
public:
|
||||
void release() override { delete this; }
|
||||
bool initialize() override;
|
||||
bool uninitialize() override;
|
||||
|
||||
_IsDerivedFromClass_Final_(StreamCodecs::CStreamedMatrixDecoder, OVP_ClassId_Algorithm_SignalDecoder)
|
||||
|
||||
// ebml callbacks
|
||||
bool isMasterChild(const EBML::CIdentifier& identifier) override;
|
||||
void openChild(const EBML::CIdentifier& identifier) override;
|
||||
void processChildData(const void* buffer, const size_t size) override;
|
||||
void closeChild() override;
|
||||
|
||||
protected:
|
||||
|
||||
Kernel::TParameterHandler<uint64_t> op_sampling;
|
||||
|
||||
private:
|
||||
|
||||
std::stack<EBML::CIdentifier> m_nodes;
|
||||
};
|
||||
|
||||
class CSignalDecoderDesc final : public CStreamedMatrixDecoderDesc
|
||||
{
|
||||
public:
|
||||
void release() override { }
|
||||
CString getName() const override { return CString("Signal stream decoder"); }
|
||||
CString getAuthorName() const override { return CString("Yann Renard"); }
|
||||
CString getAuthorCompanyName() const override { return CString("INRIA/IRISA"); }
|
||||
CString getShortDescription() const override { return CString(""); }
|
||||
CString getDetailedDescription() const override { return CString(""); }
|
||||
CString getCategory() const override { return CString("Stream codecs/Decoders"); }
|
||||
CString getVersion() const override { return CString("1.0"); }
|
||||
CString getSoftwareComponent() const override { return CString("openvibe-sdk"); }
|
||||
CString getAddedSoftwareVersion() const override { return CString("0.0.0"); }
|
||||
CString getUpdatedSoftwareVersion() const override { return CString("0.0.0"); }
|
||||
CIdentifier getCreatedClass() const override { return OVP_ClassId_Algorithm_SignalDecoder; }
|
||||
IPluginObject* create() override { return new CSignalDecoder(); }
|
||||
|
||||
bool getAlgorithmPrototype(Kernel::IAlgorithmProto& prototype) const override
|
||||
{
|
||||
CStreamedMatrixDecoderDesc::getAlgorithmPrototype(prototype);
|
||||
prototype.addOutputParameter(OVP_Algorithm_SignalDecoder_OutputParameterId_Sampling, "Sampling rate", Kernel::ParameterType_UInteger);
|
||||
return true;
|
||||
}
|
||||
|
||||
_IsDerivedFromClass_Final_(StreamCodecs::CStreamedMatrixDecoderDesc, OVP_ClassId_Algorithm_SignalDecoderDesc)
|
||||
};
|
||||
} // namespace StreamCodecs
|
||||
} // namespace Plugins
|
||||
} // namespace OpenViBE
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
#include "ovpCSpectrumDecoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Plugins {
|
||||
namespace StreamCodecs {
|
||||
|
||||
// ________________________________________________________________________________________________________________
|
||||
//
|
||||
|
||||
bool CSpectrumDecoder::initialize()
|
||||
{
|
||||
CStreamedMatrixDecoder::initialize();
|
||||
op_frequencyAbscissa.initialize(getOutputParameter(OVP_Algorithm_SpectrumDecoder_OutputParameterId_FrequencyAbscissa));
|
||||
op_sampling.initialize(getOutputParameter(OVP_Algorithm_SpectrumDecoder_OutputParameterId_Sampling));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CSpectrumDecoder::uninitialize()
|
||||
{
|
||||
op_frequencyAbscissa.uninitialize();
|
||||
op_sampling.uninitialize();
|
||||
CStreamedMatrixDecoder::uninitialize();
|
||||
return true;
|
||||
}
|
||||
|
||||
// ________________________________________________________________________________________________________________
|
||||
//
|
||||
|
||||
bool CSpectrumDecoder::isMasterChild(const EBML::CIdentifier& identifier)
|
||||
{
|
||||
if (identifier == OVTK_NodeId_Header_Spectrum) { return true; }
|
||||
if (identifier == OVTK_NodeId_Header_Spectrum_FrequencyBand_Deprecated) { return true; }
|
||||
if (identifier == OVTK_NodeId_Header_Spectrum_FrequencyBand_Start_Deprecated) { return false; }
|
||||
if (identifier == OVTK_NodeId_Header_Spectrum_FrequencyBand_Stop_Deprecated) { return false; }
|
||||
if (identifier == OVTK_NodeId_Header_Spectrum_FrequencyAbscissa) { return false; }
|
||||
if (identifier == OVTK_NodeId_Header_Spectrum_Sampling) { return false; }
|
||||
return CStreamedMatrixDecoder::isMasterChild(identifier);
|
||||
}
|
||||
|
||||
void CSpectrumDecoder::openChild(const EBML::CIdentifier& identifier)
|
||||
{
|
||||
m_nodes.push(identifier);
|
||||
|
||||
EBML::CIdentifier& top = m_nodes.top();
|
||||
|
||||
if (top == OVTK_NodeId_Header_Spectrum)
|
||||
{
|
||||
op_frequencyAbscissa->resize(op_pMatrix->getDimensionSize(1));
|
||||
m_frequencyBandIdx = 0;
|
||||
}
|
||||
else if (top == OVTK_NodeId_Header_Spectrum_FrequencyAbscissa) { }
|
||||
else { CStreamedMatrixDecoder::openChild(identifier); }
|
||||
}
|
||||
|
||||
void CSpectrumDecoder::processChildData(const void* buffer, const size_t size)
|
||||
{
|
||||
EBML::CIdentifier& top = m_nodes.top();
|
||||
if ((top == OVTK_NodeId_Header_Spectrum) || (top == OVTK_NodeId_Header_Spectrum_FrequencyBand_Deprecated)) { }
|
||||
else if (top == OVTK_NodeId_Header_Spectrum_FrequencyBand_Start_Deprecated) { m_lowerFreq = m_readerHelper->getDouble(buffer, size); }
|
||||
else if (top == OVTK_NodeId_Header_Spectrum_FrequencyBand_Stop_Deprecated)
|
||||
{
|
||||
const double upperFreq = m_readerHelper->getDouble(buffer, size);
|
||||
double curFrequencyAbscissa = 0;
|
||||
if (op_frequencyAbscissa->getDimensionSize(0) > 1)
|
||||
{
|
||||
// In the old format, frequencies were separated into bins with lower and upper bounds.
|
||||
// These were calculated as lowerFreq = frequencyIndex/frequencyCount, upperFreq = (frequencyIndex + 1)/frequencyCount, with 0 based indexes.
|
||||
// This formula reverses the calculation and puts the 'middle' frequency into the right place
|
||||
curFrequencyAbscissa = m_lowerFreq + double(m_frequencyBandIdx) / (op_frequencyAbscissa->getDimensionSize(0) - 1) * (upperFreq - m_lowerFreq);
|
||||
}
|
||||
op_frequencyAbscissa->getBuffer()[m_frequencyBandIdx] = curFrequencyAbscissa;
|
||||
std::ostringstream s;
|
||||
s << std::setprecision(10);
|
||||
s << curFrequencyAbscissa;
|
||||
op_pMatrix->setDimensionLabel(1, m_frequencyBandIdx, s.str().c_str());
|
||||
|
||||
op_sampling = uint64_t((m_frequencyBandIdx + 1) * (upperFreq - op_frequencyAbscissa->getBuffer()[0]));
|
||||
}
|
||||
else if (top == OVTK_NodeId_Header_Spectrum_FrequencyAbscissa)
|
||||
{
|
||||
op_frequencyAbscissa->getBuffer()[m_frequencyBandIdx] = m_readerHelper->getDouble(buffer, size);
|
||||
}
|
||||
else if (top == OVTK_NodeId_Header_Spectrum_Sampling) { op_sampling = m_readerHelper->getUInt(buffer, size); }
|
||||
else { CStreamedMatrixDecoder::processChildData(buffer, size); }
|
||||
}
|
||||
|
||||
void CSpectrumDecoder::closeChild()
|
||||
{
|
||||
EBML::CIdentifier& top = m_nodes.top();
|
||||
|
||||
if ((top == OVTK_NodeId_Header_Spectrum)
|
||||
|| (top == OVTK_NodeId_Header_Spectrum_FrequencyBand_Start_Deprecated)
|
||||
|| (top == OVTK_NodeId_Header_Spectrum_FrequencyBand_Stop_Deprecated)) { }
|
||||
else if ((top == OVTK_NodeId_Header_Spectrum_FrequencyBand_Deprecated) || (top == OVTK_NodeId_Header_Spectrum_FrequencyAbscissa)) { m_frequencyBandIdx++; }
|
||||
else { CStreamedMatrixDecoder::closeChild(); }
|
||||
|
||||
m_nodes.pop();
|
||||
}
|
||||
|
||||
} // namespace StreamCodecs
|
||||
} // namespace Plugins
|
||||
} // namespace OpenViBE
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../ovp_defines.h"
|
||||
#include "ovpCStreamedMatrixDecoder.h"
|
||||
#include <iomanip>
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Plugins {
|
||||
namespace StreamCodecs {
|
||||
class CSpectrumDecoder final : public CStreamedMatrixDecoder
|
||||
{
|
||||
public:
|
||||
void release() override { delete this; }
|
||||
bool initialize() override;
|
||||
bool uninitialize() override;
|
||||
|
||||
_IsDerivedFromClass_Final_(StreamCodecs::CStreamedMatrixDecoder, OVP_ClassId_Algorithm_SpectrumDecoder)
|
||||
|
||||
// ebml callbacks
|
||||
bool isMasterChild(const EBML::CIdentifier& identifier) override;
|
||||
void openChild(const EBML::CIdentifier& identifier) override;
|
||||
void processChildData(const void* buffer, const size_t size) override;
|
||||
void closeChild() override;
|
||||
|
||||
protected:
|
||||
|
||||
Kernel::TParameterHandler<CMatrix*> op_frequencyAbscissa;
|
||||
Kernel::TParameterHandler<uint64_t> op_sampling;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
std::stack<EBML::CIdentifier> m_nodes;
|
||||
|
||||
size_t m_frequencyBandIdx = 0;
|
||||
|
||||
// Value of the current lower frequency of the band. Only used to read old spectrum format.
|
||||
double m_lowerFreq = 0;
|
||||
};
|
||||
|
||||
class CSpectrumDecoderDesc final : public CStreamedMatrixDecoderDesc
|
||||
{
|
||||
public:
|
||||
void release() override { }
|
||||
CString getName() const override { return CString("Spectrum stream decoder"); }
|
||||
CString getAuthorName() const override { return CString("Yann Renard"); }
|
||||
CString getAuthorCompanyName() const override { return CString("INRIA/IRISA"); }
|
||||
CString getShortDescription() const override { return CString("Decodes the Spectrum type streams."); }
|
||||
CString getDetailedDescription() const override { return CString(""); }
|
||||
CString getCategory() const override { return CString("Stream codecs/Decoders"); }
|
||||
CString getVersion() const override { return CString("1.0"); }
|
||||
CString getSoftwareComponent() const override { return CString("openvibe-sdk"); }
|
||||
CString getAddedSoftwareVersion() const override { return CString("0.0.0"); }
|
||||
CString getUpdatedSoftwareVersion() const override { return CString("0.1.0"); }
|
||||
CIdentifier getCreatedClass() const override { return OVP_ClassId_Algorithm_SpectrumDecoder; }
|
||||
IPluginObject* create() override { return new CSpectrumDecoder(); }
|
||||
|
||||
bool getAlgorithmPrototype(Kernel::IAlgorithmProto& prototype) const override
|
||||
{
|
||||
CStreamedMatrixDecoderDesc::getAlgorithmPrototype(prototype);
|
||||
|
||||
prototype.addOutputParameter(OVP_Algorithm_SpectrumDecoder_OutputParameterId_FrequencyAbscissa, "Frequency abscissa", Kernel::ParameterType_Matrix);
|
||||
prototype.addOutputParameter(OVP_Algorithm_SpectrumDecoder_OutputParameterId_Sampling, "Sampling rate", Kernel::ParameterType_UInteger);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
_IsDerivedFromClass_Final_(StreamCodecs::CStreamedMatrixDecoderDesc, OVP_ClassId_Algorithm_SpectrumDecoderDesc)
|
||||
};
|
||||
} // namespace StreamCodecs
|
||||
} // namespace Plugins
|
||||
} // namespace OpenViBE
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
#include "ovpCStimulationDecoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Plugins {
|
||||
namespace StreamCodecs {
|
||||
|
||||
// ________________________________________________________________________________________________________________
|
||||
//
|
||||
|
||||
bool CStimulationDecoder::initialize()
|
||||
{
|
||||
CEBMLBaseDecoder::initialize();
|
||||
op_stimulationSet.initialize(getOutputParameter(OVP_Algorithm_StimulationDecoder_OutputParameterId_StimulationSet));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CStimulationDecoder::uninitialize()
|
||||
{
|
||||
op_stimulationSet.uninitialize();
|
||||
CEBMLBaseDecoder::uninitialize();
|
||||
return true;
|
||||
}
|
||||
|
||||
// ________________________________________________________________________________________________________________
|
||||
//
|
||||
|
||||
bool CStimulationDecoder::isMasterChild(const EBML::CIdentifier& identifier)
|
||||
{
|
||||
if (identifier == OVTK_NodeId_Buffer_Stimulation) { return true; }
|
||||
if (identifier == OVTK_NodeId_Buffer_Stimulation_NumberOfStimulations) { return false; }
|
||||
if (identifier == OVTK_NodeId_Buffer_Stimulation_Stimulation) { return true; }
|
||||
if (identifier == OVTK_NodeId_Buffer_Stimulation_Stimulation_ID) { return false; }
|
||||
if (identifier == OVTK_NodeId_Buffer_Stimulation_Stimulation_Date) { return false; }
|
||||
if (identifier == OVTK_NodeId_Buffer_Stimulation_Stimulation_Duration) { return false; }
|
||||
return CEBMLBaseDecoder::isMasterChild(identifier);
|
||||
}
|
||||
|
||||
void CStimulationDecoder::openChild(const EBML::CIdentifier& identifier)
|
||||
{
|
||||
m_nodes.push(identifier);
|
||||
|
||||
EBML::CIdentifier& top = m_nodes.top();
|
||||
|
||||
if ((top == OVTK_NodeId_Buffer_Stimulation)
|
||||
|| (top == OVTK_NodeId_Buffer_Stimulation_NumberOfStimulations)
|
||||
|| (top == OVTK_NodeId_Buffer_Stimulation_Stimulation)
|
||||
|| (top == OVTK_NodeId_Buffer_Stimulation_Stimulation_ID)
|
||||
|| (top == OVTK_NodeId_Buffer_Stimulation_Stimulation_Date)
|
||||
|| (top == OVTK_NodeId_Buffer_Stimulation_Stimulation_Duration)) { }
|
||||
else { CEBMLBaseDecoder::openChild(identifier); }
|
||||
}
|
||||
|
||||
void CStimulationDecoder::processChildData(const void* buffer, const size_t size)
|
||||
{
|
||||
EBML::CIdentifier& top = m_nodes.top();
|
||||
|
||||
if ((top == OVTK_NodeId_Buffer_Stimulation)
|
||||
|| (top == OVTK_NodeId_Buffer_Stimulation_NumberOfStimulations)
|
||||
|| (top == OVTK_NodeId_Buffer_Stimulation_Stimulation)
|
||||
|| (top == OVTK_NodeId_Buffer_Stimulation_Stimulation_ID)
|
||||
|| (top == OVTK_NodeId_Buffer_Stimulation_Stimulation_Date)
|
||||
|| (top == OVTK_NodeId_Buffer_Stimulation_Stimulation_Duration))
|
||||
{
|
||||
if (top == OVTK_NodeId_Buffer_Stimulation_NumberOfStimulations)
|
||||
{
|
||||
op_stimulationSet->setStimulationCount(m_readerHelper->getUInt(buffer, size));
|
||||
m_stimulationIdx = 0;
|
||||
}
|
||||
if (top == OVTK_NodeId_Buffer_Stimulation_Stimulation_ID)
|
||||
{
|
||||
op_stimulationSet->setStimulationIdentifier(m_stimulationIdx, m_readerHelper->getUInt(buffer, size));
|
||||
}
|
||||
if (top == OVTK_NodeId_Buffer_Stimulation_Stimulation_Date)
|
||||
{
|
||||
op_stimulationSet->setStimulationDate(m_stimulationIdx, m_readerHelper->getUInt(buffer, size));
|
||||
}
|
||||
if (top == OVTK_NodeId_Buffer_Stimulation_Stimulation_Duration)
|
||||
{
|
||||
op_stimulationSet->setStimulationDuration(m_stimulationIdx, m_readerHelper->getUInt(buffer, size));
|
||||
}
|
||||
}
|
||||
else { CEBMLBaseDecoder::processChildData(buffer, size); }
|
||||
}
|
||||
|
||||
void CStimulationDecoder::closeChild()
|
||||
{
|
||||
EBML::CIdentifier& top = m_nodes.top();
|
||||
|
||||
if ((top == OVTK_NodeId_Buffer_Stimulation)
|
||||
|| (top == OVTK_NodeId_Buffer_Stimulation_NumberOfStimulations)
|
||||
|| (top == OVTK_NodeId_Buffer_Stimulation_Stimulation)
|
||||
|| (top == OVTK_NodeId_Buffer_Stimulation_Stimulation_ID)
|
||||
|| (top == OVTK_NodeId_Buffer_Stimulation_Stimulation_Date)
|
||||
|| (top == OVTK_NodeId_Buffer_Stimulation_Stimulation_Duration)) { if (top == OVTK_NodeId_Buffer_Stimulation_Stimulation) { m_stimulationIdx++; } }
|
||||
else { CEBMLBaseDecoder::closeChild(); }
|
||||
|
||||
m_nodes.pop();
|
||||
}
|
||||
|
||||
} // namespace StreamCodecs
|
||||
} // namespace Plugins
|
||||
} // namespace OpenViBE
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../ovp_defines.h"
|
||||
#include "ovpCEBMLBaseDecoder.h"
|
||||
#include <stack>
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Plugins {
|
||||
namespace StreamCodecs {
|
||||
class CStimulationDecoder final : public CEBMLBaseDecoder
|
||||
{
|
||||
public:
|
||||
void release() override { delete this; }
|
||||
bool initialize() override;
|
||||
bool uninitialize() override;
|
||||
|
||||
_IsDerivedFromClass_Final_(StreamCodecs::CEBMLBaseDecoder, OVP_ClassId_Algorithm_StimulationDecoder)
|
||||
|
||||
// ebml callbacks
|
||||
bool isMasterChild(const EBML::CIdentifier& identifier) override;
|
||||
void openChild(const EBML::CIdentifier& identifier) override;
|
||||
void processChildData(const void* buffer, const size_t size) override;
|
||||
void closeChild() override;
|
||||
|
||||
protected:
|
||||
|
||||
Kernel::TParameterHandler<IStimulationSet*> op_stimulationSet;
|
||||
|
||||
private:
|
||||
|
||||
std::stack<EBML::CIdentifier> m_nodes;
|
||||
|
||||
size_t m_stimulationIdx = 0;
|
||||
CStimulationSet m_stimSet;
|
||||
};
|
||||
|
||||
class CStimulationDecoderDesc final : public CEBMLBaseDecoderDesc
|
||||
{
|
||||
public:
|
||||
void release() override { }
|
||||
CString getName() const override { return CString("Stimulation stream decoder"); }
|
||||
CString getAuthorName() const override { return CString("Yann Renard"); }
|
||||
CString getAuthorCompanyName() const override { return CString("INRIA/IRISA"); }
|
||||
CString getShortDescription() const override { return CString(""); }
|
||||
CString getDetailedDescription() const override { return CString(""); }
|
||||
CString getCategory() const override { return CString("Stream codecs/Decoders"); }
|
||||
CString getVersion() const override { return CString("1.0"); }
|
||||
CString getSoftwareComponent() const override { return CString("openvibe-sdk"); }
|
||||
CString getAddedSoftwareVersion() const override { return CString("0.0.0"); }
|
||||
CString getUpdatedSoftwareVersion() const override { return CString("0.0.0"); }
|
||||
CIdentifier getCreatedClass() const override { return OVP_ClassId_Algorithm_StimulationDecoder; }
|
||||
IPluginObject* create() override { return new CStimulationDecoder(); }
|
||||
|
||||
bool getAlgorithmPrototype(Kernel::IAlgorithmProto& prototype) const override
|
||||
{
|
||||
CEBMLBaseDecoderDesc::getAlgorithmPrototype(prototype);
|
||||
prototype.addOutputParameter(OVP_Algorithm_StimulationDecoder_OutputParameterId_StimulationSet, "Stimulation set",
|
||||
Kernel::ParameterType_StimulationSet);
|
||||
return true;
|
||||
}
|
||||
|
||||
_IsDerivedFromClass_Final_(StreamCodecs::CEBMLBaseDecoderDesc, OVP_ClassId_Algorithm_StimulationDecoderDesc)
|
||||
};
|
||||
} // namespace StreamCodecs
|
||||
} // namespace Plugins
|
||||
} // namespace OpenViBE
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
#include "ovpCStreamStructureDecoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Plugins {
|
||||
namespace StreamCodecs {
|
||||
|
||||
CStreamStructureDecoder::CStreamStructureDecoder() {}
|
||||
|
||||
// ________________________________________________________________________________________________________________
|
||||
//
|
||||
|
||||
bool CStreamStructureDecoder::initialize()
|
||||
{
|
||||
CEBMLBaseDecoder::initialize();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CStreamStructureDecoder::uninitialize()
|
||||
{
|
||||
CEBMLBaseDecoder::uninitialize();
|
||||
return true;
|
||||
}
|
||||
|
||||
// ________________________________________________________________________________________________________________
|
||||
//
|
||||
|
||||
bool CStreamStructureDecoder::isMasterChild(const EBML::CIdentifier& identifier) { return CEBMLBaseDecoder::isMasterChild(identifier); }
|
||||
void CStreamStructureDecoder::openChild(const EBML::CIdentifier& identifier) { CEBMLBaseDecoder::openChild(identifier); }
|
||||
void CStreamStructureDecoder::processChildData(const void* buffer, const size_t size) { CEBMLBaseDecoder::processChildData(buffer, size); }
|
||||
void CStreamStructureDecoder::closeChild() { CEBMLBaseDecoder::closeChild(); }
|
||||
|
||||
} // namespace StreamCodecs
|
||||
} // namespace Plugins
|
||||
} // namespace OpenViBE
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../ovp_defines.h"
|
||||
#include "ovpCEBMLBaseDecoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Plugins {
|
||||
namespace StreamCodecs {
|
||||
class CStreamStructureDecoder final : public CEBMLBaseDecoder
|
||||
{
|
||||
public:
|
||||
|
||||
CStreamStructureDecoder();
|
||||
void release() override { delete this; }
|
||||
bool initialize() override;
|
||||
bool uninitialize() override;
|
||||
|
||||
_IsDerivedFromClass_Final_(StreamCodecs::CEBMLBaseDecoder, OVP_ClassId_Algorithm_StreamStructureDecoder)
|
||||
|
||||
// ebml callbacks
|
||||
bool isMasterChild(const EBML::CIdentifier& identifier) override;
|
||||
void openChild(const EBML::CIdentifier& identifier) override;
|
||||
void processChildData(const void* buffer, const size_t size) override;
|
||||
void closeChild() override;
|
||||
};
|
||||
|
||||
class CStreamStructureDecoderDesc final : public CEBMLBaseDecoderDesc
|
||||
{
|
||||
public:
|
||||
void release() override { }
|
||||
CString getName() const override { return CString("Stream Structure Decoder"); }
|
||||
CString getAuthorName() const override { return CString("Jozef Legeny"); }
|
||||
CString getAuthorCompanyName() const override { return CString("Mensia Technologies"); }
|
||||
CString getShortDescription() const override { return CString(""); }
|
||||
CString getDetailedDescription() const override { return CString(""); }
|
||||
CString getCategory() const override { return CString("Stream codecs/Decoders"); }
|
||||
CString getVersion() const override { return CString("1.0"); }
|
||||
CString getSoftwareComponent() const override { return CString("openvibe-sdk"); }
|
||||
CString getAddedSoftwareVersion() const override { return CString("2.0.0"); }
|
||||
CString getUpdatedSoftwareVersion() const override { return CString("0.0.0"); }
|
||||
CIdentifier getCreatedClass() const override { return OVP_ClassId_Algorithm_StreamStructureDecoder; }
|
||||
IPluginObject* create() override { return new CStreamStructureDecoder(); }
|
||||
|
||||
bool getAlgorithmPrototype(Kernel::IAlgorithmProto& prototype) const override
|
||||
{
|
||||
CEBMLBaseDecoderDesc::getAlgorithmPrototype(prototype);
|
||||
return true;
|
||||
}
|
||||
|
||||
_IsDerivedFromClass_Final_(StreamCodecs::CEBMLBaseDecoderDesc, OVP_ClassId_Algorithm_StreamStructureDecoderDesc)
|
||||
};
|
||||
} // namespace StreamCodecs
|
||||
} // namespace Plugins
|
||||
} // namespace OpenViBE
|
||||
+160
@@ -0,0 +1,160 @@
|
||||
#include "ovpCStreamedMatrixDecoder.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Plugins {
|
||||
namespace StreamCodecs {
|
||||
|
||||
namespace {
|
||||
// removes pre and post spaces, tabs and carriage returns
|
||||
void trim(char* dst, const char* src1, const char* src2)
|
||||
{
|
||||
if (!src1 || *src1 == '\0') { dst[0] = '\0'; }
|
||||
if (!src2) { src2 = src1 + strlen(src1) - 1; }
|
||||
while (src1 < src2 && (*src1 == ' ' || *src1 == '\t' || *src1 == '\r' || *src1 == '\n')) { src1++; }
|
||||
while (src1 < src2 && (*src2 == ' ' || *src2 == '\t' || *src2 == '\r' || *src2 == '\n')) { src2--; }
|
||||
src2++;
|
||||
strncpy(dst, src1, src2 - src1);
|
||||
dst[src2 - src1] = '\0';
|
||||
}
|
||||
} // namespace
|
||||
|
||||
// ________________________________________________________________________________________________________________
|
||||
//
|
||||
|
||||
bool CStreamedMatrixDecoder::initialize()
|
||||
{
|
||||
CEBMLBaseDecoder::initialize();
|
||||
op_pMatrix.initialize(getOutputParameter(OVP_Algorithm_StreamedMatrixDecoder_OutputParameterId_Matrix));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CStreamedMatrixDecoder::uninitialize()
|
||||
{
|
||||
op_pMatrix.uninitialize();
|
||||
CEBMLBaseDecoder::uninitialize();
|
||||
return true;
|
||||
}
|
||||
|
||||
// ________________________________________________________________________________________________________________
|
||||
//
|
||||
|
||||
bool CStreamedMatrixDecoder::isMasterChild(const EBML::CIdentifier& id)
|
||||
{
|
||||
if (id == OVTK_NodeId_Header_StreamedMatrix) { return true; }
|
||||
if (id == OVTK_NodeId_Header_StreamedMatrix_Dimension) { return true; }
|
||||
if (id == OVTK_NodeId_Header_StreamedMatrix_DimensionCount) { return false; }
|
||||
if (id == OVTK_NodeId_Header_StreamedMatrix_Dimension_Size) { return false; }
|
||||
if (id == OVTK_NodeId_Header_StreamedMatrix_Dimension_Label) { return false; }
|
||||
if (id == OVTK_NodeId_Buffer_StreamedMatrix) { return true; }
|
||||
if (id == OVTK_NodeId_Buffer_StreamedMatrix_RawBuffer) { return false; }
|
||||
return CEBMLBaseDecoder::isMasterChild(id);
|
||||
}
|
||||
|
||||
void CStreamedMatrixDecoder::openChild(const EBML::CIdentifier& id)
|
||||
{
|
||||
m_nodes.push(id);
|
||||
|
||||
EBML::CIdentifier& top = m_nodes.top();
|
||||
|
||||
if ((top == OVTK_NodeId_Header_StreamedMatrix)
|
||||
|| (top == OVTK_NodeId_Header_StreamedMatrix_Dimension)
|
||||
|| (top == OVTK_NodeId_Header_StreamedMatrix_DimensionCount)
|
||||
|| (top == OVTK_NodeId_Header_StreamedMatrix_Dimension_Size)
|
||||
|| (top == OVTK_NodeId_Header_StreamedMatrix_Dimension_Label)
|
||||
|| (top == OVTK_NodeId_Buffer_StreamedMatrix)
|
||||
|| (top == OVTK_NodeId_Buffer_StreamedMatrix_RawBuffer))
|
||||
{
|
||||
if (top == OVTK_NodeId_Header_StreamedMatrix && m_status == EParsingStatus::Nothing)
|
||||
{
|
||||
m_status = EParsingStatus::Header;
|
||||
m_dimensionIdx = 0;
|
||||
}
|
||||
else if (top == OVTK_NodeId_Header_StreamedMatrix_Dimension && m_status == EParsingStatus::Header)
|
||||
{
|
||||
m_status = EParsingStatus::Dimension;
|
||||
m_dimensionEntryIdx = 0;
|
||||
}
|
||||
else if (top == OVTK_NodeId_Buffer_StreamedMatrix && m_status == EParsingStatus::Nothing) { m_status = EParsingStatus::Buffer; }
|
||||
}
|
||||
else { CEBMLBaseDecoder::openChild(id); }
|
||||
}
|
||||
|
||||
void CStreamedMatrixDecoder::processChildData(const void* buffer, const size_t size)
|
||||
{
|
||||
EBML::CIdentifier& top = m_nodes.top();
|
||||
|
||||
if ((top == OVTK_NodeId_Header_StreamedMatrix)
|
||||
|| (top == OVTK_NodeId_Header_StreamedMatrix_Dimension)
|
||||
|| (top == OVTK_NodeId_Header_StreamedMatrix_DimensionCount)
|
||||
|| (top == OVTK_NodeId_Header_StreamedMatrix_Dimension_Size)
|
||||
|| (top == OVTK_NodeId_Header_StreamedMatrix_Dimension_Label)
|
||||
|| (top == OVTK_NodeId_Buffer_StreamedMatrix)
|
||||
|| (top == OVTK_NodeId_Buffer_StreamedMatrix_RawBuffer))
|
||||
{
|
||||
switch (m_status)
|
||||
{
|
||||
case EParsingStatus::Header:
|
||||
if (top == OVTK_NodeId_Header_StreamedMatrix_DimensionCount) { op_pMatrix->setDimensionCount(size_t(m_readerHelper->getUInt(buffer, size))); }
|
||||
break;
|
||||
|
||||
case EParsingStatus::Dimension:
|
||||
if (top == OVTK_NodeId_Header_StreamedMatrix_Dimension_Size)
|
||||
{
|
||||
op_pMatrix->setDimensionSize(m_dimensionIdx, size_t(m_readerHelper->getUInt(buffer, size)));
|
||||
}
|
||||
if (top == OVTK_NodeId_Header_StreamedMatrix_Dimension_Label)
|
||||
{
|
||||
char label[1024];
|
||||
trim(label, m_readerHelper->getStr(buffer, size), nullptr);
|
||||
op_pMatrix->setDimensionLabel(m_dimensionIdx, m_dimensionEntryIdx++, label);
|
||||
}
|
||||
break;
|
||||
|
||||
case EParsingStatus::Buffer:
|
||||
if (top == OVTK_NodeId_Buffer_StreamedMatrix_RawBuffer) { memcpy(op_pMatrix->getBuffer(), buffer, m_size * sizeof(double)); }
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
else { CEBMLBaseDecoder::processChildData(buffer, size); }
|
||||
}
|
||||
|
||||
void CStreamedMatrixDecoder::closeChild()
|
||||
{
|
||||
EBML::CIdentifier& top = m_nodes.top();
|
||||
|
||||
if ((top == OVTK_NodeId_Header_StreamedMatrix)
|
||||
|| (top == OVTK_NodeId_Header_StreamedMatrix_Dimension)
|
||||
|| (top == OVTK_NodeId_Header_StreamedMatrix_DimensionCount)
|
||||
|| (top == OVTK_NodeId_Header_StreamedMatrix_Dimension_Size)
|
||||
|| (top == OVTK_NodeId_Header_StreamedMatrix_Dimension_Label)
|
||||
|| (top == OVTK_NodeId_Buffer_StreamedMatrix)
|
||||
|| (top == OVTK_NodeId_Buffer_StreamedMatrix_RawBuffer))
|
||||
{
|
||||
if (top == OVTK_NodeId_Buffer_StreamedMatrix && m_status == EParsingStatus::Buffer) { m_status = EParsingStatus::Nothing; }
|
||||
else if (top == OVTK_NodeId_Header_StreamedMatrix_Dimension && m_status == EParsingStatus::Dimension)
|
||||
{
|
||||
m_status = EParsingStatus::Header;
|
||||
m_dimensionIdx++;
|
||||
}
|
||||
else if (top == OVTK_NodeId_Header_StreamedMatrix && m_status == EParsingStatus::Header)
|
||||
{
|
||||
m_status = EParsingStatus::Nothing;
|
||||
|
||||
if (op_pMatrix->getDimensionCount() == 0) { m_size = 0; }
|
||||
else
|
||||
{
|
||||
m_size = 1;
|
||||
for (size_t i = 0; i < op_pMatrix->getDimensionCount(); ++i) { m_size *= op_pMatrix->getDimensionSize(i); }
|
||||
}
|
||||
}
|
||||
}
|
||||
else { CEBMLBaseDecoder::closeChild(); }
|
||||
|
||||
m_nodes.pop();
|
||||
}
|
||||
} // namespace StreamCodecs
|
||||
} // namespace Plugins
|
||||
} // namespace OpenViBE
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../ovp_defines.h"
|
||||
#include "ovpCEBMLBaseDecoder.h"
|
||||
#include <stack>
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Plugins {
|
||||
namespace StreamCodecs {
|
||||
class CStreamedMatrixDecoder : public CEBMLBaseDecoder
|
||||
{
|
||||
public:
|
||||
|
||||
CStreamedMatrixDecoder() { }
|
||||
void release() override { delete this; }
|
||||
bool initialize() override;
|
||||
bool uninitialize() override;
|
||||
|
||||
_IsDerivedFromClass_Final_(StreamCodecs::CEBMLBaseDecoder, OVP_ClassId_Algorithm_StreamedMatrixDecoder)
|
||||
|
||||
// ebml callbacks
|
||||
bool isMasterChild(const EBML::CIdentifier& id) override;
|
||||
void openChild(const EBML::CIdentifier& id) override;
|
||||
void processChildData(const void* buffer, const size_t size) override;
|
||||
void closeChild() override;
|
||||
|
||||
protected:
|
||||
|
||||
Kernel::TParameterHandler<CMatrix*> op_pMatrix;
|
||||
|
||||
private:
|
||||
|
||||
enum class EParsingStatus { Nothing, Header, Buffer, Dimension };
|
||||
|
||||
std::stack<EBML::CIdentifier> m_nodes;
|
||||
|
||||
EParsingStatus m_status = EParsingStatus::Nothing;
|
||||
size_t m_dimensionIdx = 0;
|
||||
size_t m_dimensionEntryIdx = 0;
|
||||
// size_t mdimensionEntryIdxUnit = 0;
|
||||
size_t m_size = 0;
|
||||
};
|
||||
|
||||
class CStreamedMatrixDecoderDesc : public CEBMLBaseDecoderDesc
|
||||
{
|
||||
public:
|
||||
void release() override { }
|
||||
CString getName() const override { return CString("Streamed matrix stream decoder"); }
|
||||
CString getAuthorName() const override { return CString("Yann Renard"); }
|
||||
CString getAuthorCompanyName() const override { return CString("INRIA/IRISA"); }
|
||||
CString getShortDescription() const override { return CString(""); }
|
||||
CString getDetailedDescription() const override { return CString(""); }
|
||||
CString getCategory() const override { return CString("Stream codecs/Decoders"); }
|
||||
CString getVersion() const override { return CString("1.0"); }
|
||||
CString getSoftwareComponent() const override { return CString("openvibe-sdk"); }
|
||||
CString getAddedSoftwareVersion() const override { return CString("0.0.0"); }
|
||||
CString getUpdatedSoftwareVersion() const override { return CString("0.0.0"); }
|
||||
CIdentifier getCreatedClass() const override { return OVP_ClassId_Algorithm_StreamedMatrixDecoder; }
|
||||
IPluginObject* create() override { return new CStreamedMatrixDecoder(); }
|
||||
|
||||
bool getAlgorithmPrototype(Kernel::IAlgorithmProto& prototype) const override
|
||||
{
|
||||
CEBMLBaseDecoderDesc::getAlgorithmPrototype(prototype);
|
||||
prototype.addOutputParameter(OVP_Algorithm_StreamedMatrixDecoder_OutputParameterId_Matrix, "Matrix", Kernel::ParameterType_Matrix);
|
||||
return true;
|
||||
}
|
||||
|
||||
_IsDerivedFromClass_Final_(StreamCodecs::CEBMLBaseDecoderDesc, OVP_ClassId_Algorithm_StreamedMatrixDecoderDesc)
|
||||
};
|
||||
} // namespace StreamCodecs
|
||||
} // namespace Plugins
|
||||
} // namespace OpenViBE
|
||||
+85
@@ -0,0 +1,85 @@
|
||||
#include "ovpCAcquisitionEncoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Plugins {
|
||||
namespace StreamCodecs {
|
||||
|
||||
bool CAcquisitionEncoder::initialize()
|
||||
{
|
||||
CEBMLBaseEncoder::initialize();
|
||||
|
||||
ip_bufferDuration.initialize(getInputParameter(OVP_Algorithm_AcquisitionEncoder_InputParameterId_BufferDuration));
|
||||
ip_experimentInfoStream.initialize(getInputParameter(OVP_Algorithm_AcquisitionEncoder_InputParameterId_ExperimentInfoStream));
|
||||
ip_signalStream.initialize(getInputParameter(OVP_Algorithm_AcquisitionEncoder_InputParameterId_SignalStream));
|
||||
ip_stimulationStream.initialize(getInputParameter(OVP_Algorithm_AcquisitionEncoder_InputParameterId_StimulationStream));
|
||||
ip_channelLocalisationStream.initialize(getInputParameter(OVP_Algorithm_AcquisitionEncoder_InputParameterId_ChannelLocalisationStream));
|
||||
ip_channelUnitsStream.initialize(getInputParameter(OVP_Algorithm_AcquisitionEncoder_InputParameterId_ChannelUnitsStream));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CAcquisitionEncoder::uninitialize()
|
||||
{
|
||||
ip_channelUnitsStream.uninitialize();
|
||||
ip_channelLocalisationStream.uninitialize();
|
||||
ip_stimulationStream.uninitialize();
|
||||
ip_signalStream.uninitialize();
|
||||
ip_experimentInfoStream.uninitialize();
|
||||
ip_bufferDuration.uninitialize();
|
||||
|
||||
CEBMLBaseEncoder::uninitialize();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ________________________________________________________________________________________________________________
|
||||
//
|
||||
|
||||
bool CAcquisitionEncoder::processHeader()
|
||||
{
|
||||
m_writerHelper->openChild(OVTK_NodeId_Acquisition_Header_BufferDuration);
|
||||
m_writerHelper->setUInt(ip_bufferDuration);
|
||||
m_writerHelper->closeChild();
|
||||
m_writerHelper->openChild(OVTK_NodeId_Acquisition_Header_ExperimentInfo);
|
||||
m_writerHelper->setBinary(ip_experimentInfoStream->getDirectPointer(), ip_experimentInfoStream->getSize());
|
||||
m_writerHelper->closeChild();
|
||||
m_writerHelper->openChild(OVTK_NodeId_Acquisition_Header_Signal);
|
||||
m_writerHelper->setBinary(ip_signalStream->getDirectPointer(), ip_signalStream->getSize());
|
||||
m_writerHelper->closeChild();
|
||||
m_writerHelper->openChild(OVTK_NodeId_Acquisition_Header_Stimulation);
|
||||
m_writerHelper->setBinary(ip_stimulationStream->getDirectPointer(), ip_stimulationStream->getSize());
|
||||
m_writerHelper->closeChild();
|
||||
m_writerHelper->openChild(OVTK_NodeId_Acquisition_Header_ChannelLocalisation);
|
||||
m_writerHelper->setBinary(ip_channelLocalisationStream->getDirectPointer(), ip_channelLocalisationStream->getSize());
|
||||
m_writerHelper->closeChild();
|
||||
m_writerHelper->openChild(OVTK_NodeId_Acquisition_Header_ChannelUnits);
|
||||
m_writerHelper->setBinary(ip_channelUnitsStream->getDirectPointer(), ip_channelUnitsStream->getSize());
|
||||
m_writerHelper->closeChild();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CAcquisitionEncoder::processBuffer()
|
||||
{
|
||||
m_writerHelper->openChild(OVTK_NodeId_Acquisition_Buffer_ExperimentInfo);
|
||||
m_writerHelper->setBinary(ip_experimentInfoStream->getDirectPointer(), ip_experimentInfoStream->getSize());
|
||||
m_writerHelper->closeChild();
|
||||
m_writerHelper->openChild(OVTK_NodeId_Acquisition_Buffer_Signal);
|
||||
m_writerHelper->setBinary(ip_signalStream->getDirectPointer(), ip_signalStream->getSize());
|
||||
m_writerHelper->closeChild();
|
||||
m_writerHelper->openChild(OVTK_NodeId_Acquisition_Buffer_Stimulation);
|
||||
m_writerHelper->setBinary(ip_stimulationStream->getDirectPointer(), ip_stimulationStream->getSize());
|
||||
m_writerHelper->closeChild();
|
||||
m_writerHelper->openChild(OVTK_NodeId_Acquisition_Buffer_ChannelLocalisation);
|
||||
m_writerHelper->setBinary(ip_channelLocalisationStream->getDirectPointer(), ip_channelLocalisationStream->getSize());
|
||||
m_writerHelper->closeChild();
|
||||
m_writerHelper->openChild(OVTK_NodeId_Acquisition_Buffer_ChannelUnits);
|
||||
m_writerHelper->setBinary(ip_channelUnitsStream->getDirectPointer(), ip_channelUnitsStream->getSize());
|
||||
m_writerHelper->closeChild();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace StreamCodecs
|
||||
} // namespace Plugins
|
||||
} // namespace OpenViBE
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../ovp_defines.h"
|
||||
#include "ovpCEBMLBaseEncoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Plugins {
|
||||
namespace StreamCodecs {
|
||||
class CAcquisitionEncoder final : public CEBMLBaseEncoder
|
||||
{
|
||||
public:
|
||||
void release() override { delete this; }
|
||||
bool initialize() override;
|
||||
bool uninitialize() override;
|
||||
bool processHeader() override;
|
||||
bool processBuffer() override;
|
||||
|
||||
_IsDerivedFromClass_Final_(StreamCodecs::CEBMLBaseEncoder, OVP_ClassId_Algorithm_AcquisitionEncoder)
|
||||
|
||||
protected:
|
||||
|
||||
Kernel::TParameterHandler<uint64_t> ip_bufferDuration;
|
||||
Kernel::TParameterHandler<IMemoryBuffer*> ip_experimentInfoStream;
|
||||
Kernel::TParameterHandler<IMemoryBuffer*> ip_signalStream;
|
||||
Kernel::TParameterHandler<IMemoryBuffer*> ip_stimulationStream;
|
||||
Kernel::TParameterHandler<IMemoryBuffer*> ip_channelLocalisationStream;
|
||||
Kernel::TParameterHandler<IMemoryBuffer*> ip_channelUnitsStream;
|
||||
};
|
||||
|
||||
class CAcquisitionEncoderDesc final : public CEBMLBaseEncoderDesc
|
||||
{
|
||||
public:
|
||||
void release() override { }
|
||||
CString getName() const override { return CString("Acquisition stream encoder"); }
|
||||
CString getAuthorName() const override { return CString("Yann Renard"); }
|
||||
CString getAuthorCompanyName() const override { return CString("INRIA/IRISA"); }
|
||||
CString getShortDescription() const override { return CString(""); }
|
||||
CString getDetailedDescription() const override { return CString(""); }
|
||||
CString getCategory() const override { return CString("Stream codecs/Encoders"); }
|
||||
CString getVersion() const override { return CString("1.1"); }
|
||||
CString getSoftwareComponent() const override { return CString("openvibe-sdk"); }
|
||||
CString getAddedSoftwareVersion() const override { return CString("0.0.0"); }
|
||||
CString getUpdatedSoftwareVersion() const override { return CString("0.0.0"); }
|
||||
CIdentifier getCreatedClass() const override { return OVP_ClassId_Algorithm_AcquisitionEncoder; }
|
||||
IPluginObject* create() override { return new CAcquisitionEncoder(); }
|
||||
|
||||
bool getAlgorithmPrototype(Kernel::IAlgorithmProto& prototype) const override
|
||||
{
|
||||
CEBMLBaseEncoderDesc::getAlgorithmPrototype(prototype);
|
||||
|
||||
prototype.addInputParameter(OVP_Algorithm_AcquisitionEncoder_InputParameterId_BufferDuration, "Buffer duration", Kernel::ParameterType_UInteger);
|
||||
prototype.addInputParameter(OVP_Algorithm_AcquisitionEncoder_InputParameterId_ExperimentInfoStream, "Experiment information stream",
|
||||
Kernel::ParameterType_MemoryBuffer);
|
||||
prototype.addInputParameter(OVP_Algorithm_AcquisitionEncoder_InputParameterId_SignalStream, "Signal stream", Kernel::ParameterType_MemoryBuffer);
|
||||
prototype.addInputParameter(OVP_Algorithm_AcquisitionEncoder_InputParameterId_StimulationStream, "Stimulation stream",
|
||||
Kernel::ParameterType_MemoryBuffer);
|
||||
prototype.addInputParameter(OVP_Algorithm_AcquisitionEncoder_InputParameterId_ChannelLocalisationStream, "Channel localisation stream",
|
||||
Kernel::ParameterType_MemoryBuffer);
|
||||
prototype.addInputParameter(OVP_Algorithm_AcquisitionEncoder_InputParameterId_ChannelUnitsStream, "Channel units stream",
|
||||
Kernel::ParameterType_MemoryBuffer);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
_IsDerivedFromClass_Final_(StreamCodecs::CEBMLBaseEncoderDesc, OVP_ClassId_Algorithm_AcquisitionEncoderDesc)
|
||||
};
|
||||
} // namespace StreamCodecs
|
||||
} // namespace Plugins
|
||||
} // namespace OpenViBE
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
#include "ovpCChannelLocalisationEncoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Plugins {
|
||||
namespace StreamCodecs {
|
||||
|
||||
bool CChannelLocalisationEncoder::initialize()
|
||||
{
|
||||
CStreamedMatrixEncoder::initialize();
|
||||
ip_bDynamic.initialize(getInputParameter(OVP_Algorithm_ChannelLocalisationEncoder_InputParameterId_Dynamic));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CChannelLocalisationEncoder::uninitialize()
|
||||
{
|
||||
ip_bDynamic.uninitialize();
|
||||
CStreamedMatrixEncoder::uninitialize();
|
||||
return true;
|
||||
}
|
||||
|
||||
// ________________________________________________________________________________________________________________
|
||||
//
|
||||
|
||||
bool CChannelLocalisationEncoder::processHeader()
|
||||
{
|
||||
CStreamedMatrixEncoder::processHeader();
|
||||
|
||||
m_writerHelper->openChild(OVTK_NodeId_Header_ChannelLocalisation);
|
||||
m_writerHelper->openChild(OVTK_NodeId_Header_ChannelLocalisation_Dynamic);
|
||||
m_writerHelper->setUInt(ip_bDynamic ? 1 : 0);
|
||||
m_writerHelper->closeChild();
|
||||
m_writerHelper->closeChild();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace StreamCodecs
|
||||
} // namespace Plugins
|
||||
} // namespace OpenViBE
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../ovp_defines.h"
|
||||
#include "ovpCStreamedMatrixEncoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Plugins {
|
||||
namespace StreamCodecs {
|
||||
class CChannelLocalisationEncoder final : public CStreamedMatrixEncoder
|
||||
{
|
||||
public:
|
||||
void release() override { delete this; }
|
||||
bool initialize() override;
|
||||
bool uninitialize() override;
|
||||
bool processHeader() override;
|
||||
|
||||
_IsDerivedFromClass_Final_(StreamCodecs::CStreamedMatrixEncoder, OVP_ClassId_Algorithm_ChannelLocalisationEncoder)
|
||||
|
||||
protected:
|
||||
|
||||
Kernel::TParameterHandler<bool> ip_bDynamic;
|
||||
};
|
||||
|
||||
|
||||
class CChannelLocalisationEncoderDesc final : public CStreamedMatrixEncoderDesc
|
||||
{
|
||||
public:
|
||||
void release() override { }
|
||||
CString getName() const override { return CString("Channel localisation stream encoder"); }
|
||||
CString getAuthorName() const override { return CString("Yann Renard"); }
|
||||
CString getAuthorCompanyName() const override { return CString("INRIA/IRISA"); }
|
||||
CString getShortDescription() const override { return CString(""); }
|
||||
CString getDetailedDescription() const override { return CString(""); }
|
||||
CString getCategory() const override { return CString("Stream codecs/Encoders"); }
|
||||
CString getVersion() const override { return CString("1.0"); }
|
||||
CString getSoftwareComponent() const override { return CString("openvibe-sdk"); }
|
||||
CString getAddedSoftwareVersion() const override { return CString("0.0.0"); }
|
||||
CString getUpdatedSoftwareVersion() const override { return CString("0.0.0"); }
|
||||
CIdentifier getCreatedClass() const override { return OVP_ClassId_Algorithm_ChannelLocalisationEncoder; }
|
||||
IPluginObject* create() override { return new CChannelLocalisationEncoder(); }
|
||||
|
||||
bool getAlgorithmPrototype(Kernel::IAlgorithmProto& prototype) const override
|
||||
{
|
||||
CStreamedMatrixEncoderDesc::getAlgorithmPrototype(prototype);
|
||||
|
||||
prototype.addInputParameter(OVP_Algorithm_ChannelLocalisationEncoder_InputParameterId_Dynamic, "Dynamic", Kernel::ParameterType_Boolean);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
_IsDerivedFromClass_Final_(StreamCodecs::CStreamedMatrixEncoderDesc, OVP_ClassId_Algorithm_ChannelLocalisationEncoderDesc)
|
||||
};
|
||||
} // namespace StreamCodecs
|
||||
} // namespace Plugins
|
||||
} // namespace OpenViBE
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
#include "ovpCChannelUnitsEncoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Plugins {
|
||||
namespace StreamCodecs {
|
||||
|
||||
bool CChannelUnitsEncoder::initialize()
|
||||
{
|
||||
CStreamedMatrixEncoder::initialize();
|
||||
ip_bDynamic.initialize(getInputParameter(OVP_Algorithm_ChannelUnitsEncoder_InputParameterId_Dynamic));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CChannelUnitsEncoder::uninitialize()
|
||||
{
|
||||
ip_bDynamic.uninitialize();
|
||||
CStreamedMatrixEncoder::uninitialize();
|
||||
return true;
|
||||
}
|
||||
|
||||
// ________________________________________________________________________________________________________________
|
||||
//
|
||||
|
||||
bool CChannelUnitsEncoder::processHeader()
|
||||
{
|
||||
CStreamedMatrixEncoder::processHeader();
|
||||
|
||||
m_writerHelper->openChild(OVTK_NodeId_Header_ChannelUnits);
|
||||
m_writerHelper->openChild(OVTK_NodeId_Header_ChannelUnits_Dynamic);
|
||||
m_writerHelper->setUInt(ip_bDynamic ? 1 : 0);
|
||||
m_writerHelper->closeChild();
|
||||
m_writerHelper->closeChild();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace StreamCodecs
|
||||
} // namespace Plugins
|
||||
} // namespace OpenViBE
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../ovp_defines.h"
|
||||
#include "ovpCStreamedMatrixEncoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Plugins {
|
||||
namespace StreamCodecs {
|
||||
class CChannelUnitsEncoder final : public CStreamedMatrixEncoder
|
||||
{
|
||||
public:
|
||||
void release() override { delete this; }
|
||||
bool initialize() override;
|
||||
bool uninitialize() override;
|
||||
bool processHeader() override;
|
||||
|
||||
_IsDerivedFromClass_Final_(StreamCodecs::CStreamedMatrixEncoder, OVP_ClassId_Algorithm_ChannelUnitsEncoder)
|
||||
|
||||
protected:
|
||||
|
||||
Kernel::TParameterHandler<bool> ip_bDynamic;
|
||||
};
|
||||
|
||||
|
||||
class CChannelUnitsEncoderDesc final : public CStreamedMatrixEncoderDesc
|
||||
{
|
||||
public:
|
||||
void release() override { }
|
||||
CString getName() const override { return CString("Channel units stream encoder"); }
|
||||
CString getAuthorName() const override { return CString("Yann Renard"); }
|
||||
CString getAuthorCompanyName() const override { return CString("INRIA/IRISA"); }
|
||||
CString getShortDescription() const override { return CString(""); }
|
||||
CString getDetailedDescription() const override { return CString(""); }
|
||||
CString getCategory() const override { return CString("Stream codecs/Encoders"); }
|
||||
CString getVersion() const override { return CString("1.0"); }
|
||||
CString getSoftwareComponent() const override { return CString("openvibe-sdk"); }
|
||||
CString getAddedSoftwareVersion() const override { return CString("0.0.0"); }
|
||||
CString getUpdatedSoftwareVersion() const override { return CString("0.0.0"); }
|
||||
CIdentifier getCreatedClass() const override { return OVP_ClassId_Algorithm_ChannelUnitsEncoder; }
|
||||
IPluginObject* create() override { return new CChannelUnitsEncoder(); }
|
||||
|
||||
bool getAlgorithmPrototype(Kernel::IAlgorithmProto& prototype) const override
|
||||
{
|
||||
CStreamedMatrixEncoderDesc::getAlgorithmPrototype(prototype);
|
||||
|
||||
prototype.addInputParameter(OVP_Algorithm_ChannelUnitsEncoder_InputParameterId_Dynamic, "Dynamic", Kernel::ParameterType_Boolean);
|
||||
// prototype.addInputParameter(OVP_Algorithm_ChannelUnitsEncoder_InputParameterId_MeasurementUnits, "Measurement units", Kernel::ParameterType_Matrix);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
_IsDerivedFromClass_Final_(StreamCodecs::CStreamedMatrixEncoderDesc, OVP_ClassId_Algorithm_ChannelUnitsEncoderDesc)
|
||||
};
|
||||
} // namespace StreamCodecs
|
||||
} // namespace Plugins
|
||||
} // namespace OpenViBE
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
#include "ovpCEBMLBaseEncoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Plugins {
|
||||
namespace StreamCodecs {
|
||||
|
||||
// ________________________________________________________________________________________________________________
|
||||
//
|
||||
|
||||
bool CEBMLBaseEncoder::initialize()
|
||||
{
|
||||
op_buffer.initialize(getOutputParameter(OVP_Algorithm_EBMLEncoder_OutputParameterId_EncodedMemoryBuffer));
|
||||
|
||||
m_writer = createWriter(m_callbackProxy);
|
||||
m_writerHelper = EBML::createWriterHelper();
|
||||
m_writerHelper->connect(m_writer);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CEBMLBaseEncoder::uninitialize()
|
||||
{
|
||||
m_writerHelper->disconnect();
|
||||
m_writerHelper->release();
|
||||
m_writerHelper = nullptr;
|
||||
|
||||
m_writer->release();
|
||||
m_writer = nullptr;
|
||||
|
||||
op_buffer.uninitialize();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ________________________________________________________________________________________________________________
|
||||
//
|
||||
|
||||
bool CEBMLBaseEncoder::process()
|
||||
{
|
||||
if (isInputTriggerActive(OVP_Algorithm_EBMLEncoder_InputTriggerId_EncodeHeader))
|
||||
{
|
||||
m_writerHelper->openChild(OVTK_NodeId_Header);
|
||||
m_writerHelper->openChild(OVTK_NodeId_Header_StreamType);
|
||||
m_writerHelper->setUInt(0);
|
||||
m_writerHelper->closeChild();
|
||||
m_writerHelper->openChild(OVTK_NodeId_Header_StreamVersion);
|
||||
m_writerHelper->setUInt(0);
|
||||
m_writerHelper->closeChild();
|
||||
this->processHeader();
|
||||
m_writerHelper->closeChild();
|
||||
activateOutputTrigger(OVP_Algorithm_EBMLEncoder_OutputTriggerId_MemoryBufferUpdated, true);
|
||||
}
|
||||
|
||||
if (isInputTriggerActive(OVP_Algorithm_EBMLEncoder_InputTriggerId_EncodeBuffer))
|
||||
{
|
||||
m_writerHelper->openChild(OVTK_NodeId_Buffer);
|
||||
this->processBuffer();
|
||||
m_writerHelper->closeChild();
|
||||
activateOutputTrigger(OVP_Algorithm_EBMLEncoder_OutputTriggerId_MemoryBufferUpdated, true);
|
||||
}
|
||||
|
||||
if (isInputTriggerActive(OVP_Algorithm_EBMLEncoder_InputTriggerId_EncodeEnd))
|
||||
{
|
||||
m_writerHelper->openChild(OVTK_NodeId_End);
|
||||
this->processEnd();
|
||||
m_writerHelper->closeChild();
|
||||
activateOutputTrigger(OVP_Algorithm_EBMLEncoder_OutputTriggerId_MemoryBufferUpdated, true);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ________________________________________________________________________________________________________________
|
||||
//
|
||||
|
||||
void CEBMLBaseEncoder::write(const void* buffer, const size_t size)
|
||||
{
|
||||
const size_t currentBufferSize = op_buffer->getSize();
|
||||
op_buffer->setSize(currentBufferSize + size, false);
|
||||
memcpy(op_buffer->getDirectPointer() + currentBufferSize, buffer, size);
|
||||
}
|
||||
} // namespace StreamCodecs
|
||||
} // namespace Plugins
|
||||
} // namespace OpenViBE
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../ovp_defines.h"
|
||||
#include <openvibe/ov_all.h>
|
||||
#include <toolkit/ovtk_all.h>
|
||||
|
||||
#include <ebml/IWriter.h>
|
||||
#include <ebml/IWriterHelper.h>
|
||||
#include <ebml/TWriterCallbackProxy.h>
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Plugins {
|
||||
namespace StreamCodecs {
|
||||
class CEBMLBaseEncoder : public Toolkit::TAlgorithm<IAlgorithm>
|
||||
{
|
||||
public:
|
||||
|
||||
CEBMLBaseEncoder() : m_callbackProxy(*this, &CEBMLBaseEncoder::write) {}
|
||||
void release() override { delete this; }
|
||||
bool initialize() override;
|
||||
bool uninitialize() override;
|
||||
bool process() override;
|
||||
virtual bool processHeader() { return true; }
|
||||
virtual bool processBuffer() { return true; }
|
||||
virtual bool processEnd() { return true; }
|
||||
|
||||
_IsDerivedFromClass_Final_(Toolkit::TAlgorithm<IAlgorithm>, OVP_ClassId_Algorithm_EBMLBaseEncoder)
|
||||
|
||||
// ebml callbacks
|
||||
virtual void write(const void* buffer, size_t size);
|
||||
|
||||
protected:
|
||||
|
||||
Kernel::TParameterHandler<IMemoryBuffer*> op_buffer;
|
||||
|
||||
EBML::IWriterHelper* m_writerHelper = nullptr;
|
||||
EBML::IWriter* m_writer = nullptr;
|
||||
EBML::TWriterCallbackProxy1<CEBMLBaseEncoder> m_callbackProxy;
|
||||
};
|
||||
|
||||
class CEBMLBaseEncoderDesc : public IAlgorithmDesc
|
||||
{
|
||||
public:
|
||||
bool getAlgorithmPrototype(Kernel::IAlgorithmProto& prototype) const override
|
||||
{
|
||||
prototype.addOutputParameter(OVP_Algorithm_EBMLEncoder_OutputParameterId_EncodedMemoryBuffer, "Encoded memory buffer",
|
||||
Kernel::ParameterType_MemoryBuffer);
|
||||
prototype.addInputTrigger(OVP_Algorithm_EBMLEncoder_InputTriggerId_EncodeHeader, "Encode header");
|
||||
prototype.addInputTrigger(OVP_Algorithm_EBMLEncoder_InputTriggerId_EncodeBuffer, "Encode buffer");
|
||||
prototype.addInputTrigger(OVP_Algorithm_EBMLEncoder_InputTriggerId_EncodeEnd, "Encode end");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
_IsDerivedFromClass_(IAlgorithmDesc, OVP_ClassId_Algorithm_EBMLBaseEncoderDesc)
|
||||
};
|
||||
} // namespace StreamCodecs
|
||||
} // namespace Plugins
|
||||
} // namespace OpenViBE
|
||||
+92
@@ -0,0 +1,92 @@
|
||||
#include "ovpCExperimentInfoEncoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Plugins {
|
||||
namespace StreamCodecs {
|
||||
|
||||
bool CExperimentInfoEncoder::initialize()
|
||||
{
|
||||
CEBMLBaseEncoder::initialize();
|
||||
|
||||
ip_ExperimentID.initialize(getInputParameter(OVP_Algorithm_ExperimentInfoEncoder_InputParameterId_ExperimentID));
|
||||
ip_experimentDate.initialize(getInputParameter(OVP_Algorithm_ExperimentInfoEncoder_InputParameterId_ExperimentDate));
|
||||
ip_subjectID.initialize(getInputParameter(OVP_Algorithm_ExperimentInfoEncoder_InputParameterId_SubjectID));
|
||||
ip_subjectName.initialize(getInputParameter(OVP_Algorithm_ExperimentInfoEncoder_InputParameterId_SubjectName));
|
||||
ip_subjectAge.initialize(getInputParameter(OVP_Algorithm_ExperimentInfoEncoder_InputParameterId_SubjectAge));
|
||||
ip_subjectGender.initialize(getInputParameter(OVP_Algorithm_ExperimentInfoEncoder_InputParameterId_SubjectGender));
|
||||
ip_LaboratoryID.initialize(getInputParameter(OVP_Algorithm_ExperimentInfoEncoder_InputParameterId_LaboratoryID));
|
||||
ip_pLaboratoryName.initialize(getInputParameter(OVP_Algorithm_ExperimentInfoEncoder_InputParameterId_LaboratoryName));
|
||||
ip_TechnicianID.initialize(getInputParameter(OVP_Algorithm_ExperimentInfoEncoder_InputParameterId_TechnicianID));
|
||||
ip_pTechnicianName.initialize(getInputParameter(OVP_Algorithm_ExperimentInfoEncoder_InputParameterId_TechnicianName));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CExperimentInfoEncoder::uninitialize()
|
||||
{
|
||||
ip_pTechnicianName.uninitialize();
|
||||
ip_TechnicianID.uninitialize();
|
||||
ip_pLaboratoryName.uninitialize();
|
||||
ip_LaboratoryID.uninitialize();
|
||||
ip_subjectGender.uninitialize();
|
||||
ip_subjectAge.uninitialize();
|
||||
ip_subjectName.uninitialize();
|
||||
ip_subjectID.uninitialize();
|
||||
ip_experimentDate.uninitialize();
|
||||
ip_ExperimentID.uninitialize();
|
||||
|
||||
CEBMLBaseEncoder::uninitialize();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ________________________________________________________________________________________________________________
|
||||
//
|
||||
|
||||
bool CExperimentInfoEncoder::processHeader()
|
||||
{
|
||||
m_writerHelper->openChild(OVTK_NodeId_Header_ExperimentInfo);
|
||||
m_writerHelper->openChild(OVTK_NodeId_Header_ExperimentInfo_Experiment);
|
||||
m_writerHelper->openChild(OVTK_NodeId_Header_ExperimentInfo_Experiment_ID);
|
||||
m_writerHelper->setUInt(ip_ExperimentID);
|
||||
m_writerHelper->closeChild();
|
||||
m_writerHelper->openChild(OVTK_NodeId_Header_ExperimentInfo_Experiment_Date);
|
||||
m_writerHelper->setStr(ip_experimentDate->toASCIIString());
|
||||
m_writerHelper->closeChild();
|
||||
m_writerHelper->closeChild();
|
||||
m_writerHelper->openChild(OVTK_NodeId_Header_ExperimentInfo_Subject);
|
||||
m_writerHelper->openChild(OVTK_NodeId_Header_ExperimentInfo_Subject_ID);
|
||||
m_writerHelper->setUInt(ip_subjectID);
|
||||
m_writerHelper->closeChild();
|
||||
m_writerHelper->openChild(OVTK_NodeId_Header_ExperimentInfo_Subject_Name);
|
||||
m_writerHelper->setStr(ip_subjectName->toASCIIString());
|
||||
m_writerHelper->closeChild();
|
||||
m_writerHelper->openChild(OVTK_NodeId_Header_ExperimentInfo_Subject_Age);
|
||||
m_writerHelper->setUInt(ip_subjectAge);
|
||||
m_writerHelper->closeChild();
|
||||
m_writerHelper->openChild(OVTK_NodeId_Header_ExperimentInfo_Subject_Gender);
|
||||
m_writerHelper->setUInt(ip_subjectGender);
|
||||
m_writerHelper->closeChild();
|
||||
m_writerHelper->closeChild();
|
||||
m_writerHelper->openChild(OVTK_NodeId_Header_ExperimentInfo_Context);
|
||||
m_writerHelper->openChild(OVTK_NodeId_Header_ExperimentInfo_Context_LaboratoryID);
|
||||
m_writerHelper->setUInt(ip_LaboratoryID);
|
||||
m_writerHelper->closeChild();
|
||||
m_writerHelper->openChild(OVTK_NodeId_Header_ExperimentInfo_Context_LaboratoryName);
|
||||
m_writerHelper->setStr(ip_pLaboratoryName->toASCIIString());
|
||||
m_writerHelper->closeChild();
|
||||
m_writerHelper->openChild(OVTK_NodeId_Header_ExperimentInfo_Context_TechnicianID);
|
||||
m_writerHelper->setUInt(ip_TechnicianID);
|
||||
m_writerHelper->closeChild();
|
||||
m_writerHelper->openChild(OVTK_NodeId_Header_ExperimentInfo_Context_TechnicianName);
|
||||
m_writerHelper->setStr(ip_pTechnicianName->toASCIIString());
|
||||
m_writerHelper->closeChild();
|
||||
m_writerHelper->closeChild();
|
||||
m_writerHelper->closeChild();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace StreamCodecs
|
||||
} // namespace Plugins
|
||||
} // namespace OpenViBE
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../ovp_defines.h"
|
||||
#include "ovpCEBMLBaseEncoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Plugins {
|
||||
namespace StreamCodecs {
|
||||
class CExperimentInfoEncoder final : public CEBMLBaseEncoder
|
||||
{
|
||||
public:
|
||||
void release() override { delete this; }
|
||||
bool initialize() override;
|
||||
bool uninitialize() override;
|
||||
bool processHeader() override;
|
||||
|
||||
_IsDerivedFromClass_Final_(StreamCodecs::CEBMLBaseEncoder, OVP_ClassId_Algorithm_ExperimentInfoEncoder)
|
||||
|
||||
protected:
|
||||
|
||||
Kernel::TParameterHandler<uint64_t> ip_ExperimentID;
|
||||
Kernel::TParameterHandler<CString*> ip_experimentDate;
|
||||
|
||||
Kernel::TParameterHandler<uint64_t> ip_subjectID;
|
||||
Kernel::TParameterHandler<CString*> ip_subjectName;
|
||||
Kernel::TParameterHandler<uint64_t> ip_subjectAge;
|
||||
Kernel::TParameterHandler<uint64_t> ip_subjectGender;
|
||||
|
||||
Kernel::TParameterHandler<uint64_t> ip_LaboratoryID;
|
||||
Kernel::TParameterHandler<CString*> ip_pLaboratoryName;
|
||||
Kernel::TParameterHandler<uint64_t> ip_TechnicianID;
|
||||
Kernel::TParameterHandler<CString*> ip_pTechnicianName;
|
||||
};
|
||||
|
||||
class CExperimentInfoEncoderDesc final : public CEBMLBaseEncoderDesc
|
||||
{
|
||||
public:
|
||||
void release() override { }
|
||||
CString getName() const override { return CString("Experiment information stream encoder"); }
|
||||
CString getAuthorName() const override { return CString("Yann Renard"); }
|
||||
CString getAuthorCompanyName() const override { return CString("INRIA/IRISA"); }
|
||||
CString getShortDescription() const override { return CString(""); }
|
||||
CString getDetailedDescription() const override { return CString(""); }
|
||||
CString getCategory() const override { return CString("Stream codecs/Encoders"); }
|
||||
CString getVersion() const override { return CString("1.0"); }
|
||||
CString getSoftwareComponent() const override { return CString("openvibe-sdk"); }
|
||||
CString getAddedSoftwareVersion() const override { return CString("0.0.0"); }
|
||||
CString getUpdatedSoftwareVersion() const override { return CString("0.0.0"); }
|
||||
CIdentifier getCreatedClass() const override { return OVP_ClassId_Algorithm_ExperimentInfoEncoder; }
|
||||
IPluginObject* create() override { return new CExperimentInfoEncoder(); }
|
||||
|
||||
bool getAlgorithmPrototype(Kernel::IAlgorithmProto& prototype) const override
|
||||
{
|
||||
CEBMLBaseEncoderDesc::getAlgorithmPrototype(prototype);
|
||||
|
||||
prototype.addInputParameter(OVP_Algorithm_ExperimentInfoEncoder_InputParameterId_ExperimentID, "Experiment identifier", Kernel::ParameterType_UInteger);
|
||||
prototype.addInputParameter(OVP_Algorithm_ExperimentInfoEncoder_InputParameterId_ExperimentDate, "Experiment date", Kernel::ParameterType_String);
|
||||
prototype.addInputParameter(OVP_Algorithm_ExperimentInfoEncoder_InputParameterId_SubjectID, "Subject identifier", Kernel::ParameterType_UInteger);
|
||||
prototype.addInputParameter(OVP_Algorithm_ExperimentInfoEncoder_InputParameterId_SubjectName, "Subject name", Kernel::ParameterType_String);
|
||||
prototype.addInputParameter(OVP_Algorithm_ExperimentInfoEncoder_InputParameterId_SubjectAge, "Subject age", Kernel::ParameterType_UInteger);
|
||||
prototype.addInputParameter(OVP_Algorithm_ExperimentInfoEncoder_InputParameterId_SubjectGender, "Subject gender", Kernel::ParameterType_UInteger);
|
||||
prototype.addInputParameter(OVP_Algorithm_ExperimentInfoEncoder_InputParameterId_LaboratoryID, "Laboratory identifier", Kernel::ParameterType_UInteger);
|
||||
prototype.addInputParameter(OVP_Algorithm_ExperimentInfoEncoder_InputParameterId_LaboratoryName, "Laboratory name", Kernel::ParameterType_String);
|
||||
prototype.addInputParameter(OVP_Algorithm_ExperimentInfoEncoder_InputParameterId_TechnicianID, "Technician identifier", Kernel::ParameterType_UInteger);
|
||||
prototype.addInputParameter(OVP_Algorithm_ExperimentInfoEncoder_InputParameterId_TechnicianName, "Technician name", Kernel::ParameterType_String);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
_IsDerivedFromClass_Final_(StreamCodecs::CEBMLBaseEncoderDesc, OVP_ClassId_Algorithm_ExperimentInfoEncoderDesc)
|
||||
};
|
||||
} // namespace StreamCodecs
|
||||
} // namespace Plugins
|
||||
} // namespace OpenViBE
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
#include "ovpCFeatureVectorEncoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Plugins {
|
||||
namespace StreamCodecs {
|
||||
|
||||
bool CFeatureVectorEncoder::processHeader()
|
||||
{
|
||||
OV_ERROR_UNLESS_KRF(ip_pMatrix->getDimensionCount() == 1, "Invalid feature vector: found " << ip_pMatrix->getDimensionCount() << " dimensions, 1 expected",
|
||||
Kernel::ErrorType::BadInput);
|
||||
|
||||
CStreamedMatrixEncoder::processHeader();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace StreamCodecs
|
||||
} // namespace Plugins
|
||||
} // namespace OpenViBE
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../ovp_defines.h"
|
||||
#include "ovpCStreamedMatrixEncoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Plugins {
|
||||
namespace StreamCodecs {
|
||||
class CFeatureVectorEncoder final : public CStreamedMatrixEncoder
|
||||
{
|
||||
public:
|
||||
void release() override { delete this; }
|
||||
bool processHeader() override;
|
||||
|
||||
_IsDerivedFromClass_Final_(StreamCodecs::CStreamedMatrixEncoder, OVP_ClassId_Algorithm_FeatureVectorEncoder)
|
||||
};
|
||||
|
||||
class CFeatureVectorEncoderDesc final : public CStreamedMatrixEncoderDesc
|
||||
{
|
||||
public:
|
||||
void release() override { }
|
||||
CString getName() const override { return CString("Feature vector stream encoder"); }
|
||||
CString getAuthorName() const override { return CString("Yann Renard"); }
|
||||
CString getAuthorCompanyName() const override { return CString("INRIA/IRISA"); }
|
||||
CString getShortDescription() const override { return CString(""); }
|
||||
CString getDetailedDescription() const override { return CString(""); }
|
||||
CString getCategory() const override { return CString("Stream codecs/Encoders"); }
|
||||
CString getVersion() const override { return CString("1.0"); }
|
||||
CString getSoftwareComponent() const override { return CString("openvibe-sdk"); }
|
||||
CString getAddedSoftwareVersion() const override { return CString("0.0.0"); }
|
||||
CString getUpdatedSoftwareVersion() const override { return CString("0.0.0"); }
|
||||
CIdentifier getCreatedClass() const override { return OVP_ClassId_Algorithm_FeatureVectorEncoder; }
|
||||
IPluginObject* create() override { return new CFeatureVectorEncoder(); }
|
||||
|
||||
bool getAlgorithmPrototype(Kernel::IAlgorithmProto& prototype) const override
|
||||
{
|
||||
CStreamedMatrixEncoderDesc::getAlgorithmPrototype(prototype);
|
||||
return true;
|
||||
}
|
||||
|
||||
_IsDerivedFromClass_Final_(StreamCodecs::CStreamedMatrixEncoderDesc, OVP_ClassId_Algorithm_FeatureVectorEncoderDesc)
|
||||
};
|
||||
} // namespace StreamCodecs
|
||||
} // namespace Plugins
|
||||
} // namespace OpenViBE
|
||||
+231
@@ -0,0 +1,231 @@
|
||||
#include "ovpCMasterAcquisitionEncoder.h"
|
||||
#include "../../algorithms/encoders/ovpCAcquisitionEncoder.h"
|
||||
#include "../../algorithms/encoders/ovpCExperimentInfoEncoder.h"
|
||||
#include "../../algorithms/encoders/ovpCSignalEncoder.h"
|
||||
#include "../../algorithms/encoders/ovpCStimulationEncoder.h"
|
||||
#include "../../algorithms/encoders/ovpCChannelLocalisationEncoder.h"
|
||||
#include "../../algorithms/encoders/ovpCChannelUnitsEncoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Plugins {
|
||||
namespace StreamCodecs {
|
||||
|
||||
bool CMasterAcquisitionEncoder::initialize()
|
||||
{
|
||||
// Manages sub-algorithms
|
||||
|
||||
m_acquisitionStreamEncoder = &this->getAlgorithmManager().getAlgorithm(
|
||||
this->getAlgorithmManager().createAlgorithm(OVP_ClassId_Algorithm_AcquisitionEncoder));
|
||||
m_experimentInfoStreamEncoder = &this->getAlgorithmManager().getAlgorithm(
|
||||
this->getAlgorithmManager().createAlgorithm(OVP_ClassId_Algorithm_ExperimentInfoEncoder));
|
||||
m_signalStreamEncoder = &this->getAlgorithmManager().getAlgorithm(this->getAlgorithmManager().createAlgorithm(OVP_ClassId_Algorithm_SignalEncoder));
|
||||
m_stimulationStreamEncoder = &this->getAlgorithmManager().getAlgorithm(
|
||||
this->getAlgorithmManager().createAlgorithm(OVP_ClassId_Algorithm_StimulationEncoder));
|
||||
m_channelLocalisationStreamEncoder = &this->getAlgorithmManager().getAlgorithm(
|
||||
this->getAlgorithmManager().createAlgorithm(OVP_ClassId_Algorithm_ChannelLocalisationEncoder));
|
||||
m_channelUnitsStreamEncoder = &this->getAlgorithmManager().getAlgorithm(
|
||||
this->getAlgorithmManager().createAlgorithm(OVP_ClassId_Algorithm_ChannelUnitsEncoder));
|
||||
|
||||
m_acquisitionStreamEncoder->initialize();
|
||||
m_experimentInfoStreamEncoder->initialize();
|
||||
m_signalStreamEncoder->initialize();
|
||||
m_stimulationStreamEncoder->initialize();
|
||||
m_channelLocalisationStreamEncoder->initialize();
|
||||
m_channelUnitsStreamEncoder->initialize();
|
||||
|
||||
// Declares parameter handlers for this algorithm
|
||||
|
||||
Kernel::TParameterHandler<uint64_t> ip_subjectID(this->getInputParameter(OVP_Algorithm_MasterAcquisitionEncoder_InputParameterId_SubjectID));
|
||||
Kernel::TParameterHandler<uint64_t> ip_subjectAge(this->getInputParameter(OVP_Algorithm_MasterAcquisitionEncoder_InputParameterId_SubjectAge));
|
||||
Kernel::TParameterHandler<uint64_t> ip_subjectGender(this->getInputParameter(OVP_Algorithm_MasterAcquisitionEncoder_InputParameterId_SubjectGender));
|
||||
Kernel::TParameterHandler<CMatrix*> ip_pMatrix(this->getInputParameter(OVP_Algorithm_MasterAcquisitionEncoder_InputParameterId_SignalMatrix));
|
||||
Kernel::TParameterHandler<uint64_t> ip_sampling(this->getInputParameter(OVP_Algorithm_MasterAcquisitionEncoder_InputParameterId_SignalSampling));
|
||||
Kernel::TParameterHandler<IStimulationSet*> ip_stimSet(this->getInputParameter(OVP_Algorithm_MasterAcquisitionEncoder_InputParameterId_StimulationSet));
|
||||
Kernel::TParameterHandler<uint64_t> ip_bufferDuration(this->getInputParameter(OVP_Algorithm_MasterAcquisitionEncoder_InputParameterId_BufferDuration));
|
||||
Kernel::TParameterHandler<IMemoryBuffer*> op_buffer(this->getOutputParameter(OVP_Algorithm_EBMLEncoder_OutputParameterId_EncodedMemoryBuffer));
|
||||
Kernel::TParameterHandler<CMatrix*> ip_channelLocalisationMaster(
|
||||
this->getInputParameter(OVP_Algorithm_MasterAcquisitionEncoder_InputParameterId_ChannelLocalisation));
|
||||
Kernel::TParameterHandler<CMatrix*> ip_channelUnitsMaster(this->getInputParameter(OVP_Algorithm_MasterAcquisitionEncoder_InputParameterId_ChannelUnits));
|
||||
|
||||
// Declares parameter handlers for sub-algorithm acquisition
|
||||
|
||||
Kernel::TParameterHandler<IMemoryBuffer*> ip_pAcquisitionChannelUnitsMemoryBuffer(
|
||||
m_acquisitionStreamEncoder->getInputParameter(OVP_Algorithm_AcquisitionEncoder_InputParameterId_ChannelUnitsStream));
|
||||
Kernel::TParameterHandler<IMemoryBuffer*> ip_pAcquisitionChannelLocalisationMemoryBuffer(
|
||||
m_acquisitionStreamEncoder->getInputParameter(OVP_Algorithm_AcquisitionEncoder_InputParameterId_ChannelLocalisationStream));
|
||||
Kernel::TParameterHandler<IMemoryBuffer*> ip_pAcquisitionExperimentInfoMemoryBuffer(
|
||||
m_acquisitionStreamEncoder->getInputParameter(OVP_Algorithm_AcquisitionEncoder_InputParameterId_ExperimentInfoStream));
|
||||
Kernel::TParameterHandler<IMemoryBuffer*> ip_pAcquisitionSignalMemoryBuffer(
|
||||
m_acquisitionStreamEncoder->getInputParameter(OVP_Algorithm_AcquisitionEncoder_InputParameterId_SignalStream));
|
||||
Kernel::TParameterHandler<IMemoryBuffer*> ip_pAcquisitionStimulationMemoryBuffer(
|
||||
m_acquisitionStreamEncoder->getInputParameter(OVP_Algorithm_AcquisitionEncoder_InputParameterId_StimulationStream));
|
||||
Kernel::TParameterHandler<uint64_t> ip_AcquisitionBufferDuration(
|
||||
m_acquisitionStreamEncoder->getInputParameter(OVP_Algorithm_AcquisitionEncoder_InputParameterId_BufferDuration));
|
||||
Kernel::TParameterHandler<IMemoryBuffer*> op_pAcquisitionMemoryBuffer(
|
||||
m_acquisitionStreamEncoder->getOutputParameter(OVP_Algorithm_EBMLEncoder_OutputParameterId_EncodedMemoryBuffer));
|
||||
|
||||
// Declares parameter handlers for sub-algorithm experiment information
|
||||
|
||||
// Kernel::TParameterHandler<uint64_t> ip_ExperimentInfoExperimentID(m_experimentInfoStreamEncoder->getInputParameter(OVP_Algorithm_ExperimentInfoEncoder_InputParameterId_ExperimentID));
|
||||
// Kernel::TParameterHandler<CString*> ip_experimentInfoExperimentDate(m_experimentInfoStreamEncoder->getInputParameter(OVP_Algorithm_ExperimentInfoEncoder_InputParameterId_ExperimentDate));
|
||||
Kernel::TParameterHandler<uint64_t> ip_ExperimentInfoSubjectID(
|
||||
m_experimentInfoStreamEncoder->getInputParameter(OVP_Algorithm_ExperimentInfoEncoder_InputParameterId_SubjectID));
|
||||
// Kernel::TParameterHandler< CString*> ip_experimentInfoSubjectName(m_experimentInfoStreamEncoder->getInputParameter(OVP_Algorithm_ExperimentInfoEncoder_InputParameterId_SubjectName));
|
||||
Kernel::TParameterHandler<uint64_t> ip_ExperimentInfoSubjectAge(
|
||||
m_experimentInfoStreamEncoder->getInputParameter(OVP_Algorithm_ExperimentInfoEncoder_InputParameterId_SubjectAge));
|
||||
Kernel::TParameterHandler<uint64_t> ip_ExperimentInfoSubjectGender(
|
||||
m_experimentInfoStreamEncoder->getInputParameter(OVP_Algorithm_ExperimentInfoEncoder_InputParameterId_SubjectGender));
|
||||
// Kernel::TParameterHandler<uint64_t> ip_ExperimentInfoLaboratoryID(m_experimentInfoStreamEncoder->getInputParameter(OVP_Algorithm_ExperimentInfoEncoder_InputParameterId_LaboratoryID));
|
||||
// Kernel::TParameterHandler<CString*> ip_experimentInfoLaboratoryName(m_experimentInfoStreamEncoder->getInputParameter(OVP_Algorithm_ExperimentInfoEncoder_InputParameterId_LaboratoryName));
|
||||
// Kernel::TParameterHandler<uint64_t> ip_ExperimentInfoTechnicianID(m_experimentInfoStreamEncoder->getInputParameter(OVP_Algorithm_ExperimentInfoEncoder_InputParameterId_TechnicianID));
|
||||
// Kernel::TParameterHandler<CString*> ip_experimentInfoTehnicianName(m_experimentInfoStreamEncoder->getInputParameter(OVP_Algorithm_ExperimentInfoEncoder_InputParameterId_TechnicianName));
|
||||
Kernel::TParameterHandler<IMemoryBuffer*> op_experimentInfoMemoryBuffer(
|
||||
m_experimentInfoStreamEncoder->getOutputParameter(OVP_Algorithm_EBMLEncoder_OutputParameterId_EncodedMemoryBuffer));
|
||||
|
||||
// Declares parameter handlers for sub-algorithm signal
|
||||
|
||||
Kernel::TParameterHandler<CMatrix*> ip_matrix(m_signalStreamEncoder->getInputParameter(OVP_Algorithm_StreamedMatrixEncoder_InputParameterId_Matrix));
|
||||
Kernel::TParameterHandler<uint64_t> ip_signalSamplingRate(m_signalStreamEncoder->getInputParameter(OVP_Algorithm_SignalEncoder_InputParameterId_Sampling));
|
||||
Kernel::TParameterHandler<IMemoryBuffer*> op_signalMemoryBuffer(
|
||||
m_signalStreamEncoder->getOutputParameter(OVP_Algorithm_EBMLEncoder_OutputParameterId_EncodedMemoryBuffer));
|
||||
|
||||
// Declares parameter handlers for sub-algorithm stimulation
|
||||
|
||||
Kernel::TParameterHandler<IStimulationSet*> ip_stimulationStimulationSet(
|
||||
m_stimulationStreamEncoder->getInputParameter(OVP_Algorithm_StimulationEncoder_InputParameterId_StimulationSet));
|
||||
Kernel::TParameterHandler<IMemoryBuffer*> op_stimulationMemoryBuffer(
|
||||
m_stimulationStreamEncoder->getOutputParameter(OVP_Algorithm_EBMLEncoder_OutputParameterId_EncodedMemoryBuffer));
|
||||
|
||||
Kernel::TParameterHandler<CMatrix*> ip_channelLocalisation(
|
||||
m_channelLocalisationStreamEncoder->getInputParameter(OVP_Algorithm_StreamedMatrixEncoder_InputParameterId_Matrix));
|
||||
Kernel::TParameterHandler<IMemoryBuffer*> op_channelLocalisationMemoryBuffer(
|
||||
m_channelLocalisationStreamEncoder->getOutputParameter(OVP_Algorithm_EBMLEncoder_OutputParameterId_EncodedMemoryBuffer));
|
||||
|
||||
Kernel::TParameterHandler<CMatrix*> ip_pUnits(m_channelUnitsStreamEncoder->getInputParameter(OVP_Algorithm_StreamedMatrixEncoder_InputParameterId_Matrix));
|
||||
Kernel::TParameterHandler<IMemoryBuffer*> op_channelUnitsMemoryBuffer(
|
||||
m_channelUnitsStreamEncoder->getOutputParameter(OVP_Algorithm_EBMLEncoder_OutputParameterId_EncodedMemoryBuffer));
|
||||
|
||||
|
||||
// Manage parameter connection / referencing | this algorithm to sub algorithm
|
||||
|
||||
ip_ExperimentInfoSubjectID.setReferenceTarget(ip_subjectID);
|
||||
ip_ExperimentInfoSubjectAge.setReferenceTarget(ip_subjectAge);
|
||||
ip_ExperimentInfoSubjectGender.setReferenceTarget(ip_subjectGender);
|
||||
ip_matrix.setReferenceTarget(ip_pMatrix);
|
||||
ip_signalSamplingRate.setReferenceTarget(ip_sampling);
|
||||
ip_stimulationStimulationSet.setReferenceTarget(ip_stimSet);
|
||||
ip_AcquisitionBufferDuration.setReferenceTarget(ip_bufferDuration);
|
||||
op_buffer.setReferenceTarget(op_pAcquisitionMemoryBuffer);
|
||||
ip_channelLocalisationMaster.setReferenceTarget(ip_channelLocalisation);
|
||||
ip_channelUnitsMaster.setReferenceTarget(ip_pUnits);
|
||||
|
||||
// Manage parameter connection / referencing | sub-algorithm to sub algorithm
|
||||
|
||||
ip_pAcquisitionExperimentInfoMemoryBuffer.setReferenceTarget(op_experimentInfoMemoryBuffer);
|
||||
ip_pAcquisitionSignalMemoryBuffer.setReferenceTarget(op_signalMemoryBuffer);
|
||||
ip_pAcquisitionStimulationMemoryBuffer.setReferenceTarget(op_stimulationMemoryBuffer);
|
||||
ip_pAcquisitionChannelLocalisationMemoryBuffer.setReferenceTarget(op_channelLocalisationMemoryBuffer);
|
||||
ip_pAcquisitionChannelUnitsMemoryBuffer.setReferenceTarget(op_channelUnitsMemoryBuffer);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CMasterAcquisitionEncoder::uninitialize()
|
||||
{
|
||||
m_channelUnitsStreamEncoder->uninitialize();
|
||||
m_channelLocalisationStreamEncoder->uninitialize();
|
||||
m_stimulationStreamEncoder->uninitialize();
|
||||
m_signalStreamEncoder->uninitialize();
|
||||
m_experimentInfoStreamEncoder->uninitialize();
|
||||
m_acquisitionStreamEncoder->uninitialize();
|
||||
|
||||
this->getAlgorithmManager().releaseAlgorithm(*m_channelUnitsStreamEncoder);
|
||||
this->getAlgorithmManager().releaseAlgorithm(*m_channelLocalisationStreamEncoder);
|
||||
this->getAlgorithmManager().releaseAlgorithm(*m_stimulationStreamEncoder);
|
||||
this->getAlgorithmManager().releaseAlgorithm(*m_signalStreamEncoder);
|
||||
this->getAlgorithmManager().releaseAlgorithm(*m_experimentInfoStreamEncoder);
|
||||
this->getAlgorithmManager().releaseAlgorithm(*m_acquisitionStreamEncoder);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CMasterAcquisitionEncoder::process()
|
||||
{
|
||||
Kernel::TParameterHandler<IMemoryBuffer*> ip_pAcquisitionChannelUnitsMemoryBuffer(
|
||||
m_acquisitionStreamEncoder->getInputParameter(OVP_Algorithm_AcquisitionEncoder_InputParameterId_ChannelUnitsStream));
|
||||
Kernel::TParameterHandler<IMemoryBuffer*> ip_pAcquisitionChannelLocalisationMemoryBuffer(
|
||||
m_acquisitionStreamEncoder->getInputParameter(OVP_Algorithm_AcquisitionEncoder_InputParameterId_ChannelLocalisationStream));
|
||||
Kernel::TParameterHandler<IMemoryBuffer*> ip_pAcquisitionExperimentInfoMemoryBuffer(
|
||||
m_acquisitionStreamEncoder->getInputParameter(OVP_Algorithm_AcquisitionEncoder_InputParameterId_ExperimentInfoStream));
|
||||
Kernel::TParameterHandler<IMemoryBuffer*> ip_pAcquisitionSignalMemoryBuffer(
|
||||
m_acquisitionStreamEncoder->getInputParameter(OVP_Algorithm_AcquisitionEncoder_InputParameterId_SignalStream));
|
||||
Kernel::TParameterHandler<IMemoryBuffer*> ip_pAcquisitionStimulationMemoryBuffer(
|
||||
m_acquisitionStreamEncoder->getInputParameter(OVP_Algorithm_AcquisitionEncoder_InputParameterId_StimulationStream));
|
||||
// Kernel::TParameterHandler < IMemoryBuffer* > op_pAcquisitionMemoryBuffer(m_acquisitionStreamEncoder->getOutputParameter(OVP_Algorithm_EBMLEncoder_OutputParameterId_EncodedMemoryBuffer));
|
||||
|
||||
if (this->isInputTriggerActive(OVP_Algorithm_EBMLEncoder_InputTriggerId_EncodeHeader))
|
||||
{
|
||||
ip_pAcquisitionChannelUnitsMemoryBuffer->setSize(0, true);
|
||||
ip_pAcquisitionChannelLocalisationMemoryBuffer->setSize(0, true);
|
||||
ip_pAcquisitionExperimentInfoMemoryBuffer->setSize(0, true);
|
||||
ip_pAcquisitionSignalMemoryBuffer->setSize(0, true);
|
||||
ip_pAcquisitionStimulationMemoryBuffer->setSize(0, true);
|
||||
// op_pAcquisitionMemoryBuffer->setSize(0, true);
|
||||
|
||||
m_channelLocalisationStreamEncoder->process(OVP_Algorithm_EBMLEncoder_InputTriggerId_EncodeHeader);
|
||||
m_channelUnitsStreamEncoder->process(OVP_Algorithm_EBMLEncoder_InputTriggerId_EncodeHeader);
|
||||
m_stimulationStreamEncoder->process(OVP_Algorithm_EBMLEncoder_InputTriggerId_EncodeHeader);
|
||||
m_signalStreamEncoder->process(OVP_Algorithm_EBMLEncoder_InputTriggerId_EncodeHeader);
|
||||
m_experimentInfoStreamEncoder->process(OVP_Algorithm_EBMLEncoder_InputTriggerId_EncodeHeader);
|
||||
m_acquisitionStreamEncoder->process(OVP_Algorithm_EBMLEncoder_InputTriggerId_EncodeHeader);
|
||||
}
|
||||
if (this->isInputTriggerActive(OVP_Algorithm_EBMLEncoder_InputTriggerId_EncodeBuffer))
|
||||
{
|
||||
ip_pAcquisitionChannelUnitsMemoryBuffer->setSize(0, true);
|
||||
ip_pAcquisitionChannelLocalisationMemoryBuffer->setSize(0, true);
|
||||
ip_pAcquisitionExperimentInfoMemoryBuffer->setSize(0, true);
|
||||
ip_pAcquisitionSignalMemoryBuffer->setSize(0, true);
|
||||
ip_pAcquisitionStimulationMemoryBuffer->setSize(0, true);
|
||||
// op_pAcquisitionMemoryBuffer->setSize(0, true);
|
||||
|
||||
// For these streams, we only send the buffer if there is something to send
|
||||
const Kernel::TParameterHandler<bool>
|
||||
ip_bEncodeUnitData(this->getInputParameter(OVP_Algorithm_MasterAcquisitionEncoder_InputParameterId_EncodeChannelUnitData));
|
||||
if (ip_bEncodeUnitData)
|
||||
{
|
||||
// this->getLogManager() << Kernel::LogLevel_Info << "Encoding units " << ip_pUnits->getBufferElementCount() << "\n";
|
||||
m_channelUnitsStreamEncoder->process(OVP_Algorithm_EBMLEncoder_InputTriggerId_EncodeBuffer);
|
||||
}
|
||||
|
||||
const Kernel::TParameterHandler<bool> ip_encodeChannelLocalisationData(
|
||||
this->getInputParameter(OVP_Algorithm_MasterAcquisitionEncoder_InputParameterId_EncodeChannelLocalisationData));
|
||||
if (ip_encodeChannelLocalisationData) { m_channelLocalisationStreamEncoder->process(OVP_Algorithm_EBMLEncoder_InputTriggerId_EncodeBuffer); }
|
||||
|
||||
m_stimulationStreamEncoder->process(OVP_Algorithm_EBMLEncoder_InputTriggerId_EncodeBuffer);
|
||||
m_signalStreamEncoder->process(OVP_Algorithm_EBMLEncoder_InputTriggerId_EncodeBuffer);
|
||||
m_experimentInfoStreamEncoder->process(OVP_Algorithm_EBMLEncoder_InputTriggerId_EncodeBuffer);
|
||||
m_acquisitionStreamEncoder->process(OVP_Algorithm_EBMLEncoder_InputTriggerId_EncodeBuffer);
|
||||
}
|
||||
if (this->isInputTriggerActive(OVP_Algorithm_EBMLEncoder_InputTriggerId_EncodeEnd))
|
||||
{
|
||||
ip_pAcquisitionChannelUnitsMemoryBuffer->setSize(0, true);
|
||||
ip_pAcquisitionChannelLocalisationMemoryBuffer->setSize(0, true);
|
||||
ip_pAcquisitionExperimentInfoMemoryBuffer->setSize(0, true);
|
||||
ip_pAcquisitionSignalMemoryBuffer->setSize(0, true);
|
||||
ip_pAcquisitionStimulationMemoryBuffer->setSize(0, true);
|
||||
// op_pAcquisitionMemoryBuffer->setSize(0, true);
|
||||
|
||||
m_channelUnitsStreamEncoder->process(OVP_Algorithm_EBMLEncoder_InputTriggerId_EncodeEnd);
|
||||
m_channelLocalisationStreamEncoder->process(OVP_Algorithm_EBMLEncoder_InputTriggerId_EncodeEnd);
|
||||
m_stimulationStreamEncoder->process(OVP_Algorithm_EBMLEncoder_InputTriggerId_EncodeEnd);
|
||||
m_signalStreamEncoder->process(OVP_Algorithm_EBMLEncoder_InputTriggerId_EncodeEnd);
|
||||
m_experimentInfoStreamEncoder->process(OVP_Algorithm_EBMLEncoder_InputTriggerId_EncodeEnd);
|
||||
m_acquisitionStreamEncoder->process(OVP_Algorithm_EBMLEncoder_InputTriggerId_EncodeEnd);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace StreamCodecs
|
||||
} // namespace Plugins
|
||||
} // namespace OpenViBE
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../ovp_defines.h"
|
||||
#include "ovpCEBMLBaseEncoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Plugins {
|
||||
namespace StreamCodecs {
|
||||
class CMasterAcquisitionEncoder final : public Toolkit::TAlgorithm<IAlgorithm>
|
||||
{
|
||||
public:
|
||||
void release() override { delete this; }
|
||||
bool initialize() override;
|
||||
bool uninitialize() override;
|
||||
bool process() override;
|
||||
|
||||
_IsDerivedFromClass_Final_(Toolkit::TAlgorithm<IAlgorithm>, OVP_ClassId_Algorithm_MasterAcquisitionEncoder)
|
||||
|
||||
protected:
|
||||
|
||||
Kernel::IAlgorithmProxy* m_acquisitionStreamEncoder = nullptr;
|
||||
Kernel::IAlgorithmProxy* m_experimentInfoStreamEncoder = nullptr;
|
||||
Kernel::IAlgorithmProxy* m_signalStreamEncoder = nullptr;
|
||||
Kernel::IAlgorithmProxy* m_stimulationStreamEncoder = nullptr;
|
||||
Kernel::IAlgorithmProxy* m_channelLocalisationStreamEncoder = nullptr;
|
||||
Kernel::IAlgorithmProxy* m_channelUnitsStreamEncoder = nullptr;
|
||||
};
|
||||
|
||||
class CMasterAcquisitionEncoderDesc final : public IAlgorithmDesc
|
||||
{
|
||||
public:
|
||||
void release() override { }
|
||||
CString getName() const override { return CString("Master acquisition stream encoder"); }
|
||||
CString getAuthorName() const override { return CString("Yann Renard"); }
|
||||
CString getAuthorCompanyName() const override { return CString("INRIA"); }
|
||||
CString getShortDescription() const override { return CString(""); }
|
||||
CString getDetailedDescription() const override { return CString(""); }
|
||||
CString getCategory() const override { return CString("Stream codecs/Encoders"); }
|
||||
CString getVersion() const override { return CString("1.1"); }
|
||||
CString getSoftwareComponent() const override { return CString("openvibe-sdk"); }
|
||||
CString getAddedSoftwareVersion() const override { return CString("0.0.0"); }
|
||||
CString getUpdatedSoftwareVersion() const override { return CString("0.0.0"); }
|
||||
CIdentifier getCreatedClass() const override { return OVP_ClassId_Algorithm_MasterAcquisitionEncoder; }
|
||||
IPluginObject* create() override { return new CMasterAcquisitionEncoder(); }
|
||||
|
||||
bool getAlgorithmPrototype(Kernel::IAlgorithmProto& prototype) const override
|
||||
{
|
||||
prototype.addInputTrigger(OVP_Algorithm_EBMLEncoder_InputTriggerId_EncodeHeader, "Encode header");
|
||||
prototype.addInputTrigger(OVP_Algorithm_EBMLEncoder_InputTriggerId_EncodeBuffer, "Encode buffer");
|
||||
prototype.addInputTrigger(OVP_Algorithm_EBMLEncoder_InputTriggerId_EncodeEnd, "Encode end");
|
||||
|
||||
prototype.addInputParameter(OVP_Algorithm_MasterAcquisitionEncoder_InputParameterId_SubjectID, "Subject identifier", Kernel::ParameterType_UInteger);
|
||||
prototype.addInputParameter(OVP_Algorithm_MasterAcquisitionEncoder_InputParameterId_SubjectAge, "Subject age", Kernel::ParameterType_UInteger);
|
||||
prototype.addInputParameter(OVP_Algorithm_MasterAcquisitionEncoder_InputParameterId_SubjectGender, "Subject gender", Kernel::ParameterType_UInteger);
|
||||
prototype.addInputParameter(OVP_Algorithm_MasterAcquisitionEncoder_InputParameterId_SignalMatrix, "Signal matrix", Kernel::ParameterType_Matrix);
|
||||
prototype.addInputParameter(OVP_Algorithm_MasterAcquisitionEncoder_InputParameterId_SignalSampling, "Signal sampling rate",
|
||||
Kernel::ParameterType_UInteger);
|
||||
prototype.addInputParameter(OVP_Algorithm_MasterAcquisitionEncoder_InputParameterId_StimulationSet, "Stimulation set",
|
||||
Kernel::ParameterType_StimulationSet);
|
||||
prototype.addInputParameter(OVP_Algorithm_MasterAcquisitionEncoder_InputParameterId_BufferDuration, "Buffer duration", Kernel::ParameterType_UInteger);
|
||||
prototype.addInputParameter(OVP_Algorithm_MasterAcquisitionEncoder_InputParameterId_ChannelLocalisation, "Channel localisation",
|
||||
Kernel::ParameterType_Matrix);
|
||||
prototype.addInputParameter(OVP_Algorithm_MasterAcquisitionEncoder_InputParameterId_ChannelUnits, "Channel units", Kernel::ParameterType_Matrix);
|
||||
prototype.addInputParameter(OVP_Algorithm_MasterAcquisitionEncoder_InputParameterId_EncodeChannelLocalisationData, "Encode channel localisation data",
|
||||
Kernel::ParameterType_Boolean);
|
||||
prototype.addInputParameter(OVP_Algorithm_MasterAcquisitionEncoder_InputParameterId_EncodeChannelUnitData, "Encode channel unit data",
|
||||
Kernel::ParameterType_Boolean);
|
||||
|
||||
prototype.addOutputParameter(OVP_Algorithm_EBMLEncoder_OutputParameterId_EncodedMemoryBuffer, "Encoded memory buffer",
|
||||
Kernel::ParameterType_MemoryBuffer);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
_IsDerivedFromClass_Final_(IAlgorithmDesc, OVP_ClassId_Algorithm_MasterAcquisitionEncoderDesc)
|
||||
};
|
||||
} // namespace StreamCodecs
|
||||
} // namespace Plugins
|
||||
} // namespace OpenViBE
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
#include "ovpCSignalEncoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Plugins {
|
||||
namespace StreamCodecs {
|
||||
|
||||
bool CSignalEncoder::initialize()
|
||||
{
|
||||
CStreamedMatrixEncoder::initialize();
|
||||
ip_sampling.initialize(getInputParameter(OVP_Algorithm_SignalEncoder_InputParameterId_Sampling));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CSignalEncoder::uninitialize()
|
||||
{
|
||||
ip_sampling.uninitialize();
|
||||
CStreamedMatrixEncoder::uninitialize();
|
||||
return true;
|
||||
}
|
||||
|
||||
// ________________________________________________________________________________________________________________
|
||||
//
|
||||
|
||||
bool CSignalEncoder::processHeader()
|
||||
{
|
||||
m_writerHelper->openChild(OVTK_NodeId_Header_Signal);
|
||||
m_writerHelper->openChild(OVTK_NodeId_Header_Signal_Sampling);
|
||||
m_writerHelper->setUInt(ip_sampling);
|
||||
m_writerHelper->closeChild();
|
||||
m_writerHelper->closeChild();
|
||||
|
||||
CStreamedMatrixEncoder::processHeader();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace StreamCodecs
|
||||
} // namespace Plugins
|
||||
} // namespace OpenViBE
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../ovp_defines.h"
|
||||
#include "ovpCStreamedMatrixEncoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Plugins {
|
||||
namespace StreamCodecs {
|
||||
class CSignalEncoder final : public CStreamedMatrixEncoder
|
||||
{
|
||||
public:
|
||||
void release() override { delete this; }
|
||||
bool initialize() override;
|
||||
bool uninitialize() override;
|
||||
bool processHeader() override;
|
||||
|
||||
_IsDerivedFromClass_Final_(StreamCodecs::CStreamedMatrixEncoder, OVP_ClassId_Algorithm_SignalEncoder)
|
||||
|
||||
protected:
|
||||
|
||||
Kernel::TParameterHandler<uint64_t> ip_sampling;
|
||||
};
|
||||
|
||||
|
||||
class CSignalEncoderDesc final : public CStreamedMatrixEncoderDesc
|
||||
{
|
||||
public:
|
||||
void release() override { }
|
||||
CString getName() const override { return CString("Signal stream encoder"); }
|
||||
CString getAuthorName() const override { return CString("Yann Renard"); }
|
||||
CString getAuthorCompanyName() const override { return CString("INRIA/IRISA"); }
|
||||
CString getShortDescription() const override { return CString(""); }
|
||||
CString getDetailedDescription() const override { return CString(""); }
|
||||
CString getCategory() const override { return CString("Stream codecs/Encoders"); }
|
||||
CString getVersion() const override { return CString("1.0"); }
|
||||
CString getSoftwareComponent() const override { return CString("openvibe-sdk"); }
|
||||
CString getAddedSoftwareVersion() const override { return CString("0.0.0"); }
|
||||
CString getUpdatedSoftwareVersion() const override { return CString("0.0.0"); }
|
||||
CIdentifier getCreatedClass() const override { return OVP_ClassId_Algorithm_SignalEncoder; }
|
||||
IPluginObject* create() override { return new CSignalEncoder(); }
|
||||
|
||||
bool getAlgorithmPrototype(Kernel::IAlgorithmProto& prototype) const override
|
||||
{
|
||||
CStreamedMatrixEncoderDesc::getAlgorithmPrototype(prototype);
|
||||
prototype.addInputParameter(OVP_Algorithm_SignalEncoder_InputParameterId_Sampling, "Sampling rate", Kernel::ParameterType_UInteger);
|
||||
return true;
|
||||
}
|
||||
|
||||
_IsDerivedFromClass_Final_(StreamCodecs::CStreamedMatrixEncoderDesc, OVP_ClassId_Algorithm_SignalEncoderDesc)
|
||||
};
|
||||
} // namespace StreamCodecs
|
||||
} // namespace Plugins
|
||||
} // namespace OpenViBE
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
#include "ovpCSpectrumEncoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Plugins {
|
||||
namespace StreamCodecs {
|
||||
|
||||
bool CSpectrumEncoder::initialize()
|
||||
{
|
||||
CStreamedMatrixEncoder::initialize();
|
||||
ip_frequencyAbscissa.initialize(getInputParameter(OVP_Algorithm_SpectrumEncoder_InputParameterId_FrequencyAbscissa));
|
||||
ip_sampling.initialize(getInputParameter(OVP_Algorithm_SpectrumEncoder_InputParameterId_Sampling));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CSpectrumEncoder::uninitialize()
|
||||
{
|
||||
ip_frequencyAbscissa.uninitialize();
|
||||
ip_sampling.uninitialize();
|
||||
|
||||
CStreamedMatrixEncoder::uninitialize();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ________________________________________________________________________________________________________________
|
||||
//
|
||||
|
||||
bool CSpectrumEncoder::processHeader()
|
||||
{
|
||||
// ip_frequencyAbscissa dimension count should be 1
|
||||
// ip_frequencyAbscissa dimension size 0 should be the same as streamed matrix dimension size 1
|
||||
|
||||
CMatrix* frequencyAbscissa = ip_frequencyAbscissa;
|
||||
const uint64_t sampling = ip_sampling;
|
||||
CStreamedMatrixEncoder::processHeader();
|
||||
m_writerHelper->openChild(OVTK_NodeId_Header_Spectrum);
|
||||
m_writerHelper->openChild(OVTK_NodeId_Header_Spectrum_Sampling);
|
||||
m_writerHelper->setUInt(sampling);
|
||||
m_writerHelper->closeChild();
|
||||
for (size_t i = 0; i < frequencyAbscissa->getDimensionSize(0); ++i)
|
||||
{
|
||||
m_writerHelper->openChild(OVTK_NodeId_Header_Spectrum_FrequencyAbscissa);
|
||||
m_writerHelper->setDouble(frequencyAbscissa->getBuffer()[i]);
|
||||
m_writerHelper->closeChild();
|
||||
}
|
||||
m_writerHelper->closeChild();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace StreamCodecs
|
||||
} // namespace Plugins
|
||||
} // namespace OpenViBE
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../ovp_defines.h"
|
||||
#include "ovpCStreamedMatrixEncoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Plugins {
|
||||
namespace StreamCodecs {
|
||||
class CSpectrumEncoder final : public CStreamedMatrixEncoder
|
||||
{
|
||||
public:
|
||||
void release() override { delete this; }
|
||||
bool initialize() override;
|
||||
bool uninitialize() override;
|
||||
bool processHeader() override;
|
||||
|
||||
_IsDerivedFromClass_Final_(StreamCodecs::CStreamedMatrixEncoder, OVP_ClassId_Algorithm_SpectrumEncoder)
|
||||
|
||||
protected:
|
||||
Kernel::TParameterHandler<CMatrix*> ip_frequencyAbscissa;
|
||||
Kernel::TParameterHandler<uint64_t> ip_sampling;
|
||||
};
|
||||
|
||||
class CSpectrumEncoderDesc final : public CStreamedMatrixEncoderDesc
|
||||
{
|
||||
public:
|
||||
void release() override { }
|
||||
CString getName() const override { return CString("Spectrum stream encoder"); }
|
||||
CString getAuthorName() const override { return CString("Yann Renard"); }
|
||||
CString getAuthorCompanyName() const override { return CString("INRIA/IRISA"); }
|
||||
CString getShortDescription() const override { return CString("Encodes a Spectrum stream."); }
|
||||
CString getDetailedDescription() const override { return CString(""); }
|
||||
CString getCategory() const override { return CString("Stream codecs/Encoders"); }
|
||||
CString getVersion() const override { return CString("1.0"); }
|
||||
CString getSoftwareComponent() const override { return CString("openvibe-sdk"); }
|
||||
CString getAddedSoftwareVersion() const override { return CString("0.0.0"); }
|
||||
CString getUpdatedSoftwareVersion() const override { return CString("0.1.0"); }
|
||||
CIdentifier getCreatedClass() const override { return OVP_ClassId_Algorithm_SpectrumEncoder; }
|
||||
IPluginObject* create() override { return new CSpectrumEncoder(); }
|
||||
|
||||
bool getAlgorithmPrototype(Kernel::IAlgorithmProto& prototype) const override
|
||||
{
|
||||
CStreamedMatrixEncoderDesc::getAlgorithmPrototype(prototype);
|
||||
|
||||
prototype.addInputParameter(OVP_Algorithm_SpectrumEncoder_InputParameterId_FrequencyAbscissa, "Frequency abscissa", Kernel::ParameterType_Matrix);
|
||||
prototype.addInputParameter(OVP_Algorithm_SpectrumEncoder_InputParameterId_Sampling, "Sampling rate", Kernel::ParameterType_UInteger);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
_IsDerivedFromClass_Final_(StreamCodecs::CStreamedMatrixEncoderDesc, OVP_ClassId_Algorithm_SpectrumEncoderDesc)
|
||||
};
|
||||
} // namespace StreamCodecs
|
||||
} // namespace Plugins
|
||||
} // namespace OpenViBE
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
#include "ovpCStimulationEncoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Plugins {
|
||||
namespace StreamCodecs {
|
||||
|
||||
bool CStimulationEncoder::initialize()
|
||||
{
|
||||
CEBMLBaseEncoder::initialize();
|
||||
ip_stimSet.initialize(getInputParameter(OVP_Algorithm_StimulationEncoder_InputParameterId_StimulationSet));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CStimulationEncoder::uninitialize()
|
||||
{
|
||||
ip_stimSet.uninitialize();
|
||||
CEBMLBaseEncoder::uninitialize();
|
||||
return true;
|
||||
}
|
||||
|
||||
// ________________________________________________________________________________________________________________
|
||||
//
|
||||
|
||||
bool CStimulationEncoder::processBuffer()
|
||||
{
|
||||
IStimulationSet* stimulationSet = ip_stimSet;
|
||||
|
||||
m_writerHelper->openChild(OVTK_NodeId_Buffer_Stimulation);
|
||||
m_writerHelper->openChild(OVTK_NodeId_Buffer_Stimulation_NumberOfStimulations);
|
||||
m_writerHelper->setUInt(stimulationSet->getStimulationCount());
|
||||
m_writerHelper->closeChild();
|
||||
for (size_t i = 0; i < stimulationSet->getStimulationCount(); ++i)
|
||||
{
|
||||
m_writerHelper->openChild(OVTK_NodeId_Buffer_Stimulation_Stimulation);
|
||||
m_writerHelper->openChild(OVTK_NodeId_Buffer_Stimulation_Stimulation_ID);
|
||||
m_writerHelper->setUInt(stimulationSet->getStimulationIdentifier(i));
|
||||
m_writerHelper->closeChild();
|
||||
m_writerHelper->openChild(OVTK_NodeId_Buffer_Stimulation_Stimulation_Date);
|
||||
m_writerHelper->setUInt(stimulationSet->getStimulationDate(i));
|
||||
m_writerHelper->closeChild();
|
||||
m_writerHelper->openChild(OVTK_NodeId_Buffer_Stimulation_Stimulation_Duration);
|
||||
m_writerHelper->setUInt(stimulationSet->getStimulationDuration(i));
|
||||
m_writerHelper->closeChild();
|
||||
m_writerHelper->closeChild();
|
||||
}
|
||||
m_writerHelper->closeChild();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace StreamCodecs
|
||||
} // namespace Plugins
|
||||
} // namespace OpenViBE
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../ovp_defines.h"
|
||||
#include "ovpCEBMLBaseEncoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Plugins {
|
||||
namespace StreamCodecs {
|
||||
class CStimulationEncoder final : public CEBMLBaseEncoder
|
||||
{
|
||||
public:
|
||||
void release() override { delete this; }
|
||||
bool initialize() override;
|
||||
bool uninitialize() override;
|
||||
bool processBuffer() override;
|
||||
|
||||
_IsDerivedFromClass_Final_(StreamCodecs::CEBMLBaseEncoder, OVP_ClassId_Algorithm_StimulationEncoder)
|
||||
|
||||
protected:
|
||||
|
||||
Kernel::TParameterHandler<IStimulationSet*> ip_stimSet;
|
||||
};
|
||||
|
||||
class CStimulationEncoderDesc final : public CEBMLBaseEncoderDesc
|
||||
{
|
||||
public:
|
||||
void release() override { }
|
||||
CString getName() const override { return CString("Stimulation stream encoder"); }
|
||||
CString getAuthorName() const override { return CString("Yann Renard"); }
|
||||
CString getAuthorCompanyName() const override { return CString("INRIA/IRISA"); }
|
||||
CString getShortDescription() const override { return CString(""); }
|
||||
CString getDetailedDescription() const override { return CString(""); }
|
||||
CString getCategory() const override { return CString("Stream codecs/Encoders"); }
|
||||
CString getVersion() const override { return CString("1.0"); }
|
||||
CString getSoftwareComponent() const override { return CString("openvibe-sdk"); }
|
||||
CString getAddedSoftwareVersion() const override { return CString("0.0.0"); }
|
||||
CString getUpdatedSoftwareVersion() const override { return CString("0.0.0"); }
|
||||
CIdentifier getCreatedClass() const override { return OVP_ClassId_Algorithm_StimulationEncoder; }
|
||||
IPluginObject* create() override { return new CStimulationEncoder(); }
|
||||
|
||||
bool getAlgorithmPrototype(Kernel::IAlgorithmProto& prototype) const override
|
||||
{
|
||||
CEBMLBaseEncoderDesc::getAlgorithmPrototype(prototype);
|
||||
prototype.addInputParameter(OVP_Algorithm_StimulationEncoder_InputParameterId_StimulationSet, "Stimulation set", Kernel::ParameterType_StimulationSet);
|
||||
return true;
|
||||
}
|
||||
|
||||
_IsDerivedFromClass_Final_(StreamCodecs::CEBMLBaseEncoderDesc, OVP_ClassId_Algorithm_StimulationEncoderDesc)
|
||||
};
|
||||
} // namespace StreamCodecs
|
||||
} // namespace Plugins
|
||||
} // namespace OpenViBE
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
#include "ovpCStreamedMatrixEncoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Plugins {
|
||||
namespace StreamCodecs {
|
||||
|
||||
bool CStreamedMatrixEncoder::initialize()
|
||||
{
|
||||
CEBMLBaseEncoder::initialize();
|
||||
ip_pMatrix.initialize(getInputParameter(OVP_Algorithm_StreamedMatrixEncoder_InputParameterId_Matrix));
|
||||
m_size = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CStreamedMatrixEncoder::uninitialize()
|
||||
{
|
||||
ip_pMatrix.uninitialize();
|
||||
CEBMLBaseEncoder::uninitialize();
|
||||
return true;
|
||||
}
|
||||
|
||||
// ________________________________________________________________________________________________________________
|
||||
//
|
||||
|
||||
bool CStreamedMatrixEncoder::processHeader()
|
||||
{
|
||||
CMatrix* matrix = ip_pMatrix;
|
||||
size_t j;
|
||||
|
||||
m_size = (matrix->getDimensionCount() == 0 ? 0 : 1);
|
||||
|
||||
m_writerHelper->openChild(OVTK_NodeId_Header_StreamedMatrix);
|
||||
m_writerHelper->openChild(OVTK_NodeId_Header_StreamedMatrix_DimensionCount);
|
||||
m_writerHelper->setUInt(matrix->getDimensionCount());
|
||||
m_writerHelper->closeChild();
|
||||
for (size_t i = 0; i < matrix->getDimensionCount(); ++i)
|
||||
{
|
||||
m_size *= matrix->getDimensionSize(i);
|
||||
m_writerHelper->openChild(OVTK_NodeId_Header_StreamedMatrix_Dimension);
|
||||
m_writerHelper->openChild(OVTK_NodeId_Header_StreamedMatrix_Dimension_Size);
|
||||
m_writerHelper->setUInt(matrix->getDimensionSize(i));
|
||||
m_writerHelper->closeChild();
|
||||
bool shouldSendLabels = false;
|
||||
for (j = 0; j < matrix->getDimensionSize(i) && !shouldSendLabels; ++j)
|
||||
{
|
||||
if (matrix->getDimensionLabel(i, j) != nullptr && matrix->getDimensionLabel(i, j)[0] != '\0') { shouldSendLabels = true; }
|
||||
}
|
||||
if (shouldSendLabels)
|
||||
{
|
||||
for (j = 0; j < matrix->getDimensionSize(i); ++j)
|
||||
{
|
||||
m_writerHelper->openChild(OVTK_NodeId_Header_StreamedMatrix_Dimension_Label);
|
||||
m_writerHelper->setStr(matrix->getDimensionLabel(i, j));
|
||||
m_writerHelper->closeChild();
|
||||
}
|
||||
}
|
||||
m_writerHelper->closeChild();
|
||||
}
|
||||
m_writerHelper->closeChild();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CStreamedMatrixEncoder::processBuffer()
|
||||
{
|
||||
CMatrix* matrix = ip_pMatrix;
|
||||
|
||||
m_writerHelper->openChild(OVTK_NodeId_Buffer_StreamedMatrix);
|
||||
m_writerHelper->openChild(OVTK_NodeId_Buffer_StreamedMatrix_RawBuffer);
|
||||
m_writerHelper->setBinary(matrix->getBuffer(), m_size * sizeof(double));
|
||||
m_writerHelper->closeChild();
|
||||
m_writerHelper->closeChild();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace StreamCodecs
|
||||
} // namespace Plugins
|
||||
} // namespace OpenViBE
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../ovp_defines.h"
|
||||
#include "ovpCEBMLBaseEncoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Plugins {
|
||||
namespace StreamCodecs {
|
||||
class CStreamedMatrixEncoder : public CEBMLBaseEncoder
|
||||
{
|
||||
public:
|
||||
void release() override { delete this; }
|
||||
bool initialize() override;
|
||||
bool uninitialize() override;
|
||||
bool processHeader() override;
|
||||
bool processBuffer() override;
|
||||
|
||||
_IsDerivedFromClass_Final_(StreamCodecs::CEBMLBaseEncoder, OVP_ClassId_Algorithm_StreamedMatrixEncoder)
|
||||
|
||||
protected:
|
||||
|
||||
Kernel::TParameterHandler<CMatrix*> ip_pMatrix;
|
||||
|
||||
private:
|
||||
|
||||
size_t m_size = 0;
|
||||
};
|
||||
|
||||
class CStreamedMatrixEncoderDesc : public CEBMLBaseEncoderDesc
|
||||
{
|
||||
public:
|
||||
void release() override { }
|
||||
CString getName() const override { return CString("Streamed matrix stream encoder"); }
|
||||
CString getAuthorName() const override { return CString("Yann Renard"); }
|
||||
CString getAuthorCompanyName() const override { return CString("INRIA/IRISA"); }
|
||||
CString getShortDescription() const override { return CString(""); }
|
||||
CString getDetailedDescription() const override { return CString(""); }
|
||||
CString getCategory() const override { return CString("Stream codecs/Encoders"); }
|
||||
CString getVersion() const override { return CString("1.0"); }
|
||||
CString getSoftwareComponent() const override { return CString("openvibe-sdk"); }
|
||||
CString getAddedSoftwareVersion() const override { return CString("0.0.0"); }
|
||||
CString getUpdatedSoftwareVersion() const override { return CString("0.0.0"); }
|
||||
CIdentifier getCreatedClass() const override { return OVP_ClassId_Algorithm_StreamedMatrixEncoder; }
|
||||
IPluginObject* create() override { return new CStreamedMatrixEncoder(); }
|
||||
|
||||
bool getAlgorithmPrototype(Kernel::IAlgorithmProto& prototype) const override
|
||||
{
|
||||
CEBMLBaseEncoderDesc::getAlgorithmPrototype(prototype);
|
||||
prototype.addInputParameter(OVP_Algorithm_StreamedMatrixEncoder_InputParameterId_Matrix, "Matrix", Kernel::ParameterType_Matrix);
|
||||
return true;
|
||||
}
|
||||
|
||||
_IsDerivedFromClass_Final_(StreamCodecs::CEBMLBaseEncoderDesc, OVP_ClassId_Algorithm_StreamedMatrixEncoderDesc)
|
||||
};
|
||||
} // namespace StreamCodecs
|
||||
} // namespace Plugins
|
||||
} // namespace OpenViBE
|
||||
+131
@@ -0,0 +1,131 @@
|
||||
#include "ovpCDecoderAlgorithmTest.h"
|
||||
|
||||
#include "../algorithms/decoders/ovpCExperimentInfoDecoder.h"
|
||||
#include "../algorithms/decoders/ovpCFeatureVectorDecoder.h"
|
||||
#include "../algorithms/decoders/ovpCSignalDecoder.h"
|
||||
#include "../algorithms/decoders/ovpCSpectrumDecoder.h"
|
||||
#include "../algorithms/decoders/ovpCStimulationDecoder.h"
|
||||
#include "../algorithms/decoders/ovpCChannelLocalisationDecoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Plugins {
|
||||
namespace StreamCodecs {
|
||||
|
||||
static std::stringstream print(CMatrix& matrix)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << "Matrix :\n";
|
||||
ss << " | Dimension count : " << matrix.getDimensionCount() << "\n";
|
||||
for (size_t i = 0; i < matrix.getDimensionCount(); ++i)
|
||||
{
|
||||
ss << " | Dimension size " << i << " : " << matrix.getDimensionSize(i) << "\n";
|
||||
for (size_t j = 0; j < matrix.getDimensionSize(i); ++j)
|
||||
{
|
||||
ss << " | Dimension label " << i << " " << j << " : " << matrix.getDimensionLabel(i, j) << "\n";
|
||||
}
|
||||
}
|
||||
return ss;
|
||||
}
|
||||
|
||||
static std::stringstream print(IStimulationSet& stimSet)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << "Stimulation set :\n";
|
||||
ss << " | Number of elements : " << stimSet.getStimulationCount() << "\n";
|
||||
for (size_t i = 0; i < stimSet.getStimulationCount(); ++i)
|
||||
{
|
||||
ss << " | Stimulation " << i << " : "
|
||||
<< "id = " << stimSet.getStimulationIdentifier(i) << " "
|
||||
<< "date = " << stimSet.getStimulationDate(i) << " "
|
||||
<< "duration = " << stimSet.getStimulationDuration(i) << "\n";
|
||||
}
|
||||
return ss;
|
||||
}
|
||||
|
||||
bool CDecoderAlgorithmTest::initialize()
|
||||
{
|
||||
m_decoder[0] = &getAlgorithmManager().getAlgorithm(getAlgorithmManager().createAlgorithm(OVP_ClassId_Algorithm_ExperimentInfoDecoder));
|
||||
m_decoder[1] = &getAlgorithmManager().getAlgorithm(getAlgorithmManager().createAlgorithm(OVP_ClassId_Algorithm_FeatureVectorDecoder));
|
||||
m_decoder[2] = &getAlgorithmManager().getAlgorithm(getAlgorithmManager().createAlgorithm(OVP_ClassId_Algorithm_SignalDecoder));
|
||||
m_decoder[3] = &getAlgorithmManager().getAlgorithm(getAlgorithmManager().createAlgorithm(OVP_ClassId_Algorithm_SpectrumDecoder));
|
||||
m_decoder[4] = &getAlgorithmManager().getAlgorithm(getAlgorithmManager().createAlgorithm(OVP_ClassId_Algorithm_StimulationDecoder));
|
||||
m_decoder[5] = &getAlgorithmManager().getAlgorithm(getAlgorithmManager().createAlgorithm(OVP_ClassId_Algorithm_StreamedMatrixDecoder));
|
||||
m_decoder[6] = &getAlgorithmManager().getAlgorithm(getAlgorithmManager().createAlgorithm(OVP_ClassId_Algorithm_ChannelLocalisationDecoder));
|
||||
|
||||
for (size_t i = 0; i < 7; ++i)
|
||||
{
|
||||
m_decoder[i]->initialize();
|
||||
ip_buffer[i].initialize(m_decoder[i]->getInputParameter(OVP_Algorithm_EBMLDecoder_InputParameterId_MemoryBufferToDecode));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CDecoderAlgorithmTest::uninitialize()
|
||||
{
|
||||
for (size_t i = 0; i < 7; ++i)
|
||||
{
|
||||
ip_buffer[i].uninitialize();
|
||||
m_decoder[i]->uninitialize();
|
||||
getAlgorithmManager().releaseAlgorithm(*m_decoder[i]);
|
||||
m_decoder[i] = nullptr;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CDecoderAlgorithmTest::processInput(const size_t /*index*/)
|
||||
{
|
||||
getBoxAlgorithmContext()->markAlgorithmAsReadyToProcess();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CDecoderAlgorithmTest::process()
|
||||
{
|
||||
Kernel::IBoxIO& boxContext = getDynamicBoxContext();
|
||||
const size_t nInput = getStaticBoxContext().getInputCount();
|
||||
|
||||
for (size_t i = 0; i < nInput; ++i)
|
||||
{
|
||||
for (size_t j = 0; j < boxContext.getInputChunkCount(i); ++j)
|
||||
{
|
||||
ip_buffer[i] = boxContext.getInputChunk(i, j);
|
||||
m_decoder[i]->process();
|
||||
|
||||
if (m_decoder[i]->isOutputTriggerActive(OVP_Algorithm_EBMLDecoder_OutputTriggerId_ReceivedHeader))
|
||||
{
|
||||
{
|
||||
Kernel::TParameterHandler<CMatrix*> handler(m_decoder[i]->getOutputParameter(OVP_Algorithm_StreamedMatrixDecoder_OutputParameterId_Matrix));
|
||||
if (handler.exists()) { OV_WARNING_K(print(*handler).str()); }
|
||||
}
|
||||
|
||||
{
|
||||
Kernel::TParameterHandler<CMatrix*> handler(m_decoder[i]->getOutputParameter(OVP_Algorithm_SpectrumDecoder_OutputParameterId_FrequencyAbscissa));
|
||||
if (handler.exists()) { OV_WARNING_K(print(*handler).str()); }
|
||||
}
|
||||
|
||||
{
|
||||
Kernel::TParameterHandler<uint64_t> handler(m_decoder[i]->getOutputParameter(OVP_Algorithm_SignalDecoder_OutputParameterId_Sampling));
|
||||
if (handler.exists()) { OV_WARNING_K(handler); }
|
||||
}
|
||||
}
|
||||
|
||||
if (m_decoder[i]->isOutputTriggerActive(OVP_Algorithm_EBMLDecoder_OutputTriggerId_ReceivedBuffer))
|
||||
{
|
||||
{
|
||||
Kernel::TParameterHandler<IStimulationSet*>
|
||||
handler(m_decoder[i]->getOutputParameter(OVP_Algorithm_StimulationDecoder_OutputParameterId_StimulationSet));
|
||||
if (handler.exists()) { getLogManager() << Kernel::LogLevel_Warning << print(*handler).str() << "\n"; }
|
||||
}
|
||||
}
|
||||
|
||||
boxContext.markInputAsDeprecated(i, j);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace StreamCodecs
|
||||
} // namespace Plugins
|
||||
} // namespace OpenViBE
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
#pragma once
|
||||
|
||||
#include "../ovp_defines.h"
|
||||
#include <toolkit/ovtk_all.h>
|
||||
#include <array>
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Plugins {
|
||||
namespace StreamCodecs {
|
||||
class CDecoderAlgorithmTest final : public Toolkit::TBoxAlgorithm<IBoxAlgorithm>
|
||||
{
|
||||
public:
|
||||
|
||||
CDecoderAlgorithmTest() { }
|
||||
~CDecoderAlgorithmTest() override { }
|
||||
void release() override { delete this; }
|
||||
bool initialize() override;
|
||||
bool uninitialize() override;
|
||||
bool processInput(const size_t index) override;
|
||||
bool process() override;
|
||||
|
||||
_IsDerivedFromClass_Final_(Toolkit::TBoxAlgorithm<IBoxAlgorithm>, OVP_ClassId_BoxAlgorithm_DecoderAlgorithmTest)
|
||||
|
||||
protected:
|
||||
|
||||
std::array<Kernel::IAlgorithmProxy*, 7> m_decoder;
|
||||
std::array<Kernel::TParameterHandler<const IMemoryBuffer*>, 7> ip_buffer;
|
||||
};
|
||||
|
||||
class CDecoderAlgorithmTestDesc final : public IBoxAlgorithmDesc
|
||||
{
|
||||
public:
|
||||
void release() override { }
|
||||
CString getName() const override { return CString("Decoder algorithm test"); }
|
||||
CString getAuthorName() const override { return CString("Yann Renard"); }
|
||||
CString getAuthorCompanyName() const override { return CString("INRIA/IRISA"); }
|
||||
|
||||
CString getShortDescription() const override { return CString("Decodes various types of streams and outputs some of the content parameters the log"); }
|
||||
|
||||
CString getDetailedDescription() const override
|
||||
{
|
||||
return CString("Note: Warnings are normal as the algorithm polls the decoders for structures they may not contain.");
|
||||
}
|
||||
|
||||
CString getCategory() const override { return CString("Tests/Algorithms"); }
|
||||
CString getVersion() const override { return CString("1.0"); }
|
||||
CIdentifier getCreatedClass() const override { return OVP_ClassId_BoxAlgorithm_DecoderAlgorithmTest; }
|
||||
IPluginObject* create() override { return new CDecoderAlgorithmTest(); }
|
||||
|
||||
bool getBoxPrototype(Kernel::IBoxProto& prototype) const override
|
||||
{
|
||||
prototype.addInput("Experiment information", OV_TypeId_ExperimentInfo);
|
||||
prototype.addInput("Feature vector", OV_TypeId_FeatureVector);
|
||||
prototype.addInput("Signal", OV_TypeId_Signal);
|
||||
prototype.addInput("Spectrum", OV_TypeId_Spectrum);
|
||||
prototype.addInput("Stimulation", OV_TypeId_Stimulations);
|
||||
prototype.addInput("Streamed matrix", OV_TypeId_StreamedMatrix);
|
||||
prototype.addInput("Channel localisation", OV_TypeId_ChannelLocalisation);
|
||||
return true;
|
||||
}
|
||||
|
||||
_IsDerivedFromClass_Final_(IBoxAlgorithmDesc, OVP_ClassId_BoxAlgorithm_DecoderAlgorithmTestDesc)
|
||||
};
|
||||
} // namespace StreamCodecs
|
||||
} // namespace Plugins
|
||||
} // namespace OpenViBE
|
||||
+126
@@ -0,0 +1,126 @@
|
||||
#include "ovpCEncoderAlgorithmTest.h"
|
||||
|
||||
#include "../algorithms/encoders/ovpCExperimentInfoEncoder.h"
|
||||
#include "../algorithms/encoders/ovpCFeatureVectorEncoder.h"
|
||||
#include "../algorithms/encoders/ovpCSignalEncoder.h"
|
||||
#include "../algorithms/encoders/ovpCSpectrumEncoder.h"
|
||||
#include "../algorithms/encoders/ovpCStimulationEncoder.h"
|
||||
#include "../algorithms/encoders/ovpCChannelLocalisationEncoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Plugins {
|
||||
namespace StreamCodecs {
|
||||
|
||||
bool CEncoderAlgorithmTest::initialize()
|
||||
{
|
||||
m_encoders[0] = &getAlgorithmManager().getAlgorithm(getAlgorithmManager().createAlgorithm(OVP_ClassId_Algorithm_ExperimentInfoEncoder));
|
||||
m_encoders[1] = &getAlgorithmManager().getAlgorithm(getAlgorithmManager().createAlgorithm(OVP_ClassId_Algorithm_FeatureVectorEncoder));
|
||||
m_encoders[2] = &getAlgorithmManager().getAlgorithm(getAlgorithmManager().createAlgorithm(OVP_ClassId_Algorithm_SignalEncoder));
|
||||
m_encoders[3] = &getAlgorithmManager().getAlgorithm(getAlgorithmManager().createAlgorithm(OVP_ClassId_Algorithm_SpectrumEncoder));
|
||||
m_encoders[4] = &getAlgorithmManager().getAlgorithm(getAlgorithmManager().createAlgorithm(OVP_ClassId_Algorithm_StimulationEncoder));
|
||||
m_encoders[5] = &getAlgorithmManager().getAlgorithm(getAlgorithmManager().createAlgorithm(OVP_ClassId_Algorithm_StreamedMatrixEncoder));
|
||||
m_encoders[6] = &getAlgorithmManager().getAlgorithm(getAlgorithmManager().createAlgorithm(OVP_ClassId_Algorithm_ChannelLocalisationEncoder));
|
||||
|
||||
for (size_t i = 0; i < 7; ++i)
|
||||
{
|
||||
m_encoders[i]->initialize();
|
||||
op_buffer[i].initialize(m_encoders[i]->getOutputParameter(OVP_Algorithm_EBMLEncoder_OutputParameterId_EncodedMemoryBuffer));
|
||||
}
|
||||
|
||||
m_matrix1 = new CMatrix();
|
||||
m_matrix1->resize(16, 16);
|
||||
|
||||
m_matrix2 = new CMatrix();
|
||||
m_matrix2->resize(16);
|
||||
|
||||
m_matrix3 = new CMatrix();
|
||||
m_matrix3->resize(4, 3);
|
||||
m_matrix3->setDimensionLabel(0, 0, "C3");
|
||||
m_matrix3->setDimensionLabel(0, 1, "Cz");
|
||||
m_matrix3->setDimensionLabel(0, 2, "C4");
|
||||
m_matrix3->setDimensionLabel(0, 3, "Pz");
|
||||
m_matrix3->setDimensionLabel(1, 0, "x");
|
||||
m_matrix3->setDimensionLabel(1, 1, "y");
|
||||
m_matrix3->setDimensionLabel(1, 2, "z");
|
||||
|
||||
m_stimSet = new CStimulationSet();
|
||||
|
||||
size_t frequency = 16;
|
||||
|
||||
m_encoders[1]->getInputParameter(OVP_Algorithm_StreamedMatrixEncoder_InputParameterId_Matrix)->setValue(&m_matrix1);
|
||||
m_encoders[2]->getInputParameter(OVP_Algorithm_StreamedMatrixEncoder_InputParameterId_Matrix)->setValue(&m_matrix1);
|
||||
m_encoders[2]->getInputParameter(OVP_Algorithm_SignalEncoder_InputParameterId_Sampling)->setValue(&frequency);
|
||||
m_encoders[3]->getInputParameter(OVP_Algorithm_StreamedMatrixEncoder_InputParameterId_Matrix)->setValue(&m_matrix1);
|
||||
m_encoders[3]->getInputParameter(OVP_Algorithm_SpectrumEncoder_InputParameterId_FrequencyAbscissa)->setValue(&m_matrix2);
|
||||
m_encoders[4]->getInputParameter(OVP_Algorithm_StimulationEncoder_InputParameterId_StimulationSet)->setValue(&m_stimSet);
|
||||
m_encoders[5]->getInputParameter(OVP_Algorithm_StreamedMatrixEncoder_InputParameterId_Matrix)->setValue(&m_matrix2);
|
||||
m_encoders[6]->getInputParameter(OVP_Algorithm_StreamedMatrixEncoder_InputParameterId_Matrix)->setValue(&m_matrix3);
|
||||
|
||||
m_hasSentHeader = false;
|
||||
m_startTime = 0;
|
||||
m_endTime = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CEncoderAlgorithmTest::uninitialize()
|
||||
{
|
||||
delete m_stimSet;
|
||||
delete m_matrix3;
|
||||
delete m_matrix2;
|
||||
delete m_matrix1;
|
||||
|
||||
for (size_t i = 0; i < 7; ++i)
|
||||
{
|
||||
op_buffer[i].uninitialize();
|
||||
m_encoders[i]->uninitialize();
|
||||
getAlgorithmManager().releaseAlgorithm(*m_encoders[i]);
|
||||
m_encoders[i] = nullptr;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CEncoderAlgorithmTest::processClock(Kernel::CMessageClock& /*msg*/)
|
||||
{
|
||||
getBoxAlgorithmContext()->markAlgorithmAsReadyToProcess();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CEncoderAlgorithmTest::process()
|
||||
{
|
||||
Kernel::IBoxIO& boxContext = getDynamicBoxContext();
|
||||
Kernel::IPlayerContext& playerContext = getPlayerContext();
|
||||
const size_t nInput = getStaticBoxContext().getOutputCount();
|
||||
|
||||
if (!m_hasSentHeader)
|
||||
{
|
||||
m_startTime = 0;
|
||||
m_endTime = 0;
|
||||
for (size_t i = 0; i < nInput; ++i)
|
||||
{
|
||||
op_buffer[i] = boxContext.getOutputChunk(i);
|
||||
m_encoders[i]->process(OVP_Algorithm_EBMLEncoder_InputTriggerId_EncodeHeader);
|
||||
}
|
||||
m_hasSentHeader = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (size_t i = 0; i < nInput; ++i)
|
||||
{
|
||||
op_buffer[i] = boxContext.getOutputChunk(i);
|
||||
m_encoders[i]->process(OVP_Algorithm_EBMLEncoder_InputTriggerId_EncodeBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < nInput; ++i) { boxContext.markOutputAsReadyToSend(i, m_startTime, m_endTime); }
|
||||
|
||||
m_startTime = m_endTime;
|
||||
m_endTime = playerContext.getCurrentTime();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace StreamCodecs
|
||||
} // namespace Plugins
|
||||
} // namespace OpenViBE
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
#pragma once
|
||||
|
||||
#include "../ovp_defines.h"
|
||||
#include <toolkit/ovtk_all.h>
|
||||
#include <array>
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Plugins {
|
||||
namespace StreamCodecs {
|
||||
class CEncoderAlgorithmTest : public Toolkit::TBoxAlgorithm<IBoxAlgorithm>
|
||||
{
|
||||
public:
|
||||
void release() override { delete this; }
|
||||
uint64_t getClockFrequency() override { return 1LL << 32; }
|
||||
bool initialize() override;
|
||||
bool uninitialize() override;
|
||||
bool processClock(Kernel::CMessageClock& msg) override;
|
||||
bool process() override;
|
||||
|
||||
_IsDerivedFromClass_Final_(Toolkit::TBoxAlgorithm<IBoxAlgorithm>, OVP_ClassId_BoxAlgorithm_EncoderAlgorithmTest)
|
||||
|
||||
protected:
|
||||
|
||||
std::array<Kernel::IAlgorithmProxy*, 7> m_encoders;
|
||||
std::array<Kernel::TParameterHandler<IMemoryBuffer*>, 7> op_buffer;
|
||||
|
||||
bool m_hasSentHeader = false;
|
||||
uint64_t m_startTime = 0;
|
||||
uint64_t m_endTime = 0;
|
||||
|
||||
CMatrix* m_matrix1 = nullptr;
|
||||
CMatrix* m_matrix2 = nullptr;
|
||||
CMatrix* m_matrix3 = nullptr;
|
||||
CStimulationSet* m_stimSet = nullptr;
|
||||
};
|
||||
|
||||
class CEncoderAlgorithmTestDesc final : public IBoxAlgorithmDesc
|
||||
{
|
||||
public:
|
||||
void release() override { }
|
||||
CString getName() const override { return CString("Encoder algorithm test"); }
|
||||
CString getAuthorName() const override { return CString("Yann Renard"); }
|
||||
CString getAuthorCompanyName() const override { return CString("INRIA/IRISA"); }
|
||||
CString getShortDescription() const override { return CString("Setups various streams and outputs them"); }
|
||||
CString getDetailedDescription() const override { return CString("Note: Data sent in the streams does not change over time"); }
|
||||
CString getCategory() const override { return CString("Tests/Algorithms"); }
|
||||
CString getVersion() const override { return CString("1.0"); }
|
||||
CIdentifier getCreatedClass() const override { return OVP_ClassId_BoxAlgorithm_EncoderAlgorithmTest; }
|
||||
IPluginObject* create() override { return new CEncoderAlgorithmTest(); }
|
||||
|
||||
bool getBoxPrototype(Kernel::IBoxProto& prototype) const override
|
||||
{
|
||||
prototype.addOutput("Experiment information", OV_TypeId_ExperimentInfo);
|
||||
prototype.addOutput("Feature vector", OV_TypeId_FeatureVector);
|
||||
prototype.addOutput("Signal", OV_TypeId_Signal);
|
||||
prototype.addOutput("Spectrum", OV_TypeId_Spectrum);
|
||||
prototype.addOutput("Stimulation", OV_TypeId_Stimulations);
|
||||
prototype.addOutput("Streamed matrix", OV_TypeId_StreamedMatrix);
|
||||
prototype.addOutput("Channel localisation", OV_TypeId_ChannelLocalisation);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
_IsDerivedFromClass_Final_(IBoxAlgorithmDesc, OVP_ClassId_BoxAlgorithm_EncoderAlgorithmTestDesc)
|
||||
};
|
||||
} // namespace StreamCodecs
|
||||
} // namespace Plugins
|
||||
} // namespace OpenViBE
|
||||
@@ -0,0 +1,143 @@
|
||||
#pragma once
|
||||
|
||||
// Boxes
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
#define OVP_ClassId_Algorithm_AcquisitionDecoder OpenViBE::CIdentifier(0x1E0812B7, 0x3F686DD4)
|
||||
#define OVP_ClassId_Algorithm_AcquisitionDecoderDesc OpenViBE::CIdentifier(0xA01599B0, 0x7F51631A)
|
||||
#define OVP_Algorithm_AcquisitionDecoder_OutputParameterId_BufferDuration OpenViBE::CIdentifier(0x7527D6E5, 0xB7A70339)
|
||||
#define OVP_Algorithm_AcquisitionDecoder_OutputParameterId_ExperimentInfoStream OpenViBE::CIdentifier(0xA7F1D539, 0xEC708539)
|
||||
#define OVP_Algorithm_AcquisitionDecoder_OutputParameterId_SignalStream OpenViBE::CIdentifier(0x42C0D7BD, 0xBBCEA3F3)
|
||||
#define OVP_Algorithm_AcquisitionDecoder_OutputParameterId_StimulationStream OpenViBE::CIdentifier(0x08FC3C12, 0x86A07BF7)
|
||||
#define OVP_Algorithm_AcquisitionDecoder_OutputParameterId_ChannelLocalisationStream OpenViBE::CIdentifier(0x4EB92F81, 0x6ECDA6B9)
|
||||
#define OVP_Algorithm_AcquisitionDecoder_OutputParameterId_ChannelUnitsStream OpenViBE::CIdentifier(0x11B93981, 0x6E5DA9B0)
|
||||
|
||||
#define OVP_ClassId_Algorithm_AcquisitionEncoder OpenViBE::CIdentifier(0xF9FD2FB5, 0xDF0B3B2C)
|
||||
#define OVP_ClassId_Algorithm_AcquisitionEncoderDesc OpenViBE::CIdentifier(0xE3E0D9EB, 0x4D4EBA00)
|
||||
#define OVP_Algorithm_AcquisitionEncoder_InputParameterId_BufferDuration OpenViBE::CIdentifier(0xAFA07097, 0x1145B59B)
|
||||
#define OVP_Algorithm_AcquisitionEncoder_InputParameterId_ExperimentInfoStream OpenViBE::CIdentifier(0x38755128, 0xCB0C908A)
|
||||
#define OVP_Algorithm_AcquisitionEncoder_InputParameterId_SignalStream OpenViBE::CIdentifier(0x4ED9D929, 0x6DF5B2B6)
|
||||
#define OVP_Algorithm_AcquisitionEncoder_InputParameterId_StimulationStream OpenViBE::CIdentifier(0xCDE202AD, 0xF4864EC9)
|
||||
#define OVP_Algorithm_AcquisitionEncoder_InputParameterId_ChannelLocalisationStream OpenViBE::CIdentifier(0x2CF786E5, 0x520714A1)
|
||||
#define OVP_Algorithm_AcquisitionEncoder_InputParameterId_ChannelUnitsStream OpenViBE::CIdentifier(0x25DD84B4, 0x528524CA)
|
||||
|
||||
#define OVP_ClassId_Algorithm_ChannelLocalisationDecoder OpenViBE::CIdentifier(0x8222F065, 0xB05D35CF)
|
||||
#define OVP_ClassId_Algorithm_ChannelLocalisationDecoderDesc OpenViBE::CIdentifier(0x713A29FD, 0xA5A95E2C)
|
||||
#define OVP_Algorithm_ChannelLocalisationDecoder_OutputParameterId_Dynamic OpenViBE::CIdentifier(0xD20991FD, 0xA3153651)
|
||||
|
||||
#define OVP_ClassId_Algorithm_ChannelUnitsDecoder OpenViBE::CIdentifier(0x5F973DDF, 0x4A582DAF)
|
||||
#define OVP_ClassId_Algorithm_ChannelUnitsDecoderDesc OpenViBE::CIdentifier(0x2D59257D, 0x3B1915DA)
|
||||
#define OVP_Algorithm_ChannelUnitsDecoder_OutputParameterId_Dynamic OpenViBE::CIdentifier(0x31CF1C7A, 0x17475323)
|
||||
|
||||
#define OVP_ClassId_Algorithm_ChannelUnitsEncoder OpenViBE::CIdentifier(0x2CA034FD, 0x5C051E86)
|
||||
#define OVP_ClassId_Algorithm_ChannelUnitsEncoderDesc OpenViBE::CIdentifier(0x08696DFC, 0x6D415262)
|
||||
#define OVP_Algorithm_ChannelUnitsEncoder_InputParameterId_Dynamic OpenViBE::CIdentifier(0x615F03B9, 0x4F6A320A)
|
||||
|
||||
#define OVP_ClassId_BoxAlgorithm_DecoderAlgorithmTest OpenViBE::CIdentifier(0x3C2EF355, 0xFE495C3D)
|
||||
#define OVP_ClassId_BoxAlgorithm_DecoderAlgorithmTestDesc OpenViBE::CIdentifier(0xE5176EB9, 0xD6E47D7F)
|
||||
|
||||
#define OVP_ClassId_Algorithm_EBMLBaseDecoder OpenViBE::CIdentifier(0xFD30C96D, 0x8245A8F8)
|
||||
#define OVP_ClassId_Algorithm_EBMLBaseDecoderDesc OpenViBE::CIdentifier(0x4F701AC9, 0xDFBE912E)
|
||||
#define OVP_Algorithm_EBMLDecoder_InputParameterId_MemoryBufferToDecode OpenViBE::CIdentifier(0x2F98EA3C, 0xFB0BE096)
|
||||
#define OVP_Algorithm_EBMLDecoder_OutputTriggerId_ReceivedHeader OpenViBE::CIdentifier(0x815234BF, 0xAABAE5F2)
|
||||
#define OVP_Algorithm_EBMLDecoder_OutputTriggerId_ReceivedBuffer OpenViBE::CIdentifier(0xAA2738BF, 0xF7FE9FC3)
|
||||
#define OVP_Algorithm_EBMLDecoder_OutputTriggerId_ReceivedEnd OpenViBE::CIdentifier(0xC4AA114C, 0x628C2D77)
|
||||
|
||||
#define OVP_ClassId_Algorithm_EBMLBaseEncoder OpenViBE::CIdentifier(0x4272C178, 0x3FE84927)
|
||||
#define OVP_ClassId_Algorithm_EBMLBaseEncoderDesc OpenViBE::CIdentifier(0x47A9E701, 0x7C57BF3C)
|
||||
#define OVP_Algorithm_EBMLEncoder_OutputParameterId_EncodedMemoryBuffer OpenViBE::CIdentifier(0xA3D8B171, 0xF8734734)
|
||||
#define OVP_Algorithm_EBMLEncoder_InputTriggerId_EncodeHeader OpenViBE::CIdentifier(0x878EAF60, 0xF9D5303F)
|
||||
#define OVP_Algorithm_EBMLEncoder_InputTriggerId_EncodeBuffer OpenViBE::CIdentifier(0x1B7076FD, 0x449BC70A)
|
||||
#define OVP_Algorithm_EBMLEncoder_InputTriggerId_EncodeEnd OpenViBE::CIdentifier(0x3FC23508, 0x806753D8)
|
||||
#define OVP_Algorithm_EBMLEncoder_OutputTriggerId_MemoryBufferUpdated OpenViBE::CIdentifier(0xD46C7462, 0xD3407E5F)
|
||||
|
||||
#define OVP_ClassId_Algorithm_ExperimentInfoDecoder OpenViBE::CIdentifier(0x6FA7D52B, 0x80E2ABD6)
|
||||
#define OVP_ClassId_Algorithm_ExperimentInfoDecoderDesc OpenViBE::CIdentifier(0x0F37CA61, 0x8A77F44E)
|
||||
#define OVP_Algorithm_ExperimentInfoDecoder_OutputParameterId_ExperimentID OpenViBE::CIdentifier(0x40259641, 0x478C73DE)
|
||||
#define OVP_Algorithm_ExperimentInfoDecoder_OutputParameterId_ExperimentDate OpenViBE::CIdentifier(0xBC0266A2, 0x9C2935F1)
|
||||
#define OVP_Algorithm_ExperimentInfoDecoder_OutputParameterId_SubjectID OpenViBE::CIdentifier(0x97C5D20D, 0x203E65B3)
|
||||
#define OVP_Algorithm_ExperimentInfoDecoder_OutputParameterId_SubjectName OpenViBE::CIdentifier(0x3D3826EA, 0xE8883815)
|
||||
#define OVP_Algorithm_ExperimentInfoDecoder_OutputParameterId_SubjectAge OpenViBE::CIdentifier(0xC36C6B08, 0x5227380A)
|
||||
#define OVP_Algorithm_ExperimentInfoDecoder_OutputParameterId_SubjectGender OpenViBE::CIdentifier(0x7D5059E8, 0xE4D8B38D)
|
||||
#define OVP_Algorithm_ExperimentInfoDecoder_OutputParameterId_LaboratoryID OpenViBE::CIdentifier(0xE761D3D4, 0x44BA1EBF)
|
||||
#define OVP_Algorithm_ExperimentInfoDecoder_OutputParameterId_LaboratoryName OpenViBE::CIdentifier(0x5CA80FA5, 0x774F01CB)
|
||||
#define OVP_Algorithm_ExperimentInfoDecoder_OutputParameterId_TechnicianID OpenViBE::CIdentifier(0xC8ECFBBC, 0x0DCDA310)
|
||||
#define OVP_Algorithm_ExperimentInfoDecoder_OutputParameterId_TechnicianName OpenViBE::CIdentifier(0xB8A94B68, 0x389393D9)
|
||||
|
||||
#define OVP_ClassId_BoxAlgorithm_EncoderAlgorithmTest OpenViBE::CIdentifier(0x87D18C62, 0xF2DAF779)
|
||||
#define OVP_ClassId_BoxAlgorithm_EncoderAlgorithmTestDesc OpenViBE::CIdentifier(0x95E27325, 0x6893A519)
|
||||
|
||||
#define OVP_ClassId_Algorithm_ExperimentInfoEncoder OpenViBE::CIdentifier(0x56B354FE, 0xBF175468)
|
||||
#define OVP_ClassId_Algorithm_ExperimentInfoEncoderDesc OpenViBE::CIdentifier(0x8CC2C754, 0x61665FDA)
|
||||
#define OVP_Algorithm_ExperimentInfoEncoder_InputParameterId_ExperimentID OpenViBE::CIdentifier(0x40259641, 0x478C73DE)
|
||||
#define OVP_Algorithm_ExperimentInfoEncoder_InputParameterId_ExperimentDate OpenViBE::CIdentifier(0xBC0266A2, 0x9C2935F1)
|
||||
#define OVP_Algorithm_ExperimentInfoEncoder_InputParameterId_SubjectID OpenViBE::CIdentifier(0x97C5D20D, 0x203E65B3)
|
||||
#define OVP_Algorithm_ExperimentInfoEncoder_InputParameterId_SubjectName OpenViBE::CIdentifier(0x3D3826EA, 0xE8883815)
|
||||
#define OVP_Algorithm_ExperimentInfoEncoder_InputParameterId_SubjectAge OpenViBE::CIdentifier(0xC36C6B08, 0x5227380A)
|
||||
#define OVP_Algorithm_ExperimentInfoEncoder_InputParameterId_SubjectGender OpenViBE::CIdentifier(0x7D5059E8, 0xE4D8B38D)
|
||||
#define OVP_Algorithm_ExperimentInfoEncoder_InputParameterId_LaboratoryID OpenViBE::CIdentifier(0xE761D3D4, 0x44BA1EBF)
|
||||
#define OVP_Algorithm_ExperimentInfoEncoder_InputParameterId_LaboratoryName OpenViBE::CIdentifier(0x5CA80FA5, 0x774F01CB)
|
||||
#define OVP_Algorithm_ExperimentInfoEncoder_InputParameterId_TechnicianID OpenViBE::CIdentifier(0xC8ECFBBC, 0x0DCDA310)
|
||||
#define OVP_Algorithm_ExperimentInfoEncoder_InputParameterId_TechnicianName OpenViBE::CIdentifier(0xB8A94B68, 0x389393D9)
|
||||
|
||||
#define OVP_ClassId_Algorithm_FeatureVectorDecoder OpenViBE::CIdentifier(0xC2689ECC, 0x43B335C1)
|
||||
#define OVP_ClassId_Algorithm_FeatureVectorDecoderDesc OpenViBE::CIdentifier(0xAB0AE561, 0xF181E34F)
|
||||
|
||||
#define OVP_ClassId_Algorithm_FeatureVectorEncoder OpenViBE::CIdentifier(0x7EBE049D, 0xF777A602)
|
||||
#define OVP_ClassId_Algorithm_FeatureVectorEncoderDesc OpenViBE::CIdentifier(0xC249527B, 0x89EE1996)
|
||||
|
||||
#define OVP_ClassId_Algorithm_MasterAcquisitionEncoder OpenViBE::CIdentifier(0x2D15E00B, 0x51414EB6)
|
||||
#define OVP_ClassId_Algorithm_MasterAcquisitionEncoderDesc OpenViBE::CIdentifier(0xE6EC841D, 0x9E75A8FB)
|
||||
#define OVP_Algorithm_MasterAcquisitionEncoder_InputParameterId_SubjectID OpenViBE::CIdentifier(0xD5BB5231, 0x59389B72)
|
||||
#define OVP_Algorithm_MasterAcquisitionEncoder_InputParameterId_SubjectAge OpenViBE::CIdentifier(0x9EF355E4, 0xC8531112)
|
||||
#define OVP_Algorithm_MasterAcquisitionEncoder_InputParameterId_SubjectGender OpenViBE::CIdentifier(0xA9056AE3, 0x57FE6AF0)
|
||||
#define OVP_Algorithm_MasterAcquisitionEncoder_InputParameterId_SignalMatrix OpenViBE::CIdentifier(0xE9AC8077, 0xE369A51D)
|
||||
#define OVP_Algorithm_MasterAcquisitionEncoder_InputParameterId_SignalSampling OpenViBE::CIdentifier(0xB84AD0CA, 0x4F316DD3)
|
||||
#define OVP_Algorithm_MasterAcquisitionEncoder_InputParameterId_StimulationSet OpenViBE::CIdentifier(0x5B728D37, 0xFD088887)
|
||||
#define OVP_Algorithm_MasterAcquisitionEncoder_InputParameterId_BufferDuration OpenViBE::CIdentifier(0xE1FC7385, 0x586A4F3F)
|
||||
#define OVP_Algorithm_MasterAcquisitionEncoder_InputParameterId_ChannelLocalisation OpenViBE::CIdentifier(0x227E13F0, 0x206B44F9)
|
||||
#define OVP_Algorithm_MasterAcquisitionEncoder_InputParameterId_ChannelUnits OpenViBE::CIdentifier(0x740060C2, 0x7D2B4F57)
|
||||
|
||||
#define OVP_Algorithm_MasterAcquisitionEncoder_InputParameterId_EncodeChannelLocalisationData OpenViBE::CIdentifier(0x26EE1F81, 0x3DB00D5D)
|
||||
#define OVP_Algorithm_MasterAcquisitionEncoder_InputParameterId_EncodeChannelUnitData OpenViBE::CIdentifier(0x19DC533C, 0x56301D0B)
|
||||
|
||||
#define OVP_ClassId_Algorithm_SignalDecoder OpenViBE::CIdentifier(0x7237C149, 0x0CA66DA7)
|
||||
#define OVP_ClassId_Algorithm_SignalDecoderDesc OpenViBE::CIdentifier(0xF1547D89, 0x49FFD0C2)
|
||||
#define OVP_Algorithm_SignalDecoder_OutputParameterId_Sampling OpenViBE::CIdentifier(0x363D8D79, 0xEEFB912C)
|
||||
|
||||
#define OVP_ClassId_Algorithm_SignalEncoder OpenViBE::CIdentifier(0xC488AD3C, 0xEB2E36BF)
|
||||
#define OVP_ClassId_Algorithm_SignalEncoderDesc OpenViBE::CIdentifier(0x90AC1E0F, 0x01518200)
|
||||
#define OVP_Algorithm_SignalEncoder_InputParameterId_Sampling OpenViBE::CIdentifier(0x998710FF, 0x2C5CCA82)
|
||||
|
||||
#define OVP_ClassId_Algorithm_SpectrumDecoder OpenViBE::CIdentifier(0x128202DB, 0x449FC7A6)
|
||||
#define OVP_ClassId_Algorithm_SpectrumDecoderDesc OpenViBE::CIdentifier(0x54D18EE8, 0x5DBD913A)
|
||||
#define OVP_Algorithm_SpectrumDecoder_OutputParameterId_FrequencyAbscissa OpenViBE::CIdentifier(0x14A572E4, 0x5C405C8E)
|
||||
#define OVP_Algorithm_SpectrumDecoder_OutputParameterId_Sampling OpenViBE::CIdentifier(0x68442C12, 0x0D9A46DE)
|
||||
|
||||
|
||||
#define OVP_ClassId_Algorithm_SpectrumEncoder OpenViBE::CIdentifier(0xB3E252DB, 0xC3214498)
|
||||
#define OVP_ClassId_Algorithm_SpectrumEncoderDesc OpenViBE::CIdentifier(0xD6182973, 0x122CE114)
|
||||
#define OVP_Algorithm_SpectrumEncoder_InputParameterId_FrequencyAbscissa OpenViBE::CIdentifier(0x05C91BD6, 0x2D8C4083)
|
||||
#define OVP_Algorithm_SpectrumEncoder_InputParameterId_Sampling OpenViBE::CIdentifier(0x02D25E1B, 0x76A1019B)
|
||||
|
||||
#define OVP_ClassId_Algorithm_StimulationDecoder OpenViBE::CIdentifier(0xC8807F2B, 0x0813C5B1)
|
||||
#define OVP_ClassId_Algorithm_StimulationDecoderDesc OpenViBE::CIdentifier(0x391A615B, 0x71CD888A)
|
||||
#define OVP_Algorithm_StimulationDecoder_OutputParameterId_StimulationSet OpenViBE::CIdentifier(0xF46D0C19, 0x47306BEA)
|
||||
|
||||
#define OVP_ClassId_Algorithm_StimulationEncoder OpenViBE::CIdentifier(0x6E86F7D5, 0xA4668108)
|
||||
#define OVP_ClassId_Algorithm_StimulationEncoderDesc OpenViBE::CIdentifier(0x9B994B50, 0x52C3F06A)
|
||||
#define OVP_Algorithm_StimulationEncoder_InputParameterId_StimulationSet OpenViBE::CIdentifier(0x8565254C, 0x3A49268E)
|
||||
|
||||
#define OVP_ClassId_Algorithm_StreamedMatrixDecoder OpenViBE::CIdentifier(0x7359D0DB, 0x91784B21)
|
||||
#define OVP_ClassId_Algorithm_StreamedMatrixDecoderDesc OpenViBE::CIdentifier(0x384529D5, 0xD8E0A728)
|
||||
#define OVP_Algorithm_StreamedMatrixDecoder_OutputParameterId_Matrix OpenViBE::CIdentifier(0x79EF3123, 0x35E3EA4D)
|
||||
|
||||
#define OVP_ClassId_Algorithm_StreamedMatrixEncoder OpenViBE::CIdentifier(0x5CB32C71, 0x576F00A6)
|
||||
#define OVP_ClassId_Algorithm_StreamedMatrixEncoderDesc OpenViBE::CIdentifier(0xEEEFE060, 0x646EE8AB)
|
||||
#define OVP_Algorithm_StreamedMatrixEncoder_InputParameterId_Matrix OpenViBE::CIdentifier(0xA3E9E5B0, 0xAE756303)
|
||||
|
||||
#define OVP_ClassId_Algorithm_StreamStructureDecoder OpenViBE::CIdentifier(0xA7EF3E8B, 0x4CF70B74)
|
||||
#define OVP_ClassId_Algorithm_StreamStructureDecoderDesc OpenViBE::CIdentifier(0x2E361099, 0xCBE828A7)
|
||||
|
||||
#define OVP_ClassId_Algorithm_ChannelLocalisationEncoder OpenViBE::CIdentifier(0xC4AA738A, 0x2368C0EA)
|
||||
#define OVP_ClassId_Algorithm_ChannelLocalisationEncoderDesc OpenViBE::CIdentifier(0x3F7B49A3, 0x2B8F861A)
|
||||
#define OVP_Algorithm_ChannelLocalisationEncoder_InputParameterId_Dynamic OpenViBE::CIdentifier(0xCF5DD4F8, 0xC2FF2878)
|
||||
@@ -0,0 +1,56 @@
|
||||
#include "algorithms/decoders/ovpCAcquisitionDecoder.h"
|
||||
#include "algorithms/decoders/ovpCStreamStructureDecoder.h"
|
||||
#include "algorithms/decoders/ovpCExperimentInfoDecoder.h"
|
||||
#include "algorithms/decoders/ovpCChannelLocalisationDecoder.h"
|
||||
#include "algorithms/decoders/ovpCChannelUnitsDecoder.h"
|
||||
#include "algorithms/decoders/ovpCFeatureVectorDecoder.h"
|
||||
#include "algorithms/decoders/ovpCSignalDecoder.h"
|
||||
#include "algorithms/decoders/ovpCSpectrumDecoder.h"
|
||||
#include "algorithms/decoders/ovpCStimulationDecoder.h"
|
||||
#include "algorithms/decoders/ovpCStreamedMatrixDecoder.h"
|
||||
// #include "algorithms/decoders/ovpCMasterAcquisitionDecoder.h"
|
||||
|
||||
#include "algorithms/encoders/ovpCAcquisitionEncoder.h"
|
||||
#include "algorithms/encoders/ovpCExperimentInfoEncoder.h"
|
||||
#include "algorithms/encoders/ovpCChannelLocalisationEncoder.h"
|
||||
#include "algorithms/encoders/ovpCChannelUnitsEncoder.h"
|
||||
#include "algorithms/encoders/ovpCFeatureVectorEncoder.h"
|
||||
#include "algorithms/encoders/ovpCSignalEncoder.h"
|
||||
#include "algorithms/encoders/ovpCSpectrumEncoder.h"
|
||||
#include "algorithms/encoders/ovpCStimulationEncoder.h"
|
||||
#include "algorithms/encoders/ovpCStreamedMatrixEncoder.h"
|
||||
#include "algorithms/encoders/ovpCMasterAcquisitionEncoder.h"
|
||||
|
||||
namespace OpenViBE {
|
||||
namespace Plugins {
|
||||
namespace StreamCodecs {
|
||||
|
||||
OVP_Declare_Begin()
|
||||
OVP_Declare_New(CAcquisitionDecoderDesc)
|
||||
OVP_Declare_New(CStreamStructureDecoderDesc);
|
||||
OVP_Declare_New(CExperimentInfoDecoderDesc)
|
||||
OVP_Declare_New(CChannelLocalisationDecoderDesc)
|
||||
OVP_Declare_New(CChannelUnitsDecoderDesc)
|
||||
OVP_Declare_New(CFeatureVectorDecoderDesc)
|
||||
OVP_Declare_New(CSignalDecoderDesc)
|
||||
OVP_Declare_New(CSpectrumDecoderDesc)
|
||||
OVP_Declare_New(CStimulationDecoderDesc)
|
||||
OVP_Declare_New(CStreamedMatrixDecoderDesc)
|
||||
// OVP_Declare_New(CMasterAcquisitionDecoderDesc);
|
||||
|
||||
OVP_Declare_New(CAcquisitionEncoderDesc)
|
||||
OVP_Declare_New(CExperimentInfoEncoderDesc)
|
||||
OVP_Declare_New(CChannelLocalisationEncoderDesc)
|
||||
OVP_Declare_New(CChannelUnitsEncoderDesc)
|
||||
OVP_Declare_New(CFeatureVectorEncoderDesc)
|
||||
OVP_Declare_New(CSignalEncoderDesc)
|
||||
OVP_Declare_New(CSpectrumEncoderDesc)
|
||||
OVP_Declare_New(CStimulationEncoderDesc)
|
||||
OVP_Declare_New(CStreamedMatrixEncoderDesc)
|
||||
OVP_Declare_New(CMasterAcquisitionEncoderDesc);
|
||||
|
||||
OVP_Declare_End()
|
||||
|
||||
} // namespace StreamCodecs
|
||||
} // namespace Plugins
|
||||
} // namespace OpenViBE
|
||||
Reference in New Issue
Block a user