mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-13 03:09:57 +01:00
Display mixing source original texture when inactive
Re-using activesurface_ for manipulation and display of the source's input texture in the Mixer icon when inactive.
This commit is contained in:
@@ -519,7 +519,7 @@ void MediaPlayer::enable(bool on)
|
|||||||
if ( enabled_ != on ) {
|
if ( enabled_ != on ) {
|
||||||
|
|
||||||
// option to automatically rewind each time the player is disabled
|
// option to automatically rewind each time the player is disabled
|
||||||
if (!on && rewind_on_disable_ )
|
if (!on && rewind_on_disable_ && desired_state_ == GST_STATE_PLAYING)
|
||||||
rewind(true);
|
rewind(true);
|
||||||
|
|
||||||
// apply change
|
// apply change
|
||||||
@@ -529,9 +529,8 @@ void MediaPlayer::enable(bool on)
|
|||||||
GstState requested_state = GST_STATE_PAUSED;
|
GstState requested_state = GST_STATE_PAUSED;
|
||||||
|
|
||||||
// unpause only if enabled
|
// unpause only if enabled
|
||||||
if (enabled_) {
|
if (enabled_)
|
||||||
requested_state = desired_state_;
|
requested_state = desired_state_;
|
||||||
}
|
|
||||||
|
|
||||||
// apply state change
|
// apply state change
|
||||||
GstStateChangeReturn ret = gst_element_set_state (pipeline_, requested_state);
|
GstStateChangeReturn ret = gst_element_set_state (pipeline_, requested_state);
|
||||||
|
|||||||
@@ -66,8 +66,17 @@ void SessionSource::setActive (bool on)
|
|||||||
Source::setActive(on);
|
Source::setActive(on);
|
||||||
|
|
||||||
// change status of session (recursive change of internal sources)
|
// change status of session (recursive change of internal sources)
|
||||||
if (session_)
|
if (session_) {
|
||||||
session_->setActive(active_);
|
session_->setActive(active_);
|
||||||
|
|
||||||
|
// change visibility of active surface (show preview of session when inactive)
|
||||||
|
if (activesurface_) {
|
||||||
|
if (active_)
|
||||||
|
activesurface_->setTextureIndex(Resource::getTextureTransparent());
|
||||||
|
else
|
||||||
|
activesurface_->setTextureIndex(session_->frame()->texture());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SessionSource::update(float dt)
|
void SessionSource::update(float dt)
|
||||||
@@ -101,7 +110,6 @@ void SessionSource::replay ()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SessionFileSource::SessionFileSource(uint64_t id) : SessionSource(id), path_(""), initialized_(false), wait_for_sources_(false)
|
SessionFileSource::SessionFileSource(uint64_t id) : SessionSource(id), path_(""), initialized_(false), wait_for_sources_(false)
|
||||||
{
|
{
|
||||||
// specific node for transition view
|
// specific node for transition view
|
||||||
|
|||||||
25
Source.cpp
25
Source.cpp
@@ -268,7 +268,7 @@ Source::Source(uint64_t id) : SourceCore(), id_(id), ready_(false), symbol_(null
|
|||||||
|
|
||||||
// for drawing in mixing view
|
// for drawing in mixing view
|
||||||
mixingshader_ = new ImageShader;
|
mixingshader_ = new ImageShader;
|
||||||
mixingshader_->stipple = 1.0;
|
mixingshader_->stipple = 1.0f;
|
||||||
mixinggroup_ = nullptr;
|
mixinggroup_ = nullptr;
|
||||||
|
|
||||||
// create media surface:
|
// create media surface:
|
||||||
@@ -281,6 +281,7 @@ Source::Source(uint64_t id) : SourceCore(), id_(id), ready_(false), symbol_(null
|
|||||||
renderbuffer_ = nullptr;
|
renderbuffer_ = nullptr;
|
||||||
rendersurface_ = nullptr;
|
rendersurface_ = nullptr;
|
||||||
mixingsurface_ = nullptr;
|
mixingsurface_ = nullptr;
|
||||||
|
activesurface_ = nullptr;
|
||||||
maskbuffer_ = nullptr;
|
maskbuffer_ = nullptr;
|
||||||
maskimage_ = nullptr;
|
maskimage_ = nullptr;
|
||||||
mask_need_update_ = false;
|
mask_need_update_ = false;
|
||||||
@@ -454,11 +455,11 @@ void Source::attach(FrameBuffer *renderbuffer)
|
|||||||
groups_[View::LAYER]->attach(mixingsurface_);
|
groups_[View::LAYER]->attach(mixingsurface_);
|
||||||
|
|
||||||
// for views showing a scaled mixing surface, a dedicated transparent surface allows grabbing
|
// for views showing a scaled mixing surface, a dedicated transparent surface allows grabbing
|
||||||
Surface *surfacetmp = new Surface();
|
activesurface_ = new Surface();
|
||||||
surfacetmp->setTextureIndex(Resource::getTextureTransparent());
|
activesurface_->setTextureIndex(Resource::getTextureTransparent());
|
||||||
groups_[View::TEXTURE]->attach(surfacetmp);
|
groups_[View::TEXTURE]->attach(activesurface_);
|
||||||
groups_[View::MIXING]->attach(surfacetmp);
|
groups_[View::MIXING]->attach(activesurface_);
|
||||||
groups_[View::LAYER]->attach(surfacetmp);
|
groups_[View::LAYER]->attach(activesurface_);
|
||||||
|
|
||||||
// Transition group node is optionnal
|
// Transition group node is optionnal
|
||||||
if (groups_[View::TRANSITION]->numChildren() > 0)
|
if (groups_[View::TRANSITION]->numChildren() > 0)
|
||||||
@@ -866,8 +867,18 @@ void CloneSource::setActive (bool on)
|
|||||||
groups_[View::GEOMETRY]->visible_ = active_;
|
groups_[View::GEOMETRY]->visible_ = active_;
|
||||||
groups_[View::LAYER]->visible_ = active_;
|
groups_[View::LAYER]->visible_ = active_;
|
||||||
|
|
||||||
if ( mode_ > Source::UNINITIALIZED && origin_ != nullptr)
|
if (origin_) {
|
||||||
|
if ( mode_ > Source::UNINITIALIZED)
|
||||||
origin_->touch();
|
origin_->touch();
|
||||||
|
|
||||||
|
// change visibility of active surface (show preview of origin when inactive)
|
||||||
|
if (activesurface_) {
|
||||||
|
if (active_)
|
||||||
|
activesurface_->setTextureIndex(Resource::getTextureTransparent());
|
||||||
|
else
|
||||||
|
activesurface_->setTextureIndex(origin_->texture());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint CloneSource::texture() const
|
uint CloneSource::texture() const
|
||||||
|
|||||||
4
Source.h
4
Source.h
@@ -250,7 +250,11 @@ protected:
|
|||||||
// the rendersurface draws the renderbuffer in the scene
|
// the rendersurface draws the renderbuffer in the scene
|
||||||
// It is associated to the rendershader for mixing effects
|
// It is associated to the rendershader for mixing effects
|
||||||
FrameBufferSurface *rendersurface_;
|
FrameBufferSurface *rendersurface_;
|
||||||
|
|
||||||
|
// for the mixer, we have a surface with stippling to show
|
||||||
|
// the rendering, and a preview of the original texture
|
||||||
FrameBufferSurface *mixingsurface_;
|
FrameBufferSurface *mixingsurface_;
|
||||||
|
Surface *activesurface_;
|
||||||
|
|
||||||
// blendingshader provides mixing controls
|
// blendingshader provides mixing controls
|
||||||
ImageShader *blendingshader_;
|
ImageShader *blendingshader_;
|
||||||
|
|||||||
@@ -105,10 +105,19 @@ void StreamSource::setActive (bool on)
|
|||||||
// try to activate (may fail if source is cloned)
|
// try to activate (may fail if source is cloned)
|
||||||
Source::setActive(on);
|
Source::setActive(on);
|
||||||
|
|
||||||
|
if (stream_) {
|
||||||
// change status of stream (only if status changed)
|
// change status of stream (only if status changed)
|
||||||
if ( stream_ && active_ != was_active )
|
if (active_ != was_active)
|
||||||
stream_->enable(active_);
|
stream_->enable(active_);
|
||||||
|
|
||||||
|
// change visibility of active surface (show preview of stream when inactive)
|
||||||
|
if (activesurface_) {
|
||||||
|
if (active_)
|
||||||
|
activesurface_->setTextureIndex(Resource::getTextureTransparent());
|
||||||
|
else
|
||||||
|
activesurface_->setTextureIndex(stream_->texture());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ TextEditor editor;
|
|||||||
#define PLOT_ARRAY_SIZE 180
|
#define PLOT_ARRAY_SIZE 180
|
||||||
#define LABEL_AUTO_MEDIA_PLAYER ICON_FA_CARET_SQUARE_RIGHT " Dynamic selection"
|
#define LABEL_AUTO_MEDIA_PLAYER ICON_FA_CARET_SQUARE_RIGHT " Dynamic selection"
|
||||||
#define LABEL_STORE_SELECTION " Store selection"
|
#define LABEL_STORE_SELECTION " Store selection"
|
||||||
#define LABEL_EDIT_FADING ICON_FA_RANDOM " Edit Fading"
|
#define LABEL_EDIT_FADING ICON_FA_RANDOM " Edit timeline fading"
|
||||||
|
|
||||||
// utility functions
|
// utility functions
|
||||||
void ShowAboutGStreamer(bool* p_open);
|
void ShowAboutGStreamer(bool* p_open);
|
||||||
@@ -2867,6 +2867,15 @@ void SourceController::RenderSingleSource(Source *s)
|
|||||||
ImGui::Text("%s %s", SourcePlayIcon(s), GstToolkit::time_to_string(s->playtime()).c_str() );
|
ImGui::Text("%s %s", SourcePlayIcon(s), GstToolkit::time_to_string(s->playtime()).c_str() );
|
||||||
ImGui::PopFont();
|
ImGui::PopFont();
|
||||||
|
|
||||||
|
// if ( ms != nullptr ) {
|
||||||
|
// // ok, get the media player of the media source
|
||||||
|
// MediaPlayer *mp = ms->mediaplayer();
|
||||||
|
// const double width_ratio = static_cast<double>(rendersize.x) / static_cast<double>(mp->timeline()->sectionsDuration());
|
||||||
|
|
||||||
|
// DrawTimeline("##timeline_mediaplayers", mp->timeline(), mp->position(), width_ratio, 60);
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Play button bar
|
/// Play button bar
|
||||||
///
|
///
|
||||||
|
|||||||
Reference in New Issue
Block a user