|
Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
|
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. | |
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 void(* mpipe_app_sink_cb_t) (const struct net_buf *buf, void *user_data) |
#include <zephyr/mpipe/base/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.
| buf | The buffer that reached the sink |
| user_data | The pointer registered with the callback |
| anonymous enum |
#include <zephyr/mpipe/base/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. |
| int mpipe_app_sink_init | ( | struct mpipe_app_sink * | app_sink, |
| uint8_t | id ) |
#include <zephyr/mpipe/base/mpipe_app_sink.h>
Initialize an application sink element.
| app_sink | Pointer to the element to initialize. |
| id | Unique element identifier. |
| int mpipe_app_sink_pull | ( | struct mpipe_app_sink * | app_sink, |
| struct net_buf ** | buf, | ||
| k_timeout_t | timeout ) |
#include <zephyr/mpipe/base/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.
| app_sink | The application sink |
| buf | Filled with the pulled buffer |
| timeout | How long to wait for a buffer |
| 0 | Success |
| -EINVAL | Bad arguments |
| -EAGAIN | No buffer arrived within timeout |