Implementation of OSC targets Position, Size, Angle and Seek

Creation of SourceCallback to seek in MediaSource
This commit is contained in:
Bruno Herbelin
2022-07-27 17:55:51 +02:00
parent 057dd9c01d
commit 1a2471a32d
7 changed files with 94 additions and 4 deletions

View File

@@ -19,6 +19,8 @@
#include "defines.h"
#include "Source.h"
#include "MediaSource.h"
#include "MediaPlayer.h"
#include "UpdateCallback.h"
#include "Visitor.h"
#include "Log.h"
@@ -458,6 +460,38 @@ SourceCallback *RePlay::clone() const
}
Seek::Seek(float time) : SourceCallback(), target_time_(time)
{
}
void Seek::update(Source *s, float dt)
{
SourceCallback::update(s, dt);
// perform seek when ready
if ( status_ == READY ){
// access media player if target source is a media source
MediaSource *ms = dynamic_cast<MediaSource *>(s);
if (ms != nullptr)
ms->mediaplayer()->seek( GST_SECOND * target_time_ );
status_ = FINISHED;
}
}
SourceCallback *Seek::clone() const
{
return new Seek(target_time_);
}
void Seek::accept(Visitor& v)
{
SourceCallback::accept(v);
v.visit(*this);
}
SetGeometry::SetGeometry(const Group *g, float ms, bool revert) : SourceCallback(),
duration_(ms), bidirectional_(revert)
{