|
Zephyr Project API 4.4.99
A Scalable Open Source RTOS
|
Elements that cut a formless byte stream into frames. More...
Files | |
| file | mpipe_parser.h |
| Stream parser base element. | |
Data Structures | |
| struct | mpipe_parser |
| Base parser element structure. More... | |
Functions | |
| int | mpipe_parser_init (struct mpipe_parser *parser, uint8_t id) |
| Initialize a parser element. | |
| int | mpipe_parser_change_state (struct mpipe_element *self, enum mpipe_state_change transition) |
| Change state function for the base parser element. | |
Elements that cut a formless byte stream into frames.
A parser sits where a stream stops being bytes and starts being frames. Its input is a file or a socket, which can say nothing about what it carries; its output is whole frames of a format the parser worked out by looking at them.
That asymmetry is why a parser is its own base rather than a transform. It cannot map its output back to an input capability, so it does not implement a capability crossing; it simply describes what it produces. And because the element upstream of it knows no format, the format event that arrives from there announces nothing at all - the parser is what turns it into a real announcement by substituting the capability it settled on before passing it downstream.
A parser also usually needs one buffer more than the stream in flight, to hold the frame it is still assembling.
| int mpipe_parser_change_state | ( | struct mpipe_element * | self, |
| enum mpipe_state_change | transition ) |
#include <mpipe_parser.h>
Change state function for the base parser element.
On the PAUSED to READY transition this resets the negotiated pad caps back to ANY so a subsequent re-negotiation starts fresh. Derived parsers that override change_state must chain to this base function to inherit that behavior.
| self | Pointer to the Elements |
| transition | Transition state, see mpipe_state_change |
| int mpipe_parser_init | ( | struct mpipe_parser * | parser, |
| uint8_t | id ) |
#include <mpipe_parser.h>
Initialize a parser element.
Initializes the base parser element structure, its sink and source pads and the default callbacks. A concrete parser calls it first from its own init, with the same id, and then overrides what it needs.
| parser | Pointer to the Parsers to initialize. |
| id | Unique element identifier. |