Remove dynamic types

Do not use dynamic types anymore. The reason is that it's difficult:

- to maintain a shared type database over a network.
- the extra overhead when translating between processes and for
  maintaining the translation tables.
- race conditions in translating in RT-threads, this is a problem
  because we want to make event streams.

We now have simple enums with types and extension points for all
types. This is also nicer to use in general.
We don't need the mapper anymore or pass strings around as types.
There is a parallel type info system to get more info about ids and
enums and their hierarchy. It can also be used for debugging.
This commit is contained in:
Wim Taymans 2018-08-23 17:47:57 +02:00
parent e6977fa178
commit fca3e1d85d
162 changed files with 5200 additions and 7461 deletions

View file

@ -24,56 +24,8 @@
extern "C" {
#endif
#include <spa/support/type-map.h>
#include <spa/pod/command.h>
#define SPA_TYPE_COMMAND__Node SPA_TYPE_COMMAND_BASE "Node"
#define SPA_TYPE_COMMAND_NODE_BASE SPA_TYPE_COMMAND__Node ":"
/** Suspend a node. This will release all resources of the node */
#define SPA_TYPE_COMMAND_NODE__Suspend SPA_TYPE_COMMAND_NODE_BASE "Suspend"
/** Pause processing of a node */
#define SPA_TYPE_COMMAND_NODE__Pause SPA_TYPE_COMMAND_NODE_BASE "Pause"
/** Start processing of a node */
#define SPA_TYPE_COMMAND_NODE__Start SPA_TYPE_COMMAND_NODE_BASE "Start"
/** Enable ports of a node. When sent to a port, enables just that port. Enabled
* ports on a Started node begin streaming immediately */
#define SPA_TYPE_COMMAND_NODE__Enable SPA_TYPE_COMMAND_NODE_BASE "Enable"
/** Disable ports of a node. When sent to a port, disables just that port. */
#define SPA_TYPE_COMMAND_NODE__Disable SPA_TYPE_COMMAND_NODE_BASE "Disable"
/** Flush all data from the node or port */
#define SPA_TYPE_COMMAND_NODE__Flush SPA_TYPE_COMMAND_NODE_BASE "Flush"
/** Drain all data from the node or port */
#define SPA_TYPE_COMMAND_NODE__Drain SPA_TYPE_COMMAND_NODE_BASE "Drain"
/** Set a marker on a node or port */
#define SPA_TYPE_COMMAND_NODE__Marker SPA_TYPE_COMMAND_NODE_BASE "Marker"
struct spa_type_command_node {
uint32_t Suspend;
uint32_t Pause;
uint32_t Start;
uint32_t Enable;
uint32_t Disable;
uint32_t Flush;
uint32_t Drain;
uint32_t Marker;
};
static inline void
spa_type_command_node_map(struct spa_type_map *map, struct spa_type_command_node *type)
{
if (type->Suspend == 0) {
type->Suspend = spa_type_map_get_id(map, SPA_TYPE_COMMAND_NODE__Suspend);
type->Pause = spa_type_map_get_id(map, SPA_TYPE_COMMAND_NODE__Pause);
type->Start = spa_type_map_get_id(map, SPA_TYPE_COMMAND_NODE__Start);
type->Enable = spa_type_map_get_id(map, SPA_TYPE_COMMAND_NODE__Enable);
type->Disable = spa_type_map_get_id(map, SPA_TYPE_COMMAND_NODE__Disable);
type->Flush = spa_type_map_get_id(map, SPA_TYPE_COMMAND_NODE__Flush);
type->Drain = spa_type_map_get_id(map, SPA_TYPE_COMMAND_NODE__Drain);
type->Marker = spa_type_map_get_id(map, SPA_TYPE_COMMAND_NODE__Marker);
}
}
#ifdef __cplusplus
} /* extern "C" */
#endif