tag: add a new variant of int tags, with a realtime unit property

The idea is, consumers of a tag, can check the realtime property, and
if set to something other than TAG_REALTIME_NONE, schedule a realtime
update.

For example, it could be used to track song progress.
This commit is contained in:
Daniel Eklöf 2018-12-27 11:43:27 +01:00
parent 9a94c9c1f7
commit 025c6991a3
2 changed files with 34 additions and 0 deletions

8
tag.h
View file

@ -4,6 +4,11 @@
#include <stdbool.h>
enum tag_realtime_unit {
TAG_REALTIME_NONE,
TAG_REALTIME_SECONDS
};
struct tag {
void *private;
@ -16,6 +21,7 @@ struct tag {
long (*min)(const struct tag *tag);
long (*max)(const struct tag *tag);
enum tag_realtime_unit (*realtime)(const struct tag *tag);
};
struct tag_set {
@ -25,6 +31,8 @@ struct tag_set {
struct tag *tag_new_int(const char *name, long value);
struct tag *tag_new_int_range(const char *name, long value, long min, long max);
struct tag *tag_new_int_realtime(const char *name, long value, long min,
long max, enum tag_realtime_unit unit);
struct tag *tag_new_bool(const char *name, bool value);
struct tag *tag_new_float(const char *name, double value);
struct tag *tag_new_string(const char *name, const char *value);