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

Bin structure. More...

#include <mpipe_bin.h>

Data Fields

struct mpipe_element element
 Base element structure.
int children_num
 Number of children in the bin.
sys_dlist_t children
 List of children elements in the bin.
struct zbus_runtime_channel bus
 The bin's message bus.

Detailed Description

Bin structure.

A container element that can hold multiple child elements.

A bin manages the state changes of its children and handles the topology of the pipeline elements within it.

Field Documentation

◆ bus

struct zbus_runtime_channel mpipe_bin::bus

The bin's message bus.

A one-way, out-of-band notification channel that carries Messages events (end-of-stream, errors) from the elements up to the application. It is "out-of-band" because it does not travel along the data path (pads/buffers); it is a side channel for control and status notifications only.

Bus is a single zbus channel, owned by the bin and shared by all of its children. mpipe_bin_init initializes it; it needs no teardown, as it lives entirely inside the bin and is registered nowhere else.

A channel involves three roles:

  • Producers: elements post messages with mpipe_message_post, which locates the bus from the message's origin element. The message is copied by value into the channel, so stack storage is fine. The application must not post to a bus that it consumes.
  • Consumers: a channel can have one or more observers. Reach the channel with mpipe_element_get_bus_chan and attach with zbus_chan_add_obs(); three kinds are useful here:
    • Listener: the callback runs inline in the posting thread, holding the channel lock. Cheapest by far - no queue, no buffer - but it must not block or change pipeline state. Define it with ZBUS_LISTENER_DEFINE().
    • Message subscriber (needs CONFIG_ZBUS_MSG_SUBSCRIBER): the application reads messages from its own thread, blocking until one arrives, and no message is lost. Costs a net_buf per publish, taken from a pool shared with every other zbus channel in the system. Define it with ZBUS_MSG_SUBSCRIBER_DEFINE() and read with zbus_sub_wait_msg().
    • Async listener (needs CONFIG_ZBUS_ASYNC_LISTENER, which pulls in the message subscriber machinery): the callback runs later on the system work queue. Define it with ZBUS_ASYNC_LISTENER_DEFINE(). Detach any observer with zbus_chan_rm_obs() before the bin goes away.
  • Validator: an optional zbus validator, installed by mpipe_bin_set_bus_validator, runs in the posting thread before the message is published, and may drop messages (e.g. collapsing N end-of-stream events into one). Keep it short and non-blocking.

◆ children

sys_dlist_t mpipe_bin::children

List of children elements in the bin.

◆ children_num

int mpipe_bin::children_num

Number of children in the bin.

◆ element

struct mpipe_element mpipe_bin::element

Base element structure.


The documentation for this struct was generated from the following file: