2017-11-21 19:34:37 +01:00
|
|
|
/* 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_IO_H__
|
|
|
|
|
#define __SPA_IO_H__
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include <spa/support/type-map.h>
|
|
|
|
|
|
|
|
|
|
/** Base for IO structures to interface with node ports */
|
|
|
|
|
#define SPA_TYPE__IO SPA_TYPE_POINTER_BASE "IO"
|
|
|
|
|
#define SPA_TYPE_IO_BASE SPA_TYPE__IO ":"
|
|
|
|
|
|
|
|
|
|
/** Base for control structures */
|
|
|
|
|
#define SPA_TYPE_IO__Control SPA_TYPE_IO_BASE "Control"
|
|
|
|
|
#define SPA_TYPE_IO_CONTROL_BASE SPA_TYPE_IO__Control ":"
|
|
|
|
|
|
2017-11-29 13:25:56 +01:00
|
|
|
/** Base for controlable properties */
|
|
|
|
|
#define SPA_TYPE_IO__Prop SPA_TYPE_IO_BASE "Prop"
|
|
|
|
|
#define SPA_TYPE_IO_PROP_BASE SPA_TYPE_IO__Prop ":"
|
2017-11-21 19:34:37 +01:00
|
|
|
|
|
|
|
|
/** An io area to exchange buffers with a port */
|
|
|
|
|
#define SPA_TYPE_IO__Buffers SPA_TYPE_IO_BASE "Buffers"
|
|
|
|
|
|
2018-07-17 09:50:51 +02:00
|
|
|
/** IO area with clock information */
|
|
|
|
|
#define SPA_TYPE_IO__Clock SPA_TYPE_IO_BASE "Clock"
|
|
|
|
|
|
2017-11-21 19:34:37 +01:00
|
|
|
/** Buffers IO area
|
|
|
|
|
*
|
|
|
|
|
* IO information for a port on a node. This is allocated
|
|
|
|
|
* by the host and configured on all ports for which IO is requested.
|
|
|
|
|
*/
|
|
|
|
|
struct spa_io_buffers {
|
|
|
|
|
#define SPA_STATUS_OK 0
|
2018-04-19 20:10:47 +02:00
|
|
|
#define SPA_STATUS_NEED_BUFFER (1<<0)
|
|
|
|
|
#define SPA_STATUS_HAVE_BUFFER (1<<1)
|
|
|
|
|
#define SPA_STATUS_FORMAT_CHANGED (1<<2)
|
2018-05-08 10:42:17 +02:00
|
|
|
#define SPA_STATUS_PORT_CHANGED (1<<3)
|
2018-04-19 20:10:47 +02:00
|
|
|
#define SPA_STATUS_PARAM_CHANGED (1<<4)
|
2017-11-21 19:34:37 +01:00
|
|
|
int32_t status; /**< the status code */
|
|
|
|
|
uint32_t buffer_id; /**< a buffer id */
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#define SPA_IO_BUFFERS_INIT (struct spa_io_buffers) { SPA_STATUS_OK, SPA_ID_INVALID, }
|
|
|
|
|
|
|
|
|
|
/** Information about requested range */
|
|
|
|
|
#define SPA_TYPE_IO_CONTROL__Range SPA_TYPE_IO_CONTROL_BASE "Range"
|
|
|
|
|
|
|
|
|
|
/** A range, suitable for input ports that can suggest a range to output ports */
|
|
|
|
|
struct spa_io_control_range {
|
|
|
|
|
uint64_t offset; /**< offset in range */
|
|
|
|
|
uint32_t min_size; /**< minimum size of data */
|
|
|
|
|
uint32_t max_size; /**< maximum size of data */
|
|
|
|
|
};
|
|
|
|
|
|
2018-07-17 09:50:51 +02:00
|
|
|
/** A time source */
|
|
|
|
|
struct spa_io_clock {
|
2018-07-19 13:30:27 +02:00
|
|
|
uint64_t nsec; /**< time in nanoseconds */
|
|
|
|
|
struct spa_fraction rate; /**< rate for position/delay */
|
|
|
|
|
uint64_t position; /**< current position */
|
|
|
|
|
uint64_t delay; /**< delay between position and hardware,
|
|
|
|
|
add to position for capture,
|
|
|
|
|
subtract for playback */
|
2018-07-17 09:50:51 +02:00
|
|
|
};
|
|
|
|
|
|
2017-11-21 19:34:37 +01:00
|
|
|
struct spa_type_io {
|
|
|
|
|
uint32_t Buffers;
|
|
|
|
|
uint32_t ControlRange;
|
2017-11-29 13:25:56 +01:00
|
|
|
uint32_t Prop;
|
2018-07-17 09:50:51 +02:00
|
|
|
uint32_t Clock;
|
2017-11-21 19:34:37 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static inline void spa_type_io_map(struct spa_type_map *map, struct spa_type_io *type)
|
|
|
|
|
{
|
|
|
|
|
if (type->Buffers == 0) {
|
|
|
|
|
type->Buffers = spa_type_map_get_id(map, SPA_TYPE_IO__Buffers);
|
|
|
|
|
type->ControlRange = spa_type_map_get_id(map, SPA_TYPE_IO_CONTROL__Range);
|
2017-11-29 13:25:56 +01:00
|
|
|
type->Prop = spa_type_map_get_id(map, SPA_TYPE_IO__Prop);
|
2018-07-17 09:50:51 +02:00
|
|
|
type->Clock = spa_type_map_get_id(map, SPA_TYPE_IO__Clock);
|
2017-11-21 19:34:37 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
} /* extern "C" */
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif /* __SPA_IO_H__ */
|