Remove direction

Direction is tied to the port id.
Handle nodes with fixed ports.
This commit is contained in:
Wim Taymans 2016-08-29 18:31:53 +02:00
parent 7d8e2d53f7
commit 9485bd77e7
25 changed files with 246 additions and 165 deletions

View file

@ -103,17 +103,15 @@ typedef struct {
typedef struct {
uint32_t port_id;
uint32_t change_mask;
SpaDirection direction;
unsigned int n_possible_formats;
SpaFormat **possible_formats;
const SpaProps *props;
const SpaPortInfo *info;
} SpaControlCmdPortUpdate;
#define SPA_CONTROL_CMD_PORT_UPDATE_DIRECTION (1 << 0)
#define SPA_CONTROL_CMD_PORT_UPDATE_POSSIBLE_FORMATS (1 << 1)
#define SPA_CONTROL_CMD_PORT_UPDATE_PROPS (1 << 2)
#define SPA_CONTROL_CMD_PORT_UPDATE_INFO (1 << 3)
#define SPA_CONTROL_CMD_PORT_UPDATE_POSSIBLE_FORMATS (1 << 0)
#define SPA_CONTROL_CMD_PORT_UPDATE_PROPS (1 << 1)
#define SPA_CONTROL_CMD_PORT_UPDATE_INFO (1 << 2)
/* SPA_CONTROL_CMD_PORT_REMOVED */
typedef struct {
@ -141,7 +139,6 @@ typedef struct {
/* SPA_CONTROL_CMD_ADD_PORT */
typedef struct {
uint32_t port_id;
SpaDirection direction;
} SpaControlCmdAddPort;
/* SPA_CONTROL_CMD_REMOVE_PORT */

View file

@ -61,12 +61,6 @@ typedef enum {
SPA_RESULT_WRONG_STATE = -29,
} SpaResult;
typedef enum {
SPA_DIRECTION_INVALID = 0,
SPA_DIRECTION_INPUT,
SPA_DIRECTION_OUTPUT
} SpaDirection;
typedef void (*SpaNotify) (void *data);
#define SPA_N_ELEMENTS(arr) (sizeof (arr) / sizeof ((arr)[0]))

View file

@ -66,20 +66,32 @@ typedef enum {
struct _SpaEvent {
SpaEventType type;
uint32_t port_id;
void *data;
size_t size;
};
typedef struct {
SpaDirection direction;
uint32_t port_id;
} SpaEventPortAdded;
typedef struct {
uint32_t port_id;
} SpaEventPortRemoved;
typedef struct {
SpaNodeState state;
} SpaEventStateChange;
typedef struct {
uint32_t port_id;
} SpaEventHaveOutput;
typedef struct {
uint32_t port_id;
} SpaEventNeedInput;
typedef struct {
uint32_t port_id;
uint32_t buffer_id;
} SpaEventReuseBuffer;

View file

@ -267,8 +267,22 @@ struct _SpaNode {
unsigned int n_output_ports,
uint32_t *output_ids);
/**
* SpaNode::add_port:
* @node: a #SpaNode
* @port_id: an unused port id
*
* Make a new port with @port_id. The called should use get_port_ids() to
* find an unused id.
*
* Input port ids should be between 0 and max_input_ports and output ports
* between max_input_ports and max_input_ports + max_output_ports as obtained
* from get_port_ids().
*
* Returns: #SPA_RESULT_OK on success
* #SPA_RESULT_INVALID_ARGUMENTS when node is %NULL
*/
SpaResult (*add_port) (SpaNode *node,
SpaDirection direction,
uint32_t port_id);
SpaResult (*remove_port) (SpaNode *node,
uint32_t port_id);