Mentions légales du service

Skip to content
Snippets Groups Projects

Resolve "Skeleton Generator generates deprecated files"

Files
18
#include "ovpCBoxAlgorithm@@ClassName@@.h"
using namespace OpenViBE;
using namespace /*OpenViBE::*/Kernel;
using namespace /*OpenViBE::*/Plugins;
using namespace /*OpenViBE::Plugins::*/@@Namespace@@;
///-------------------------------------------------------------------------------------------------
///
/// \brief Classes of the Box @@BoxName@@.
/// \author @@Author@@ (@@Company@@).
/// \version @@Version@@.
/// \date @@Date@@.
///
///-------------------------------------------------------------------------------------------------
#include "CBoxAlgorithm@@ClassName@@.hpp"
namespace OpenViBE {
namespace Plugins {
namespace @@Namespace@@ {
///-------------------------------------------------------------------------------------------------
bool CBoxAlgorithm@@ClassName@@::initialize()
{
@@AlgorithmInitialisation@@
@@ -20,16 +28,16 @@ bool CBoxAlgorithm@@ClassName@@::initialize()
return true;
}
/*******************************************************************************/
///-------------------------------------------------------------------------------------------------
bool CBoxAlgorithm@@ClassName@@::uninitialize()
{
@@AlgorithmUninitialisation@@
return true;
}
/*******************************************************************************/
@@ProcessClockCommentIn@@
///-------------------------------------------------------------------------------------------------
bool CBoxAlgorithm@@ClassName@@::processClock(Kernel::CMessageClock& msg)
{
// some pre-processing code if needed...
@@ -40,19 +48,19 @@ bool CBoxAlgorithm@@ClassName@@::processClock(Kernel::CMessageClock& msg)
return true;
}
@@ProcessClockCommentOut@@
/*******************************************************************************/
@@ProcessClockCommentIn@@
///-------------------------------------------------------------------------------------------------
uint64_t CBoxAlgorithm@@ClassName@@::getClockFrequency()
{
// Note that the time is coded on a 64 bits unsigned integer, fixed decimal point (32:32)
return @@ClockFrequency@@; // the box clock frequency
}
@@ProcessClockCommentOut@@
/*******************************************************************************/
@@ProcessInputCommentIn@@
bool CBoxAlgorithm@@ClassName@@::processInput(const size_t index)
///-------------------------------------------------------------------------------------------------
bool CBoxAlgorithm@@ClassName@@::processInput(const size_t /*index*/)
{
// some pre-processing code if needed...
@@ -62,37 +70,35 @@ bool CBoxAlgorithm@@ClassName@@::processInput(const size_t index)
return true;
}
@@ProcessInputCommentOut@@
/*******************************************************************************/
///-------------------------------------------------------------------------------------------------
bool CBoxAlgorithm@@ClassName@@::process()
{
// the static box context describes the box inputs, outputs, settings structures
const IBox& staticBoxContext=this->getStaticBoxContext();
const Kernel::IBox& staticBoxCtx = this->getStaticBoxContext();
// the dynamic box context describes the current state of the box inputs and outputs (i.e. the chunks)
IBoxIO& boxContext = this->getDynamicBoxContext();
Kernel::IBoxIO& boxCtx = this->getDynamicBoxContext();
// here is some useful functions:
// - To get input/output/setting count:
// staticBoxContext.getInputCount();
// staticBoxContext.getOutputCount();
// staticBoxCtx.getInputCount();
// staticBoxCtx.getOutputCount();
// - To get the number of chunks currently available on a particular input :
// boxContext.getInputChunkCount(input_index)
// boxCtx.getInputChunkCount(input_index)
// - To send an output chunk :
// boxContext.markOutputAsReadyToSend(output_index, chunk_start_time, chunk_end_time);
// boxCtx.markOutputAsReadyToSend(output_index, chunk_start_time, chunk_end_time);
// A typical process iteration may look like this.
// This example only iterate over the first input of type Signal, and output a modified Signal.
// thus, the box uses 1 decoder (m_signalDecoder) and 1 encoder (m_signalEncoder)
/*
IBoxIO& boxContext = this->getDynamicBoxContext();
IBoxIO& boxCtx = this->getDynamicBoxContext();
//iterate over all chunk on input 0
for (size_t i = 0; i < boxContext.getInputChunkCount(0); ++i)
for (size_t i = 0; i < boxCtx.getInputChunkCount(0); ++i)
{
// decode the chunk i
m_signalDecoder.decode(i);
@@ -105,7 +111,7 @@ bool CBoxAlgorithm@@ClassName@@::process()
// Pass the header to the next boxes, by encoding a header on the output 0:
m_signalEncoder.encodeHeader(0);
// send the output chunk containing the header. The dates are the same as the input chunk:
boxContext.markOutputAsReadyToSend(0, boxContext.getInputChunkStartTime(0, i), boxContext.getInputChunkEndTime(0, i));
boxCtx.markOutputAsReadyToSend(0, boxCtx.getInputChunkStartTime(0, i), boxCtx.getInputChunkEndTime(0, i));
}
if(m_signalDecoder.isBufferReceived())
{
@@ -119,18 +125,18 @@ bool CBoxAlgorithm@@ClassName@@::process()
// Encode the output buffer :
m_signalEncoder.encodeBuffer(0);
// and send it to the next boxes :
boxContext.markOutputAsReadyToSend(0, boxContext.getInputChunkStartTime(0, i), boxContext.getInputChunkEndTime(0, i));
boxCtx.markOutputAsReadyToSend(0, boxCtx.getInputChunkStartTime(0, i), boxCtx.getInputChunkEndTime(0, i));
}
if(m_signalDecoder.isEndReceived())
{
// End of stream received. This happens only once when pressing "stop". Just pass it to the next boxes so they receive the message :
m_signalEncoder.encodeEnd(0);
boxContext.markOutputAsReadyToSend(0, boxContext.getInputChunkStartTime(0, i), boxContext.getInputChunkEndTime(0, i));
boxCtx.markOutputAsReadyToSend(0, boxCtx.getInputChunkStartTime(0, i), boxCtx.getInputChunkEndTime(0, i));
}
// The current input chunk has been processed, and automaticcaly discarded.
// you don't need to call "boxContext.markInputAsDeprecated(0, i);"
// you don't need to call "boxCtx.markInputAsDeprecated(0, i);"
}
*/
@@ -145,3 +151,7 @@ bool CBoxAlgorithm@@ClassName@@::process()
return true;
}
} // namespace @@Namespace@@
} // namespace Plugins
} // namespace OpenViBE
Loading