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

This file contains the definition of the pipeline object. More...

#include "streamer_api.h"
#include "streamer_element.h"

Data Structures

struct  Pipeline
 

Macros

#define PIPELINE_STATE_MASK   (0x3)
 Pipeline state mask.
 
#define MAX_ELEMENT_LEVEL   (10)
 
#define PIPELINE_STATE(pPipe)   ((pPipe)->state)
 Get pipeline state.
 
#define PIPELINE_LEVEL_HEAD(pPipe, level)   (&((pPipe)->level_head[level]))
 Get pipeline level head.
 
#define STATE_TRANSITION(cur, next)   (((cur) << 3) | (next))
 
#define STATE_TRANSITION_CURRENT(trans)   ((PipelineState)((trans) >> 3))
 
#define STATE_TRANSITION_NEXT(trans)   ((PipelineState)((trans)&0x7))
 

Enumerations

enum  PipelineStateChange {
  STATE_CHANGE_NULL_TO_READY = STATE_TRANSITION(STATE_NULL, STATE_READY) ,
  STATE_CHANGE_READY_TO_PAUSED = STATE_TRANSITION(STATE_READY, STATE_PAUSED) ,
  STATE_CHANGE_PAUSED_TO_PLAYING = STATE_TRANSITION(STATE_PAUSED, STATE_PLAYING) ,
  STATE_CHANGE_PLAYING_TO_PAUSED = STATE_TRANSITION(STATE_PLAYING, STATE_PAUSED) ,
  STATE_CHANGE_PAUSED_TO_READY = STATE_TRANSITION(STATE_PAUSED, STATE_READY) ,
  STATE_CHANGE_READY_TO_NULL = STATE_TRANSITION(STATE_READY, STATE_NULL)
}
 

Functions

int32_t process_pipeline (PipelineHandle handle)
 Process Pipeline.
 
int32_t create_pipeline (PipelineHandle *handle, unsigned int index, osa_msgq_handle_t *app_mq)
 create_pipeline
 
int32_t destroy_pipeline (PipelineHandle handle)
 destroy_pipeline
 
PipelineState get_state_pipeline (PipelineHandle handle)
 get_state_pipeline
 
int32_t set_state_pipeline (PipelineHandle handle, PipelineState state)
 set_state_pipeline
 
int32_t seek_pipeline (PipelineHandle handle, uint32_t time_msec)
 seek_pipeline
 
int32_t seek_relative (PipelineHandle handle, int32_t time_msec)
 seek_relative
 
int32_t query_info_pipeline (PipelineHandle handle, StreamInfoType info_type, StreamData *data)
 query_info_pipeline:
 
int32_t add_element_pipeline (PipelineHandle pipeline_handle, ElementHandle element_handle, int8_t level)
 add_element_pipeline
 
int32_t remove_element_pipeline (PipelineHandle pipeline_handle, ElementHandle element_handle)
 remove_element_pipeline
 
int32_t get_element_pipeline (PipelineHandle pipeline_handle, StreamElementType type, int8_t key, ElementHandle *handle)
 get_element_pipeline
 
int32_t send_msg_pipeline (Pipeline *pipeline, StreamMessage *msg)
 send_msg_pipeline
 
int32_t set_repeat_pipeline (PipelineHandle handle, bool repeat)
 Set pipeline repeat mode.
 
bool get_repeat_pipeline (PipelineHandle handle)
 Get pipeline repeat mode.
 
void clear_pipeline_trackinfo (PipelineHandle handle)
 Clears the pipeline track info cache.
 

Macro Definition Documentation

◆ MAX_ELEMENT_LEVEL

#define MAX_ELEMENT_LEVEL   (10)

MAX_ELEMENT_LEVEL Specifies the maximum # of elements that can be present in a single pipeline path.

◆ STATE_TRANSITION

#define STATE_TRANSITION ( cur,
next )   (((cur) << 3) | (next))

STATE_TRANSITION

Parameters
curA current state
nextA next state

Given a current state cur and a next state next, calculate the associated PipelineStateChange transition.

