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

This file contains the implementation for the File Sink. More...

#include <string.h>
#include "file_sink.h"
#include "pipeline.h"
#include "streamer_element_properties.h"
#include "file_utils.h"

Macros

#define FILESINK_PULL_SIZE   1920
 Pull size for the AUDIO_PROC test pipeline with file source and file sink.
 

Functions

void FILE_Dump_Task (void *param)
 this function is a task that writes data to the SD card
 
static uint8_t filesink_sink_pad_activation_handler (StreamPad *pad, uint8_t active)
 This function activates the sink pad and allocates memory for the file sink element.
 
static FlowReturn filesink_sink_pad_chain_handler (StreamPad *pad, StreamBuffer *buf)
 This pad function accumulates data from the decoder and pushes it onto the selected audio driver. The audio sink maintains a double buffer and starts sending data once both the buffers are full. It blocks if the previous data is not sent out by the driver for some reason.
 
static int32_t filesink_sink_pad_process_handler (StreamPad *pad)
 File sink pad process handler.
 
static uint8_t filesink_sink_pad_event_handler (StreamPad *pad, StreamEvent *event)
 This function is the calls the specified audio device driver implementation of the sink pad event handler.
 
static int32_t filesink_change_state (StreamElement *element, PipelineState new_state)
 This function changes the file sink state and calls the appropriate apis for that state and takes the actions and then returns. PipelineState Transition: NULL to READY: Open file READY to PAUSE: Activate sink pads and their peer pads PAUSE to PLAY: Start Writing PAUSE to READY: Deactivate sink pads and their peer pads READY to NULL: Close file.
 
static uint8_t filesink_sink_pad_query_handler (StreamPad *pad, StreamQuery *query)
 This pad function handles query from the pipeline. If not able to handle the query then it pushes the query to its peer.
 
static int32_t filesink_set_property (StreamElement *element_ptr, uint16_t prop, uint32_t val)
 This function sets audio sink element's properties.
 
static int32_t filesink_get_property (StreamElement *element_ptr, uint16_t prop, uint32_t *val_ptr)
 This function gets audio sink element's properties.
 
int32_t filesink_init_element (StreamElement *element)
 this function initializes the audio sink element and sink pads
 
int32_t filesink_set_location (ElementHandle element, char *path)
 This function sets a destiniaiton file to be writen by file sink.
 
int32_t filesink_set_write_mode (ElementHandle element, uint8_t write_mode)
 Set the raw write mode or the packet header mode to write to file.
 

Variables

static FileDump file_dump
 Structure that holds information necessary for writing to a file.
 

Function Documentation

◆ FILE_Dump_Task()

void FILE_Dump_Task ( void * param)
Parameters
paramNULL

◆ filesink_sink_pad_activation_handler()

static uint8_t filesink_sink_pad_activation_handler ( StreamPad * pad,
uint8_t active )
static
Parameters
padpad handle
activeboolean activate/disactivate pad
Returns
uint8_t

◆ filesink_sink_pad_chain_handler()

static FlowReturn filesink_sink_pad_chain_handler ( StreamPad * pad,
StreamBuffer * buf )
static
Parameters
padpad handle
bufinput buffer
Returns
FlowReturn

◆ filesink_sink_pad_process_handler()

static int32_t filesink_sink_pad_process_handler ( StreamPad * pad)
static
Parameters
padPad pointer
Returns
int32_t

◆ filesink_sink_pad_event_handler()

static uint8_t filesink_sink_pad_event_handler ( StreamPad * pad,
StreamEvent * event )
static
Parameters
padpad handle
eventevent enumeration
Returns
uint8_t

◆ filesink_change_state()

static int32_t filesink_change_state ( StreamElement * element,
PipelineState new_state )
static
Parameters
elementelement
new_statefile sink state to be changed
Returns
int32_t

◆ filesink_sink_pad_query_handler()

static uint8_t filesink_sink_pad_query_handler ( StreamPad * pad,
StreamQuery * query )
static
Parameters
padpad handle
queryinput buffer
Returns
uint8_t

◆ filesink_set_property()

static int32_t filesink_set_property ( StreamElement * element_ptr,
uint16_t prop,
uint32_t val )
static
Parameters
element_ptrfile sink element instance
propelement property
valvalue to be set
Returns
StreamReturnType
Return values
STREAM_OKsuccess
STREAM_ERR_NO_MEMdo not support this property

◆ filesink_get_property()

static int32_t filesink_get_property ( StreamElement * element_ptr,
uint16_t prop,
uint32_t * val_ptr )
static
Parameters
element_ptraudio sink element instance
propelement property
val_ptrvalue to be acquired
Returns
StreamReturnType
Return values
STREAM_OKsuccess

◆ filesink_init_element()

int32_t filesink_init_element ( StreamElement * element)
Parameters
elementan element which is created by parent element
Returns
StreamReturnType
Return values
STREAM_OKif successful
STREAM_ERR_INVALID_ARGSmeans invalid arguments

◆ filesink_set_location()

int32_t filesink_set_location ( ElementHandle element,
char * path )
Parameters
elementelement handle
pathpointer to a file path
Returns
StreamReturnType
Return values
STREAM_OKif successful
STREAM_ERR_INVALID_ARGSmeans invalid arguments

◆ filesink_set_write_mode()

int32_t filesink_set_write_mode ( ElementHandle element,
uint8_t write_mode )
Parameters
elementelement handle
write_modewrite mode raw (or) packet header
Returns
: StreamReturnType
Return values
STREAM_OKif successful
STREAM_ERR_INVALID_ARGSmeans invalid arguments