Metadata-Version: 2.4
Name: pixtreme-transport-sequence
Version: 0.1.1
Summary: Image sequence module for pixtreme.transport
License-Expression: MIT AND BSD-3-Clause
License-File: licenses/nanobind.txt
License-File: licenses/robin_map.txt
License-File: licenses/third-party.json
Project-URL: Homepage, https://github.com/sync-dev-org/pixtreme-transport-sequence
Project-URL: Repository, https://github.com/sync-dev-org/pixtreme-transport-sequence
Project-URL: Releases, https://github.com/sync-dev-org/pixtreme-transport-sequence/releases
Requires-Python: >=3.12
Requires-Dist: pixtreme>=2.33.0
Requires-Dist: pixtreme-transport>=0.54.0
Description-Content-Type: text/markdown

# pixtreme-transport-sequence

`pixtreme.transport.sequence` reads and writes numbered image sequences through
pixtreme's format-specific Readers and Writers. Its `SequenceEntrance` and
`SequenceExit` factories create pixtreme.transport sessions with the module name
`sequence`, using buffers owned by the caller. Input preserves the source colour
and alpha; output performs only image conversions explicitly allowed by the
caller through pixtreme.

## Installation and requirements

Install from PyPI:

```sh
python -m pip install pixtreme-transport-sequence
```

The release platforms are Linux x86_64 (glibc 2.28 or later) and native Windows
x86_64. Install a wheel for your platform from the selected release; a platform
is available only when that release provides its wheel. The supported Python
versions are standard CPython 3.12 and 3.13; wheels use the CPython 3.12 stable
ABI. Image I/O uses an NVIDIA GPU and requires the CUDA-compatible driver
specified by the installed [pixtreme](https://pypi.org/project/pixtreme/) release.

The only direct runtime dependencies are `pixtreme>=2.33.0` and
`pixtreme-transport>=0.54.0`. Python installation resolves these packages and
their own dependencies. Image formats are those supported by the installed
pixtreme Readers and Writers, selected by the filename extension.

## Python sessions

Create input and output sessions through `sequence`:

```python
from fractions import Fraction

from pixtreme.transport import sequence
from pixtreme.transport.session import ExitSettings, FrameBuffer, Pacing

device = 0  # Ordinal after CUDA_VISIBLE_DEVICES filtering.
input_buffer = FrameBuffer(2, mode="blocking")
source = sequence.SequenceEntrance(
    device,
    input_buffer,
    {
        "path": "input/frame_%04d.exr",
        "sequence.frame_rate": "24000/1001",
        "sequence.start_frame": "1",
    },
)

output_buffer = FrameBuffer(2, mode="blocking")
settings = ExitSettings(Fraction(1001, 24000))  # Frame period, in seconds.
settings.pacing = Pacing.NONE
settings.audio.enabled = False
target = sequence.SequenceExit(
    device,
    output_buffer,
    settings,
    {"path": "output/frame_%04d.exr", "sequence.start_frame": "1"},
)
```

Creation returns unopened sessions. Call `source.open()`, read with
`source.next()` until it returns `None`, and close the source in a `finally`
block. Each returned item's `frame` contains the image and timing. To write,
put the processed transport frames into `output_buffer`, open the target, close
the buffer after the last frame, and call `target.join()` to wait for all writes.
Close the target in a `finally` block. Run the producer and consumer concurrently
when filling a blocking buffer beyond its capacity. Create the output directory
before opening the target.

Input reads in display order as quickly as its blocking buffer accepts images.
It does not pace reads by the OS clock or attach receipt timestamps. For a file
pipeline, `Pacing.NONE` and FIFO selection write every accepted image once and
wait while the output buffer is empty and open. Closing and draining the buffer
finishes output. `Pacing.CORE_CLOCK` with FIFO selection is also accepted; it
writes the images and repeats supplied by the core at its output cadence.

### Sequence options

Options are strings, supplied as a mapping or an iterable of name/value pairs.

| Option | Input | Output |
|---|---|---|
| `path` | Required image filename pattern | Required image filename pattern |
| `sequence.frame_rate` | Required positive rational, such as `24000/1001` | Not accepted; use the core output frame period |
| `sequence.start_frame` | Optional decimal integer; otherwise find the first existing file among numbers 0–4 | Optional decimal integer; default `1` |

A path must contain exactly one printf-style `%0Nd` number field, with `N >= 1`:
`frame_%04d.exr` produces names such as `frame_0001.exr`. Use `%%` for a literal
percent sign. Glob patterns, `####`, explicit filename lists and sequence seek
are not supported.

Input advances through consecutive numbers and ends at the first missing file.
A missing first image or an existing unreadable or undecodable image is an
error. Output numbers each received image consecutively from its start number.
Sequence input supplies images without audio, motion vectors or residuals;
output rejects enabled audio before writing an image. Unknown, duplicate,
missing or inapplicable settings fail with the setting name and reason.

## C and C++ SDK

Download the SDK archive for your platform and version, together with
`SHA256SUMS`, from the
[GitHub Releases](https://github.com/sync-dev-org/pixtreme-transport-sequence/releases).
Verify the archive's SHA256 before extracting it. The SDK provides the same
module library as the wheel, public headers, CMake package files and licenses.
Obtain compatible shared SDKs for
[pixtreme](https://github.com/sync-dev-org/pixtreme/releases) and
[pixtreme-transport](https://github.com/sync-dev-org/pixtreme-transport/releases)
separately; their libraries are supplied by those distributions.

Point CMake's `pixtreme_DIR`, `pixtreme_transport_DIR` and
`pixtreme_transport_sequence_DIR` to the extracted SDKs' `pixtreme/core/cmake`,
`pixtreme/transport/cmake` and `pixtreme/transport/sequence/cmake` directories,
respectively. C and C++ consumers can link the module through its imported
CMake target:

```cmake
find_package(pixtreme_transport_sequence CONFIG REQUIRED)
target_link_libraries(application PRIVATE pixtreme::transport_sequence)
```

C++ consumers use C++20. For creation by name, install the SDK trees under one
common prefix so the core can locate `pixtreme/transport/sequence/lib/` on Linux or
`pixtreme/transport/sequence/bin/` on Windows. Configure the platform's shared
library search paths for the dependencies and keep one copy of each shared
library per process.

Use `pixtreme_transport_module_create_entrance` and
`pixtreme_transport_module_create_exit` from `<pixtreme/transport/c/module.h>`
in C, or `pixtreme::transport::module::create_entrance` and `create_exit` from
`<pixtreme/transport/module.h>` in C++, passing the module name `sequence`.
Supply the device, caller-owned blocking buffer, output settings where needed,
and the same sequence options shown above. Check the core ABI before using
its operations, open each returned session to begin I/O, and close sessions
before releasing their owned handles.

## License and third-party notices

The sequence module is licensed under the
[MIT License](https://github.com/sync-dev-org/pixtreme-transport-sequence/blob/main/LICENSE).
The Python binding incorporates nanobind (BSD-3-Clause) and robin-map (MIT).
Their copyright notices and license texts are in `nanobind.txt` and
`robin_map.txt`; `third-party.json` records their versions, source checksums and
build descriptions. These files are included in the wheel's license directory;
the `License-File` fields in its metadata give the relative paths. The SDK
includes the module license and the provenance record in its license materials.
It supplies the native module without the Python binding or its embedded
third-party implementations.
The separately installed pixtreme and pixtreme-transport dependencies carry
their own licenses and notices.
