mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-19 14:19:57 +01:00
Delay user notification for when source is ready
This commit is contained in:
@@ -51,7 +51,6 @@
|
|||||||
#include "SrtReceiverSource.h"
|
#include "SrtReceiverSource.h"
|
||||||
#include "SourceCallback.h"
|
#include "SourceCallback.h"
|
||||||
|
|
||||||
#include "InfoVisitor.h"
|
|
||||||
#include "ActionManager.h"
|
#include "ActionManager.h"
|
||||||
#include "MixingGroup.h"
|
#include "MixingGroup.h"
|
||||||
#include "FrameGrabber.h"
|
#include "FrameGrabber.h"
|
||||||
@@ -455,6 +454,33 @@ void Mixer::addSource(Source *s)
|
|||||||
candidate_sources_.push_back(s);
|
candidate_sources_.push_back(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void delayed_notification( Source *source )
|
||||||
|
{
|
||||||
|
bool done = false;
|
||||||
|
|
||||||
|
while (!done) {
|
||||||
|
// give it a bit of time and avoid CPU overload
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(30));
|
||||||
|
|
||||||
|
// to be safe, make sure we have a valid source
|
||||||
|
Session *session = Mixer::manager().session();
|
||||||
|
SourceList::iterator sit = session->find(source);
|
||||||
|
if ( sit != session->end() ) {
|
||||||
|
// voila! the source is valid : notify user if it's ready
|
||||||
|
if ( (*sit)->ready() ) {
|
||||||
|
Log::Notify("%s source %s is ready.", (*sit)->info().c_str(), (*sit)->name().c_str());
|
||||||
|
done = true;
|
||||||
|
}
|
||||||
|
// do not notify if failed
|
||||||
|
else if ( (*sit)->failed() )
|
||||||
|
done = true;
|
||||||
|
}
|
||||||
|
// end loop if invalid source
|
||||||
|
else
|
||||||
|
done = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Mixer::insertSource(Source *s, View::Mode m)
|
void Mixer::insertSource(Source *s, View::Mode m)
|
||||||
{
|
{
|
||||||
if ( s != nullptr )
|
if ( s != nullptr )
|
||||||
@@ -477,11 +503,9 @@ void Mixer::insertSource(Source *s, View::Mode m)
|
|||||||
// new state in history manager
|
// new state in history manager
|
||||||
Action::manager().store(s->name() + std::string(": source inserted"));
|
Action::manager().store(s->name() + std::string(": source inserted"));
|
||||||
|
|
||||||
// notify creation of source
|
// Log & notification
|
||||||
static InfoVisitor _more_info;
|
Log::Info("Adding source '%s'...", s->name().c_str());
|
||||||
s->accept(_more_info);
|
std::thread(delayed_notification, s).detach();
|
||||||
std::string moreinfo = BaseToolkit::unspace(_more_info.str(), ' ');
|
|
||||||
Log::Notify("Added %s source '%s' (%s)", s->info().c_str(), s->name().c_str(), moreinfo.c_str());
|
|
||||||
|
|
||||||
// if requested to show the source in a given view
|
// if requested to show the source in a given view
|
||||||
// (known to work for View::MIXING et TRANSITION: other views untested)
|
// (known to work for View::MIXING et TRANSITION: other views untested)
|
||||||
|
|||||||
@@ -656,13 +656,12 @@ View::Cursor MixingView::over (glm::vec2 pos)
|
|||||||
if (s != nullptr && s->ready()) {
|
if (s != nullptr && s->ready()) {
|
||||||
|
|
||||||
s->symbol_->color = glm::vec4( COLOR_HIGHLIGHT_SOURCE, 1.f );
|
s->symbol_->color = glm::vec4( COLOR_HIGHLIGHT_SOURCE, 1.f );
|
||||||
s->initial_0_->color = glm::vec4( COLOR_HIGHLIGHT_SOURCE, 1.f );
|
|
||||||
s->initial_1_->color = glm::vec4( COLOR_HIGHLIGHT_SOURCE, 1.f );
|
|
||||||
const ImVec4 h = ImGuiToolkit::HighlightColor();
|
const ImVec4 h = ImGuiToolkit::HighlightColor();
|
||||||
|
|
||||||
// overlay symbol
|
// overlay symbol
|
||||||
if ( pick.first == s->symbol_ )
|
if ( pick.first == s->symbol_ )
|
||||||
s->symbol_->color = glm::vec4( h.x, h.y, h.z, 1.f );
|
s->symbol_->color = glm::vec4( h.x, h.y, h.z, 1.f );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
Reference in New Issue
Block a user