ADTF  3.13.0
cSubStreamTypes

Helper class to create a stream type with multiple Substreams. More...

Inheritance diagram for cSubStreamTypes:
[legend]

Public Member Functions

tVoid SetSubStream (const tChar *strName, tUInt32 nSubStreamId, const flash::cStreamTypeHelper &oType)
 Adds or updates a Substream. More...
 
- Public Member Functions inherited from cSubStreamTypes
template<typename MetaType = stream_meta_type_substreams, typename = std::enable_if_t<is_stream_meta_type<MetaType>::value, MetaType>>
 cSubStreamTypes (const MetaType &=MetaType())
 Constructor. More...
 
 cSubStreamTypes (const ucom::ant::iobject_ptr< const ant::IStreamMetaType > &pMetaType)
 Constructor. More...
 
virtual ~cSubStreamTypes ()
 Destructor.
 
tVoid SetSubStream (const tChar *strName, tUInt32 nSubStreamId, const ucom::ant::iobject_ptr< const ant::IStreamType > &pType)
 Adds or updates a Substream. More...
 
tVoid SetRequestProperties (const base::ant::IProperties &oProperties, const tChar *strSubStreamName="")
 Sets the common or Substream specific request properties. More...
 
ucom::ant::object_ptr< const streaming::ant::IStreamTypeGetSubStreamType (const tChar *strName) const
 Retrieve the Stream Type of a given Substream. More...
 
ucom::ant::object_ptr< ant::IStreamTypeGetStreamType () const
 Get a Stream Type that contains all currently set Substreams. More...
 

Additional Inherited Members

- Protected Attributes inherited from cSubStreamTypes
std::unique_ptr< cImplementation > m_pImplementation
 

Detailed Description

Helper class to create a stream type with multiple Substreams.

Example Usage

#include <set>
class cMyFilter: public adtf::filter::cFilter
{
public:
ADTF_CLASS_ID_NAME(cMyFilter, "my_filter.filter.example.cid", "My Filter");
cMyFilter()
{
CreateRunner("generate_samples");
m_pWriter = CreateRequestableOutputPin("output", oSubStreams);
}
tResult EnableSubStream(adtf::streaming::ISampleWriter* /*pWriter*/,
tUInt32 nSubStreamId,
const adtf::base::IProperties* /*pRequestProperties*/) override
{
if (nSubStreamId > 2)
{
RETURN_ERROR_DESC(ERR_INVALID_ARG, "No Substream with id %d available", nSubStreamId);
}
m_oEnabledSubStreams.insert(nSubStreamId);
}
tVoid DisableSubStream(adtf::streaming::ISampleWriter* /*pWriter*/, tUInt32 nSubStreamId) override
{
m_oEnabledSubStreams.erase(nSubStreamId);
}
tResult Process(adtf::base::tNanoSeconds tmTrigger, adtf::streaming::IRunner* /*pRunner*/) override
{
++m_nTriggerCounter;
for (const auto& nSubStreamId: m_oEnabledSubStreams)
{
adtf::streaming::output_sample_data<tUInt32> oNewData(tmTrigger, m_nTriggerCounter, nSubStreamId);
m_pWriter->Write(oNewData.Release());
}
}
private:
adtf::streaming::ISampleWriter* m_pWriter = nullptr;
std::set<tUInt32> m_oEnabledSubStreams;
tUInt32 m_nTriggerCounter = 0;
};

Definition at line 123 of file stream_type_helper.h.

Member Function Documentation

◆ SetSubStream()

tVoid SetSubStream ( const tChar strName,
tUInt32  nSubStreamId,
const flash::cStreamTypeHelper oType 
)

Adds or updates a Substream.

Parameters
[in]strNameThe name of the Substream, required to be unique, this is the key to the map of substreams.
[in]nSubStreamIdThe id of the Substream, should be unique, but can be reused for aliases etc.
[in]oTypeThe type of the substream.

Copyright © Audi Electronics Venture GmbH. All rights reserved. (Generated on Tue Sep 28 2021 by doxygen 1.8.14)