A Reader that is returned by cScriptFilter::createInputPin.
More...
|
void | streamTypeChanged (QObject *type) |
| Connect to this signal to handle new Stream Types recieved via the associated Pin. More...
|
|
void | trigger (qint64 timestamp) |
| Connect to this signal to handle Data In Triggers in the associated Pin. More...
|
|
void | sample (const QVariant &sample) |
| Connect to this signal to handle Samples received via the associated Pin. More...
|
|
A Reader that is returned by cScriptFilter::createInputPin.
Samples returned by getNextSample(), getLastSample() and passed via the sample() signal contain the following elements:
- sample.timestamp: contains the timestamp of the sample in nanoseconds.
- sample.substream: contains the name of the substream that the sample belongs to (can be empty)
- sample.data: contains the payload of the sample in one of the following forms:
- For streams that have a media description:
- A javascript object that represents the data structure of the media description, i.e sample.data.parent.child.value etc.
- For streams with stream type "adtf/image" (adtf::streaming::ant::stream_meta_type_image)
- A QImage with the image data.
- For all others
- A javascript ArrayBuffer object containing the raw data bytes of the sample
Please keep in mind that when you do not connect a callback to both trigger() and sample(), all incoming samples will be discarded.
Definition at line 127 of file builds/digitalwerk/solutions/adtf_content/adtf_base/adtf_core/src/libraries/javascriptfiltersdk/src/reader.h.
◆ cancelRequest()
Q_INVOKABLE void cancelRequest |
( |
const QString & |
strSubStream | ) |
|
Cancels a request for samples from a given Substream.
- Parameters
-
[in] | strSubStream | The substream. |
◆ getLastSample()
Q_INVOKABLE QVariant getLastSample |
( |
| ) |
|
Returns the last available sample.
Example Usage
var input = filter.createInputPin("input")
input.trigger.connect(function(timestamp)
{
console.info("last sample: " + JSON.stringify(input.getLastSample()))
})
- Warning
- Mind that this does not work for Substreams.
- Returns
- The last sample available or false.
◆ getNextSample()
Q_INVOKABLE QVariant getNextSample |
( |
| ) |
|
Returns the next available sample.
Example Usage
var input = filter.createInputPin("input")
input.trigger.connect(function(timestamp)
{
var sampleCount = 0
while ((sample = input.getNextSample()))
{
++sampleCount
}
console.info("recieved " + sampleCount + " samples")
})
- Returns
- The next sample available or false.
◆ requestSamples()
Q_INVOKABLE void requestSamples |
( |
const QString & |
strSubStream | ) |
|
Request samples from a given Substream.
Example Usage
var input = filter.createInputPin("input")
input.requestSamples("stream1")
input.requestSamples("stream2")
input.sample.connect(function(sample)
{
if (sample.substream === "stream1")
{
console.info("recieved sample from substream stream1")
}
else if (sample.substream === "stream2")
{
console.info("recieved sample from substream stream2")
}
})
- Parameters
-
[in] | strSubStream | The Substream. |
◆ sample
void sample |
( |
const QVariant & |
sample | ) |
|
|
signal |
Connect to this signal to handle Samples received via the associated Pin.
Note this signal is only emitted if the trigger() signal has no receivers.
Example Usage
var input = filter.createInputPin("input")
input.sample.connect(function(sample)
{
console.info("sample with timestamp " + sample.timestamp)
})
- Parameters
-
◆ streamTypeChanged
void streamTypeChanged |
( |
QObject * |
type | ) |
|
|
signal |
Connect to this signal to handle new Stream Types recieved via the associated Pin.
Example Usage
var input = filter.createInputPin("input")
input.streamTypeChanged.connect(function(type)
{
console.info("stream type: " + JSON.stringify(type))
})
- Parameters
-
◆ trigger
void trigger |
( |
qint64 |
timestamp | ) |
|
|
signal |
Connect to this signal to handle Data In Triggers in the associated Pin.
Example Usage
var input = filter.createInputPin("input")
input.trigger.connect(function(timestamp)
{
console.info("trigger at " + timestamp)
})
Process Samples from multiple inputs on a single trigger
- Parameters
-
timestamp | The timestamp of the trigger in nanoseconds. |