|
Zephyr Project API 4.4.99
A Scalable Open Source RTOS
|
Element injecting application data into a pipeline. More...
Files | |
| file | mpipe_app_src.h |
| Application source element. | |
Data Structures | |
| struct | mpipe_app_src |
| Application source element structure. More... | |
Enumerations | |
| enum | { MPIPE_PROP_BASE_APP_SRC_CAPS = MPIPE_PROP_SRC_LAST } |
| Application source property identifiers. More... | |
Functions | |
| int | mpipe_app_src_init (struct mpipe_app_src *app_src, uint8_t id) |
| Initialize an application source element. | |
| int | mpipe_app_src_alloc (struct mpipe_app_src *app_src, uint32_t size, k_timeout_t timeout, struct net_buf **buf) |
| Take a buffer of the element's pool to fill in place. | |
| int | mpipe_app_src_push_buf (struct mpipe_app_src *app_src, struct net_buf *buf, uint32_t size, k_timeout_t timeout) |
| Queue a filled buffer into the pipeline. | |
| int | mpipe_app_src_push (struct mpipe_app_src *app_src, const void *data, uint32_t size, k_timeout_t timeout) |
| Push one payload into the pipeline, by copy. | |
| int | mpipe_app_src_eos (struct mpipe_app_src *app_src, k_timeout_t timeout) |
| Declare end of stream. | |
Element injecting application data into a pipeline.
The application boundary on the producing side. Payloads either travel by copy, with mpipe_app_src_push, or in place: mpipe_app_src_alloc hands out a buffer of the element's pool for the application to fill, and mpipe_app_src_push_buf queues it.
Push once the pipeline is at least PAUSED: whatever was queued while READY is discarded when the pipeline starts. End of stream is declared with mpipe_app_src_eos; alternatively MPIPE_PROP_SRC_NUM_BUFS ends the stream after a number of buffers.
| anonymous enum |
#include <mpipe_app_src.h>
Application source property identifiers.
| Enumerator | |
|---|---|
| MPIPE_PROP_BASE_APP_SRC_CAPS | Capability of the produced stream, a const struct mpipe_structure pointer, copied. It is what negotiation offers downstream; what the application pushes must match it, the element cannot check. Until it is set the element offers a capability constraining nothing. |
| int mpipe_app_src_alloc | ( | struct mpipe_app_src * | app_src, |
| uint32_t | size, | ||
| k_timeout_t | timeout, | ||
| struct net_buf ** | buf ) |
#include <mpipe_app_src.h>
Take a buffer of the element's pool to fill in place.
The buffer holds up to CONFIG_MPIPE_BASE_APP_SRC_BUF_SZ bytes. The application writes its payload into the buffer data and hands the buffer to mpipe_app_src_push_buf, or releases it with net_buf_unref() if it changes its mind.
| app_src | The application source |
| size | Number of payload bytes the buffer must hold |
| timeout | How long to wait for a free buffer |
| buf | Filled with the buffer |
| 0 | Success |
| -EINVAL | Bad arguments, or size above the buffer size |
| -ENOBUFS | No buffer became free within timeout |
| int mpipe_app_src_eos | ( | struct mpipe_app_src * | app_src, |
| k_timeout_t | timeout ) |
#include <mpipe_app_src.h>
Declare end of stream.
Buffers pushed before this call are still delivered; the pipeline then receives EOS.
| app_src | The application source |
| timeout | How long to wait for a queue slot |
| 0 | Success |
| -EINVAL | app_src is NULL |
| -EAGAIN | The queue stayed full within timeout |
| int mpipe_app_src_init | ( | struct mpipe_app_src * | app_src, |
| uint8_t | id ) |
#include <mpipe_app_src.h>
Initialize an application source element.
| app_src | Pointer to the element to initialize. |
| id | Unique element identifier. |
| int mpipe_app_src_push | ( | struct mpipe_app_src * | app_src, |
| const void * | data, | ||
| uint32_t | size, | ||
| k_timeout_t | timeout ) |
#include <mpipe_app_src.h>
Push one payload into the pipeline, by copy.
Takes a buffer, copies size bytes into it and queues it: the two waits may each last up to timeout.
| app_src | The application source |
| data | Payload bytes |
| size | Number of bytes, bounded by CONFIG_MPIPE_BASE_APP_SRC_BUF_SZ |
| timeout | How long to wait for a free buffer, and for a queue slot |
| 0 | Success |
| -EINVAL | Bad arguments |
| -ENOBUFS | No buffer became free within timeout |
| -EAGAIN | The queue stayed full within timeout |
| int mpipe_app_src_push_buf | ( | struct mpipe_app_src * | app_src, |
| struct net_buf * | buf, | ||
| uint32_t | size, | ||
| k_timeout_t | timeout ) |
#include <mpipe_app_src.h>
Queue a filled buffer into the pipeline.
The buffer comes from mpipe_app_src_alloc. On success the pipeline owns it; on failure it stays the caller's, to retry or release.
| app_src | The application source |
| buf | The buffer to queue |
| size | Number of valid payload bytes in the buffer |
| timeout | How long to wait for a queue slot |
| 0 | Success |
| -EINVAL | Bad arguments, or size above what the buffer holds |
| -EAGAIN | The queue stayed full within timeout |