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
116 Q_INVOKABLE QObject* createInterfaceClient(const QString& strName, const QString& strInterface);
117
123 Q_INVOKABLE void linkTrigger(const QString& strSource, const QString& strDestination);
124
132 Q_INVOKABLE QVariant getProperty(const QString& strName);
133
141 Q_INVOKABLE void setProperty(const QString& strName, const QVariant& oValue, const QString& strType = "");
142
147
148signals:
152 void connected();
153
158
164 void propertyChanged(const QString& strName, const QVariant& oValue);
165
167private:
168 void FlushWriters();
169 void ForwardTrigger(base::tNanoSeconds tmTrigger);
170
171 void PostTriggerHandler(bool bForwardTriggerViaOutputPins, qint64 tmTrigger);
172
173 QQmlPropertyMap* GetProperties();
174
175private:
176 filter::cFilter& m_oFilter;
177 QJSEngine& m_oEngine;
178 bool m_bUseAsyncSlotConnections;
179 std::mutex m_oProcessingLock;
180 std::vector<QPointer<cScriptReader>> m_oScriptReader;
181 std::vector<streaming::ISampleWriter*> m_oWriters;
182 std::unique_ptr<cPropertiesQtMapper> m_pProperties;
183 bool m_bEnablePropertyValueOverride = false;
185};
186
187} // namespace scripting
188} // namespace javascript
189} // namespace adtf
190
192namespace filter_properties
193{
194
195static constexpr auto strSynchronousTriggerProcessingProperty = "__synchronous_trigger_processing";
196
197}
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