| Maestro Audio Framework v 1.0 NXP Semiconductors

Data Structures | Macros | Typedefs | Enumerations | Functions
streamer_api.h File Reference

Streamer API header. More...

`#include <stddef.h>`
`#include "osa_common.h"`
`#include "streamer_message.h"`

## Data Structures
struct | AlbumArt
| Album Art Object. More...
struct | TrackInfo
| Track Info Object. More...
struct | StreamImageType
| StreamImageType. More...
struct | StreamStringType
| StreamStringType. More...
union | StreamData
| StreamData. More...
struct | ELEMENT_PROPERTY_T
| Element Property structure. More...
struct | STREAMER_MSG_T
| Streamer Message Type. More...
struct | STREAMER_CREATE_PARAM
| Streamer Arguments. More...
struct | STREAMER_T
| Streamer Data Structure. More...

## Macros
#define | AF_MESSAGE_SECTION 0x10000
#define | STREAMER_MSG_START (0x0000 | AF_MESSAGE_SECTION)
#define | STREAMER_MSG_END (0x00FF | AF_MESSAGE_SECTION)
#define | CODEC_INFO_LEN 64
#define | GET_BIT(Bit) (1 << (Bit))
#define | SET_BIT(Flag, Bit) ((Flag) |= GET_BIT(Bit))
#define | CLEAR_BIT(Flag, Bit) ((Flag) &= ~GET_BIT(Bit))
#define | BUILD_ELEMENT(n_src, n_sink, id) (_SRC(n_src) | _SINK(n_sink) | id)
#define | _SINK(num) ((num & 0x3) << 14)
#define | _SRC(num) ((num & 0x3) << 12)
#define | ELEMENT_ID(type) (type & 0x0FFF)
#define | STREAMER_MQ_NAME_LENGTH (32)
#define | PLAYER_MQ_NAME_BASE "/player.mq."
#define | STREAMER_MQ_NAME_BASE "/streamer.mq."
#define | MQ_NAME_FORMAT "%s%ld"
#define | MAX_PIPELINES (1)
| The maximum number of Pipelines that may be created within a single streamer task.
#define | MAX_ELEMENTS (ELEMENT_LAST_INDEX)
| The maximum number of Elements that may be created within a single streamer task.
#define | WAIT_STREAMER_MSG_RESPONSE_TIME_OUT 8000 /* 8s */
| The wait time out for streamer response of a message processing completion After streamer processed a message, it will signal the condition variable in the message to make the function call synchronized.
#define | TRACK_TITLE_LEN 64
#define | TRACK_ARTIST_LEN 64
#define | TRACK_ALBUM_LEN 64
#define | TRACK_GENRE_LEN 34
#define | TRACK_YEAR_LEN 5
#define | STREAMER_MSG_SIZE (sizeof(STREAMER_MSG_T))

## Typedefs
typedef uintptr_t | ElementHandle
typedef uintptr_t | PipelineHandle
typedef uintptr_t | APPHandle

