New Generalize option to restart on deactivation to any StreamSource

StreamSource now have the option 'restart on deactivation' like MediaPlayer. This option is saved in XML (added Visitors for Stream and StreamSource). The GUI is added as sub-menu in play bar (like for MediaPlayer). Some StreamSource subclasses needed to be fixed to allow this feature (e.g. MultiFileSource).
This commit is contained in:
Bruno Herbelin
2023-08-10 18:47:44 +02:00
parent 4efaa1f350
commit 87a51afd99
16 changed files with 146 additions and 27 deletions

View File

@@ -53,6 +53,7 @@ Stream::Stream()
single_frame_ = false;
live_ = false;
failed_ = false;
rewind_on_disable_ = false;
decoder_name_ = "";
// start index in frame_ stack
@@ -216,6 +217,15 @@ void Stream::open(const std::string &gstreamer_description, guint w, guint 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
{
@@ -407,6 +417,10 @@ void Stream::enable(bool on)
if ( enabled_ != on ) {
// option to automatically rewind each time the player is disabled
if (!on && rewind_on_disable_ && desired_state_ == GST_STATE_PLAYING)
rewind();
enabled_ = on;
// default to pause