Minor improvements in InfoVisitor for source info

This commit is contained in:
Bruno Herbelin
2022-01-20 22:46:47 +01:00
parent 1a80e52241
commit f4eb8b246b
4 changed files with 56 additions and 18 deletions

View File

@@ -196,9 +196,9 @@ void InfoVisitor::visit (CloneSource& s)
std::ostringstream oss; std::ostringstream oss;
if (!brief_) { if (!brief_) {
oss << "Clone of '" << s.origin()->name() << "' ("; oss << "Clone of '" << s.origin()->name() << "'" << std::endl;
oss << CloneSource::cloning_provenance_label[s.cloningProvenance()]; oss << CloneSource::cloning_provenance_label[s.cloningProvenance()];
oss << ") " << std::endl; oss << ", " << (int)(s.delay()*100.0) << "ms delay " << std::endl;
} }
if (s.frame()){ if (s.frame()){
@@ -235,7 +235,7 @@ void InfoVisitor::visit (DeviceSource& s)
std::ostringstream oss; std::ostringstream oss;
DeviceConfigSet confs = Device::manager().config( Device::manager().index(s.device().c_str())); DeviceConfigSet confs = Device::manager().config( Device::manager().index(s.device()));
if ( !confs.empty()) { if ( !confs.empty()) {
DeviceConfig best = *confs.rbegin(); DeviceConfig best = *confs.rbegin();
float fps = static_cast<float>(best.fps_numerator) / static_cast<float>(best.fps_denominator); float fps = static_cast<float>(best.fps_numerator) / static_cast<float>(best.fps_denominator);
@@ -247,6 +247,7 @@ void InfoVisitor::visit (DeviceSource& s)
} }
else { else {
oss << s.device() << std::endl; oss << s.device() << std::endl;
oss << Device::manager().description( Device::manager().index(s.device())) << std::endl;
oss << best.width << " x " << best.height << ", "; oss << best.width << " x " << best.height << ", ";
oss << best.stream << " " << best.format << ", "; oss << best.stream << " " << best.format << ", ";
oss << std::fixed << std::setprecision(1) << fps << " fps"; oss << std::fixed << std::setprecision(1) << fps << " fps";
@@ -271,9 +272,10 @@ void InfoVisitor::visit (NetworkSource& s)
oss << "IP " << ns->serverAddress(); oss << "IP " << ns->serverAddress();
} }
else { else {
oss << s.connection() << " (IP " << ns->serverAddress() << ")" << std::endl; oss << s.connection() << std::endl;
oss << ns->resolution().x << " x " << ns->resolution().y << ", ";
oss << NetworkToolkit::protocol_name[ns->protocol()]; oss << NetworkToolkit::protocol_name[ns->protocol()];
oss << ", IP " << ns->serverAddress() << std::endl;
oss << ns->resolution().x << " x " << ns->resolution().y << " ";
} }
information_ = oss.str(); information_ = oss.str();

View File

@@ -3771,13 +3771,6 @@ void OutputPreview::Render()
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN); ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
ImGui::MenuItem( "Lower bandwidth (H264)", NULL, &Settings::application.stream_low_bandwidth); ImGui::MenuItem( "Lower bandwidth (H264)", NULL, &Settings::application.stream_low_bandwidth);
static char dummy_str[512];
sprintf(dummy_str, "%s", Connection::manager().info().name.c_str());
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(0.14f, 0.14f, 0.14f, 0.9f));
ImGui::InputText("My ID", dummy_str, IM_ARRAYSIZE(dummy_str), ImGuiInputTextFlags_ReadOnly);
ImGui::PopStyleColor(1);
std::vector<std::string> ls = Streaming::manager().listStreams(); std::vector<std::string> ls = Streaming::manager().listStreams();
if (ls.size()>0) { if (ls.size()>0) {
ImGui::Separator(); ImGui::Separator();
@@ -3799,18 +3792,27 @@ void OutputPreview::Render()
ImVec2 draw_pos = ImGui::GetCursorScreenPos(); ImVec2 draw_pos = ImGui::GetCursorScreenPos();
// preview image // preview image
ImGui::Image((void*)(intptr_t)output->texture(), imagesize); ImGui::Image((void*)(intptr_t)output->texture(), imagesize);
// tooltip overlay // raise window on double clic
if (ImGui::IsMouseDoubleClicked(0) )
Rendering::manager().outputWindow().show();
///
/// Info overlays
///
ImGui::SetCursorScreenPos(draw_pos + ImVec2(imagesize.x - ImGui::GetTextLineHeightWithSpacing(), 6));
ImGui::Text(ICON_FA_INFO_CIRCLE);
if (ImGui::IsItemHovered()) if (ImGui::IsItemHovered())
{ {
ImDrawList* draw_list = ImGui::GetWindowDrawList(); ImDrawList* draw_list = ImGui::GetWindowDrawList();
draw_list->AddRectFilled(draw_pos, ImVec2(draw_pos.x + width, draw_pos.y + ImGui::GetTextLineHeightWithSpacing()), IMGUI_COLOR_OVERLAY); const float h = (Settings::application.accept_connections ? 2.f : 1.f) * ImGui::GetTextLineHeightWithSpacing();
draw_list->AddRectFilled(draw_pos, ImVec2(draw_pos.x + width, draw_pos.y + h), IMGUI_COLOR_OVERLAY);
ImGui::SetCursorScreenPos(draw_pos); ImGui::SetCursorScreenPos(draw_pos);
ImGui::Text(" %d x %d px, %.d fps", output->width(), output->height(), int(Mixer::manager().fps()) ); ImGui::Text(" %d x %d px, %.d fps", output->width(), output->height(), int(Mixer::manager().fps()) );
if (Settings::application.accept_connections){
// raise window on double clic ImGui::Text( " " ICON_FA_SHARE_ALT " %s", Connection::manager().info().name.c_str() );
if (ImGui::IsMouseDoubleClicked(0) ) }
Rendering::manager().outputWindow().show();
} }
const float r = ImGui::GetTextLineHeightWithSpacing(); const float r = ImGui::GetTextLineHeightWithSpacing();
// recording indicator overlay // recording indicator overlay
if (video_recorder_) if (video_recorder_)

View File

@@ -0,0 +1,6 @@
#include "VideoBroadcast.h"
VideoBroadcast::VideoBroadcast()
{
}

View File

@@ -0,0 +1,28 @@
#ifndef VIDEOBROADCAST_H
#define VIDEOBROADCAST_H
#include "NetworkToolkit.h"
#include "FrameGrabber.h"
#define BROADCAST_FPS 30
class VideoBroadcast : public FrameGrabber
{
friend class Streaming;
std::string init(GstCaps *caps) override;
void terminate() override;
void stop() override;
// connection information
int port_;
std::atomic<bool> stopped_;
public:
VideoBroadcast();
virtual ~VideoBroadcast() {}
std::string info() const override;
};
#endif // VIDEOBROADCAST_H