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

This file contains the definition of an element pad object. More...

#include "streamer.h"
#include "streamer_api.h"

Data Structures

struct  StreamEvent
 
struct  StreamPad
 
struct  PadSrc
 
struct  PadSink
 

Macros

#define BUFFER_PTR(pstbuffer)   ((pstbuffer)->buffer)
 Get buffer pointer.
 
#define BUFFER_SIZE(pstbuffer)   ((pstbuffer)->size)
 Get buffer size.
 
#define BUFFER_OFFSET(pstbuffer)   ((pstbuffer)->offset)
 Get buffer offset.
 
#define BUFFER_TIME(pstbuffer)   ((pstbuffer)->time)
 Get time.
 
#define EVENT_TYPE_BOTH   (EVENT_TYPE_UPSTREAM | EVENT_TYPE_DOWNSTREAM)
 The same thing as EVENT_TYPE_UPSTREAM | EVENT_TYPE_DOWNSTREAM.
 
#define EVENT_TYPE_SHIFT   4
 Shift for custom event type creation.
 
#define EVENT_MAKE_TYPE(num, flags)   (((num) << EVENT_TYPE_SHIFT) | (flags))
 
#define FLAG(name)   EVENT_TYPE_##name
 Event type flag creation.
 
#define EVENT_IS_UPSTREAM(ev)   ((uint32_t)EVENT_TYPE(ev) & (uint32_t)EVENT_TYPE_UPSTREAM)
 
#define EVENT_IS_DOWNSTREAM(ev)   ((uint32_t)EVENT_TYPE(ev) & (uint32_t)EVENT_TYPE_DOWNSTREAM)
 
#define EVENT_IS_SERIALIZED(ev)   ((uint32_t)EVENT_TYPE(ev) & (uint32_t)EVENT_TYPE_SERIALIZED)
 
#define EVENT_TYPE(pstevent)   ((pstevent)->type)
 Get event type.
 
#define EVENT_FORMAT(pstevent)   ((pstevent)->format)
 Get event format.
 
#define EVENT_DATA(pstevent)   ((pstevent)->data)
 Get event data.
 
#define QUERY_TYPE(pStreamQuery)   ((pStreamQuery)->type)
 Get query type.
 
#define QUERY_FORMAT(pStreamQuery)   ((pStreamQuery)->format)
 Get query format.
 
#define QUERY_DATATYPE(pStreamQuery)   ((pStreamQuery)->data_type)
 Get query data type.
 
#define QUERY_DATA(pStreamQuery)   ((pStreamQuery)->data)
 Get query data.
 
#define MEMBERS_PAD
 Generic pad.
 
#define PAD_PARENT_ELEMENT(pstpad)   ((StreamElement *)((pstpad)->parent))
 Get pad parent element.
 
#define PAD_PARENT_PIPELINE(pstpad)   ((Pipeline *)((PAD_PARENT_ELEMENT(pstpad))->parent))
 Get pad parent pipeline.
 
#define PAD_PARENT(pstpad)   ((pstpad)->parent)
 Get pad parent.
 
#define PAD_TYPE(pstpad)   ((pstpad)->type)
 Get pad type.
 
#define PAD_SCHEDULING(pstpad)   ((pstpad)->scheduling)
 Get pad scheduling.
 
#define PAD_PEER(pstpad)   ((pstpad)->peer)
 Get pad peer.
 
#define PAD_IS_FLUSHING(pstpad)   ((pstpad)->flushing)
 Get pad flushing.
 
#define PAD_SET_FLUSHING(pstpad)   ((pstpad)->flushing = true)
 Set pad flushing.
 
#define PAD_CLEAR_FLUSHING(pstpad)   ((pstpad)->flushing = false)
 Clear pad flushing.
 
#define PAD_IS_ACTIVATED(pstpad)   ((pstpad)->activated)
 Get pad activated.
 
#define PAD_SET_ACTIVATED(pstpad)   ((pstpad)->activated = true)
 Set pad activated.
 
#define PAD_CLEAR_ACTIVATED(pstpad)   ((pstpad)->activated = false)
 Clear pad activated.
 
#define PAD_ACTIVATEFUNC(pstpad)   ((pstpad)->activation_handler)
 Get pad activation handler.
 
#define PAD_ACTIVATEPULLFUNC(pstpad)   ((pstpad)->activate_pull)
 Get pad activate pull function.
 
#define PAD_ACTIVATEPUSHFUNC(pstpad)   ((pstpad)->activate_push)
 Get pad activate push function.
 
#define PAD_EVENTFUNC(pstpad)   ((pstpad)->event_handler)
 Get pad event handler.
 
#define PAD_QUERYFUNC(pstpad)   ((pstpad)->query_handler)
 Get pad query handler.
 
