Shows how to handle incoming substream requests.
#include "requestable_substream_generator_filter.h"
ADTF_PLUGIN(
"Demo Requestable Substream Generator Plugin", cDemoRequestableSubStreamGenerator);
cDemoRequestableSubStreamGenerator::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");
}
cDemoRequestableSubStreamGenerator::~cDemoRequestableSubStreamGenerator() = default;
uint32_t nSubStreamId,
{
if (nSubStreamId > 2)
{
RETURN_ERROR_DESC(ERR_INVALID_ARG,
"No substream with id %" PRIu32
" available", nSubStreamId);
}
m_oEnabledSubStreams.insert(nSubStreamId);
LOG_INFO(
"Enabled substream %" PRIu32, nSubStreamId);
}
void cDemoRequestableSubStreamGenerator::DisableSubStream(
ISampleWriter* , uint32_t nSubStreamId)
{
m_oEnabledSubStreams.erase(nSubStreamId);
LOG_INFO(
"Disabled substream %u", nSubStreamId);
}
{
++m_nTriggerCounter;
for (const auto& nSubStreamId : m_oEnabledSubStreams)
{
m_pWriter->Write(oNewData.Release());
}
}
#define ADTF_PLUGIN(__plugin_identifier,...)
Definition adtf_plugin.h:29
#define LOG_INFO(...)
Logs an info message.
Definition log.h:388
A_UTILS_NS::cResult tResult
For backwards compatibility and to bring latest version into scope.
Definition result.h:736
#define RETURN_ERROR_DESC(_code,...)
Same as RETURN_ERROR(_error) using a printf like parameter list for detailed error description.
Definition result.h:44
#define RETURN_NOERROR
Return status ERR_NOERROR, which requires the calling function's return type to be tResult.
Definition result.h:29
Definition property_intf.h:213
Definition stream_type_helper.h:154
void SetSubStream(const char *strName, uint32_t nSubStreamId, const flash::cStreamTypeHelper &oType)
Definition runner_intf.h:24
Definition samplestreamer_intf.h:234
Generator template to create an instance of a ant::IStreamType class for penguin::stream_meta_type_pl...
Definition streammetatypeplain.h:315
Namespace for the ADTF Base SDK.
Definition adtf_base_type_traits.h:13
Namespace for the ADTF Filter SDK.
Definition configurable_runner.h:18
Namespace for the ADTF Streaming SDK.
Definition bindingproxyinport.h:14
Namespace for the ADTF uCOM SDK.
Definition adtf_system.h:324
A timestamp with nanosecond precision.
Definition chrono.h:23