types: work on types

Move static pod types to type system
work on type info for types
Move the event and command ids to an enum to make it easier to extend
later.
This commit is contained in:
Wim Taymans 2018-08-24 10:53:09 +02:00
parent fca3e1d85d
commit 805e3bb6c1
82 changed files with 812 additions and 924 deletions

View file

@ -1,55 +0,0 @@
/* Simple Plugin API
* Copyright (C) 2016 Wim Taymans <wim.taymans@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __SPA_COMMAND_NODE_TYPES_H__
#define __SPA_COMMAND_NODE_TYPES_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/utils/type-info.h>
#include <spa/node/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"
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* _SPA_COMMAND_NODE_TYPES_H__ */

View file

@ -26,6 +26,23 @@ extern "C" {
#include <spa/pod/command.h>
enum spa_node_command {
SPA_NODE_COMMAND_Suspend,
SPA_NODE_COMMAND_Pause,
SPA_NODE_COMMAND_Start,
SPA_NODE_COMMAND_Enable,
SPA_NODE_COMMAND_Disable,
SPA_NODE_COMMAND_Flush,
SPA_NODE_COMMAND_Drain,
SPA_NODE_COMMAND_Marker,
};
#define SPA_NODE_COMMAND_ID(cmd) SPA_COMMAND_ID(cmd, SPA_ID_COMMAND_Node)
#define SPA_NODE_COMMAND_INIT(id) (struct spa_command) \
{ { sizeof(struct spa_command_body), SPA_ID_Object }, \
{ { id, SPA_ID_COMMAND_Node } } } \
#ifdef __cplusplus
} /* extern "C" */
#endif

View file

@ -1,41 +0,0 @@
/* Simple Plugin API
* Copyright (C) 2016 Wim Taymans <wim.taymans@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __SPA_EVENT_NODE_TYPES_H__
#define __SPA_EVENT_NODE_TYPES_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/utils/type-info.h>
#include <spa/node/event.h>
#define SPA_TYPE_EVENT__Node SPA_TYPE_EVENT_BASE "Node"
#define SPA_TYPE_EVENT_NODE_BASE SPA_TYPE_EVENT__Node ":"
#define SPA_TYPE_EVENT_NODE__Error SPA_TYPE_EVENT_NODE_BASE "Error"
#define SPA_TYPE_EVENT_NODE__Buffering SPA_TYPE_EVENT_NODE_BASE "Buffering"
#define SPA_TYPE_EVENT_NODE__RequestRefresh SPA_TYPE_EVENT_NODE_BASE "RequestRefresh"
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __SPA_EVENT_NODE_TYPES_H__ */

View file

@ -28,6 +28,14 @@ extern "C" {
#include <spa/pod/event.h>
#include <spa/node/node.h>
enum spa_node_event {
SPA_NODE_EVENT_Error,
SPA_NODE_EVENT_Buffering,
SPA_NODE_EVENT_RequestRefresh,
};
#define SPA_NODE_EVENT_ID(ev) SPA_EVENT_ID(ev, SPA_ID_EVENT_Node)
#ifdef __cplusplus
} /* extern "C" */
#endif

View file

@ -1,42 +0,0 @@
/* Simple Plugin API
* Copyright (C) 2016 Wim Taymans <wim.taymans@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __SPA_NODE_TYPES_H__
#define __SPA_NODE_TYPES_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/utils/type-info.h>
#include <spa/node/node.h>
#define SPA_TYPE__Node SPA_TYPE_INTERFACE_BASE "Node"
#define SPA_TYPE_NODE_BASE SPA_TYPE__Node ":"
static const struct spa_type_info spa_type_node[] = {
{ SPA_ID_INTERFACE_Node, SPA_TYPE__Node, SPA_POD_TYPE_ID, },
{ 0, NULL, },
};
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __SPA_NODE_TYPES_H__ */

View file

@ -17,14 +17,17 @@
* Boston, MA 02110-1301, USA.
*/
#ifndef __SPA_IO_TYPES_H__
#define __SPA_IO_TYPES_H__
#ifndef __SPA_NODE_TYPES_H__
#define __SPA_NODE_TYPES_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/utils/type-info.h>
#include <spa/node/command.h>
#include <spa/node/event.h>
#include <spa/node/io.h>
/** Base for IO structures to interface with node ports */
@ -48,4 +51,4 @@ extern "C" {
} /* extern "C" */
#endif
#endif /* __SPA_IO_TYPES_H__ */
#endif /* _SPA_NODE_TYPES_H__ */