Maestro Audio Framework v 1.7
NXP Semiconductors
|
this file implement file source element. More...
#include <stdio.h>
#include "audio_cfg.h"
#include "streamer_element.h"
#include "file_src_freertos.h"
#include "audio_sink.h"
#include "pipeline.h"
#include "streamer_element_properties.h"
Functions | |
int32_t | filesrc_src_pad_process (StreamPad *pad) |
Function is the loop function of the filesrc source pad which runs in the task thread. It reads the chunk_size of data from the file and pushes it to peer element sink pad. When EOF file is reached, the task goes to PAUSE state. | |
static int32_t | filesrc_change_state (StreamElement *element, PipelineState state) |
Function handles the state change of the element in a pipeline. | |
static uint8_t | filesrc_handle_src_event (StreamPad *pad, StreamEvent *event) |
Function handles the events of the element source pad. | |
static uint8_t | filesrc_handle_src_query (StreamPad *pad, StreamQuery *query) |
Function Description: This function is the empty impl of the src pad query handler. | |
static uint8_t | filesrc_src_activate_push (StreamPad *pad, uint8_t active) |
Function activates or deactivates the filesrc source pad in PUSH mode. | |
static uint8_t | filesrc_src_activate_pull (StreamPad *pad, uint8_t active) |
Function activates or deactivates the filesrc source pad in PULL mode. | |
static uint8_t | filesrc_src_activate (StreamPad *pad, uint8_t active) |
Function is the queue src pad activatation handler. Activation is handled by the peer sink pad, this should just handle the deactivation. | |
static FlowReturn | filesrc_pull (StreamPad *pad, StreamBuffer *buffer, uint32_t size, uint32_t offset) |
Function is the pull function of the filesrc source pad in SCHEDULING_PULL mode. It reads the size of data from the offset to buffer. | |
static int32_t | filesrc_get_property (StreamElement *element_ptr, uint16_t prop, uint64_t *val_ptr) |
This function get file source element properties. | |
static int32_t | filesrc_set_property (StreamElement *element_ptr, uint16_t prop, uintptr_t val) |
This function set file source element properties. | |
int32_t | filesrc_init (StreamElement *element) |
this function initializes the file source element and source pad. All the pad's handlers are intialized. | |
int32_t | filesrc_set_location (ElementHandle element, char *path) |
Set a destination file to be read by file source element. | |
int32_t | filesrc_get_location (ElementHandle element, char **pp_path) |
This function gets the location of the file. | |
int32_t | filesrc_set_push_chunk_size (ElementHandle element, uint32_t chunk_size) |
Set the chunk size in which the file source sends the data in push mode. | |
int32_t | filesrc_get_push_chunk_size (ElementHandle element, uint64_t *chunk_size) |
Get the chunk size in which the file source sends the data in push mode. | |
static FlowReturn | filesrc_read (ElementFileSrc *filesrc, uint32_t offset, uint32_t length, StreamBuffer *buf) |
Function reads the data from the file specified by the element. NOTE: Function may or may not be able to read the required length of data. Returns FLOW_EOS when EOF file is encountered. or FLOW_UNEXPECTED when read fails. | |
int32_t | file_query (int32_t fd, StreamInfoType info, StreamData *data) |
file_query | |
int32_t | file_src_get_decoder_type (char *filename, StreamerFileSrcConfig *config) |
Get the file source decoder and parser type. | |
Variables | |
static StreamerFileSrcConfig | file_src_cfg_lookup_table [] |
int32_t filesrc_src_pad_process | ( | StreamPad * | pad | ) |
filesrc_src_pad_process:
pad | Element pad |
|
static |
element | Pointer to element |
state | changed state. |
|
static |
pad | Element pad |
event | type of event |
|
static |
pad | pad handle |
query | query |
|
static |
pad | Element pad |
active | true if pad is to be activated else false to deactivate |
|
static |
pad | Element pad |
active | true if pad is to be activated else false to deactivate |
|
static |
pad | Queue element src pad |
active | To activate or deactivate pad. |
|
static |
pad | Element pad |
buffer | Pointer of the buffer to read data |
size | Number of bytes to read |
offset | Offset to the file |
|
static |
element_ptr | element pointer |
prop | properties |
val_ptr | parameters |
|
static |
element_ptr | element pointer |
prop | properties |
val | parameters |
int32_t filesrc_init | ( | StreamElement * | element | ) |
element | pointer to element |
STREAM_OK | if successful |
STREAM_ERR_INVALID_ARGS | means invalid arguments |
int32_t filesrc_set_location | ( | ElementHandle | element, |
char * | path ) |
element | element handle |
path | pointer to a file path |
STREAM_OK | if successful |
STREAM_ERR_INVALID_ARGS | means invalid arguments |
int32_t filesrc_get_location | ( | ElementHandle | element, |
char ** | pp_path ) |
element | element handle |
pp_path | location path |
STREAM_OK | if successful |
STREAM_ERR_INVALID_ARGS | means invalid arguments |
int32_t filesrc_set_push_chunk_size | ( | ElementHandle | element, |
uint32_t | chunk_size ) |
element | element handle |
chunk_size | chunk size |
STREAM_OK | if successful |
STREAM_ERR_INVALID_ARGS | means invalid arguments |
int32_t filesrc_get_push_chunk_size | ( | ElementHandle | element, |
uint64_t * | chunk_size ) |
element | element handle |
chunk_size | chunk size |
STREAM_OK | if successful |
STREAM_ERR_INVALID_ARGS | means invalid arguments |
|
static |
filesrc | Pointer to filesrc element |
offset | Offset of the file to read data from |
length | Number of bytes to read |
buf | Pointer to buffer to read data |
int32_t file_query | ( | int32_t | fd, |
StreamInfoType | info, | ||
StreamData * | data ) |
Attempt to query information from a file
fd | File handle |
info | Type of query |
data | Data pointer to result data |
STREAM_OK | Query was successful |
STREAM_ERR_INFO_ABSENT | File does not supported specified query |
int32_t file_src_get_decoder_type | ( | char * | filename, |
StreamerFileSrcConfig * | config ) |
filename | name of the file |
config | file source information |
STREAM_OK | if successful |
STREAM_ERR_GENERAL | means either file does not contain an extension or the file type is not supported |
|
static |
This table is used by File source to select the appropriate decoder and parser based on the extension of the file. This is needed to properly configure the pipeline when switching between different audio file types.