## Enumerations
enum | StreamReturnType { STREAM_OK = 0 , STREAM_ERR_GENERAL = -1 , STREAM_ERR_INVALID_ARGS = -2 , STREAM_ERR_NO_MEM = -3 , STREAM_ERR_INVALID_SEEK_TIME = -4 , STREAM_ERR_NOT_SEEKABLE = -5 , STREAM_ERR_INFO_ABSENT = -6 , STREAM_ERR_ELEMENT_ALREADY_IN_PIPELINE = -7 , STREAM_ERR_ELEMENT_LINKED = -8 , STREAM_ERR_ELEMENT_NOT_FREE = -9 , STREAM_ERR_ELEMENT_NOT_FOUND = -10 , STREAM_ERR_ELEMENT_INVALID_PAD = -11 , STREAM_ERR_ELEMENT_PADS_NOT_LINKED = -12 , STREAM_ERR_ELEMENT_BAD_STATUS = -13 }
| StreamReturnType Handles return status from pipeline operations. More...
enum | STREAMER_MSG_ID { STREAM_MSG_CLOSE_TASK = STREAMER_MSG_START , STREAM_MSG_CREATE_PIPELINE , STREAM_MSG_DESTROY_PIPELINE , STREAM_MSG_CREATE_ELEMENT , STREAM_MSG_DESTROY_ELEMENT , STREAM_MSG_ADD_ELEMENT , STREAM_MSG_REMOVE_ELEMENT , STREAM_MSG_LINK_ELEMENTS , STREAM_MSG_UNLINK_ELEMENTS , STREAM_MSG_SET_STATE , STREAM_MSG_GET_STATE , STREAM_MSG_SET_FILE , STREAM_MSG_SET_PROPERTY , STREAM_MSG_GET_PROPERTY , STREAM_MSG_GET_TRACK_INFO , STREAM_MSG_SEEK_PIPELINE , STREAM_MSG_QUERY_PIPELINE , STREAM_MSG_SET_REPEAT , STREAM_MSG_UPDATE_DURATION , STREAM_MSG_UPDATE_POSITION , STREAM_MSG_UPDATE_TRACK_INFO , STREAM_MSG_EOS , STREAM_MSG_ERROR , STREAM_MSG_LAST = STREAMER_MSG_END }
| Streamer Message Identifiers Enumeration of all streamer request messages. More...
enum | PipelineState { STATE_NULL , STATE_READY , STATE_PAUSED , STATE_PLAYING }
| PipelineState. More...
enum | StreamPipelineType { STREAM_PIPELINE_FILESYSTEM , STREAM_PIPELINE_MEM , STREAM_PIPELINE_NETBUF , STREAM_PIPELINE_PCM , STREAM_PIPELINE_BTSA , STREAM_PIPELINE_PCM_AIRPLAY , STREAM_PIPELINE_PCM_ASYNC , STREAM_PIPELINE_PCM_ANALOG , STREAM_PIPELINE_MIC2FILE , STREAM_PIPELINE_VIT , STREAM_PIPELINE_EAP , STREAM_PIPELINE_MAX }
| StreamPipelineType. More...
enum | ElementIndex { ELEMENT_FILE_SRC_INDEX , ELEMENT_MEM_SRC_INDEX , ELEMENT_NETBUF_SRC_INDEX , ELEMENT_AUDIO_SRC_INDEX , ELEMENT_FILE_SINK_INDEX , ELEMENT_MEM_SINK_INDEX , ELEMENT_AUDIO_SINK_INDEX , ELEMENT_DECODER_INDEX , ELEMENT_VIT_INDEX , ELEMENT_EAP_INDEX , ELEMENT_LAST_INDEX }
enum | StreamElementType { TYPE_ELEMENT_FILE_SRC = BUILD_ELEMENT (3, 0, ELEMENT_FILE_SRC_INDEX) , TYPE_ELEMENT_MEM_SRC = BUILD_ELEMENT (3, 0, ELEMENT_MEM_SRC_INDEX) , TYPE_ELEMENT_NETBUF_SRC = BUILD_ELEMENT (3, 0, ELEMENT_NETBUF_SRC_INDEX) , TYPE_ELEMENT_AUDIO_SRC = BUILD_ELEMENT (1, 0, ELEMENT_AUDIO_SRC_INDEX) , TYPE_ELEMENT_FILE_SINK = BUILD_ELEMENT (0, 1, ELEMENT_FILE_SINK_INDEX) , TYPE_ELEMENT_MEM_SINK = BUILD_ELEMENT (0, 1, ELEMENT_MEM_SINK_INDEX) , TYPE_ELEMENT_AUDIO_SINK = BUILD_ELEMENT (0, 1, ELEMENT_AUDIO_SINK_INDEX) , TYPE_ELEMENT_DECODER = BUILD_ELEMENT (1, 3, ELEMENT_DECODER_INDEX) , TYPE_ELEMENT_VIT_SINK = BUILD_ELEMENT (0, 1, ELEMENT_VIT_INDEX) , TYPE_ELEMENT_EAP = BUILD_ELEMENT (1, 1, ELEMENT_EAP_INDEX) , TYPE_ELEMENT_LAST = ELEMENT_LAST_INDEX }
| StreamElementType. More...
enum | DecoderType { DECODER_TYPE_UNKNOWN , DECODER_TYPE_WAV , DECODER_TYPE_MP3 , DECODER_TYPE_MP2 , DECODER_TYPE_AAC , DECODER_TYPE_OGG , DECODER_TYPE_WMA , DECODER_TYPE_WMV , DECODER_TYPE_MPEG2 , DECODER_TYPE_MPEG4 , DECODER_TYPE_JPEG , DECODER_TYPE_CD_DA , DECODER_TYPE_MFI , DECODER_TYPE_FLAC , DECODER_TYPE_ALAC , DECODER_TYPE_AC3 , DECODER_TYPE_OPUS , DECODER_TYPE_OGG_OPUS , LAST_DECODER_TYPE }
| DecoderType. More...
enum | ParserType { PARSER_TYPE_ASF , PARSER_TYPE_MP4 , PARSER_TYPE_3GP , PARSER_TYPE_OGG , PARSER_TYPE_BY_PASS , LAST_PARSER_TYPE }
| ParserType. More...
enum | StreamInfoType { INFO_VIDEO_BITRATE = 1 , INFO_VIDEO_FRAMERATE , INFO_VIDEO_TYPE , INFO_AUDIO_BITRATE , INFO_AUDIO_CHANNELS , INFO_AUDIO_SAMPLERATE , INFO_AUDIO_TYPE , INFO_CODEC_INFO , INFO_DURATION , INFO_POSITION , INFO_TIME_SEEKABLE , INFO_BYTE_SEEKABLE , INFO_STREAM_INFO_UPDATE , INFO_FILE_SIZE , INFO_BUFF_OCC , INFO_ALBUM , INFO_ARTIST , INFO_TITLE , INFO_GENRE , INFO_YEAR , INFO_TRACK , INFO_ALBUMART_IMAGE , INFO_META_INFO_UPDATE , INFO_ERROR , INFO_LAST }
| StreamInfoType. More...
enum | AudioSrcDeviceDriverType { AUDIOSRC_PCMRTOS , LAST_AUDIOSRC_DEVICE_DRIVER_TYPE }
| AudioSrcDeviceDriverType. More...
enum | AudioSinkDeviceDriverType { AUDIO_SINK_DEVICE_TYPE_PCMRTOS , LAST_AUDIO_SINK_DEVICE_DRIVER_TYPE }
| AudioSinkDeviceDriverType. More...
enum | StreamMsgType { MESSAGE_UNKNOWN = 0 , MESSAGE_EOS = GET_BIT (0) , MESSAGE_ERROR = GET_BIT (1) , MESSAGE_WARNING = GET_BIT (2) , MESSAGE_INFO = GET_BIT (3) , MESSAGE_BUFFERING = GET_BIT (4) , MESSAGE_STATE_CHANGED = GET_BIT (5) }
| StreamMsgType Different message types that are available. More...
enum | AlbumArtSource { ART_DEFAULT = 0 , ART_EMBEDDED , ART_FOLDER }
| Album Art Source. More...
enum | ImageFormat { IMG_RGB_555 = 0 , IMG_RGB_565 , IMG_RGB_666 , IMG_RGB_888 , IMG_GRAYSCALE }
| Image Format. More...

