mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-17 13:19:59 +01:00
New Reload source function
Generalize the reload of stream source to all types of sources. Enable OSC command to reload source.
This commit is contained in:
@@ -209,6 +209,11 @@ void CloneSource::replay()
|
|||||||
filter_->reset();
|
filter_->reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CloneSource::reload()
|
||||||
|
{
|
||||||
|
replay();
|
||||||
|
}
|
||||||
|
|
||||||
guint64 CloneSource::playtime () const
|
guint64 CloneSource::playtime () const
|
||||||
{
|
{
|
||||||
if (filter_->type() != FrameBufferFilter::FILTER_PASSTHROUGH)
|
if (filter_->type() != FrameBufferFilter::FILTER_PASSTHROUGH)
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ public:
|
|||||||
void play (bool on) override;
|
void play (bool on) override;
|
||||||
bool playable () const override;
|
bool playable () const override;
|
||||||
void replay () override;
|
void replay () override;
|
||||||
|
void reload() override;
|
||||||
guint64 playtime () const override;
|
guint64 playtime () const override;
|
||||||
uint texture() const override;
|
uint texture() const override;
|
||||||
Failure failed() const override;
|
Failure failed() const override;
|
||||||
|
|||||||
@@ -612,6 +612,10 @@ bool Control::receiveSourceAttribute(Source *target, const std::string &attribut
|
|||||||
else if ( attribute.compare(OSC_SOURCE_REPLAY) == 0) {
|
else if ( attribute.compare(OSC_SOURCE_REPLAY) == 0) {
|
||||||
target->call( new RePlay() );
|
target->call( new RePlay() );
|
||||||
}
|
}
|
||||||
|
/// e.g. '/vimix/current/reload'
|
||||||
|
else if ( attribute.compare(OSC_SOURCE_RELOAD) == 0) {
|
||||||
|
target->reload();
|
||||||
|
}
|
||||||
/// e.g. '/vimix/current/alpha f 0.3'
|
/// e.g. '/vimix/current/alpha f 0.3'
|
||||||
else if ( attribute.compare(OSC_SOURCE_LOCK) == 0) {
|
else if ( attribute.compare(OSC_SOURCE_LOCK) == 0) {
|
||||||
float x = 1.f;
|
float x = 1.f;
|
||||||
|
|||||||
@@ -38,6 +38,7 @@
|
|||||||
#define OSC_SOURCE_PLAY "/play"
|
#define OSC_SOURCE_PLAY "/play"
|
||||||
#define OSC_SOURCE_PAUSE "/pause"
|
#define OSC_SOURCE_PAUSE "/pause"
|
||||||
#define OSC_SOURCE_REPLAY "/replay"
|
#define OSC_SOURCE_REPLAY "/replay"
|
||||||
|
#define OSC_SOURCE_RELOAD "/reload"
|
||||||
#define OSC_SOURCE_ALPHA "/alpha"
|
#define OSC_SOURCE_ALPHA "/alpha"
|
||||||
#define OSC_SOURCE_LOOM "/loom"
|
#define OSC_SOURCE_LOOM "/loom"
|
||||||
#define OSC_SOURCE_TRANSPARENCY "/transparency"
|
#define OSC_SOURCE_TRANSPARENCY "/transparency"
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ FilteringProgram::FilteringProgram(const std::string &name, const std::string &f
|
|||||||
}
|
}
|
||||||
|
|
||||||
FilteringProgram::FilteringProgram(const FilteringProgram &other) :
|
FilteringProgram::FilteringProgram(const FilteringProgram &other) :
|
||||||
name_(other.name_), code_(other.code_), parameters_(other.parameters_), two_pass_filter_(other.two_pass_filter_)
|
name_(other.name_), code_(other.code_), two_pass_filter_(other.two_pass_filter_), parameters_(other.parameters_)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -162,6 +162,11 @@ void MediaSource::replay ()
|
|||||||
mediaplayer_->rewind();
|
mediaplayer_->rewind();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MediaSource::reload ()
|
||||||
|
{
|
||||||
|
mediaplayer_->reopen();
|
||||||
|
}
|
||||||
|
|
||||||
guint64 MediaSource::playtime () const
|
guint64 MediaSource::playtime () const
|
||||||
{
|
{
|
||||||
return mediaplayer_->position();
|
return mediaplayer_->position();
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ public:
|
|||||||
void play (bool) override;
|
void play (bool) override;
|
||||||
bool playable () const override;
|
bool playable () const override;
|
||||||
void replay () override;
|
void replay () override;
|
||||||
|
void reload () override;
|
||||||
guint64 playtime () const override;
|
guint64 playtime () const override;
|
||||||
void render() override;
|
void render() override;
|
||||||
Failure failed() const override;
|
Failure failed() const override;
|
||||||
|
|||||||
@@ -162,6 +162,17 @@ void RenderSource::replay ()
|
|||||||
reset_ = true;
|
reset_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RenderSource::reload ()
|
||||||
|
{
|
||||||
|
// reset renderbuffer_
|
||||||
|
if (renderbuffer_)
|
||||||
|
delete renderbuffer_;
|
||||||
|
renderbuffer_ = nullptr;
|
||||||
|
|
||||||
|
// request next frame to reset
|
||||||
|
reset_ = true;
|
||||||
|
}
|
||||||
|
|
||||||
glm::vec3 RenderSource::resolution() const
|
glm::vec3 RenderSource::resolution() const
|
||||||
{
|
{
|
||||||
if (rendered_output_ != nullptr)
|
if (rendered_output_ != nullptr)
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ public:
|
|||||||
bool playing () const override { return !paused_; }
|
bool playing () const override { return !paused_; }
|
||||||
void play (bool) override;
|
void play (bool) override;
|
||||||
void replay () override;
|
void replay () override;
|
||||||
|
void reload () override;
|
||||||
bool playable () const override { return true; }
|
bool playable () const override { return true; }
|
||||||
guint64 playtime () const override { return runtime_; }
|
guint64 playtime () const override { return runtime_; }
|
||||||
Failure failed () const override;
|
Failure failed () const override;
|
||||||
|
|||||||
@@ -277,10 +277,14 @@ void SessionFileSource::load(const std::string &p, uint level)
|
|||||||
path_ = p;
|
path_ = p;
|
||||||
|
|
||||||
// delete session
|
// delete session
|
||||||
if (session_) {
|
if (session_)
|
||||||
delete session_;
|
delete session_;
|
||||||
session_ = nullptr;
|
session_ = nullptr;
|
||||||
}
|
|
||||||
|
// reset renderbuffer_
|
||||||
|
if (renderbuffer_)
|
||||||
|
delete renderbuffer_;
|
||||||
|
renderbuffer_ = nullptr;
|
||||||
|
|
||||||
// init session
|
// init session
|
||||||
if ( path_.empty() ) {
|
if ( path_.empty() ) {
|
||||||
@@ -299,6 +303,11 @@ void SessionFileSource::load(const std::string &p, uint level)
|
|||||||
ready_ = false;
|
ready_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SessionFileSource::reload()
|
||||||
|
{
|
||||||
|
load(path_);
|
||||||
|
}
|
||||||
|
|
||||||
void SessionFileSource::init()
|
void SessionFileSource::init()
|
||||||
{
|
{
|
||||||
// init is first about getting the loaded session
|
// init is first about getting the loaded session
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ public:
|
|||||||
|
|
||||||
// SessionFile Source specific interface
|
// SessionFile Source specific interface
|
||||||
void load(const std::string &p = "", uint level = 0);
|
void load(const std::string &p = "", uint level = 0);
|
||||||
|
void reload () override;
|
||||||
|
|
||||||
inline std::string path() const { return path_; }
|
inline std::string path() const { return path_; }
|
||||||
|
|
||||||
|
|||||||
@@ -184,6 +184,7 @@ public:
|
|||||||
virtual bool playing () const = 0;
|
virtual bool playing () const = 0;
|
||||||
virtual void play (bool on) = 0;
|
virtual void play (bool on) = 0;
|
||||||
virtual void replay () {}
|
virtual void replay () {}
|
||||||
|
virtual void reload () {}
|
||||||
virtual guint64 playtime () const { return 0; }
|
virtual guint64 playtime () const { return 0; }
|
||||||
|
|
||||||
// a Source shall informs if the source failed (i.e. shall be deleted)
|
// a Source shall informs if the source failed (i.e. shall be deleted)
|
||||||
|
|||||||
@@ -34,13 +34,13 @@ public:
|
|||||||
void play (bool) override;
|
void play (bool) override;
|
||||||
bool playable () const override;
|
bool playable () const override;
|
||||||
void replay () override;
|
void replay () override;
|
||||||
|
void reload () override;
|
||||||
guint64 playtime () const override;
|
guint64 playtime () const override;
|
||||||
Failure failed() const override;
|
Failure failed() const override;
|
||||||
uint texture() const override;
|
uint texture() const override;
|
||||||
|
|
||||||
// pure virtual interface
|
// pure virtual interface
|
||||||
virtual Stream *stream() const = 0;
|
virtual Stream *stream() const = 0;
|
||||||
void reload ();
|
|
||||||
|
|
||||||
// Source interface
|
// Source interface
|
||||||
virtual void accept (Visitor& v) override;
|
virtual void accept (Visitor& v) override;
|
||||||
|
|||||||
Reference in New Issue
Block a user