#define PAD_PULLFUNC(pstpad)   ((pstpad)->pull_handler)
 Get pad pull handler.
 
#define PAD_CHAINFUNC(pstpad)   ((pstpad)->chain_handler)
 Get pad chain handler.
 

Typedefs

typedef uint8_t(* PadActivateFunc) (struct _StreamPad *pad, uint8_t active)
 
typedef FlowReturn(* PadPullFunc) (struct _StreamPad *pad, StreamBuffer *buffer, uint32_t size, uint32_t offset)
 
typedef FlowReturn(* PadChainFunc) (struct _StreamPad *pad, StreamBuffer *buffer)
 
typedef uint8_t(* PadEventFunc) (struct _StreamPad *pad, StreamEvent *event)
 
typedef uint8_t(* PadQueryFunc) (struct _StreamPad *pad, StreamQuery *query)
 
typedef int32_t(* PadProcessFunc) (struct _StreamPad *pad)
 
typedef uint8_t(* PadPrecheckFunc) (struct _StreamPad *pad)
 

Enumerations

enum  EventTypeFlags {
  EVENT_TYPE_UPSTREAM = 1 << 0 ,
  EVENT_TYPE_DOWNSTREAM = 1 << 1 ,
  EVENT_TYPE_SERIALIZED = 1 << 2
}
 
enum  EventType {
  EVENT_UNKNOWN = EVENT_MAKE_TYPE(0, 0) ,
  EVENT_FLUSH_START = EVENT_MAKE_TYPE(1, FLAG(BOTH)) ,
  EVENT_FLUSH_STOP = EVENT_MAKE_TYPE(2, FLAG(BOTH) | FLAG(SERIALIZED)) ,
  EVENT_EOS = EVENT_MAKE_TYPE(3, FLAG(DOWNSTREAM) | FLAG(SERIALIZED)) ,
  EVENT_NEWSEGMENT = EVENT_MAKE_TYPE(4, FLAG(DOWNSTREAM) | FLAG(SERIALIZED)) ,
  EVENT_SEEK = EVENT_MAKE_TYPE(5, FLAG(UPSTREAM))
}
 
enum  PadScheduling {
  SCHEDULING_NONE ,
  SCHEDULING_PULL ,
  SCHEDULING_PUSH
}
 
enum  PadType {
  TYPE_PAD_SRC ,
  TYPE_PAD_SINK ,
  TYPE_PAD_LAST
}
 
enum  FlowReturn {
  FLOW_OK = 0 ,
  FLOW_NOT_LINKED = -1 ,
  FLOW_WRONG_STATE = -2 ,
  FLOW_UNEXPECTED = -3 ,
  FLOW_ERROR = -4 ,
  FLOW_NOT_SUPPORTED = -5 ,
  FLOW_BAD_PARAMETER = -6 ,
  FLOW_TIME_OUT = -7 ,
  FLOW_EOS = -8
}
 

Functions

FlowReturn init_pad (StreamPad *pad, void *parent, PadType type)
 Pad initialization function.
 
FlowReturn deinit_pad (StreamPad *pad)
 Pad deinitialization function.
 
FlowReturn pad_push (StreamPad *pad, StreamBuffer *buffer)
 Push the data buffer to the peer pad.
 
FlowReturn pad_pull_range (StreamPad *pad, uint32_t offset, uint32_t size, StreamBuffer *buffer)
 Pull the data buffer from the peer pad.
 
uint8_t pad_push_event (StreamPad *pad, StreamEvent *event)
 Push event to the peer pad.
 
uint8_t pad_send_event (StreamPad *pad, StreamEvent *event)
 Send the event to the element where it will be handled by a handler function.
 
uint8_t activate_pad (StreamPad *pad, uint8_t activate)
 Call the appropriate pad activation function.
 
uint8_t pad_activate_pull (StreamPad *pad, uint8_t active)
 Pad activation/deactivation in pull mode.
 
uint8_t pad_activate_push (StreamPad *pad, uint8_t active)
 Pad activation/deactivation in push mode.
 
FlowReturn event_create_flush_start (StreamEvent *event)
 Create flush start event.
 
FlowReturn event_create_flush_stop (StreamEvent *event)
 Create flush stop event.
 
FlowReturn event_create_eos (StreamEvent *event)
 Create end of stream event.
 
FlowReturn event_create_new_segment (StreamEvent *event, StreamDataFormat format, uint32_t data)
 Create new segment event.
 
FlowReturn event_create_seek (StreamEvent *event, StreamDataFormat format, uint32_t data)
 Create seek event.
 
uint8_t pad_query (StreamPad *pad, StreamQuery *query)
 Send a query to a pad.
 
