ADTF  3.18.2
builds/digitalwerk/solutions/adtf_content/adtf_base/adtf_core/src/libraries/javascriptfiltersdk/src/types.h
Go to the documentation of this file.
1 
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 
14 #include <adtf_utils.h>
18 #include <QJSEngine>
19 
20 namespace adtf
21 {
22 
23 namespace javascript
24 {
25 
26 namespace scripting
27 {
28 
32 class cScriptStructure: public QObject, public ddl::DDStructure
33 {
34  Q_OBJECT
35 
36  public:
38  cScriptStructure(const QString& strStructName, QJSEngine& oEngine);
40 
52  Q_INVOKABLE QObject* add(const QString& strElementName, const QJSValue& oElementType, quint64 nArraySize = 1);
53 
54  private:
55  QJSEngine& m_oEngine;
56 };
57 
61 class cStreamTypeWrapper: public QObject
62 {
63  Q_OBJECT
64  public:
68  QString getStreamMetaType() const;
69  QVariantMap getProperties() const;
71 
72  Q_PROPERTY(QVariantMap properties READ getProperties);
73  Q_PROPERTY(QString stream_meta_type READ getStreamMetaType);
79  Q_INVOKABLE void setProperty(const QString& strName, const QJSValue& oValue);
80 
81 
90  Q_INVOKABLE QList<QString> getSubStreams();
91 
101  Q_INVOKABLE QObject* getSubStreamType(const QString& strSubStream);
102 
103 
104  private:
106  QJSEngine& m_oEngine;
107 };
108 
113 class cSubStreamsTypeWrapper: public QObject
114 {
115  Q_OBJECT
116  public:
118  cSubStreamsTypeWrapper(QJSEngine& oEngine);
121 
128  Q_INVOKABLE void setSubStream(const QString& strName, quint32 nSubStreamId, const QJSValue& oStreamType);
129 
130  private:
132  QJSEngine& m_oEngine;
133 };
134 
138 class cScriptTypes: public QObject
139 {
140  Q_OBJECT
141 
142  public:
144  cScriptTypes(QJSEngine& oEngine, const adtf::util::cFilepath& strScriptFolder);
146 
156  Q_INVOKABLE QObject* createDefinition(const QString& strStructName);
157 
169  Q_INVOKABLE QObject* getDefinition(const QString& strStructName);
170 
181  Q_INVOKABLE QObject* createStreamType(const QString& strMetaType);
182 
193  Q_INVOKABLE QObject* createPlainStreamType(const QString& strCType);
194 
202  Q_INVOKABLE QObject* createSubStreamsType();
203 
216  Q_INVOKABLE QObject* fromDescriptionFile(const QString& strStructName, const QString& strFileName, bool bResolveStruct = true);
217 
229  Q_INVOKABLE QObject* fromDescriptionString(const QString& strStructName, const QString& strMediaDescription, bool bResolveStruct = true);
230 
231  private:
232  QJSEngine& m_oEngine;
233  adtf::util::cFilepath m_strScriptFolder;
234 };
235 
237 ucom::object_ptr<const adtf::streaming::IStreamType> get_stream_type(const QJSValue& oStreamType);
239 
240 }
241 }
242 }
Copyright © Audi Electronics Venture GmbH.
Q_INVOKABLE QObject * add(const QString &strElementName, const QJSValue &oElementType, quint64 nArraySize=1)
Adds an element to the structure definition.
Q_INVOKABLE QObject * createStreamType(const QString &strMetaType)
Create a new cStreamTypeWrapper instance with the given Stream Meta Type.
Q_INVOKABLE QObject * createPlainStreamType(const QString &strCType)
Create a new cStreamTypeWrapper instance for a adtf/plain stream type with the a given c-type.
Q_INVOKABLE QObject * getDefinition(const QString &strStructName)
Returns a stream type with a media description set from the Media Description Service.
Q_INVOKABLE QObject * createDefinition(const QString &strStructName)
Create a new cScriptStructure definition.
Q_INVOKABLE QObject * fromDescriptionFile(const QString &strStructName, const QString &strFileName, bool bResolveStruct=true)
Creates an 'adtf/default' Stream Type from the given media description file.
Q_INVOKABLE QObject * createSubStreamsType()
Creates a stream type that can handle Substreams.
Q_INVOKABLE QObject * fromDescriptionString(const QString &strStructName, const QString &strMediaDescription, bool bResolveStruct=true)
Creates an 'adtf/default' Stream Type from the given media description string.
Q_INVOKABLE QObject * getSubStreamType(const QString &strSubStream)
Return an StreamType from the stream type if found, otherwise return null.
Q_INVOKABLE void setProperty(const QString &strName, const QJSValue &oValue)
Set a property to a given value.
Q_INVOKABLE QList< QString > getSubStreams()
Returns a list of all substreams.
Q_INVOKABLE void setSubStream(const QString &strName, quint32 nSubStreamId, const QJSValue &oStreamType)
Adds or updates a Substream.
Helper class to create a stream type with multiple Substreams.
Object pointer implementation used for reference counting on objects of type IObject.
Definition: object_ptr.h:163
Utility class for a complete valid data definition of one StructType and its dependencies.
Definition: ddstructure.h:55
Namespace for entire ADTF SDK.
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.
Copyright © Audi Electronics Venture GmbH.