## Functions
STREAMER_T * | streamer_create (STREAMER_CREATE_PARAM *task_param)
void | streamer_destroy (STREAMER_T *streamer)
int32_t | streamer_create_pipeline (STREAMER_T *streamer, int32_t pipeline_id, StreamPipelineType pipeline_type, char *in_dev_name, char *out_dev_name, bool block)
int32_t | streamer_destroy_pipeline (STREAMER_T *streamer, int32_t pipeline_id, bool block)
int32_t | streamer_get_track_info (STREAMER_T *streamer, int32_t pipeline_id, TrackInfo *info, bool block)
int32_t | streamer_set_state (STREAMER_T *streamer, int32_t pipeline_id, PipelineState state, bool block)
int32_t | streamer_get_state (STREAMER_T *streamer, int32_t pipeline_id, PipelineState *state, bool block)
int32_t | streamer_query_info (STREAMER_T *streamer, int32_t pipeline_id, StreamInfoType infoType, StreamData *query_data, bool block)
int32_t | streamer_seek_pipeline (STREAMER_T *streamer, int32_t pipeline_id, int32_t seek_time_ms, bool block)
int32_t | streamer_set_property (STREAMER_T *streamer, ELEMENT_PROPERTY_T prop, bool block)
int32_t | streamer_get_property (STREAMER_T *streamer, uint16_t prop, uint32_t *val_ptr, bool block)
int32_t | streamer_set_file (STREAMER_T *streamer, int32_t pipeline_id, char *path, PipelineState state, bool block)
int32_t | streamer_set_repeat (STREAMER_T *streamer, int32_t pipeline_id, bool repeat_on, bool block)

## Detailed Description

Public APIs for using the maestro streamer framework

## Enumeration Type Documentation

## ◆ StreamReturnType

enum StreamReturnType

