Description
Example python script which decodes and prints the content for each sample of a stream used within python_processor.
Usage
Set this file within the script
propery of the python_processor.
Source
import adtf_file
print('exporter module imported')
sample_decoder = None
def open(streams, destination_url):
global sample_decoder
for stream in streams:
print(f'open: {stream.name} -> {destination_url}')
sample_decoder = adtf_file.SampleDecoder(stream.initial_type)
def process(item):
global sample_decoder
print(f'process: {item.type}')
if item.type == adtf_file.ItemType.StreamType:
sample_decoder = adtf_file.SampleDecoder(item.stream_type)
if item.type == adtf_file.ItemType.Sample:
sample = item.sample
print(f' sample:')
print(f' time_stamp: {sample.time_stamp}')
print(f' substream_id: {sample.substream_id}')
print(f' flags: {sample.flags}')
print(f' data: {sample_decoder.decode(sample)}')