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

This file implement the memory source functions. More...

#include <string.h>
#include "streamer_element.h"
#include "mem_src.h"
#include "audio_sink.h"
#include "pipeline.h"
#include "streamer_element_properties.h"

Functions

static int32_t memsrc_src_pad_process (StreamPad *pad)
 Function is the loop function of the memsrc source pad which runs in the task thread. It reads the chunk_size of data from the memory and pushes it to peer element sink pad. When EOF memory is reached, the task goes to PAUSE state.
 
static int32_t memsrc_change_state (StreamElement *element, PipelineState state)
 Function handles the state change of the element in a pipeline.
 
static uint8_t memsrc_handle_src_event (StreamPad *pad, StreamEvent *event)
 Function handles the events of the element source pad.
 
static uint8_t memsrc_handle_src_query (StreamPad *pad, StreamQuery *query)
 Function Description: This function is the empty impl of the src pad query handler.
 
static uint8_t memsrc_src_activate_push (StreamPad *pad, uint8_t active)
 Function activates or deactivates the memsrc source pad in PUSH mode.
 
static uint8_t memsrc_src_activate_pull (StreamPad *pad, uint8_t active)
 Function activates or deactivates the memsrc source pad in PULL mode.
 
static uint8_t memsrc_src_activate (StreamPad *pad, uint8_t active)
 queue src pad activatation handler. Activation is handled by the peer sink pad, this should just handle the deactivation.
 
static FlowReturn memsrc_pull (StreamPad *pad, StreamBuffer *buffer, uint32_t size, uint32_t offset)
 Function is the pull function of the memsrc source pad in SCHEDULING_PULL mode. It reads the size of data from the offset to buffer.
 
static int32_t memsrc_get_property (StreamElement *element_ptr, uint16_t prop, uint32_t *val_ptr)
 This function get memory source element properties.
 
static int32_t memsrc_set_property (StreamElement *element_ptr, uint16_t prop, uintptr_t val)
 This function set memory source element properties.
 
int32_t memsrc_init (StreamElement *element)
 this function initializes the memory source element and source pad. all the pad's handlers are intialized.
 
int32_t memsrc_set_buffer (ElementHandle element, int8_t *location, uint32_t size)
 This function sets a destiniaiton buffer to be read by memory source element.
 
int32_t memsrc_set_push_chunk_size (ElementHandle element, uint32_t chunk_size)
 This function sets the chunk size in which the momery source sends the data in push mode.
 
int32_t memsrc_get_push_chunk_size (ElementHandle element, uint32_t *chunk_size)
 This function gets the chunk size.
 
static FlowReturn memsrc_read (ElementMemSrc *memsrc, int32_t offset, int32_t length, StreamBuffer *buf)
 Reads the data from the memory array specified by the element. NOTE: Function may or may not be able to read the required length of data. Returns FLOW_OK or FLOW_EOS when EOF file is encountered.
 

Function Documentation

◆ memsrc_src_pad_process()

int32_t memsrc_src_pad_process ( StreamPad * pad)
static

memsrc_src_pad_process:

Parameters
padElement pad

◆ memsrc_change_state()

static int32_t memsrc_change_state ( StreamElement * element,
PipelineState state )
static
Parameters
elementPointer to element
statechanged state.

◆ memsrc_handle_src_event()

static uint8_t memsrc_handle_src_event ( StreamPad * pad,
StreamEvent * event )
static
Parameters
padElement pad
eventtype of event

◆ memsrc_handle_src_query()

static uint8_t memsrc_handle_src_query ( StreamPad * pad,
StreamQuery * query )
static
Parameters
padpad handle
queryquery
Returns
uint8_t

◆ memsrc_src_activate_push()

static uint8_t memsrc_src_activate_push ( StreamPad * pad,
uint8_t active )
static
Parameters
padElement pad
activetrue if pad is to be activated else false to deactivate

◆ memsrc_src_activate_pull()

static uint8_t memsrc_src_activate_pull ( StreamPad * pad,
uint8_t active )
static
Parameters
padElement pad
activetrue if pad is to be activated else false to deactivate

◆ memsrc_src_activate()

static uint8_t memsrc_src_activate ( StreamPad * pad,
uint8_t active )
static
Parameters
padQueue element src pad
activeTo activate or deactivate pad.

◆ memsrc_pull()

static FlowReturn memsrc_pull ( StreamPad * pad,
StreamBuffer * buffer,
uint32_t size,
uint32_t offset )
static
Parameters
padElement pad
bufferPointer of the buffer to read data
sizeNumber of bytes to read
offsetOffset to the file

◆ memsrc_get_property()

static int32_t memsrc_get_property ( StreamElement * element_ptr,
uint16_t prop,
uint32_t * val_ptr )
static
Parameters
element_ptrelement pointer
propproperties
val_ptrparameters
Returns
StreamErrorType

◆ memsrc_set_property()

static int32_t memsrc_set_property ( StreamElement * element_ptr,
uint16_t prop,
uintptr_t val )
static
Parameters
element_ptrelement pointer
propproperties
valparameters
Returns
StreamErrorType

◆ memsrc_init()

int32_t memsrc_init ( StreamElement * element)
Parameters
elementpointer to element
Returns
StreamReturnType
Return values
STREAM_OKif successful
STREAM_ERR_INVALID_ARGSmeans invalid arguments

◆ memsrc_set_buffer()

int32_t memsrc_set_buffer ( ElementHandle element,
int8_t * location,
uint32_t size )
Parameters
elementelement handle
locationmemory location
sizememory size
Returns
StreamReturnType
Return values
STREAM_OKif successful
STREAM_ERR_INVALID_ARGSmeans invalid arguments

◆ memsrc_set_push_chunk_size()

int32_t memsrc_set_push_chunk_size ( ElementHandle element,
uint32_t chunk_size )
Parameters
elementelement handle
chunk_sizechunk size
Returns
StreamReturnType
Return values
STREAM_OKif successful
STREAM_ERR_INVALID_ARGSmeans invalid arguments

◆ memsrc_get_push_chunk_size()

int32_t memsrc_get_push_chunk_size ( ElementHandle element,
uint32_t * chunk_size )
Parameters
elementelement handle
chunk_sizechunk size
Returns
StreamReturnType
Return values
STREAM_OKif successful
STREAM_ERR_INVALID_ARGSmeans invalid arguments

◆ memsrc_read()

static FlowReturn memsrc_read ( ElementMemSrc * memsrc,
int32_t offset,
int32_t length,
StreamBuffer * buf )
static
Parameters
memsrcPointer to memsrc element
offsetOffset of the file to read data from
lengthNumber of bytes to read
bufPointer to buffer to read data