v0: improve compatibility

Implement RequestClockUpdate event and ClockUpdate message for
old clients.
This commit is contained in:
Wim Taymans 2020-02-11 11:23:28 +01:00
parent c12f2276c4
commit 293932d4ec
7 changed files with 152 additions and 21 deletions

View file

@ -28,6 +28,50 @@
extern "C" {
#endif
/** The state of the clock */
enum spa_clock0_state {
SPA_CLOCK0_STATE_STOPPED, /*< the clock is stopped */
SPA_CLOCK0_STATE_PAUSED, /*< the clock is paused */
SPA_CLOCK0_STATE_RUNNING, /*< the clock is running */
};
struct spa_command_node0_clock_update_body {
struct spa_pod_object_body body;
#define SPA_COMMAND_NODE0_CLOCK_UPDATE_TIME (1 << 0)
#define SPA_COMMAND_NODE0_CLOCK_UPDATE_SCALE (1 << 1)
#define SPA_COMMAND_NODE0_CLOCK_UPDATE_STATE (1 << 2)
#define SPA_COMMAND_NODE0_CLOCK_UPDATE_LATENCY (1 << 3)
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);
#define SPA_COMMAND_NODE0_CLOCK_UPDATE_FLAG_LIVE (1 << 0)
struct spa_pod_int flags SPA_ALIGNED(8);
struct spa_pod_long latency SPA_ALIGNED(8);
};
struct spa_command_node0_clock_update {
struct spa_pod pod;
struct spa_command_node0_clock_update_body body;
};
#define SPA_COMMAND_NODE0_CLOCK_UPDATE_INIT(type,change_mask,rate,ticks,monotonic_time,offset,scale,state,flags,latency) \
SPA_COMMAND_INIT_FULL(struct spa_command_node0_clock_update, \
sizeof(struct spa_command_node0_clock_update_body), 0, type, \
SPA_POD_INIT_Int(change_mask), \
SPA_POD_INIT_Int(rate), \
SPA_POD_INIT_Long(ticks), \
SPA_POD_INIT_Long(monotonic_time), \
SPA_POD_INIT_Long(offset), \
SPA_POD_INIT_Int(scale), \
SPA_POD_INIT_Int(state), \
SPA_POD_INIT_Int(flags), \
SPA_POD_INIT_Long(latency))
/** \class pw_impl_client_node0
*
* PipeWire client node interface