◆ STATE_TRANSITION_CURRENT

#define STATE_TRANSITION_CURRENT ( trans)    ((PipelineState)((trans) >> 3))

STATE_TRANSITION_CURRENT

Parameters
transA PipelineStateChange

Given a state transition trans, extract the current PipelineState.

◆ STATE_TRANSITION_NEXT

#define STATE_TRANSITION_NEXT ( trans)    ((PipelineState)((trans)&0x7))

STATE_TRANSITION_NEXT

Parameters
transA PipelineStateChange

Given a state transition trans, extract the next PipelineState.

Enumeration Type Documentation

◆ PipelineStateChange

PipelineStateChange The different state changes that are passed to the state change functions of elements.

Enumerator
STATE_CHANGE_NULL_TO_READY 

NULL to READY.

STATE_CHANGE_READY_TO_PAUSED 

READY to PAUSED.

STATE_CHANGE_PAUSED_TO_PLAYING 

PAUSED to PLAYING.

STATE_CHANGE_PLAYING_TO_PAUSED 

PLAYING to PAUSED.

STATE_CHANGE_PAUSED_TO_READY 

PAUSED to READY.

STATE_CHANGE_READY_TO_NULL 

READY to NULL.

Function Documentation

◆ process_pipeline()

int32_t process_pipeline ( PipelineHandle handle)

Iterate through the elements of a pipeline calling process handlers for non-blocked elements

Parameters
[in]handlePointer to pipeline
Returns
Error Status
Return values
STREAM_OKSuccess
STREAM_ERR_INVALID_ARGSInvalid Pipeline specified

◆ create_pipeline()

int32_t create_pipeline ( PipelineHandle * handle,
unsigned int index,
osa_msgq_handle_t * app_mq )

Create a pipeline object within the streamer task

Parameters
[in]handlePointer to pipeline
[in]indexIndex of pipeline within streamer task
[in]app_mqApplication message queue
Returns
Error Status
Return values
STREAM_OKSuccess
STREAM_ERR_INVALID_ARGSInvalid pipeline handle
STREAM_ERR_NO_MEMUnable to allocate memory

◆ destroy_pipeline()

int32_t destroy_pipeline ( PipelineHandle handle)

Sets the pipeline state to NULL and destroys the pipeline with all the elements added.

Parameters
[in]handlePointer to pipeline
Returns
Error Status
Return values
STREAM_OKSuccess
STREAM_ERR_INVALID_ARGSInvalid Pipeline object

◆ get_state_pipeline()

PipelineState get_state_pipeline ( PipelineHandle handle)

Get the current state of the pipeline

Parameters
[in]handlePointer to pipeline
Returns
Current Pipeline State
Return values
STATE_NULLPipeline is in NULL state
STATE_READYPipeline is in Ready state
STATE_PAUSEDPipeline is in Paused state
STATE_PLAYINGPipeline is in Playing state

◆ set_state_pipeline()

int32_t set_state_pipeline ( PipelineHandle handle,
PipelineState state )

Sets a new state of the pipeline if not already in the same state. This takes care of any intermediate states like changing state from NULL to PLAYING.

The order of the states is NULL, READY, PAUSED and then PLAYING. Element can switch from any state to another, but in steps of one.

Once a state change is requested, the pipeline elements are iterated from the sink elements to the source elements. This makes sure that when changing the state of an element, the downstream elements are in the correct state to process the eventual buffers. In the case of a downwards state change, e.g. PLAYING ->NULL, the sink elements will shut down first which makes the upstream elements shutdown as well since the _push() function returns a FLOW_WRONG_STATE error.

Parameters
handlePointer to pipeline
stateNew pipeline state
Returns
Error Status
Return values
STREAM_OKState retrieved successfully.
STREAM_ERR_INVALID_ARGSInvalid pipeline object

◆ seek_pipeline()

int32_t seek_pipeline ( PipelineHandle handle,
uint32_t time_msec )

Seeks the playback position to a specified absolute time in msec. This is valid only in playing and paused state. Pipeline returns to the last when seek is done.

