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

Implementation of streamer element. More...

#include "streamer.h"
#include "streamer_api.h"
#include "pipeline.h"
#include "streamer_element.h"
#include "audio_src.h"
#include "audio_sink.h"

Functions

uint8_t activate_pads_element (StreamElement *element, uint8_t activate)
 activate_pads_element
 
int32_t send_msg_element (StreamElement *element, uint32_t message, uintptr_t data)
 send_msg_element
 
int32_t create_element (ElementHandle *handle, StreamElementType type, int8_t key)
 create_element
 
int32_t destroy_element (ElementHandle handle)
 destroy_element
 
int32_t get_element_info (ElementHandle handle, StreamElementType *ptype, int8_t *pkey)
 get_element_info:
 
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 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
 

Variables

static const ElementInit element_list []
 

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

◆ 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

◆ 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

◆ 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

◆ 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

◆ 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

Variable Documentation

◆ element_list

const ElementInit element_list[]
static

Element List table This contains a list of all elements and their initialization functions. There should be an entry for each element of the 'StreamElementType' enum.