#include <set>
#include <mutex>
{
public:
cMyFilter()
{
m_pWriter = CreateOutputPin<adtf::streaming::requestable_writer<>>("output", oSubStreams);
{
if (nSubStreamId > 2)
{
THROW_ERROR_DESC(ERR_INVALID_ARG,
"No substream with id %" PRIu32
" available", nSubStreamId);
}
std::lock_guard<std::mutex> oGuard(m_oSubStreamsLock);
m_oEnabledSubStreams.insert(nSubStreamId);
},
[this](uint32_t nSubStreamId)
{
std::lock_guard<std::mutex> oGuard(m_oSubStreamsLock);
m_oEnabledSubStreams.erase(nSubStreamId);
});
}
tResult Process(adtf::base::tNanoSeconds tmTrigger, adtf::streaming::IRunner* )
override
{
++m_nTriggerCounter;
std::lock_guard<std::mutex> oGuard(m_oSubStreamsLock);
for (const auto& nSubStreamId: m_oEnabledSubStreams)
{
adtf::streaming::output_sample_data<uint32_t> oNewData(tmTrigger, m_nTriggerCounter, nSubStreamId);
m_pWriter->Write(oNewData.Release());
}
}
private:
adtf::streaming::requestable_writer<>* m_pWriter = nullptr;
std::mutex m_oSubStreamsLock;
std::set<uint32_t> m_oEnabledSubStreams;
uint32_t m_nTriggerCounter = 0;
};
#define THROW_ERROR_DESC(_code,...)
throws a tResult exception
Definition result.h:85
A_UTILS_NS::cResult tResult
For backwards compatibility and to bring latest version into scope.
Definition result.h:736
#define RETURN_NOERROR
Return status ERR_NOERROR, which requires the calling function's return type to be tResult.
Definition result.h:29
#define ADTF_CLASS_ID_NAME(_class, _strcid, _strclabel)
Definition class_id.h:33
Definition property_intf.h:213
virtual tResult Process(base::flash::tNanoSeconds tmTrigger, streaming::ant::IRunner *pRunner)
streaming::ant::IRunner * CreateRunner(const char *strName, const cTriggerHint &oTriggerHint=cNoTriggerHint(), bool bForwardTriggerViaOutputPins=true)
Definition stream_type_helper.h:154
void SetSubStream(const char *strName, uint32_t nSubStreamId, const flash::cStreamTypeHelper &oType)
Generator template to create an instance of a ant::IStreamType class for penguin::stream_meta_type_pl...
Definition streammetatypeplain.h:315