Enumerator
STREAM_OK | General success.
STREAM_ERR_GENERAL | General failure.
STREAM_ERR_INVALID_ARGS | Invalid arguments to the function.
STREAM_ERR_NO_MEM | Not enough memory to continue. Fatal.
STREAM_ERR_INVALID_SEEK_TIME | Invalid seek time specified.
STREAM_ERR_NOT_SEEKABLE | Pipeline playback not seekable.
STREAM_ERR_INFO_ABSENT | Required info not available.
STREAM_ERR_ELEMENT_ALREADY_IN_PIPELINE | Element already a part of pipeline.
STREAM_ERR_ELEMENT_LINKED | Element linked to another.
STREAM_ERR_ELEMENT_NOT_FREE | Element still linked an part of pipeline.
STREAM_ERR_ELEMENT_NOT_FOUND | Specified element not found in pipeline.
STREAM_ERR_ELEMENT_INVALID_PAD | Invalid pad index specified in element.
STREAM_ERR_ELEMENT_PADS_NOT_LINKED | Specified pads not linked.
STREAM_ERR_ELEMENT_BAD_STATUS | try to operate in a bad status.

## ◆ STREAMER_MSG_ID

enum STREAMER_MSG_ID

Enumerator
STREAM_MSG_CLOSE_TASK | Close Streamer Task.
STREAM_MSG_CREATE_PIPELINE | Create Pipeline.
STREAM_MSG_DESTROY_PIPELINE | Destroy Pipeline.
STREAM_MSG_CREATE_ELEMENT | Create Element.
STREAM_MSG_DESTROY_ELEMENT | Destroy Element.
STREAM_MSG_ADD_ELEMENT | Add Element to Pipeline.
STREAM_MSG_REMOVE_ELEMENT | Remove Element from Pipeline.
STREAM_MSG_LINK_ELEMENTS | Link two elements together.
STREAM_MSG_UNLINK_ELEMENTS | Unlink two elements together.
STREAM_MSG_SET_STATE | Set Pipeline State.
STREAM_MSG_GET_STATE | Get Pipeline State.
STREAM_MSG_SET_FILE | Set the file path and reconfigure the pipeline.
STREAM_MSG_SET_PROPERTY | Set an Element specific property value.
STREAM_MSG_GET_PROPERTY | Get an Element specific property value.
STREAM_MSG_GET_TRACK_INFO | Get track info.
STREAM_MSG_SEEK_PIPELINE | Seek the pipeline to a time.
STREAM_MSG_QUERY_PIPELINE | Query the pipeline.
STREAM_MSG_SET_REPEAT | Set repeat mode of pipeline.
STREAM_MSG_UPDATE_DURATION | Track duration info updated.
STREAM_MSG_UPDATE_POSITION | Track playing position updated.
STREAM_MSG_UPDATE_TRACK_INFO | Track info updated.
STREAM_MSG_EOS | End of track reached.
STREAM_MSG_ERROR | Error in streamer.

## ◆ PipelineState

enum PipelineState

States for pipeline and individual elements of the pipeline. In ideal condition all the elements will have the same state as the parent pipeline state.

Enumerator
STATE_NULL | A pipeline is created, but all the elements are in initial state (decoder type, parser type are not determined - using default value). Source file is not assigned or open.
STATE_READY | All the streamer elements’ properties are initialized (source file opened, decoder type, parser type are determined). The pipeline is ready for playing or pause.
STATE_PAUSED | The element should be ready to accept and process data.
STATE_PLAYING | The same as PAUSED except for live sources and sinks.

## ◆ StreamPipelineType

enum StreamPipelineType

The type of pipeline in streamer. These may not all be supported.

Enumerator
STREAM_PIPELINE_FILESYSTEM | Pipeline with file source, decoder and audio sink.
STREAM_PIPELINE_MEM | Pipeline with memory buffer source, decoder and audio sink.
STREAM_PIPELINE_NETBUF | Pipeline with network buffer source, decoder and audio sink.
STREAM_PIPELINE_PCM | Pipeline with audio (PCM) source and audio sink.

## ◆ StreamElementType

enum StreamElementType

Holds an element type for pipeline operations. Type is built based on number of source pads, number of sink pads, and a unique index

Enumerator
TYPE_ELEMENT_FILE_SRC | File source element.
TYPE_ELEMENT_MEM_SRC | Memory source element.
TYPE_ELEMENT_NETBUF_SRC | Network buffer source element. Requires CCI usage.
TYPE_ELEMENT_AUDIO_SRC | Audio source element.
TYPE_ELEMENT_FILE_SINK | File sink element.
TYPE_ELEMENT_MEM_SINK | Memory sink element.
TYPE_ELEMENT_AUDIO_SINK | Audio sink element.
TYPE_ELEMENT_DECODER | Decoder element.

## ◆ DecoderType

enum DecoderType

Enumeration of potential media decoders. These may not all be supported.

