Improved report of Media Player error

This commit is contained in:
Bruno Herbelin
2023-03-25 20:33:30 +01:00
parent e192d254f9
commit 85a25a0a39
2 changed files with 12 additions and 6 deletions

View File

@@ -642,10 +642,16 @@ void ImGuiVisitor::visit (MediaSource& s)
info.reset(); info.reset();
ImGui::SetCursorPos(top); ImGui::SetCursorPos(top);
if (ImGuiToolkit::IconButton(ICON_FA_FOLDER_OPEN, "Show in finder")) if (ImGuiToolkit::IconButton(ICON_FA_FOLDER_OPEN, "Show in finder"))
SystemToolkit::open(SystemToolkit::path_filename(s.path())); SystemToolkit::open(SystemToolkit::path_filename(s.path()));
if ( info.str().size() > 150 ) {
top.y += 2.f * ImGui::GetFrameHeight();
ImGui::SetCursorPos(top);
if (ImGuiToolkit::IconButton(ICON_FA_COPY, "Copy"))
ImGui::SetClipboardText(info.str().c_str());
}
ImGui::SetCursorPos(botom); ImGui::SetCursorPos(botom);
} }

View File

@@ -136,22 +136,22 @@ MediaInfo MediaPlayer::UriDiscoverer(const std::string &uri)
GstDiscovererResult result = gst_discoverer_info_get_result (info); GstDiscovererResult result = gst_discoverer_info_get_result (info);
switch (result) { switch (result) {
case GST_DISCOVERER_URI_INVALID: case GST_DISCOVERER_URI_INVALID:
video_stream_info.log = "Invalid URI"; video_stream_info.log = "\nInvalid URI";
break; break;
case GST_DISCOVERER_ERROR: case GST_DISCOVERER_ERROR:
video_stream_info.log = err->message; video_stream_info.log = std::string( "\nError; " ) + err->message;
break; break;
case GST_DISCOVERER_TIMEOUT: case GST_DISCOVERER_TIMEOUT:
video_stream_info.log = "Timeout loading"; video_stream_info.log = "\nTimeout loading";
break; break;
case GST_DISCOVERER_BUSY: case GST_DISCOVERER_BUSY:
video_stream_info.log = "Busy"; video_stream_info.log = "\nBusy";
break; break;
case GST_DISCOVERER_MISSING_PLUGINS: case GST_DISCOVERER_MISSING_PLUGINS:
{ {
const GstStructure *s = gst_discoverer_info_get_misc (info); const GstStructure *s = gst_discoverer_info_get_misc (info);
gchar *str = gst_structure_to_string (s); gchar *str = gst_structure_to_string (s);
video_stream_info.log = "Unknown format " + std::string(str); video_stream_info.log = std::string( "\nUnknown format; " ) + std::string(str);
g_free (str); g_free (str);
} }
break; break;