Parameters
handlePipeline handle
time_msecSeek time specified in msec.
Returns
Error Status
Return values
STREAM_OKSeek successful
STREAM_ERR_INVALID_ARGSInvalid Pipeline object
STREAM_ERR_NOT_SEEKABLEPipeline does not support seeking

◆ seek_relative()

int32_t seek_relative ( PipelineHandle handle,
int32_t time_msec )

Seeks the playback position to a time specified relative to the current playback position. This is valid only in playing and paused state. Pipeline returns to the last when seek is done.

Parameters
handlePipeline handle
time_msecSeek time specified in msec.
Returns
Error Status
Return values
STREAM_OKSeek successful
STREAM_ERR_INVALID_ARGSInvalid Pipeline object
STREAM_ERR_INFO_ABSENTUnable to determine current position
STREAM_ERR_NOT_SEEKABLEPipeline does not support seeking

◆ query_info_pipeline()

int32_t query_info_pipeline ( PipelineHandle handle,
StreamInfoType info_type,
StreamData * data )

Function to return info of the current playing/paused stream.

Parameters
handlePipeline handle
info_typeInfo type queried
dataHolds return query value
Returns
Error Status
Return values
STREAM_OKQuery successful
STREAM_ERR_INFO_ABSENTQuery unsuccessful. Info not present
STREAM_ERR_INVALID_ARGSInvalid pipeline object

◆ add_element_pipeline()

int32_t add_element_pipeline ( PipelineHandle pipeline_handle,
ElementHandle element_handle,
int8_t level )

Function to add element in a already created pipeline. If not already added in the pipeline then it is added in the pipeline so that it can be linked with other elements in the pipeline.

Parameters
pipeline_handlePipeline handle
element_handleElement handle
levelLevel of the element
Returns
Error Status
Return values
STREAM_OKElement successfully added to pipeline
STREAM_ERR_INVALID_ARGSInvalid pipeline or element object

◆ remove_element_pipeline()

int32_t remove_element_pipeline ( PipelineHandle pipeline_handle,
ElementHandle element_handle )

Function to remove element in a already created pipeline. This element should not be linked with any other pipeline before calling this function.

Parameters
pipeline_handlePipeline handle
element_handleElement handle
Returns
Error Status
Return values
STREAM_OKElement removed from pipeline
STREAM_ERR_INVALID_ARGSInvalid pipeline or element object

◆ get_element_pipeline()

int32_t get_element_pipeline ( PipelineHandle pipeline_handle,
StreamElementType type,
int8_t key,
ElementHandle * handle )

Function to return tag of the current playing/paused stream.

Parameters
pipeline_handlePipeline handle
typeElement type
keyUnique key used in creating the element
handlePointer to the element handle
Returns
Error Status
Return values
STREAM_OKElement handle successfully retrieved
STREAM_ERR_INVALID_ARGSInvalid pipeline object or element not found

◆ send_msg_pipeline()

int32_t send_msg_pipeline ( Pipeline * pipeline,
StreamMessage * msg )

The function sends the message to the callback function associated with the pipeline.

Parameters
pipelinePipeline to send the message to
msgStreamMessage pointer
Returns
Error Status
Return values
STREAM_OKMessage successfully sent
STREAM_ERR_INVALID_ARGSInvalid pipeline or message object

◆ set_repeat_pipeline()

int32_t set_repeat_pipeline ( PipelineHandle handle,
bool repeat )

Set the repeat mode of a pipeline, if repeat mode is true, pipeline will play current stream repeatly when received a MSG_EOS event.

Parameters
handlePointer to a pipeline object
repeatrepeat true or false
Returns
none

◆ get_repeat_pipeline()

bool get_repeat_pipeline ( PipelineHandle handle)
Parameters
handlePointer to a pipeline object
Returns
repeat repeat true or false

◆ clear_pipeline_trackinfo()

void clear_pipeline_trackinfo ( PipelineHandle handle)

Clears all track info from the pipeline cache

Parameters
handlePointer to a pipeline object
Returns
none