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

The top-level bin, and what actually runs a graph. More...

Files

file  mpipe_pipeline.h
 Pipeline: the top-level bin that runs a graph.

Data Structures

struct  mpipe
 A pipeline: the top-level bin that runs a graph. More...

Enumerations

enum  mpipe_prop_pipeline { MPIPE_PROP_PIPELINE_THREAD_PRIORITY }
 Properties for a pipeline. More...

Functions

int mpipe_pipeline_init (struct mpipe *pipe, uint8_t id)
 Initialize a pipeline.
int mpipe_push_buffer (struct mpipe_pad *src_pad, struct net_buf *buffer)
 Push a buffer downstream starting from a given source pad.

Detailed Description

The top-level bin, and what actually runs a graph.

A pipeline is the outermost Bins. Being the outermost is what gives it three jobs no inner bin has.

It owns the thread. One thread sits at the head of the graph acquiring buffers from the source and pushing each one downstream through the chain functions until a sink consumes it. An element that needs its own thread - to decouple two halves of a graph - gets one by putting a queue between them.

It orders the teardown. Going down from PAUSED to READY, the pipeline raises a flushing gate on every pad before the children dismantle their pools, so a buffer still in flight is dropped rather than pushed into an element that has already been torn down; and it joins the thread only after the children have drained, because a child still holding the thread in a full queue would otherwise deadlock the join. Going from PLAYING to PAUSED it does neither - a pause is not a teardown, so whatever is queued survives and a resume continues without loss.

It folds the end of the stream. A graph with several sinks produces one end-of-stream message per sink; the pipeline counts them and passes on only the last, so the application is told once and never tears a graph down while a branch is still running.

Enumeration Type Documentation

◆ mpipe_prop_pipeline

#include <mpipe_pipeline.h>

Properties for a pipeline.

Enumeration of properties that can be configured for a pipeline

Enumerator
MPIPE_PROP_PIPELINE_THREAD_PRIORITY 

Thread scheduling priority used when the pipeline thread is created.

Defaults to CONFIG_MPIPE_THREAD_DEFAULT_PRIORITY.

Function Documentation

◆ mpipe_pipeline_init()

int mpipe_pipeline_init ( struct mpipe * pipe,
uint8_t id )

#include <mpipe_pipeline.h>

Initialize a pipeline.

Initializes the pipeline structure, including the base bin and its message channel.

Parameters
pipePointer to the Multimedia Pipeline to initialize.
idUnique element identifier.
Returns
0 on success, negative errno otherwise.

◆ mpipe_push_buffer()

int mpipe_push_buffer ( struct mpipe_pad * src_pad,
struct net_buf * buffer )

#include <mpipe_pipeline.h>

Push a buffer downstream starting from a given source pad.

Walks downstream from an element's src_pad, calling each next element's chain_fn until a sink is reached, a chain_fn fails, or the output buffer is NULL.

The chain function owns the buffer it is given and releases it whether it succeeds or fails, so the walk does not release it on a chain error. The walk does release the buffer itself in the two cases where no chain function is reached: the source pad has no peer, and the peer pad is flushing.

Parameters
src_padSource pad to start pushing from (its peer's chain_fn is first called)
bufferBuffer to push (ownership transferred)
Returns
0 on success, negative errno on failure