adtf_file_library  0.13.1
Demo Exporter

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

# Copyright 2024 CARIAD SE.
#
# This Source Code Form is subject to the terms of the Mozilla
# Public License, v. 2.0. If a copy of the MPL was not distributed
# with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
#
# If it is not possible or desirable to put the notice in a particular file, then
# You may include the notice in a location (such as a LICENSE file in a
# relevant directory) where a recipient would be likely to look for such a notice.
#
# You may add additional accurate notices of copyright ownership.
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)}')

Copyright © CARIAD SE.
Generated on Fri Apr 19 2024 by doxygen 1.9.1
GIT Commit Hash: 82d535f82776c20b12fc60740bdae991b62444a7