FlowReturn query_create (StreamQuery *query, StreamInfoType type, StreamDataFormat format, StreamDataType data_type, StreamData *data)
 Create a query for element or pipeline.
 

Macro Definition Documentation

◆ EVENT_MAKE_TYPE

#define EVENT_MAKE_TYPE ( num,
flags )   (((num) << EVENT_TYPE_SHIFT) | (flags))

EVENT_MAKE_TYPE:

Parameters
numthe event number to create
flagsthe event flags

when making custom event types, use this macro with the num and the given flags

◆ EVENT_IS_UPSTREAM

#define EVENT_IS_UPSTREAM ( ev)    ((uint32_t)EVENT_TYPE(ev) & (uint32_t)EVENT_TYPE_UPSTREAM)

EVENT_IS_UPSTREAM

Parameters
evthe event to query

Check if an event can travel upstream.

◆ EVENT_IS_DOWNSTREAM

#define EVENT_IS_DOWNSTREAM ( ev)    ((uint32_t)EVENT_TYPE(ev) & (uint32_t)EVENT_TYPE_DOWNSTREAM)

EVENT_IS_DOWNSTREAM

Parameters
evthe event to query

Check if an event can travel downstream.

◆ EVENT_IS_SERIALIZED

#define EVENT_IS_SERIALIZED ( ev)    ((uint32_t)EVENT_TYPE(ev) & (uint32_t)EVENT_TYPE_SERIALIZED)

EVENT_IS_SERIALIZED

Parameters
evthe event to query

Check if an event is serialized with the data stream.

◆ MEMBERS_PAD

#define MEMBERS_PAD
Value:
void *parent; \
int8_t flushing; \
int8_t blocked; \
int8_t activated; \
PadType type; \
PadScheduling scheduling; \
struct _StreamPad *peer; \
PadEventFunc event_handler; \
PadQueryFunc query_handler; \
PadActivateFunc activation_handler; \
PadActivateFunc activate_pull; \
PadActivateFunc activate_push; \
PadProcessFunc process_handler; \
PadPrecheckFunc process_precheck
uint8_t(* PadQueryFunc)(struct _StreamPad *pad, StreamQuery *query)
Definition pad.h:380
PadType
Definition pad.h:303
PadScheduling
Definition pad.h:292
uint8_t(* PadActivateFunc)(struct _StreamPad *pad, uint8_t active)
Definition pad.h:360
int32_t(* PadProcessFunc)(struct _StreamPad *pad)
Definition pad.h:385
uint8_t(* PadPrecheckFunc)(struct _StreamPad *pad)
Definition pad.h:390
uint8_t(* PadEventFunc)(struct _StreamPad *pad, StreamEvent *event)
Definition pad.h:375
Definition pad.h:396

Typedef Documentation

◆ PadActivateFunc

typedef uint8_t(* PadActivateFunc) (struct _StreamPad *pad, uint8_t active)

Pad Activation Function Handler

◆ PadPullFunc

typedef FlowReturn(* PadPullFunc) (struct _StreamPad *pad, StreamBuffer *buffer, uint32_t size, uint32_t offset)

Pad Pull Function Handler

◆ PadChainFunc

typedef FlowReturn(* PadChainFunc) (struct _StreamPad *pad, StreamBuffer *buffer)

Pad Chain Function Handler

◆ PadEventFunc

typedef uint8_t(* PadEventFunc) (struct _StreamPad *pad, StreamEvent *event)

Pad Event Function Handler

◆ PadQueryFunc

typedef uint8_t(* PadQueryFunc) (struct _StreamPad *pad, StreamQuery *query)

Pad Query Function Handler

◆ PadProcessFunc

typedef int32_t(* PadProcessFunc) (struct _StreamPad *pad)

Pad Process Function Handler

◆ PadPrecheckFunc

typedef uint8_t(* PadPrecheckFunc) (struct _StreamPad *pad)

Pad Process Pre-check Function Handler

Enumeration Type Documentation

◆ EventTypeFlags

EventTypeFlags: EventTypeFlags indicate the aspects of the different EventType values.

Enumerator
EVENT_TYPE_UPSTREAM 

Travels towards source.

EVENT_TYPE_DOWNSTREAM 

Travels towards sink.

EVENT_TYPE_SERIALIZED 

Should be serialized with data flow.

◆ EventType

enum EventType

EventType EventType lists the standard event types that can be sent in a pipeline.

Enumerator
EVENT_UNKNOWN 

Unknown.

EVENT_FLUSH_START 

Start a flush operation.

EVENT_FLUSH_STOP 

Stop a flush operation.

EVENT_EOS 

End-Of-Stream. No more data is to be expected to follow without a NEWSEGMENT event.

