From 3dbd498b8f723d0700dd0ef75883efb7fa7f373f Mon Sep 17 00:00:00 2001 From: falsycat Date: Mon, 14 Oct 2019 00:00:00 +0000 Subject: [PATCH] [add] Added length property to sjplayer.Context. --- sjplayer/src/sjplayer/Context.d | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sjplayer/src/sjplayer/Context.d b/sjplayer/src/sjplayer/Context.d index 3fd3724..28387f0 100644 --- a/sjplayer/src/sjplayer/Context.d +++ b/sjplayer/src/sjplayer/Context.d @@ -61,6 +61,11 @@ class Context { Create(params.filter!(x => x.name == factory[0]), builder); } + length_ = 0; + foreach (ref param; params) { + length_ = length_.max(param.period.end); + } + elements_ = builder.elements[]; drawers_ = builder.drawers[]; controllers_ = builder.controllers[]; @@ -126,6 +131,10 @@ class Context { @property inout(PostEffectControllerInterface) posteffect() inout { return posteffect_controller_; } + /// + @property float length() const { + return length_; + } private: class Builder : ContextBuilderInterface { @@ -154,4 +163,6 @@ class Context { ActorControllerInterface actor_controller_; PostEffectControllerInterface posteffect_controller_; + + float length_; }