Improved SRT Receiver source

Failure cause to RETRY to connect. Info visitor informs on status of connection. Icon associated to SRT Broadcast icon.
This commit is contained in:
Bruno Herbelin
2023-04-30 13:30:24 +02:00
parent 088cf97ebf
commit 39d4002491
7 changed files with 1016 additions and 643 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1569,21 +1569,18 @@ void ImGuiVisitor::visit (SrtReceiverSource& s)
if ( !s.failed() ) { if ( !s.failed() ) {
// icon (>) to open player // icon (>) to open player
if ( s.playable() ) { if ( s.stream()->isOpen() ) {
ImGui::SetCursorPos(top); ImGui::SetCursorPos(top);
std::string msg = s.playing() ? "Open Player\n(source is playing)" : "Open Player\n(source is paused)"; std::string msg = s.playing() ? "Open Player\n(source is playing)" : "Open Player\n(source is paused)";
if (ImGuiToolkit::IconButton( s.playing() ? ICON_FA_PLAY_CIRCLE : ICON_FA_PAUSE_CIRCLE, msg.c_str())) if (ImGuiToolkit::IconButton( s.playing() ? ICON_FA_PLAY_CIRCLE : ICON_FA_PAUSE_CIRCLE, msg.c_str()))
UserInterface::manager().showSourceEditor(&s); UserInterface::manager().showSourceEditor(&s);
} }
else
info.reset();
} }
else else
info.reset(); info.reset();
ImGui::SetCursorPos(botom); ImGui::SetCursorPos(botom);
// if ( ImGui::Button( ICON_FA_REPLY " Reconnect", ImVec2(IMGUI_RIGHT_ALIGN, 0)) )
// {
// s.setConnection(s.connection());
// info.reset();
// }
} }

View File

@@ -433,15 +433,27 @@ void InfoVisitor::visit (SrtReceiverSource& s)
if (stm->failed()) { if (stm->failed()) {
oss << s.uri() << std::endl << stm->log(); oss << s.uri() << std::endl << stm->log();
} }
else { else if (stm->isOpen()) {
if (brief_) if (brief_) {
oss << s.uri() << std::endl; oss << s.uri() << std::endl;
oss << "Connected." << std::endl;
}
else { else {
oss << "SRT Receiver " << s.uri() << std::endl; oss << "SRT Receiver " << s.uri() << std::endl;
oss << "H264 (" << stm->decoderName() << ")" << std::endl; oss << "H264 (" << stm->decoderName() << ")" ;
oss << stm->width() << " x " << stm->height(); oss << stm->width() << " x " << stm->height();
} }
} }
else {
if (brief_) {
oss << s.uri() << std::endl;
oss << "Trying to connect..." << std::endl;
}
else {
oss << "SRT Receiver " << s.uri() << std::endl;
oss << "Connecting...";
}
}
} }
else else
oss << "Undefined"; oss << "Undefined";

View File

@@ -25,7 +25,7 @@
#define ICON_SOURCE_RENDER 0, 2 #define ICON_SOURCE_RENDER 0, 2
#define ICON_SOURCE_CLONE 9, 2 #define ICON_SOURCE_CLONE 9, 2
#define ICON_SOURCE_GSTREAMER 16, 16 #define ICON_SOURCE_GSTREAMER 16, 16
#define ICON_SOURCE_SRT 15, 5 #define ICON_SOURCE_SRT 14, 5
#define ICON_SOURCE 13, 11 #define ICON_SOURCE 13, 11
class Visitor; class Visitor;

View File

@@ -24,6 +24,11 @@ SrtReceiverSource::SrtReceiverSource(uint64_t id) : StreamSource(id)
symbol_->scale_.y = 1.5f; symbol_->scale_.y = 1.5f;
} }
Source::Failure SrtReceiverSource::failed() const
{
return (stream_ != nullptr && stream_->failed()) ? FAIL_RETRY : FAIL_NONE;
}
void SrtReceiverSource::setConnection(const std::string &ip, const std::string &port) void SrtReceiverSource::setConnection(const std::string &ip, const std::string &port)
{ {
@@ -32,7 +37,7 @@ void SrtReceiverSource::setConnection(const std::string &ip, const std::string &
port_ = port; port_ = port;
Log::Notify("Creating Source SRT receiving from '%s'", uri().c_str()); Log::Notify("Creating Source SRT receiving from '%s'", uri().c_str());
std::string description = "srtsrc uri=" + uri() + " latency=200 ! decodebin ! videoconvert"; std::string description = "srtsrc uri=" + uri() + " latency=200 ! queue ! decodebin ! videoconvert";
// open gstreamer // open gstreamer
stream_->open(description); stream_->open(description);

View File

@@ -15,6 +15,7 @@ public:
void accept (Visitor& v) override; void accept (Visitor& v) override;
// StreamSource interface // StreamSource interface
Failure failed() const override;
Stream *stream() const override { return stream_; } Stream *stream() const override { return stream_; }
// specific interface // specific interface

View File

@@ -1642,7 +1642,7 @@ void UserInterface::RenderSourceToolbar(bool *p_open, int* p_border, int *p_mode
ImGui::AlignTextToFramePadding(); ImGui::AlignTextToFramePadding();
ImGui::Text( MENU_SOURCE_TOOL ); ImGui::Text( MENU_SOURCE_TOOL );
ImGui::SameLine(0, sliderwidth); ImGui::SameLine(0, sliderwidth);
ImGui::TextDisabled("No source selected"); ImGui::TextDisabled("No active source");
ImGui::SameLine(0, sliderwidth); ImGui::SameLine(0, sliderwidth);
} }
@@ -1852,7 +1852,7 @@ void UserInterface::RenderSourceToolbar(bool *p_open, int* p_border, int *p_mode
else { else {
ImGui::TextDisabled(" "); ImGui::TextDisabled(" ");
ImGui::TextDisabled("No source selected"); ImGui::TextDisabled("No active source");
ImGui::TextDisabled(" "); ImGui::TextDisabled(" ");
} }