Maestro Audio Framework v 1.7
NXP Semiconductors
Loading...
Searching...
No Matches
streamer_element.h File Reference

Header for Streamer Element. More...

#include "streamer_api.h"
#include "pad.h"

Data Structures

struct  StreamElement
 Stream Element. More...
 
struct  ElementInit
 

Macros

#define ELEMENT_PARENT_PIPELINE(pstelem)   ((Pipeline *)((pstelem)->parent))
 Get element parent pipeline.
 
#define ELEMENT_PARENT(pstelem)   ((pstelem)->parent)
 Get element parent (void)
 
#define ELEMENT_KEY(pstelem)   ((pstelem)->key)
 Get element key.
 
#define ELEMENT_DEPTH(pstelem)   ((pstelem)->depth)
 Get element depth.
 
#define ELEMENT_TYPE(pstelem)   ((pstelem)->type)
 Get element type.
 
#define ELEMENT_STATE(pstelem)   ((pstelem)->state)
 Get element state.
 
#define ELEMENT_SIBLING(pstelem)   ((pstelem)->sibling)
 Get element sibling.
 
#define ELEMENT_SRC_PAD(pstelem, i)   ((StreamPad *)&(pstelem)->src_pad[i])
 Get element source pad.
 
#define ELEMENT_SINK_PAD(pstelem, i)   ((StreamPad *)&(pstelem)->sink_pad[i])
 Get element sink pad.
 
#define MAX_NUM_PADS   (3)
 Maximum number of pads.
 
#define MAX_LOCATION_PATH_LENGTH   (255)
 Maximum location path length.
 
#define MAX_DEVICE_NAME_LENGTH   (32)
 Maximum device name length.
 
#define AUDIO_SET_FORMAT(a, b, c, d)   (((d << 4) & 0xFF0) | ((c << 2) & 0x4) | ((b << 1) & 0x2) | ((a << 0) & 0x1))
 

Functions

uint8_t activate_pads_element (StreamElement *element, uint8_t activate)
 activate_pads_element
 
int32_t create_element (ElementHandle *handle, StreamElementType type, int8_t key)
 create_element
 
int32_t destroy_element (ElementHandle handle)
 destroy_element
 
int32_t link_elements (ElementHandle src_handle, int8_t src_pad_index, ElementHandle sink_handle, int8_t sink_pad_index)
 link_elements
 
int32_t unlink_elements (ElementHandle src_handle, int8_t src_pad_index, ElementHandle sink_handle, int8_t sink_pad_index)
 unlink_elements
 
int32_t get_element_info (ElementHandle handle, StreamElementType *ptype, int8_t *pkey)
 get_element_info:
 
int32_t send_msg_element (StreamElement *element, uint32_t msg, uintptr_t data)
 send_msg_element
 
int32_t element_get_property (ElementHandle element_hdl, uint16_t prop, uint64_t *val_ptr)
 This function gets property value of element.
 
int32_t element_set_property (ElementHandle element_hdl, uint16_t prop, uintptr_t val)
 this function sets property value of element
 

Macro Definition Documentation

◆ AUDIO_SET_FORMAT

#define AUDIO_SET_FORMAT ( a,
b,
c,
d )   (((d << 4) & 0xFF0) | ((c << 2) & 0x4) | ((b << 1) & 0x2) | ((a << 0) & 0x1))

AUDIO_SET_FORMAT: Set output format a- interleaved b- endianness c- signed d- word length

Function Documentation

◆ activate_pads_element()

uint8_t activate_pads_element ( StreamElement * element,
uint8_t activate )

This function iterates through all the pads of the elements, first src pads and then sink, and calls the activate pad function.

Parameters
elementPointer to element handle
activateActivate or Deactivate the pads?
Returns
bool

◆ create_element()

int32_t create_element ( ElementHandle * handle,
StreamElementType type,
int8_t key )

Creates a new element of the required type. A byte key which should be unique within the same type of element.

Parameters
handlePointer to element handle
typeElement type
keyUnique key within the same type of elements to retrieve the handle from the pipeline later.
Returns
Error Status
Return values
STREAM_OKElement created successfully
STREAM_ERR_NO_MEMError allocating memory
STREAM_ERR_ELEMENT_NOT_FOUNDElement type not found

◆ destroy_element()

int32_t destroy_element ( ElementHandle handle)

Function to destroy element. Make sure that this element is not linked to any other element and not a part of pipeline.

Parameters
handleElement handle
Returns
Error Status
Return values
STREAM_OKElement successfully destroyed
STREAM_ERR_ELEMENT_NOT_FREEElement still associated with a pipeline
STREAM_ERR_INVALID_ARGSInvalid element object

◆ link_elements()

int32_t link_elements ( ElementHandle src_handle,
int8_t src_pad_index,
ElementHandle sink_handle,
int8_t sink_pad_index )

Link elements from the source pad to sink pad.

Parameters
src_handleElement with the source pad.
src_pad_indexIndex of the source pad of element.
sink_handleElement with the sink pad.
sink_pad_indexIndex of the sink pad of element.
Returns
Error Status
Return values
STREAM_OKElements linked successfully
STREAM_ERR_INVALID_ARGSInvalid argument
STREAM_ERR_ELEMENT_LINKEDElement already linked

◆ unlink_elements()

int32_t unlink_elements ( ElementHandle src_handle,
int8_t src_pad_index,
ElementHandle sink_handle,
int8_t sink_pad_index )

Unlink elements from the source pad to sink pad.

Parameters
src_handleElement with the source pad.
src_pad_indexIndex of the source pad of element.
sink_handleElement with the sink pad.
sink_pad_indexIndex of the sink pad of element.
Returns
Error Status
Return values
STREAM_OKElements unlinked successfully
STREAM_ERR_ELEMENT_PADS_NOT_LINKEDElements not linked
STREAM_ERR_INVALID_ARGSInvalid arguments

◆ get_element_info()

int32_t get_element_info ( ElementHandle handle,
StreamElementType * ptype,
int8_t * pkey )

Function to return the element info.

Parameters
handleElement handle
ptypeElementType pointer to return the element type
pkeyint8_t pointer to return the uinque element key
Returns
Error Status
Return values
STREAM_OKElement info successfully retrieved
STREAM_ERR_INVALID_ARGSInvalid argument provided

◆ send_msg_element()

int32_t send_msg_element ( StreamElement * element,
uint32_t msg,
uintptr_t data )

The function creates and sends a message to the parent pipeline

Parameters
elementElement from which the message is sent from
msgStreamMessage type
dataData associated with the message
Returns
Error Status
Return values
STREAM_OKMessage sent successfully
STREAM_ERR_INVALID_ARGSInvalid element/pipeline object

◆ element_get_property()

int32_t element_get_property ( ElementHandle element_hdl,
uint16_t prop,
uint64_t * val_ptr )
Parameters
element_hdlelement handle
propproperty id
val_ptrpointer to the address of value
Returns
int32_t error codes

◆ element_set_property()

int32_t element_set_property ( ElementHandle element_hdl,
uint16_t prop,
uintptr_t val )
Parameters
element_hdlelement handle
propproperty id
valvalue to be set
Returns
int32_t error codes