ADTF Qt5
Loading...
Searching...
No Matches
filter.h
Go to the documentation of this file.
1
7
8/*
9 * This file depends on Qt which is licensed under LGPLv3.
10 * See ADTF_DIR/3rdparty/qt5 and doc/license for detailed information.
11 */
12#pragma once
13#include <adtffiltersdk/filter.h>
14
15#include <QQmlEngine>
16#include <QJsonValue>
17#include <QQmlPropertyMap>
18#include <vector>
19#include <memory>
20#include <mutex>
21#include <string>
22#include <unordered_set>
23
24namespace adtf
25{
26
30namespace javascript
31{
32
36namespace scripting
37{
38
40// Predeclaration of internal class
41class cPropertiesQtMapper;
42class cScriptReader;
44
48class cScriptFilter : public QObject
49{
50 Q_OBJECT
51
56 Q_PROPERTY(QQmlPropertyMap* properties READ GetProperties NOTIFY propertiesChanged)
57
58public:
60 cScriptFilter(filter::cFilter& oFilter, QJSEngine& oEngine);
61 ~cScriptFilter() override;
62 tResult Check();
64
76 Q_INVOKABLE QObject* createInputPin(const QString& strName, bool bForwardTriggerViaOutputPins = true);
77
88 Q_INVOKABLE QObject* createOutputPin(const QString& strName, const QJSValue& oStreamType = QJSValue());
89
101 Q_INVOKABLE QObject* createRunner(const QString& strName, bool bForwardTriggerViaOutputPins = true);
102
117 Q_INVOKABLE QObject* createInterfaceClient(const QString& strName, const QString& strInterface);
118
124 Q_INVOKABLE void linkTrigger(const QString& strSource, const QString& strDestination);
125
133 Q_INVOKABLE QVariant getProperty(const QString& strName);
134
142 Q_INVOKABLE void setProperty(const QString& strName, const QVariant& oValue, const QString& strType = "");
143
148
149signals:
153 void connected();
154
159
165 void propertyChanged(const QString& strName, const QVariant& oValue);
166
168private:
169 void FlushWriters();
170 void ForwardTrigger(base::tNanoSeconds tmTrigger);
171
172 void PostTriggerHandler(bool bForwardTriggerViaOutputPins, qint64 tmTrigger);
173
174 QQmlPropertyMap* GetProperties();
175
176private:
177 filter::cFilter& m_oFilter;
178 QJSEngine& m_oEngine;
179 bool m_bUseAsyncSlotConnections;
180 std::mutex m_oProcessingLock;
181 std::vector<QPointer<cScriptReader>> m_oScriptReader;
182 std::vector<streaming::ISampleWriter*> m_oWriters;
183 std::unique_ptr<cPropertiesQtMapper> m_pProperties;
184 bool m_bEnablePropertyValueOverride = false;
186};
187
188} // namespace scripting
189} // namespace javascript
190} // namespace adtf
191
193namespace filter_properties
194{
195
196static constexpr auto strSynchronousTriggerProcessingProperty = "__synchronous_trigger_processing";
197
198}
Q_INVOKABLE QVariant getProperty(const QString &strName)
QQmlPropertyMap * properties
Definition filter.h:56
Q_INVOKABLE QObject * createOutputPin(const QString &strName, const QJSValue &oStreamType=QJSValue())
Q_INVOKABLE QObject * createInputPin(const QString &strName, bool bForwardTriggerViaOutputPins=true)
void propertyChanged(const QString &strName, const QVariant &oValue)
Q_INVOKABLE void linkTrigger(const QString &strSource, const QString &strDestination)
Q_INVOKABLE QObject * createInterfaceClient(const QString &strName, const QString &strInterface)
Q_INVOKABLE void setProperty(const QString &strName, const QVariant &oValue, const QString &strType="")
Q_INVOKABLE QObject * createRunner(const QString &strName, bool bForwardTriggerViaOutputPins=true)
Definition clock.h:25
Namespace for the ADTF JavaScript Filter SDK.
Definition clock.h:22
Namespace for all functionality provided by ADTF and its SDKs.
Definition adtfui_pkg.h:13