#include <unordered_set>
class cDemoRequestableSubStreamGenerator:
public cFilter
{
public:
"demo_request_substream_generator.filter.adtf.cid",
"Demo Requestable Substream Generator");
public:
cDemoRequestableSubStreamGenerator()
{
SetDescription("Use this filter to generate data of (requested) multiple substreams whenever a timer triggers");
SetHelpLink("$(ADTF_DIR)/doc/html/page_demo_requestable_substream_generator.html");
CreateRunner("generate_samples");
SetDescription("generate_samples", "Runner to periodically trigger the function which generates samples for the substreams.");
m_pWriter = CreateRequestableOutputPin("output", oSubStreams);
SetDescription("output", "Provides the generated substreams");
}
uint32_t nSubStreamId,
{
if (nSubStreamId > 2)
{
RETURN_ERROR_DESC(ERR_INVALID_ARG,
"No substream with id %d available", nSubStreamId);
}
m_oEnabledSubStreams.insert(nSubStreamId);
LOG_INFO(
"Enabled substream %u", nSubStreamId);
}
void DisableSubStream(
ISampleWriter* , uint32_t nSubStreamId)
override
{
m_oEnabledSubStreams.erase(nSubStreamId);
LOG_INFO(
"Disabled substream %u", nSubStreamId);
}
{
++m_nTriggerCounter;
for (const auto& nSubStreamId: m_oEnabledSubStreams)
{
m_pWriter->Write(oNewData.Release());
}
}
private:
ISampleWriter* m_pWriter = nullptr;
std::unordered_set<uint32_t> m_oEnabledSubStreams;
uint32_t m_nTriggerCounter = 0;
};
ADTF_PLUGIN(
"Demo Requestable Substream Generator Plugin", cDemoRequestableSubStreamGenerator);
#define ADTF_PLUGIN(__plugin_identifier,...)
The ADTF Plugin Macro will add the code of a IPlugin implementation.
Copyright © Audi Electronics Venture GmbH.
#define LOG_INFO(...)
Logs an info message.
A_UTILS_NS::cResult tResult
For backwards compatibility and to bring latest version into scope.
#define RETURN_ERROR_DESC(_code,...)
Same as RETURN_ERROR(_error) using a printf like parameter list for detailed error description.
#define RETURN_NOERROR
Return status ERR_NOERROR, which requires the calling function's return type to be tResult.
#define ADTF_CLASS_ID_NAME(_class, _strcid, _strclabel)
Common macro to enable correct treatment of class identifier AND Class Name by IClassInfo.
Defintion of a property set container interface.
Base class for ADTF filters.
Helper class to create a stream type with multiple Substreams.
void SetSubStream(const char *strName, uint32_t nSubStreamId, const flash::cStreamTypeHelper &oType)
Adds or updates a Substream.
The Interface defines a runnable item of the GraphObjects providing a IRuntimeBehaviour.
Interface for sample writers that write to sample streams via output pins.
Wrapper class that facilitates the handling of output samples.
Generator template to create an instance of a IStreamType class for stream_meta_type_plain ("adtf/pla...
Namespace for the ADTF Base SDK.
Namespace for the ADTF Filter SDK.
Namespace for the ADTF Streaming SDK.
Namespace for the ADTF uCOM3 SDK.
A timestamp with nanosecond precision.