My Project
Graph Utility

Classes

struct  MMAL_GRAPH_T
 

Typedefs

typedef struct MMAL_GRAPH_T MMAL_GRAPH_T
 
typedef void(* MMAL_GRAPH_EVENT_CB) (MMAL_GRAPH_T *graph, MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer, void *cb_data)
 

Enumerations

enum  MMAL_GRAPH_TOPOLOGY_T { MMAL_GRAPH_TOPOLOGY_ALL = 0, MMAL_GRAPH_TOPOLOGY_STRAIGHT, MMAL_GRAPH_TOPOLOGY_CUSTOM, MMAL_GRAPH_TOPOLOGY_MAX }
 

Functions

MMAL_STATUS_T mmal_graph_create (MMAL_GRAPH_T **graph, unsigned int userdata_size)
 
MMAL_STATUS_T mmal_graph_add_component (MMAL_GRAPH_T *graph, MMAL_COMPONENT_T *component)
 
MMAL_STATUS_T mmal_graph_component_topology (MMAL_GRAPH_T *graph, MMAL_COMPONENT_T *component, MMAL_GRAPH_TOPOLOGY_T topology, int8_t *input, unsigned int input_num, int8_t *output, unsigned int output_num)
 
MMAL_STATUS_T mmal_graph_add_port (MMAL_GRAPH_T *graph, MMAL_PORT_T *port)
 
MMAL_STATUS_T mmal_graph_add_connection (MMAL_GRAPH_T *graph, MMAL_CONNECTION_T *connection)
 
MMAL_STATUS_T mmal_graph_new_component (MMAL_GRAPH_T *graph, const char *name, MMAL_COMPONENT_T **component)
 
MMAL_STATUS_T mmal_graph_new_connection (MMAL_GRAPH_T *graph, MMAL_PORT_T *out, MMAL_PORT_T *in, uint32_t flags, MMAL_CONNECTION_T **connection)
 
MMAL_STATUS_T mmal_graph_enable (MMAL_GRAPH_T *graph, MMAL_GRAPH_EVENT_CB cb, void *cb_data)
 
MMAL_STATUS_T mmal_graph_disable (MMAL_GRAPH_T *graph)
 
MMAL_PORT_Tmmal_graph_find_port (MMAL_GRAPH_T *graph, const char *name, MMAL_PORT_TYPE_T type, unsigned index)
 
MMAL_STATUS_T mmal_graph_build (MMAL_GRAPH_T *ctx, const char *name, MMAL_COMPONENT_T **component)
 
MMAL_STATUS_T mmal_graph_component_constructor (const char *name, MMAL_COMPONENT_T *component)
 
MMAL_STATUS_T mmal_graph_destroy (MMAL_GRAPH_T *ctx)
 

Detailed Description

The graph utility functions allows one to easily create graphs of MMAL components.

Typedef Documentation

◆ MMAL_GRAPH_EVENT_CB

typedef void(* MMAL_GRAPH_EVENT_CB) (MMAL_GRAPH_T *graph, MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer, void *cb_data)

Definition of the callback used by a graph to send events to the client.

Parameters
graphthe graph sending the event
portthe port which generated the event
bufferthe buffer header containing the event data
cb_datadata passed back to the client when the callback is invoked

Definition at line 181 of file mmal_graph.h.

◆ MMAL_GRAPH_T

typedef struct MMAL_GRAPH_T MMAL_GRAPH_T

Structure describing a graph

Enumeration Type Documentation

◆ MMAL_GRAPH_TOPOLOGY_T

List of topology types

Enumerator
MMAL_GRAPH_TOPOLOGY_ALL 

All input ports and output ports are linked

MMAL_GRAPH_TOPOLOGY_STRAIGHT 

Input ports and output ports of the same index are linked

MMAL_GRAPH_TOPOLOGY_CUSTOM 

Custom defined topology

MMAL_GRAPH_TOPOLOGY_MAX 

Definition at line 45 of file mmal_graph.h.

Function Documentation

◆ mmal_graph_add_component()

MMAL_STATUS_T mmal_graph_add_component ( MMAL_GRAPH_T graph,
MMAL_COMPONENT_T component 
)

Add a component to a graph. Allows the client to add a component to the graph.

Parameters
graphinstance of the graph
componentcomponent to add to a graph
Returns
MMAL_SUCCESS on success

◆ mmal_graph_add_connection()

MMAL_STATUS_T mmal_graph_add_connection ( MMAL_GRAPH_T graph,
MMAL_CONNECTION_T connection 
)

Add a connection to a graph. Allows the client to add an internal connection to a graph.

Parameters
graphinstance of the graph
connectionconnection to add to the graph
Returns
MMAL_SUCCESS on success

