mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-13 19:29:58 +01:00
BugFix Stream Source reload
Change stream reopen() to StreamSource reload()
This commit is contained in:
@@ -1878,7 +1878,7 @@ void ImGuiVisitor::visit(TextSource &s)
|
||||
ImGui::SetCursorPos(
|
||||
ImVec2(top.x + 0.95 * ImGui::GetFrameHeight(), botom.y - ImGui::GetFrameHeight()));
|
||||
if (ImGuiToolkit::IconButton(ICON_FA_REDO_ALT, "Reload"))
|
||||
tc->reopen();
|
||||
s.reload();
|
||||
}
|
||||
// general case of free text : text editor
|
||||
else {
|
||||
|
||||
@@ -1453,14 +1453,12 @@ void SourceControlWindow::RenderSingleSource(Source *s)
|
||||
|
||||
if (ImGui::BeginPopup( "MenuStreamOptions" ))
|
||||
{
|
||||
if (ImGui::MenuItem(ICON_FA_REDO_ALT " Reload"))
|
||||
ss->reload();
|
||||
// NB: ss is playable (tested above), and thus ss->stream() is not null
|
||||
if (ImGui::MenuItem( ICON_FA_REDO_ALT " Reload" )) {
|
||||
ss->stream()->reopen();
|
||||
}
|
||||
bool option = ss->stream()->rewindOnDisabled();
|
||||
if (ImGui::MenuItem(ICON_FA_SNOWFLAKE " Restart on deactivation", NULL, &option )) {
|
||||
if (ImGui::MenuItem(ICON_FA_SNOWFLAKE " Restart on deactivation", NULL, &option ))
|
||||
ss->stream()->setRewindOnDisabled(option);
|
||||
}
|
||||
|
||||
if (ImGui::IsWindowHovered())
|
||||
counter_menu_timeout=0;
|
||||
@@ -1856,7 +1854,6 @@ void SourceControlWindow::RenderMediaPlayer(MediaSource *ms)
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Dialog to edit timeline fade in and out
|
||||
///
|
||||
|
||||
@@ -216,16 +216,6 @@ void Stream::open(const std::string &gstreamer_description, guint w, guint h)
|
||||
discoverer_ = std::async(StreamDiscoverer, description_, w, h);
|
||||
}
|
||||
|
||||
void Stream::reopen()
|
||||
{
|
||||
// re-openning is meaningfull only if it was already open
|
||||
if (pipeline_ != nullptr) {
|
||||
// reload : terminate pipeline and re-create it
|
||||
close();
|
||||
execute_open();
|
||||
}
|
||||
}
|
||||
|
||||
std::string Stream::description() const
|
||||
{
|
||||
return description_;
|
||||
|
||||
@@ -40,6 +40,8 @@ struct StreamInfo {
|
||||
|
||||
class Stream {
|
||||
|
||||
friend class StreamSource;
|
||||
|
||||
public:
|
||||
/**
|
||||
* Constructor of a GStreamer Stream
|
||||
@@ -57,7 +59,6 @@ public:
|
||||
* Open a media using gstreamer pipeline keyword
|
||||
* */
|
||||
void open(const std::string &gstreamer_description, guint w = 0, guint h = 0);
|
||||
void reopen ();
|
||||
/**
|
||||
* Get description string
|
||||
* */
|
||||
|
||||
@@ -103,6 +103,7 @@ Source::Failure StreamSource::failed() const
|
||||
return (stream_ != nullptr && stream_->failed()) ? FAIL_CRITICAL : FAIL_NONE;
|
||||
}
|
||||
|
||||
|
||||
uint StreamSource::texture() const
|
||||
{
|
||||
if (stream_ == nullptr)
|
||||
@@ -187,6 +188,20 @@ void StreamSource::replay ()
|
||||
stream_->rewind();
|
||||
}
|
||||
|
||||
void StreamSource::reload()
|
||||
{
|
||||
if (stream_) {
|
||||
stream_->close();
|
||||
|
||||
// reset renderbuffer_
|
||||
if (renderbuffer_)
|
||||
delete renderbuffer_;
|
||||
renderbuffer_ = nullptr;
|
||||
|
||||
stream_->execute_open();
|
||||
}
|
||||
}
|
||||
|
||||
guint64 StreamSource::playtime () const
|
||||
{
|
||||
if ( stream_ )
|
||||
|
||||
@@ -40,6 +40,7 @@ public:
|
||||
|
||||
// pure virtual interface
|
||||
virtual Stream *stream() const = 0;
|
||||
void reload ();
|
||||
|
||||
// Source interface
|
||||
virtual void accept (Visitor& v) override;
|
||||
|
||||
Reference in New Issue
Block a user