Zephyr Project API 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches

Elements with an input and an output, and the middle of a negotiation. More...

Files

file  mpipe_transform.h
 Transform: an element that turns input buffers into output buffers.
file  mpipe_transform_client.h
 Transform client: a transform whose work runs on another core.

Data Structures

struct  mpipe_transform
 Transform element structure. More...
struct  mpipe_transform_client
 Transform client element structure. More...

Enumerations

enum  mpipe_prop_transform { MPIPE_PROP_TRANSFORM_LAST }
 Properties for a transform element. More...
enum  mpipe_transform_mode { MPIPE_MODE_PASSTHROUGH = 0 , MPIPE_MODE_INPLACE = 1 , MPIPE_MODE_NORMAL = 2 }
 Operating modes of a transform element. More...

Functions

int mpipe_transform_init (struct mpipe_transform *transform, uint8_t id)
 Initialize a transform element.
int mpipe_transform_set_caps (struct mpipe_transform *transform, enum mpipe_pad_direction direction, const struct mpipe_structure *caps)
 Set capabilities on a transform element's pad.
int mpipe_transform_change_state (struct mpipe_element *self, enum mpipe_state_change transition)
 Change state function for the base transform element.
int mpipe_transform_client_init (struct mpipe_transform_client *transform_client, uint8_t id)
 Initialize a transform client element.

Detailed Description

Elements with an input and an output, and the middle of a negotiation.

A transform has one sink pad and one source pad: a buffer arrives on one side and something leaves on the other. What "something" means is the element's choice, and mpipe_transform_mode names the three shapes - produce a new buffer from an output pool, rewrite the incoming buffer where it lies, or pass it through untouched.

A transform is the interesting case in both negotiations, because it is the only base that has to reconcile two sides.

Crossing a capability

transform_caps is what maps a capability on one side to what the other side could then be. A decoder taking one compressed format may be able to emit several raw ones, so this is a one-to-many relation - and, since nothing may allocate, those alternatives live on an index rather than in a returned set: one transformation per index, walked until the element reports there are no more.

Answering a capability query therefore nests two walks: for each capability this side supports, for each transformation of it, ask the peer on the other side. The first combination the peer accepts wins, and the peer's answer is kept on the far pad because the event pass needs it to narrow back down.

When the format event later arrives, the transform crosses it the same way and forwards it before applying it to its own pads. The order matters: an element is allowed to rewire the graph from its set_caps, so applying first would change the path the event still has to travel.

Buffer pools

On a buffer pool query a transform forwards downstream first and decides afterwards, so it always sees its downstream's proposal before choosing; then it answers upstream with a proposal of its own. See propose_buffer_pool and decide_buffer_pool below for what each side of that owes.

Enumeration Type Documentation

◆ mpipe_prop_transform

#include <mpipe_transform.h>

Properties for a transform element.

Enumeration of properties that can be configured for base transform

Enumerator
MPIPE_PROP_TRANSFORM_LAST 

Last transform property marker (for validation/iteration).

◆ mpipe_transform_mode

#include <mpipe_transform.h>

Operating modes of a transform element.

The mode specifies how input and output buffers are handled.

Enumerator
MPIPE_MODE_PASSTHROUGH 

The buffer is kept intact.

MPIPE_MODE_INPLACE 

The input buffer is directly modified.

Input and output buffers are the same.

MPIPE_MODE_NORMAL 

The output buffer is allocated and differs from the input buffer.

Function Documentation

◆ mpipe_transform_change_state()

int mpipe_transform_change_state ( struct mpipe_element * self,
enum mpipe_state_change transition )

#include <mpipe_transform.h>

Change state function for the base transform element.

On the PAUSED to READY transition this resets the negotiated pad caps back to ANY so a subsequent re-negotiation starts fresh. Derived transforms that override change_state must chain to this base function to inherit that behavior.

Parameters
selfPointer to the Elements
transitionTransition state, see mpipe_state_change
Returns
0 on success, negative errno otherwise

◆ mpipe_transform_client_init()

int mpipe_transform_client_init ( struct mpipe_transform_client * transform_client,
uint8_t id )

#include <mpipe_transform_client.h>

Initialize a transform client element.

Initializes the base transform element and installs the chain function that forwards a buffer over the transport instead of processing it locally.

init_rpc must already be set when this is called: it runs before the base element is initialized, so a transport that cannot come up is reported through the return value and nothing is left half-built.

Parameters
transform_clientPointer to the mpipe_transform_client to initialize.
idUnique element identifier.
Returns
0 on success, negative errno otherwise.

◆ mpipe_transform_init()

int mpipe_transform_init ( struct mpipe_transform * transform,
uint8_t id )

#include <mpipe_transform.h>

Initialize a transform element.

This function initializes the base transform element structure, sets up sink and source pads, and configures default function pointers for element operations. A concrete transform calls it first from its own init, with the same id, and then overrides what it needs.

Parameters
transformPointer to the Transforms to initialize.
idUnique element identifier.
Returns
0 on success, negative errno otherwise.

◆ mpipe_transform_set_caps()

int mpipe_transform_set_caps ( struct mpipe_transform * transform,
enum mpipe_pad_direction direction,
const struct mpipe_structure * caps )

#include <mpipe_transform.h>

Set capabilities on a transform element's pad.

Parameters
transformPointer to the transform element.
directionDirection of the pad to set caps on (mpipe_pad_direction).
capsPointer to the capabilities to set.
Returns
0 on success, negative errno on failure