2016-06-28 12:21:56 +02:00
|
|
|
/* Simple Plugin API
|
2016-06-03 19:05:19 +02:00
|
|
|
* 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.
|
|
|
|
|
*/
|
|
|
|
|
|
2017-03-23 21:15:52 +01:00
|
|
|
#ifndef __SPA_COMMAND_NODE_H__
|
|
|
|
|
#define __SPA_COMMAND_NODE_H__
|
2016-06-03 19:05:19 +02:00
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2017-11-10 13:36:14 +01:00
|
|
|
#include <spa/support/type-map.h>
|
|
|
|
|
#include <spa/pod/command.h>
|
2016-06-03 19:05:19 +02:00
|
|
|
|
2017-05-26 09:09:31 +02:00
|
|
|
#define SPA_TYPE_COMMAND__Node SPA_TYPE_COMMAND_BASE "Node"
|
|
|
|
|
#define SPA_TYPE_COMMAND_NODE_BASE SPA_TYPE_COMMAND__Node ":"
|
2016-10-07 13:14:32 +02:00
|
|
|
|
2017-05-26 09:09:31 +02:00
|
|
|
#define SPA_TYPE_COMMAND_NODE__Pause SPA_TYPE_COMMAND_NODE_BASE "Pause"
|
|
|
|
|
#define SPA_TYPE_COMMAND_NODE__Start SPA_TYPE_COMMAND_NODE_BASE "Start"
|
|
|
|
|
#define SPA_TYPE_COMMAND_NODE__Flush SPA_TYPE_COMMAND_NODE_BASE "Flush"
|
|
|
|
|
#define SPA_TYPE_COMMAND_NODE__Drain SPA_TYPE_COMMAND_NODE_BASE "Drain"
|
|
|
|
|
#define SPA_TYPE_COMMAND_NODE__Marker SPA_TYPE_COMMAND_NODE_BASE "Marker"
|
|
|
|
|
#define SPA_TYPE_COMMAND_NODE__ClockUpdate SPA_TYPE_COMMAND_NODE_BASE "ClockUpdate"
|
2016-10-07 13:14:32 +02:00
|
|
|
|
2017-05-25 13:28:15 +02:00
|
|
|
struct spa_type_command_node {
|
2017-05-26 08:05:01 +02:00
|
|
|
uint32_t Pause;
|
|
|
|
|
uint32_t Start;
|
|
|
|
|
uint32_t Flush;
|
|
|
|
|
uint32_t Drain;
|
|
|
|
|
uint32_t Marker;
|
|
|
|
|
uint32_t ClockUpdate;
|
2017-05-25 13:28:15 +02:00
|
|
|
};
|
2017-03-22 10:04:24 +01:00
|
|
|
|
|
|
|
|
static inline void
|
2017-05-26 08:05:01 +02:00
|
|
|
spa_type_command_node_map(struct spa_type_map *map, struct spa_type_command_node *type)
|
2017-03-22 10:04:24 +01:00
|
|
|
{
|
2017-05-26 08:05:01 +02:00
|
|
|
if (type->Pause == 0) {
|
|
|
|
|
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->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);
|
|
|
|
|
type->ClockUpdate = spa_type_map_get_id(map, SPA_TYPE_COMMAND_NODE__ClockUpdate);
|
|
|
|
|
}
|
2017-03-22 10:04:24 +01:00
|
|
|
}
|
2017-03-15 16:21:05 +01:00
|
|
|
|
2016-09-09 16:05:58 +02:00
|
|
|
/**
|
2017-05-25 13:28:15 +02:00
|
|
|
* spa_command_node_clock_update:
|
2016-09-09 16:05:58 +02:00
|
|
|
* @change_mask: marks which fields are updated
|
2016-09-12 12:28:51 +02:00
|
|
|
* @rate: the number of @ticks per second
|
|
|
|
|
* @ticks: the new ticks, when @change_mask = 1<<0
|
|
|
|
|
* @monotonic_time: the new monotonic time in nanoseconds associated with
|
|
|
|
|
* @ticks, when @change_mask = 1<<0
|
2016-09-09 16:05:58 +02:00
|
|
|
* @offset: the difference between the time when this update was generated
|
2016-09-12 12:28:51 +02:00
|
|
|
* and @monotonic_time in nanoseconds
|
2016-09-09 16:05:58 +02:00
|
|
|
* @scale: update to the speed stored as Q16.16, @change_mask = 1<<1
|
|
|
|
|
* @state: the new clock state, when @change_mask = 1<<2
|
|
|
|
|
*/
|
2017-05-25 13:28:15 +02:00
|
|
|
struct spa_command_node_clock_update_body {
|
2017-05-26 08:05:01 +02:00
|
|
|
struct spa_pod_object_body body;
|
2017-05-26 09:09:31 +02:00
|
|
|
#define SPA_COMMAND_NODE_CLOCK_UPDATE_TIME (1 << 0)
|
|
|
|
|
#define SPA_COMMAND_NODE_CLOCK_UPDATE_SCALE (1 << 1)
|
|
|
|
|
#define SPA_COMMAND_NODE_CLOCK_UPDATE_STATE (1 << 2)
|
|
|
|
|
#define SPA_COMMAND_NODE_CLOCK_UPDATE_LATENCY (1 << 3)
|
2017-05-26 08:05:01 +02:00
|
|
|
struct spa_pod_int change_mask SPA_ALIGNED(8);
|
|
|
|
|
struct spa_pod_int rate SPA_ALIGNED(8);
|
|
|
|
|
struct spa_pod_long ticks SPA_ALIGNED(8);
|
|
|
|
|
struct spa_pod_long monotonic_time SPA_ALIGNED(8);
|
|
|
|
|
struct spa_pod_long offset SPA_ALIGNED(8);
|
|
|
|
|
struct spa_pod_int scale SPA_ALIGNED(8);
|
|
|
|
|
struct spa_pod_int state SPA_ALIGNED(8);
|
2017-05-26 09:09:31 +02:00
|
|
|
#define SPA_COMMAND_NODE_CLOCK_UPDATE_FLAG_LIVE (1 << 0)
|
2017-05-26 08:05:01 +02:00
|
|
|
struct spa_pod_int flags SPA_ALIGNED(8);
|
|
|
|
|
struct spa_pod_long latency SPA_ALIGNED(8);
|
2017-05-25 13:28:15 +02:00
|
|
|
};
|
2017-03-15 16:21:05 +01:00
|
|
|
|
2017-05-25 13:28:15 +02:00
|
|
|
struct spa_command_node_clock_update {
|
2017-05-26 08:05:01 +02:00
|
|
|
struct spa_pod pod;
|
|
|
|
|
struct spa_command_node_clock_update_body body;
|
2017-05-25 13:28:15 +02:00
|
|
|
};
|
2016-09-09 16:05:58 +02:00
|
|
|
|
2017-03-23 21:15:52 +01:00
|
|
|
#define SPA_COMMAND_NODE_CLOCK_UPDATE_INIT(type,change_mask,rate,ticks,monotonic_time,offset,scale,state,flags,latency) \
|
2017-05-26 09:09:31 +02:00
|
|
|
SPA_COMMAND_INIT_COMPLEX(struct spa_command_node_clock_update, \
|
|
|
|
|
sizeof(struct spa_command_node_clock_update_body), type, \
|
|
|
|
|
SPA_POD_INT_INIT(change_mask), \
|
|
|
|
|
SPA_POD_INT_INIT(rate), \
|
|
|
|
|
SPA_POD_LONG_INIT(ticks), \
|
|
|
|
|
SPA_POD_LONG_INIT(monotonic_time), \
|
|
|
|
|
SPA_POD_LONG_INIT(offset), \
|
|
|
|
|
SPA_POD_INT_INIT(scale), \
|
|
|
|
|
SPA_POD_INT_INIT(state), \
|
|
|
|
|
SPA_POD_INT_INIT(flags), \
|
|
|
|
|
SPA_POD_LONG_INIT(latency))
|
2017-03-15 16:21:05 +01:00
|
|
|
|
2016-06-03 19:05:19 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
} /* extern "C" */
|
|
|
|
|
#endif
|
|
|
|
|
|
2017-05-26 08:05:01 +02:00
|
|
|
#endif /* _SPA_COMMAND_NODE_H__ */
|