mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-11 18:34:58 +01:00
Fixed Source creation with new Active mechanism.
This commit is contained in:
@@ -274,6 +274,9 @@ GstClockTime MediaPlayer::position()
|
||||
|
||||
void MediaPlayer::enable(bool on)
|
||||
{
|
||||
if ( !ready_ )
|
||||
return;
|
||||
|
||||
if ( enabled_ != on ) {
|
||||
|
||||
enabled_ = on;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "Visitor.h"
|
||||
#include "Log.h"
|
||||
|
||||
MediaSource::MediaSource() : Source(), path_(""), media_playing_(true)
|
||||
MediaSource::MediaSource() : Source(), path_("")
|
||||
{
|
||||
// create media player
|
||||
mediaplayer_ = new MediaPlayer;
|
||||
@@ -35,7 +35,7 @@ void MediaSource::setPath(const std::string &p)
|
||||
{
|
||||
path_ = p;
|
||||
mediaplayer_->open(path_);
|
||||
mediaplayer_->play(media_playing_);
|
||||
mediaplayer_->play(true);
|
||||
|
||||
Log::Notify("Opening %s", p.c_str());
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@ protected:
|
||||
Surface *mediasurface_;
|
||||
std::string path_;
|
||||
MediaPlayer *mediaplayer_;
|
||||
bool media_playing_;
|
||||
};
|
||||
|
||||
#endif // MEDIASOURCE_H
|
||||
|
||||
@@ -170,6 +170,7 @@ bool Rendering::init()
|
||||
//
|
||||
glfwWindowHint(GLFW_SAMPLES, 0); // no need for multisampling in displaying output
|
||||
output_.init(1, main_.window());
|
||||
output_.setIcon("images/vimix_256x256.png");
|
||||
// special callbacks for user input in output window
|
||||
glfwSetKeyCallback( output_.window(), WindowEscapeFullscreen);
|
||||
glfwSetMouseButtonCallback( output_.window(), WindowToggleFullscreen);
|
||||
|
||||
@@ -176,7 +176,7 @@ void Source::setMode(Source::Mode m)
|
||||
}
|
||||
|
||||
// choose frame if selected
|
||||
uint index_frame = m == Source::SELECTED ? 1 : 0;
|
||||
uint index_frame = m == Source::VISIBLE ? 0 : 1;
|
||||
for (auto f = frames_.begin(); f != frames_.end(); f++)
|
||||
(*f).second->setActive(index_frame);
|
||||
|
||||
|
||||
@@ -381,7 +381,6 @@ void UserInterface::handleMouse()
|
||||
|
||||
if ( !mousedown )
|
||||
{
|
||||
Log::Info("LMB down");
|
||||
mousedown = true;
|
||||
|
||||
// ask the view what was picked
|
||||
@@ -412,16 +411,11 @@ void UserInterface::handleMouse()
|
||||
s = nullptr;
|
||||
}
|
||||
}
|
||||
// Mixer::selection().toggle( Mixer::manager().currentSource() );
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
Mixer::manager().setCurrentSource( s );
|
||||
if (navigator.pannelVisible())
|
||||
navigator.showPannelSource( Mixer::manager().indexCurrentSource() );
|
||||
|
||||
}
|
||||
Mixer::manager().setCurrentSource( s );
|
||||
if (navigator.pannelVisible())
|
||||
navigator.showPannelSource( Mixer::manager().indexCurrentSource() );
|
||||
|
||||
// indicate to view that an action can be initiated (e.g. grab)
|
||||
Mixer::manager().view()->initiate();
|
||||
@@ -432,20 +426,17 @@ void UserInterface::handleMouse()
|
||||
}
|
||||
else if ( ImGui::IsMouseReleased(ImGuiMouseButton_Left) )
|
||||
{
|
||||
Log::Info("LMB release");
|
||||
mousedown = false;
|
||||
// picked = { nullptr, glm::vec2(0.f) };
|
||||
picked = { nullptr, glm::vec2(0.f) };
|
||||
}
|
||||
|
||||
if ( ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left) )
|
||||
{
|
||||
Log::Info("LMB double clic");
|
||||
// display source in left pannel
|
||||
navigator.showPannelSource( Mixer::manager().indexCurrentSource() );
|
||||
// discard current to select front most source
|
||||
// (because single clic maintains same source active)
|
||||
Mixer::manager().unsetCurrentSource();
|
||||
|
||||
}
|
||||
|
||||
// if ( mousedown && glm::distance(mouseclic[ImGuiMouseButton_Left], mousepos) > 3.f )
|
||||
@@ -1252,6 +1243,9 @@ void SourcePreview::draw(float width)
|
||||
setSource();
|
||||
else
|
||||
{
|
||||
// update source
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
source_->update( 1.f / io.Framerate);
|
||||
// render framebuffer
|
||||
source_->render();
|
||||
// draw preview
|
||||
|
||||
Reference in New Issue
Block a user