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

This file includes defines, enums and typedefs for decoder elements. More...

#include "streamer_element.h"

Data Structures

struct  DecoderHandlersType
 
struct  ElementDecoder
 

Macros

#define DECODER_INTERLEAVED   false
 Decoder interleaved.
 
#define DECODER_NONINTERLEAVED   true
 Decoder noninterleaved.
 
#define DECODER_SIGNED   true
 Decoder signed.
 
#define DECODER_UNSIGNED   false
 Decoder unsigned.
 

Enumerations

enum  DecoderOutputWordLength {
  DECODER_OUTPUT_WORD_LENGTH_8 = 8 ,
  DECODER_OUTPUT_WORD_LENGTH_16 = 16 ,
  DECODER_OUTPUT_WORD_LENGTH_24 = 24 ,
  DECODER_OUTPUT_WORD_LENGTH_32 = 32 ,
  LAST_DECODER_OUTPUT_WORD_LENGTH
}
 

Functions

int32_t decoder_init_element (StreamElement *element)
 This function initializes the decoder element, and loads the pad source and sink functions.
 
int32_t decoder_change_state (StreamElement *element, PipelineState new_dec_state)
 This function changes the decoder state by calling STATE_TRANSITION pipeline macro. If the new state is NULL_TO_READY, it verifies the decoder type is known and handler is setup.
 
uint32_t decoder_get_duration (ElementDecoder *element, StreamDataFormat data)
 Returns the duration of a source PadQueryFunc is called to return the element duration in the format defined by the StreamDataFormat parameter.
 
void decoder_set_duration (ElementDecoder *element, uint32_t stream_size, uint32_t bit_rate)
 Calculate and set the duration of a source This function calculates the duration in bytes using the stream size and stream bitrate, and sets it in bytes in the ElementDecoder variable.
 
int32_t decoder_set_property (StreamElement *element, uint16_t prop_id, uint32_t prop_value)
 Set a property of a decoder element.
 
int32_t decoder_get_property (StreamElement *element, uint16_t prop_id, uint32_t *prop_value)
 Get a property of a decoder element.
 
int32_t decoder_set_type (ElementHandle element, DecoderType dec_type)
 Set the decoder type for the input element. This function maps the generic decoder element pad handlers to the specific decoder implementation using DecoderHandlersType.
 
int32_t decoder_activate_parse_tag (ElementHandle element, uint8_t activate)
 Enable/Disable the tag parsing Sets the parse_tag variable to the value passed in via activate variable.
 
bool decoder_is_source_seekable (ElementDecoder *decoder, StreamDataFormat format)
 Is current source seekable.
 
void vUpdateAverageBitrate (ElementDecoder *element)
 Update a running average of bit rate.
 

Macro Definition Documentation

◆ DECODER_INTERLEAVED

#define DECODER_INTERLEAVED   false

Buffer sizes for supported decoders

Enumeration Type Documentation

◆ DecoderOutputWordLength

The decoder output word length

Function Documentation

◆ decoder_init_element()

int32_t decoder_init_element ( StreamElement * element)

The following Pad Functions are used in this implementation: SRC FUNCTIONS pad->event_handler = decoder_src_pad_event_handler() pad->query_handler = decoder_src_pad_query_handler() pad->activation_handler = NULL pad->activate_pull = pad->activate_push = decoder_src_pad_activation_handler() pad->process_handler = NULL pad->process_precheck = NULL pad->pull_handler = NULL SINK FUNCTIONS pad->event_handler = decoder_sink_pad_event_handler() pad->query_handler = NULL pad->activation_handler = decoder_sink_pad_activation_handler() pad->activate_pull = ??? pad->activate_push = ??? pad->process_handler = decoder_sink_pad_process_handler() pad->process_precheck = NULL pad->chain_handler = decoder_sink_pad_chain_handler() This function is loaded in the ElementInit element_list[] table and called during create_element()

Parameters
elementStreamElement pointer will be used to create ElementDecoder
Return values
STREAM_OKif successful
STREAM_ERR_INVALID_ARGSmeans invalid arguments

◆ decoder_change_state()

int32_t decoder_change_state ( StreamElement * element,
PipelineState new_dec_state )
Parameters
elementStreamElement will be used to create ElementDecoder
new_dec_statenew decoder state to change to
Return values
STREAM_ERR_INVALID_ARGSinvalid parameters
STREAM_ERR_GENERALif moved to ready state and decoders not setup
STREAM_OKsuccessful

◆ decoder_get_duration()

uint32_t decoder_get_duration ( ElementDecoder * element,
StreamDataFormat data )
Parameters
elementElementDecoder pointer will be used to create StreamPad sink
dataStreamDataFormat defines the format of the data to return.
Returns
duration or 0 if failed

◆ decoder_set_duration()

void decoder_set_duration ( ElementDecoder * element,
uint32_t stream_size,
uint32_t bit_rate )
Parameters
elementElementDecoder pointer will hold the calculated duration value
stream_sizeSize of the stream
bit_rateBit rate of the stream
Returns
None

◆ decoder_set_property()

int32_t decoder_set_property ( StreamElement * element,
uint16_t prop_id,
uint32_t prop_value )

This is a new interface to replace the original decoder_set_type().

Parameters
elementStreamElement pointer
prop_idid number of a element's property
prop_valuethe property value to be set
Returns
StreamReturnType
Return values
STREAM_OKif successful
STREAM_ERR_INVALID_ARGSmeans invalid arguments

◆ decoder_get_property()

int32_t decoder_get_property ( StreamElement * element,
uint16_t prop_id,
uint32_t * prop_value )
Parameters
elementStreamElement pointer that will be used as ElementHandle
prop_idid number of a element's property
prop_valuethe property value to be saved in
Return values
STREAM_OKif successful
STREAM_ERR_INVALID_ARGSmeans invalid arguments

◆ decoder_set_type()

int32_t decoder_set_type ( ElementHandle element,
DecoderType dec_type )
Parameters
elementElementHandle that will be used as ElementDecoder to set the handlers to the input decoder type
dec_typeDecoderType value that will be used to map the appropriate handler functions.
Return values
STREAM_OKif successful
STREAM_ERR_INVALID_ARGSmeans invalid arguments
STREAM_ERR_GENERALis returned if dec_type is not handled

◆ decoder_activate_parse_tag()

int32_t decoder_activate_parse_tag ( ElementHandle element,
uint8_t activate )
Parameters
elementElementHandle that will be used as ElementDecoder
activatevalue used to set parse_tag in decoder element.
Return values
STREAM_OKif successful
STREAM_ERR_INVALID_ARGSmeans invalid arguments

◆ decoder_is_source_seekable()

bool decoder_is_source_seekable ( ElementDecoder * decoder,
StreamDataFormat format )

This function sends a query to sink pad of the decoder element to check if check if seek is possible in the specified format.

Parameters
decoderElementDecoder pointer will be use to create a sink StreamPad
formatformat type used to create the query.
Returns
bool
Return values
truesource is seekable
falsesouce is not seekable

◆ vUpdateAverageBitrate()

void vUpdateAverageBitrate ( ElementDecoder * element)
Parameters
elementElementDecoder pointer that will contain the calculated average bit rate.
Returns
None