adtf_file_library  0.13.1
ADTF File Python Bindings

Description

Besides the C++ API we also ship .pyd library using python bindings for adtf_file and adtfdat_processing. This enables you

  • reading and writing .adtfdat files
  • processing streams
  • decoding ddl based samples

Prepare environment

To use the ADTF File Library with python it is recommended to use pipenv to set up a python environment.

A pipenv driven python enviroment is configured by a so-called Pipfile.

To set up the python environment you can use following example Pipfile, for example (examples/python/Pipfile):

NOTE: Please make sure to adapt the package path (see comment in Pipfile)

# 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.
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"
[packages]
# Adapt this path to you requested platform and version
# Here are all available packages: https://artifactory.digitalwerk.net/artifactory/Product-Releases/Gitlab-CI/adtf_file_library/
adtf_file = {file = "https://artifactory.digitalwerk.net:443/artifactory/Product-Releases/Gitlab-CI/adtf_file_library/0.13.0/build-linux-x86-64-gcc7-release/adtf_file_library.zip" }
pipfile = "*"
[requires]
python_version = "3.10"

To use the example Pipfile:

  • Create an environment directory (<env-dir>)
  • Copy the Pipefile into this environment directory
  • Go to environment directory
  • Call
pipenv install
  • Now the packages should be available
  • Activate your environment by
pipenv shell
  • and use Python as usual.
  • Or run your script by
pipenv run python <path_to_script>

Getting started

Use the build-in help functionality within python to receive the available classes and methods which can be used:

