#include "demo_md_dumper.h"
#include <cinttypes>
cMediaDescriptionDumper);
cMediaDescriptionDumper::cMediaDescriptionDumper()
{
m_pReader = CreateInputPin<decoding_sample_reader<>>("input");
SetDescription("input", "Input Pin from which the received DDL structure will be printed to console.");
SetDescription("Use this filter to print the sampla data of a received input.");
SetHelpLink("$(ADTF_DIR)/doc/adtf_html/page_demo_md_dumper_filter.html");
}
static adtf::util::cString decode_to_json(
const cSampleDecoder& oDecoder, tNanoSeconds nTimeStamp)
{
adtf::util::cString strJSONObject = adtf::util::cString::Format(
"{\n \"timestamp\": %" PRIi64
",\n \"data\":\n {", nTimeStamp.nCount);
size_t nElementIndex = 0;
strJSONObject.Append(adtf::util::cString::Format("%s\n \"%s\": %s",
nElementIndex > 0 ? "," : "",
oElement.getFullName().c_str(),
oElement.getStringValue().c_str()));
++nElementIndex;
});
strJSONObject.Append("\n }\n}");
return strJSONObject;
}
tResult cMediaDescriptionDumper::ProcessInput(tNanoSeconds ,
ISampleReader* )
{
cSampleDecoder oDecoder;
tNanoSeconds tmSampleTime;
while (m_pReader->GetNextDecoder(oDecoder, tmSampleTime))
{
LOG_INFO(
"%s", decode_to_json(oDecoder, tmSampleTime).GetPtr());
}
}
#define ADTF_PLUGIN(__plugin_identifier,...)
The ADTF Plugin Macro will add the code of a adtf::ucom::ant::IPlugin implementation.
#define LOG_INFO(...)
Logs an info message.
#define RETURN_NOERROR
Return status ERR_NOERROR, which requires the calling function's return type to be tResult.
string_base< cStackString > cString
cString implementation for a stack string which works on stack if string is lower than A_UTILS_DEFAUL...