◆ mmal_graph_add_port()

MMAL_STATUS_T mmal_graph_add_port ( MMAL_GRAPH_T graph,
MMAL_PORT_T port 
)

Add a port to a graph. Allows the client to add an input or output port to a graph. The given port will effectively become an end point for the graph.

Parameters
graphinstance of the graph
portport to add to the graph
Returns
MMAL_SUCCESS on success

◆ mmal_graph_build()

MMAL_STATUS_T mmal_graph_build ( MMAL_GRAPH_T ctx,
const char *  name,
MMAL_COMPONENT_T **  component 
)

Create an instance of a component from a graph. The newly created component will expose input and output ports to the client. Not that all the exposed ports will be in a disabled state by default.

Parameters
graphgraph to create the component from
namename of the component to create
componentreturned component
Returns
MMAL_SUCCESS on success

◆ mmal_graph_component_constructor()

MMAL_STATUS_T mmal_graph_component_constructor ( const char *  name,
MMAL_COMPONENT_T component 
)

Component constructor for a graph. FIXME: private function

Parameters
namename of the component to create
componentcomponent
Returns
MMAL_SUCCESS on success

◆ mmal_graph_component_topology()

MMAL_STATUS_T mmal_graph_component_topology ( MMAL_GRAPH_T graph,
MMAL_COMPONENT_T component,
MMAL_GRAPH_TOPOLOGY_T  topology,
int8_t *  input,
unsigned int  input_num,
int8_t *  output,
unsigned int  output_num 
)

Describe the topology of the ports of a component. Allows the client to describe the topology of a component. This information is used by the graph to choose which action to perform when enabling / disabling / committing / flushing a port exposed by the graph. Note that by default the topology of a component is set to MMAL_GRAPH_TOPOLOGY_ALL.

Parameters
graphinstance of the graph
componentcomponent to describe
topologytype of topology used by this component
inputoutput index (or -1 if sink) linked to each input port
input_numnumber of indexes in the input list
outputinput index (or -1 if source) linked to each output port
output_numnumber of indexes in the output list
Returns
MMAL_SUCCESS on success

◆ mmal_graph_create()

MMAL_STATUS_T mmal_graph_create ( MMAL_GRAPH_T **  graph,
unsigned int  userdata_size 
)

Create an instance of a graph. The newly created graph will need to be populated by the client.

Parameters
graphreturned graph
userdata_sizesize to be allocated for the userdata field
Returns
MMAL_SUCCESS on success

◆ mmal_graph_destroy()

MMAL_STATUS_T mmal_graph_destroy ( MMAL_GRAPH_T ctx)

Destroy a previously created graph

Parameters
graphgraph to destroy
Returns
MMAL_SUCCESS on success

◆ mmal_graph_disable()

MMAL_STATUS_T mmal_graph_disable ( MMAL_GRAPH_T graph)

◆ mmal_graph_enable()

MMAL_STATUS_T mmal_graph_enable ( MMAL_GRAPH_T graph,
MMAL_GRAPH_EVENT_CB  cb,
void *  cb_data 
)

Enable the graph and start processing.

Parameters
graphthe graph to enable
cbthe callback to invoke when an event occurs on any of the internal control ports
cb_datadata passed back to the client when the callback is invoked
Returns
MMAL_SUCCESS on success

◆ mmal_graph_find_port()

MMAL_PORT_T* mmal_graph_find_port ( MMAL_GRAPH_T graph,
const char *  name,
MMAL_PORT_TYPE_T  type,
unsigned  index 
)

Find a port in the graph.

Parameters
graphgraph instance
namename of the component of interest
typetype of port (in/out)
indexwhich port index within the component
Returns
port, or NULL if not found

◆ mmal_graph_new_component()

MMAL_STATUS_T mmal_graph_new_component ( MMAL_GRAPH_T graph,
const char *  name,
MMAL_COMPONENT_T **  component 
)

Create a new component and add it to a graph. Allows the client to create and add a component to the graph.

Parameters
graphinstance of the graph
namename of the component to create
componentif not NULL, will contain a pointer to the created component
Returns
MMAL_SUCCESS on success

◆ mmal_graph_new_connection()

MMAL_STATUS_T mmal_graph_new_connection ( MMAL_GRAPH_T graph,
MMAL_PORT_T out,
MMAL_PORT_T in,
uint32_t  flags,
MMAL_CONNECTION_T **  connection 
)

Create and add a connection to a graph. Allows the client to create and add an internal connection to a graph.

Parameters
graphinstance of the graph
outthe output port to use for the connection
inthe input port to use for the connection
flagsthe flags specifying which type of connection should be created
connectionif not NULL, will contain a pointer to the created connection
Returns
MMAL_SUCCESS on success