Skip to content

Commit

Permalink
wxMediaCtrl2: provide a better error message if the system does not h…
Browse files Browse the repository at this point in the history
…ave h.264 codecs installed
  • Loading branch information
jwise authored and lanewei120 committed Jan 12, 2023
1 parent 7450768 commit 730aa89
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/slic3r/GUI/wxMediaCtrl2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,42 @@ void wxMediaCtrl2::Load(wxURI url)
}
url = wxURI(url.BuildURI().append("&hwnd=").append(
boost::lexical_cast<std::string>(GetHandle())));
#endif
#ifdef __WXGTK3__
GstElementFactory *factory;
int hasplugins = 1;

factory = gst_element_factory_find("h264parse");
if (!factory) {
hasplugins = 0;
} else {
gst_object_unref(factory);
}

factory = gst_element_factory_find("openh264dec");
if (!factory) {
factory = gst_element_factory_find("avdec_h264");
}
if (!factory) {
factory = gst_element_factory_find("vaapih264dec");
}
if (!factory) {
hasplugins = 0;
} else {
gst_object_unref(factory);
}

if (!hasplugins) {
Slic3r::GUI::wxGetApp().CallAfter([] {
wxMessageBox(_L("Your system is missing H.264 codecs for GStreamer, which are required to play video. (Try installing the gstreamer1.0-plugins-bad or gstreamer1.0-libav packages, then restart Bambu Studio?)"), _L("Error"), wxOK);
});
m_error = 101;
wxMediaEvent event(wxEVT_MEDIA_STATECHANGED);
event.SetId(GetId());
event.SetEventObject(this);
wxPostEvent(this, event);
return;
}
#endif
m_error = 0;
wxMediaCtrl::Load(url);
Expand Down

0 comments on commit 730aa89

Please sign in to comment.