#include "demo_qt_video_display.h"
ADTF_PLUGIN(
"Qt5 Video Display Plugin", cQtVideoFilter)
cQtVideoFilter::cQtVideoFilter():
adtf::ui::
cQtUIFilter(), m_bStreamTypeChanged(true), m_pVideoWidget(nullptr)
{
m_nWidth.SetDescription("Specified width for Sample dimension.");
RegisterPropertyVariable("width", m_nWidth);
m_nHeight.SetDescription("Specified height for Sample dimension.");
RegisterPropertyVariable("height", m_nHeight);
m_bFitToScreen.SetDescription("If enabled, the sample will be resized to the window dimension.");
RegisterPropertyVariable("fit_to_screen", m_bFitToScreen);
m_bKeepRatio.SetDescription("If enabled, the ratio of the Sample will be kept even when resized.");
RegisterPropertyVariable("keep_ratio", m_bKeepRatio);
m_pReader = CreateInputPin<size_limited_sample_reader<1, tFalse>>(
"video", GetStreamTypeFromProperties(),
false);
set_description(*
this,
"video",
"Input Pin for uncompressed video data streams to visualize.");
SetDescription("Use this filter to visualize uncompressed ADTF Video streams.");
set_help_link(*
this,
"$(ADTF_DIR)/doc/html/page_demo_qt_video_display.html");
}
tResult cQtVideoFilter::Init(tInitStage eStage)
{
if (eStage == StageNormal)
{
}
}
object_ptr<IStreamType> cQtVideoFilter::GetStreamTypeFromProperties()
{
m_sCurrentFormat.m_ui32Width = m_nWidth;
m_sCurrentFormat.m_ui32Height = m_nHeight;
m_sCurrentFormat.m_szMaxByteSize = 0;
object_ptr<IStreamType> pType = make_object_ptr<cStreamType>(stream_meta_type_image());
return pType;
}
QWidget* cQtVideoFilter::CreateView()
{
m_pVideoWidget = new cVideoWidget(nullptr);
m_pVideoWidget->SetFitToScreen(m_bFitToScreen);
m_pVideoWidget->SetKeepRatio(m_bKeepRatio);
return m_pVideoWidget;
}
void cQtVideoFilter::ReleaseView()
{
m_pVideoWidget = nullptr;
}
{
}
tResult cQtVideoFilter::AcceptType(ISampleReader* ,
const iobject_ptr<const IStreamType>& pType)
{
if (!pType.Get())
{
}
}
tResult cQtVideoFilter::UpdateVideo()
{
while (
IS_OK(m_pReader->GetNextSample(pSample)))
{
}
if (pSample)
{
m_pVideoWidget->UpdateSample(m_sCurrentFormat, pSample);
}
}
#define ADTF_PLUGIN(__plugin_identifier,...)
The ADTF Plugin Macro will add the code of a adtf::ucom::ant::IPlugin implementation.
#define RETURN_IF_FAILED(s)
Return if expression is failed, which requires the calling function's return type to be tResult.
#define RETURN_NOERROR
Return status ERR_NOERROR, which requires the calling function's return type to be tResult.
#define RETURN_ERROR(code)
Return specific error code, which requires the calling function's return type to be tResult.
#define IS_OK(s)
Check if result is OK.
#define PLATFORM_BYTEORDER
defines a link to __get_platform_byteorder.
tResult get_stream_type_image_format(tStreamImageFormat &oFormat, const IStreamType &oType)
Helper function to retrieve the oFormat (tStreamImageFormat) out of the of a IStreamType for a stream...
tResult set_stream_type_image_format(IStreamType &oType, const tStreamImageFormat &oFormat)
Helper function to set the properties of a IStreamType for a stream_meta_type_image.
void set_description(base::ant::IConfiguration &oConfig, const char *strDescription)
Sets description information.
void set_help_link(base::ant::IConfiguration &oConfig, const char *strUrl)
Set the link to the corresponding help/documentation.