import adtf_file
help(adtf_file)
Help on module adtf_file:
NAME
adtf_file - adtf_file python bindings
CLASSES
pybind11_builtins.pybind11_object(builtins.object)
Demultiplexer
Extension
FileItem
ItemType
PropertyStreamType
PropertyValue
Reader
SampleBuffer
SampleDecoder
SeekableReader
Stream
StreamItem
Substream
WriteSample
class Demultiplexer(pybind11_builtins.pybind11_object)
| Method resolution order:
| Demultiplexer
| pybind11_builtins.pybind11_object
| builtins.object
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| add_processor(...)
| add_processor(self: adtf_file.Demultiplexer, stream_name: str, substream_name: str = '', processor_id: str, destination_url: str, configuration: dict = {}) -> None
|
| Adds a processor for the given stream.
|
| process(...)
| process(self: adtf_file.Demultiplexer, progress_callback: Callable[[float], bool] = None) -> None
|
| Process the input file with all processors.
|
| ----------------------------------------------------------------------
| Static methods inherited from pybind11_builtins.pybind11_object:
|
| __new__(*args, **kwargs) from pybind11_builtins.pybind11_type
| Create and return a new object. See help(type) for accurate signature.
class Extension(pybind11_builtins.pybind11_object)
| Method resolution order:
| Extension
| pybind11_builtins.pybind11_object
| builtins.object
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| name
|
| stream_id
|
| type_id
|
| user_id
|
|
| ----------------------------------------------------------------------
| Static methods inherited from pybind11_builtins.pybind11_object:
|
| __new__(*args, **kwargs) from pybind11_builtins.pybind11_type
| Create and return a new object. See help(type) for accurate signature.
class FileItem(pybind11_builtins.pybind11_object)
| Method resolution order:
| FileItem
| pybind11_builtins.pybind11_object
| builtins.object
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| sample
|
| stream_id
|
| stream_type
|
| time_stamp
|
| type
|
| ----------------------------------------------------------------------
| Static methods inherited from pybind11_builtins.pybind11_object:
|
| __new__(*args, **kwargs) from pybind11_builtins.pybind11_type
| Create and return a new object. See help(type) for accurate signature.
class ItemType(pybind11_builtins.pybind11_object)
| Method resolution order:
| ItemType
| pybind11_builtins.pybind11_object
| builtins.object
|
| Methods defined here:
|
| __eq__(...)
| __eq__(self: object, other: object) -> bool
|
| __getstate__(...)
| __getstate__(self: object) -> int
|
| __hash__(...)
| __hash__(self: object) -> int
|
| __index__(...)
| __index__(self: adtf_file.ItemType) -> int
|
| __init__(...)
| __init__(self: adtf_file.ItemType, value: int) -> None
|
| __int__(...)
| __int__(self: adtf_file.ItemType) -> int
|
| __ne__(...)
| __ne__(self: object, other: object) -> bool
|
| __repr__(...)
| __repr__(self: object) -> str
|
| __setstate__(...)
| __setstate__(self: adtf_file.ItemType, state: int) -> None
|
| __str__ = name(...)
| name(self: handle) -> str
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| __members__
|
| name
| name(self: handle) -> str
|
| value
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| Sample = <ItemType.Sample: 1>
|
| StreamType = <ItemType.StreamType: 2>
|
| Trigger = <ItemType.Trigger: 3>
|
| Unknown = <ItemType.Unknown: 0>
|
| ----------------------------------------------------------------------
| Static methods inherited from pybind11_builtins.pybind11_object:
|
| __new__(*args, **kwargs) from pybind11_builtins.pybind11_type
| Create and return a new object. See help(type) for accurate signature.
class PropertyStreamType(pybind11_builtins.pybind11_object)
| Method resolution order:
| PropertyStreamType
| pybind11_builtins.pybind11_object
| builtins.object
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| meta_type
|
| properties
|
| substreams
|
| ----------------------------------------------------------------------
| Static methods inherited from pybind11_builtins.pybind11_object:
|
| __new__(*args, **kwargs) from pybind11_builtins.pybind11_type
| Create and return a new object. See help(type) for accurate signature.
class PropertyValue(pybind11_builtins.pybind11_object)
| Method resolution order:
| PropertyValue
| pybind11_builtins.pybind11_object
| builtins.object
|
| Methods defined here:
|
| __init__(...)
| __init__(*args, **kwargs)
| Overloaded function.
|
| 1. __init__(self: adtf_file.PropertyValue, arg0: str, arg1: str) -> None
|
| 2. __init__(self: adtf_file.PropertyValue, arg0: str) -> None
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| type
|
| value
|
| ----------------------------------------------------------------------
| Static methods inherited from pybind11_builtins.pybind11_object:
|
| __new__(*args, **kwargs) from pybind11_builtins.pybind11_type
| Create and return a new object. See help(type) for accurate signature.
class Reader(pybind11_builtins.pybind11_object)
| Method resolution order:
| Reader
| pybind11_builtins.pybind11_object
| builtins.object
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| get_next_item(...)
| get_next_item(self: adtf_file.Reader) -> Optional[adtf_file.FileItem]
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| description
|
| extensions
|
| file_version
|
| item_count
|
| streams
|
| ----------------------------------------------------------------------
| Static methods inherited from pybind11_builtins.pybind11_object:
|
| __new__(*args, **kwargs) from pybind11_builtins.pybind11_type
| Create and return a new object. See help(type) for accurate signature.
class SampleBuffer(pybind11_builtins.pybind11_object)
| Method resolution order:
| SampleBuffer
| pybind11_builtins.pybind11_object
| builtins.object
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from pybind11_builtins.pybind11_object:
|
| __new__(*args, **kwargs) from pybind11_builtins.pybind11_type
| Create and return a new object. See help(type) for accurate signature.
class SampleDecoder(pybind11_builtins.pybind11_object)
| Method resolution order:
| SampleDecoder
| pybind11_builtins.pybind11_object
| builtins.object
|
| Methods defined here:
|
| __init__(...)
| __init__(self: adtf_file.SampleDecoder, arg0: adtf_file.PropertyStreamType) -> None
|
| decode(...)
| decode(self: adtf_file.SampleDecoder, arg0: adtf_file.WriteSample) -> object
|
| ----------------------------------------------------------------------
| Static methods inherited from pybind11_builtins.pybind11_object:
|
| __new__(*args, **kwargs) from pybind11_builtins.pybind11_type
| Create and return a new object. See help(type) for accurate signature.
class SeekableReader(pybind11_builtins.pybind11_object)
| Method resolution order:
| SeekableReader
| pybind11_builtins.pybind11_object
| builtins.object
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| get_item_index_for_stream_item_index(...)
| get_item_index_for_stream_item_index(self: adtf_file.SeekableReader, stream_id: int, stream_item_index: int) -> int
|
| get_item_index_for_timeStamp(...)
| get_item_index_for_timeStamp(self: adtf_file.SeekableReader, time_stamp: datetime.timedelta) -> int
|
| get_next_item(...)
| get_next_item(self: adtf_file.Reader) -> Optional[adtf_file.FileItem]
|
| get_stream_type_before(...)
| get_stream_type_before(self: adtf_file.SeekableReader, item_index: int, stream_id: int) -> adtf_file::StreamType
|
| seek_to(...)
| seek_to(self: adtf_file.SeekableReader, item_index: int) -> None
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| description
|
| extensions
|
| file_version
|
| item_count
|
| streams
|
| ----------------------------------------------------------------------
| Static methods inherited from pybind11_builtins.pybind11_object:
|
| __new__(*args, **kwargs) from pybind11_builtins.pybind11_type
| Create and return a new object. See help(type) for accurate signature.
class Stream(pybind11_builtins.pybind11_object)
| Method resolution order:
| Stream
| pybind11_builtins.pybind11_object
| builtins.object
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| initial_type
|
| item_count
|
| name
|
| stream_id
|
| timestamp_of_first_item
|
| timestamp_of_last_item
|
| ----------------------------------------------------------------------
| Static methods inherited from pybind11_builtins.pybind11_object:
|
| __new__(*args, **kwargs) from pybind11_builtins.pybind11_type
| Create and return a new object. See help(type) for accurate signature.
class StreamItem(pybind11_builtins.pybind11_object)
| Method resolution order:
| StreamItem
| pybind11_builtins.pybind11_object
| builtins.object
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from pybind11_builtins.pybind11_object:
|
| __new__(*args, **kwargs) from pybind11_builtins.pybind11_type
| Create and return a new object. See help(type) for accurate signature.
class Substream(pybind11_builtins.pybind11_object)
| Method resolution order:
| Substream
| pybind11_builtins.pybind11_object
| builtins.object
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| id
|
| stream_type
|
| ----------------------------------------------------------------------
| Static methods inherited from pybind11_builtins.pybind11_object:
|
| __new__(*args, **kwargs) from pybind11_builtins.pybind11_type
| Create and return a new object. See help(type) for accurate signature.
class WriteSample(pybind11_builtins.pybind11_object)
| Method resolution order:
| WriteSample
| pybind11_builtins.pybind11_object
| builtins.object
|
| Methods defined here:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Readonly properties defined here:
|
| buffer
|
| flags
|
| substream_id
|
| time_stamp
|
| ----------------------------------------------------------------------
| Static methods inherited from pybind11_builtins.pybind11_object:
|
| __new__(*args, **kwargs) from pybind11_builtins.pybind11_type
| Create and return a new object. See help(type) for accurate signature.
FUNCTIONS
create_demultiplexer(...) method of builtins.PyCapsule instance
create_demultiplexer(file_name: str, reader_id: str = '', reader_configuration: dict = {}) -> adtf_file.Demultiplexer
Creates a demultiplexer for the given file.
create_reader(...) method of builtins.PyCapsule instance
create_reader(file_name: str, reader_configuration: dict = {}) -> adtf_file.Reader
Creates a reader for the given file.
create_seekablereader(...) method of builtins.PyCapsule instance
create_seekablereader(file_name: str, reader_configuration: dict = {}) -> adtf_file.SeekableReader
Creates a seekablereader for the given file.
load_plugin(...) method of builtins.PyCapsule instance
load_plugin(file_name: str) -> None
Loads the given adtffile plugin.
DATA
Sample = <ItemType.Sample: 1>
StreamType = <ItemType.StreamType: 2>
Trigger = <ItemType.Trigger: 3>
Unknown = <ItemType.Unknown: 0>
FILE
c:\workspace\build\build\relwithdebinfo\src\python\module\adtf_file.cp310-win_amd64.pyd
Stream Type base class.
Definition: stream_item.h:43
namespace for ADTF File library
Definition: adtf2_adtf_core_media_sample_deserializer.h:25
const uint32_t version_id
IFHD Version ID V1.0.
Definition: indexedfile_v100.h:31

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