mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-04-20 03:35:41 +02:00
tag: refresh_in() *must* use the realtime unit
This commit is contained in:
parent
67bd38f5df
commit
13cc11e200
3 changed files with 9 additions and 9 deletions
|
@ -129,10 +129,6 @@ instantiate(const struct particle *particle, const struct tag_set *tags)
|
|||
|
||||
if (rt == TAG_REALTIME_NONE)
|
||||
return exposable;
|
||||
else if (rt != TAG_REALTIME_SECONDS) {
|
||||
LOG_WARN("unimplemented tag realtime unit: %d", rt);
|
||||
return exposable;
|
||||
}
|
||||
|
||||
#if 0
|
||||
long units_per_segment = (max - min) / p->width;
|
||||
|
@ -155,7 +151,7 @@ instantiate(const struct particle *particle, const struct tag_set *tags)
|
|||
|
||||
#endif
|
||||
|
||||
if (!tag->refresh_in(tag, units_til_next_segment * 1000))
|
||||
if (!tag->refresh_in(tag, units_til_next_segment))
|
||||
LOG_WARN("failed to schedule update of tag");
|
||||
|
||||
return exposable;
|
||||
|
|
8
tag.c
8
tag.c
|
@ -42,7 +42,7 @@ no_realtime(const struct tag *tag)
|
|||
}
|
||||
|
||||
static bool
|
||||
unimpl_refresh_in(const struct tag *tag, long milli_seconds)
|
||||
unimpl_refresh_in(const struct tag *tag, long units)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ int_as_float(const struct tag *tag)
|
|||
}
|
||||
|
||||
static bool
|
||||
int_refresh_in(const struct tag *tag, long milli_seconds)
|
||||
int_refresh_in(const struct tag *tag, long units)
|
||||
{
|
||||
const struct private *priv = tag->private;
|
||||
if (priv->value_as_int.realtime_unit == TAG_REALTIME_NONE)
|
||||
|
@ -126,6 +126,10 @@ int_refresh_in(const struct tag *tag, long milli_seconds)
|
|||
if (tag->owner == NULL || tag->owner->refresh_in == NULL)
|
||||
return false;
|
||||
|
||||
long milli_seconds = units;
|
||||
if (priv->value_as_int.realtime_unit == TAG_REALTIME_SECS)
|
||||
milli_seconds *= 1000;
|
||||
|
||||
return tag->owner->refresh_in(tag->owner, milli_seconds);
|
||||
}
|
||||
|
||||
|
|
4
tag.h
4
tag.h
|
@ -6,7 +6,7 @@
|
|||
|
||||
enum tag_realtime_unit {
|
||||
TAG_REALTIME_NONE,
|
||||
TAG_REALTIME_SECONDS
|
||||
TAG_REALTIME_SECS,
|
||||
};
|
||||
|
||||
struct module;
|
||||
|
@ -26,7 +26,7 @@ struct tag {
|
|||
long (*max)(const struct tag *tag);
|
||||
enum tag_realtime_unit (*realtime)(const struct tag *tag);
|
||||
|
||||
bool (*refresh_in)(const struct tag *tag, long milli_seconds);
|
||||
bool (*refresh_in)(const struct tag *tag, long units);
|
||||
};
|
||||
|
||||
struct tag_set {
|
||||
|
|
Loading…
Add table
Reference in a new issue