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

Element handing pipeline buffers to the application. More...

Files

file  mpipe_app_sink.h
 Application sink element.

Data Structures

struct  mpipe_app_sink_cb
 Callback registration for MPIPE_PROP_BASE_APP_SINK_CB. More...
struct  mpipe_app_sink
 Application sink element structure. More...

Typedefs

typedef void(* mpipe_app_sink_cb_t) (const struct net_buf *buf, void *user_data)
 Buffer callback.

Enumerations

enum  { MPIPE_PROP_BASE_APP_SINK_CAPS = MPIPE_PROP_SINK_LAST , MPIPE_PROP_BASE_APP_SINK_CB }
 Application sink property identifiers. More...

Functions

int mpipe_app_sink_init (struct mpipe_app_sink *app_sink, uint8_t id)
 Initialize an application sink element.
int mpipe_app_sink_pull (struct mpipe_app_sink *app_sink, struct net_buf **buf, k_timeout_t timeout)
 Pull the next buffer.

Detailed Description

Element handing pipeline buffers to the application.

The application boundary on the consuming side. Each buffer reaching the sink is delivered once, fragment by fragment: to the callback when one is registered, otherwise to a queue the application drains with mpipe_app_sink_pull. End of stream is reported on the pipeline bus, as for every sink.

Typedef Documentation

◆ mpipe_app_sink_cb_t

typedef void(* mpipe_app_sink_cb_t) (const struct net_buf *buf, void *user_data)

#include <mpipe_app_sink.h>

Buffer callback.

Runs in the thread driving the sink: keep it short and copy out what is needed. The buffer belongs to the element and is released on return.

Parameters
bufThe buffer that reached the sink
user_dataThe pointer registered with the callback

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

#include <mpipe_app_sink.h>

Application sink property identifiers.

Enumerator
MPIPE_PROP_BASE_APP_SINK_CAPS 

Capability this sink accepts, a const struct mpipe_structure pointer, copied.

Until it is set the sink accepts anything.

MPIPE_PROP_BASE_APP_SINK_CB 

Buffer callback, a const struct mpipe_app_sink_cb pointer, copied.

With a callback set, buffers are not queued for pulling.

Function Documentation

◆ mpipe_app_sink_init()

int mpipe_app_sink_init ( struct mpipe_app_sink * app_sink,
uint8_t id )

#include <mpipe_app_sink.h>

Initialize an application sink element.

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

◆ mpipe_app_sink_pull()

int mpipe_app_sink_pull ( struct mpipe_app_sink * app_sink,
struct net_buf ** buf,
k_timeout_t timeout )

#include <mpipe_app_sink.h>

Pull the next buffer.

Only meaningful when no callback is set. The caller owns the returned buffer and must release it with net_buf_unref(). A buffer arriving while the queue is full is dropped, so a slow puller loses data rather than stalling the pipeline.

Parameters
app_sinkThe application sink
bufFilled with the pulled buffer
timeoutHow long to wait for a buffer
Return values
0Success
-EINVALBad arguments
-EAGAINNo buffer arrived within timeout