Enumerator
DECODER_TYPE_UNKNOWN | unknown Decoder
DECODER_TYPE_WAV | Wave Decoder.
DECODER_TYPE_MP3 | MP3 Decoder.
DECODER_TYPE_OPUS | raw OPUS decoder
DECODER_TYPE_OGG_OPUS | OGG OPUS decoder.
LAST_DECODER_TYPE | Placeholder.

## ◆ ParserType

enum ParserType

Enumeration of potential media parsers. @ These may not all be supported.

Enumerator
PARSER_TYPE_ASF | ASF Parser.
PARSER_TYPE_MP4 | MP4 Parser.
PARSER_TYPE_3GP | 3GP parser
PARSER_TYPE_OGG | OGG parser.
PARSER_TYPE_BY_PASS | parser will work in by pass mode by default
LAST_PARSER_TYPE | Placeholder.

## ◆ StreamInfoType

enum StreamInfoType

Types of Information the pipeline may provide

Enumerator
INFO_VIDEO_BITRATE | Video Bitrate.
INFO_VIDEO_FRAMERATE | Video Framerate.
INFO_VIDEO_TYPE | Video File.
INFO_AUDIO_BITRATE | Audio Bitrate.
INFO_AUDIO_CHANNELS | Number of audio channels.
INFO_AUDIO_SAMPLERATE | Audio Sample Rate (Hz)
INFO_AUDIO_TYPE | Audio File.
INFO_CODEC_INFO | Codec information.
INFO_DURATION | Duration of the Track (ms)
INFO_POSITION | Current Position of the Track (ms)
INFO_TIME_SEEKABLE | Input Supports Seek by Time.
INFO_BYTE_SEEKABLE | Input Supports Seek by Byte.
INFO_STREAM_INFO_UPDATE | stream info updated
INFO_FILE_SIZE | Size of audio file from file src.
INFO_BUFF_OCC | Buffer level/audio latency.
INFO_ALBUM | Album Name.
INFO_ARTIST | Artist Name.
INFO_TITLE | Track Title.
INFO_GENRE | Genre.
INFO_YEAR | Year.
INFO_TRACK | Track Number.
INFO_ALBUMART_IMAGE | Album Artwork.
INFO_META_INFO_UPDATE | metadata info updated
INFO_ERROR | error
INFO_LAST | Placeholder always at the end.

## ◆ AudioSrcDeviceDriverType

enum AudioSrcDeviceDriverType

Enumeration of potential audio src devices

Enumerator
AUDIOSRC_PCMRTOS | Audio source device using pcm interface and rtos.
LAST_AUDIOSRC_DEVICE_DRIVER_TYPE | Placeholder.

## ◆ AudioSinkDeviceDriverType

enum AudioSinkDeviceDriverType

Enumeration of potential audio sink devices

Enumerator
AUDIO_SINK_DEVICE_TYPE_PCMRTOS | Audio sink device using pcm interface and rtos.
LAST_AUDIO_SINK_DEVICE_DRIVER_TYPE | Placeholder.

## ◆ StreamMsgType

enum StreamMsgType

Enumerator
MESSAGE_UNKNOWN | Unknown.
MESSAGE_EOS | End-of-stream reached in a pipeline. The application will only receive this message in the PLAYING state and every time it sets a pipeline to PLAYING that is in the EOS state. The application can perform a flushing seek in the pipeline, which will undo the EOS state again.
MESSAGE_ERROR | An error occurred. When the application receives an error message it should stop playback of the pipeline and not assume that more data will be played.
MESSAGE_WARNING | A warning occurred.
MESSAGE_INFO | An info message occurred.
MESSAGE_BUFFERING | The pipeline is buffering. When the application receives a buffering msg in the PLAYING state for a non-live pipeline it must PAUSE the pipeline until the buffering completes, when the percent field in the message is 100%. For live pipelines, no action must be performed and the buffering percentage can be used to inform the user about the progress.
MESSAGE_STATE_CHANGED | A state change happened.

## ◆ AlbumArtSource

enum AlbumArtSource

Identify the source of an album art image

Enumerator
ART_DEFAULT | No album art found, using default.
ART_EMBEDDED | Art found embedded in source file.
ART_FOLDER | Art found in containing folder.

## ◆ ImageFormat

enum ImageFormat

Enumeration of output formats supported by the Image Decoder

Enumerator
IMG_RGB_555 | RGB 555 (16-bit) (PPM)
IMG_RGB_565 | RGB 565 (16-bit) (PPM)
IMG_RGB_666 | RGB 666 (18-bit) (PPM)
IMG_RGB_888 | RGB 888 (24-bit) (PPM)
IMG_GRAYSCALE | Grayscale (PGM)