EVENT_NEWSEGMENT 

A new media segment follows in the dataflow.

EVENT_SEEK 

A request for a new playback position and rate.

◆ PadScheduling

PadScheduling The status of a Pad. After activating a pad, which usually happens when the parent element goes from READY to PAUSED, the ActivateMode defines if the pad operates in push or pull mode.

Enumerator
SCHEDULING_NONE 

Pad will not handle dataflow.

SCHEDULING_PULL 

Pad handles dataflow in upstream pull mode.

SCHEDULING_PUSH 

Pad handles dataflow in downstream push mode.

◆ PadType

enum PadType

PadType The type of pad, based on the direction of data.

Enumerator
TYPE_PAD_SRC 

Source Pad.

TYPE_PAD_SINK 

Sink Pad.

◆ FlowReturn

enum FlowReturn

FlowReturn The result of passing data to a pad. Note that the custom return values should not be exposed outside of the element scope and are available since 0.10.7.

Enumerator
FLOW_OK 

Data passing was ok.

FLOW_NOT_LINKED 

Pad is not linked.

FLOW_WRONG_STATE 

Pad is in wrong state.

FLOW_UNEXPECTED 

Did not expect anything, like after EOS.

FLOW_ERROR 

Some (fatal) error occured. Element generating this error should post an error message with more details.

FLOW_NOT_SUPPORTED 

This operation is not supported.

FLOW_BAD_PARAMETER 

Bad parameter detected.

FLOW_TIME_OUT 

No more resources.

FLOW_EOS 

Operation is in a terminated state.

Function Documentation

◆ init_pad()

FlowReturn init_pad ( StreamPad * pad,
void * parent,
PadType type )
Parameters
padpad object
parentparent element object
typepad type
Returns
FlowReturn

◆ deinit_pad()

FlowReturn deinit_pad ( StreamPad * pad)
Parameters
padpad object
Returns
FlowReturn

◆ pad_push()

FlowReturn pad_push ( StreamPad * pad,
StreamBuffer * buffer )
Parameters
padpad object
bufferdata buffer
Returns
FlowReturn

◆ pad_pull_range()

FlowReturn pad_pull_range ( StreamPad * pad,
uint32_t offset,
uint32_t size,
StreamBuffer * buffer )
Parameters
padpad object
offsetoffset position to be read from
sizesize to be read
bufferdata buffer to be filled
Returns
FlowReturn

◆ pad_push_event()

uint8_t pad_push_event ( StreamPad * pad,
StreamEvent * event )
Parameters
padpad object
eventevent object
Returns
uint8_t

◆ pad_send_event()

uint8_t pad_send_event ( StreamPad * pad,
StreamEvent * event )
Parameters
padpad object
eventevent object
Returns
uint8_t

◆ activate_pad()

uint8_t activate_pad ( StreamPad * pad,
uint8_t activate )
Parameters
padpad object
activateactivation/deactivation flag
Returns
uint8_t

◆ pad_activate_pull()

uint8_t pad_activate_pull ( StreamPad * pad,
uint8_t active )
Parameters
padpad object
activeactivation/deactivation flag
Returns
uint8_t

◆ pad_activate_push()

uint8_t pad_activate_push ( StreamPad * pad,
uint8_t active )
Parameters
padpad object
activeactivation/deactivation flag
Returns
uint8_t

◆ event_create_flush_start()

FlowReturn event_create_flush_start ( StreamEvent * event)
Parameters
eventevent object
Returns
FlowReturn

◆ event_create_flush_stop()

FlowReturn event_create_flush_stop ( StreamEvent * event)
Parameters
eventevent object
Returns
FlowReturn

◆ event_create_eos()

FlowReturn event_create_eos ( StreamEvent * event)
Parameters
eventevent object
Returns
FlowReturn

◆ event_create_new_segment()

FlowReturn event_create_new_segment ( StreamEvent * event,
StreamDataFormat format,
uint32_t data )
Parameters
eventevent object
formatdata format
datadata object
Returns
FlowReturn

◆ event_create_seek()

FlowReturn event_create_seek ( StreamEvent * event,
StreamDataFormat format,
uint32_t data )
Parameters
eventevent object
formatdata format
datadata object
Returns
FlowReturn

◆ pad_query()

uint8_t pad_query ( StreamPad * pad,
StreamQuery * query )
Parameters
padpad object
queryquery object
Returns
uint8_t

◆ query_create()

FlowReturn query_create ( StreamQuery * query,
StreamInfoType type,
StreamDataFormat format,
StreamDataType data_type,
StreamData * data )
Parameters
queryquery object to be created
typetype of information to be queried
formatdata format
data_typedata type
datadata object
Returns
FlowReturn