2022-07-15 15:37:19 +00:00
# include "wxMediaCtrl2.h"
2022-07-22 09:46:10 +00:00
# include "I18N.hpp"
2022-08-10 05:39:09 +00:00
# include "GUI_App.hpp"
# ifdef __WIN32__
# include <versionhelpers.h>
2022-08-12 02:27:57 +00:00
# include <wx/msw/registry.h>
2022-10-11 00:56:37 +00:00
# include <shellapi.h>
2022-08-10 05:39:09 +00:00
# endif
2022-07-15 15:37:19 +00:00
Add support for Bambu Lab X1 series live video stream on Linux.
wxWidgets on Linux uses GStreamer as its back-end for wxMediaCtrl, which
doesn't have a bambu: URI handler. On Windows, this is handled by a Windows
Media subsystem plugin, and on Mac, this is handled with a BambuPlayer
class. Luckily, the libBambuSource.so binary that is distributed with the
network plugin package already contains support for receiving h.264 data
from the network, and the API is the same as is used by the tiny
bambusource.exe binary on Windows; we glue this into a GStreamer source
plugin that registers a URI handler for bambu:.
To make this work, we make a few additional changes elsewhere. GStreamer
seems to have trouble rendering an Xv overlay onto a 32bpp X visual, but
Bambu Slicer seems to request a 32bpp visual for some background
transparency in the Notebook; it doesn't seem to use it in an interesting
way on Linux, though, so we remove that request for transparency to allow
Bambu Studio to render to a 24bpp visual. The media controller
infrastructure also makes a few assumptions about when sizing information
can be queried from a wxMediaCtrl backend that do not hold true on Linux; we
either fix those assumptions, or fake them out, as needed. We also make a
few changes needed to successfully compile C.
This has only been tested with the GStreamer backend for wxWidgets --
notably, not the GStreamer-play backend (these are, astonishingly, two
different things!). If you find that this seems not to work, consider
*un*installing the libgstreamer-plugins-bad1.0-dev package and then
rebuilding wxWidgets.
2023-01-10 09:40:39 +00:00
# ifdef __LINUX__
# include "Printer/gstbambusrc.h"
2023-06-06 09:15:26 +00:00
# include <gst/gst.h> // main gstreamer header
class WXDLLIMPEXP_MEDIA
wxGStreamerMediaBackend : public wxMediaBackendCommonBase
{
public :
GstElement * m_playbin ; // GStreamer media element
} ;
Add support for Bambu Lab X1 series live video stream on Linux.
wxWidgets on Linux uses GStreamer as its back-end for wxMediaCtrl, which
doesn't have a bambu: URI handler. On Windows, this is handled by a Windows
Media subsystem plugin, and on Mac, this is handled with a BambuPlayer
class. Luckily, the libBambuSource.so binary that is distributed with the
network plugin package already contains support for receiving h.264 data
from the network, and the API is the same as is used by the tiny
bambusource.exe binary on Windows; we glue this into a GStreamer source
plugin that registers a URI handler for bambu:.
To make this work, we make a few additional changes elsewhere. GStreamer
seems to have trouble rendering an Xv overlay onto a 32bpp X visual, but
Bambu Slicer seems to request a 32bpp visual for some background
transparency in the Notebook; it doesn't seem to use it in an interesting
way on Linux, though, so we remove that request for transparency to allow
Bambu Studio to render to a 24bpp visual. The media controller
infrastructure also makes a few assumptions about when sizing information
can be queried from a wxMediaCtrl backend that do not hold true on Linux; we
either fix those assumptions, or fake them out, as needed. We also make a
few changes needed to successfully compile C.
This has only been tested with the GStreamer backend for wxWidgets --
notably, not the GStreamer-play backend (these are, astonishingly, two
different things!). If you find that this seems not to work, consider
*un*installing the libgstreamer-plugins-bad1.0-dev package and then
rebuilding wxWidgets.
2023-01-10 09:40:39 +00:00
# endif
2023-11-21 04:17:24 +00:00
wxDEFINE_EVENT ( EVT_MEDIA_CTRL_STAT , wxCommandEvent ) ;
2022-07-15 15:37:19 +00:00
wxMediaCtrl2 : : wxMediaCtrl2 ( wxWindow * parent )
{
2022-07-25 01:39:59 +00:00
# ifdef __WIN32__
auto hModExe = GetModuleHandle ( NULL ) ;
// BOOST_LOG_TRIVIAL(info) << "wxMediaCtrl2: GetModuleHandle " << hModExe;
auto NvOptimusEnablement = ( DWORD * ) GetProcAddress ( hModExe , " NvOptimusEnablement " ) ;
auto AmdPowerXpressRequestHighPerformance = ( int * ) GetProcAddress ( hModExe , " AmdPowerXpressRequestHighPerformance " ) ;
if ( NvOptimusEnablement ) {
// BOOST_LOG_TRIVIAL(info) << "wxMediaCtrl2: NvOptimusEnablement " << *NvOptimusEnablement;
* NvOptimusEnablement = 0 ;
}
if ( AmdPowerXpressRequestHighPerformance ) {
// BOOST_LOG_TRIVIAL(info) << "wxMediaCtrl2: AmdPowerXpressRequestHighPerformance " << *AmdPowerXpressRequestHighPerformance;
* AmdPowerXpressRequestHighPerformance = 0 ;
}
# endif
wxMediaCtrl : : Create ( parent , wxID_ANY , wxEmptyString , wxDefaultPosition , wxDefaultSize , wxMEDIACTRLPLAYERCONTROLS_NONE ) ;
Add support for Bambu Lab X1 series live video stream on Linux.
wxWidgets on Linux uses GStreamer as its back-end for wxMediaCtrl, which
doesn't have a bambu: URI handler. On Windows, this is handled by a Windows
Media subsystem plugin, and on Mac, this is handled with a BambuPlayer
class. Luckily, the libBambuSource.so binary that is distributed with the
network plugin package already contains support for receiving h.264 data
from the network, and the API is the same as is used by the tiny
bambusource.exe binary on Windows; we glue this into a GStreamer source
plugin that registers a URI handler for bambu:.
To make this work, we make a few additional changes elsewhere. GStreamer
seems to have trouble rendering an Xv overlay onto a 32bpp X visual, but
Bambu Slicer seems to request a 32bpp visual for some background
transparency in the Notebook; it doesn't seem to use it in an interesting
way on Linux, though, so we remove that request for transparency to allow
Bambu Studio to render to a 24bpp visual. The media controller
infrastructure also makes a few assumptions about when sizing information
can be queried from a wxMediaCtrl backend that do not hold true on Linux; we
either fix those assumptions, or fake them out, as needed. We also make a
few changes needed to successfully compile C.
This has only been tested with the GStreamer backend for wxWidgets --
notably, not the GStreamer-play backend (these are, astonishingly, two
different things!). If you find that this seems not to work, consider
*un*installing the libgstreamer-plugins-bad1.0-dev package and then
rebuilding wxWidgets.
2023-01-10 09:40:39 +00:00
# ifdef __LINUX__
/* Register only after we have created the wxMediaCtrl, since only then are we guaranteed to have fired up Gstreamer's plugin registry. */
2023-06-06 09:15:26 +00:00
auto playbin = reinterpret_cast < wxGStreamerMediaBackend * > ( m_imp ) - > m_playbin ;
g_object_set ( G_OBJECT ( playbin ) ,
" audio-sink " , NULL ,
NULL ) ;
Add support for Bambu Lab X1 series live video stream on Linux.
wxWidgets on Linux uses GStreamer as its back-end for wxMediaCtrl, which
doesn't have a bambu: URI handler. On Windows, this is handled by a Windows
Media subsystem plugin, and on Mac, this is handled with a BambuPlayer
class. Luckily, the libBambuSource.so binary that is distributed with the
network plugin package already contains support for receiving h.264 data
from the network, and the API is the same as is used by the tiny
bambusource.exe binary on Windows; we glue this into a GStreamer source
plugin that registers a URI handler for bambu:.
To make this work, we make a few additional changes elsewhere. GStreamer
seems to have trouble rendering an Xv overlay onto a 32bpp X visual, but
Bambu Slicer seems to request a 32bpp visual for some background
transparency in the Notebook; it doesn't seem to use it in an interesting
way on Linux, though, so we remove that request for transparency to allow
Bambu Studio to render to a 24bpp visual. The media controller
infrastructure also makes a few assumptions about when sizing information
can be queried from a wxMediaCtrl backend that do not hold true on Linux; we
either fix those assumptions, or fake them out, as needed. We also make a
few changes needed to successfully compile C.
This has only been tested with the GStreamer backend for wxWidgets --
notably, not the GStreamer-play backend (these are, astonishingly, two
different things!). If you find that this seems not to work, consider
*un*installing the libgstreamer-plugins-bad1.0-dev package and then
rebuilding wxWidgets.
2023-01-10 09:40:39 +00:00
gstbambusrc_register ( ) ;
2023-03-06 08:02:57 +00:00
Bind ( wxEVT_MEDIA_LOADED , [ this ] ( auto & e ) {
m_loaded = true ;
} ) ;
Add support for Bambu Lab X1 series live video stream on Linux.
wxWidgets on Linux uses GStreamer as its back-end for wxMediaCtrl, which
doesn't have a bambu: URI handler. On Windows, this is handled by a Windows
Media subsystem plugin, and on Mac, this is handled with a BambuPlayer
class. Luckily, the libBambuSource.so binary that is distributed with the
network plugin package already contains support for receiving h.264 data
from the network, and the API is the same as is used by the tiny
bambusource.exe binary on Windows; we glue this into a GStreamer source
plugin that registers a URI handler for bambu:.
To make this work, we make a few additional changes elsewhere. GStreamer
seems to have trouble rendering an Xv overlay onto a 32bpp X visual, but
Bambu Slicer seems to request a 32bpp visual for some background
transparency in the Notebook; it doesn't seem to use it in an interesting
way on Linux, though, so we remove that request for transparency to allow
Bambu Studio to render to a 24bpp visual. The media controller
infrastructure also makes a few assumptions about when sizing information
can be queried from a wxMediaCtrl backend that do not hold true on Linux; we
either fix those assumptions, or fake them out, as needed. We also make a
few changes needed to successfully compile C.
This has only been tested with the GStreamer backend for wxWidgets --
notably, not the GStreamer-play backend (these are, astonishingly, two
different things!). If you find that this seems not to work, consider
*un*installing the libgstreamer-plugins-bad1.0-dev package and then
rebuilding wxWidgets.
2023-01-10 09:40:39 +00:00
# endif
2022-07-15 15:37:19 +00:00
}
2022-10-11 00:56:37 +00:00
# define CLSID_BAMBU_SOURCE L"{233E64FB-2041-4A6C-AFAB-FF9BCF83E7AA}"
2022-07-15 15:37:19 +00:00
void wxMediaCtrl2 : : Load ( wxURI url )
{
# ifdef __WIN32__
2022-07-22 09:46:10 +00:00
if ( m_imp = = nullptr ) {
2023-03-09 09:09:30 +00:00
CallAfter ( [ ] {
2022-08-10 05:39:09 +00:00
auto res = wxMessageBox ( _L ( " Windows Media Player is required for this task! Do you want to enable 'Windows Media Player' for your operation system? " ) , _L ( " Error " ) , wxOK | wxCANCEL ) ;
if ( res = = wxOK ) {
wxString url = IsWindows10OrGreater ( )
? " ms-settings:optionalfeatures?activationSource=SMC-Article-14209 "
: " https://support.microsoft.com/en-au/windows/get-windows-media-player-81718e0d-cfce-25b1-aee3-94596b658287 " ;
wxExecute ( " cmd /c start " + url , wxEXEC_HIDE_CONSOLE ) ;
}
} ) ;
2022-09-09 07:05:59 +00:00
m_error = 100 ;
2022-07-22 09:46:10 +00:00
wxMediaEvent event ( wxEVT_MEDIA_STATECHANGED ) ;
event . SetId ( GetId ( ) ) ;
event . SetEventObject ( this ) ;
wxPostEvent ( this , event ) ;
return ;
}
2022-08-12 02:27:57 +00:00
{
2023-10-20 06:55:17 +00:00
wxRegKey key11 ( wxRegKey : : HKCU , L " SOFTWARE \\ Classes \\ CLSID \\ " CLSID_BAMBU_SOURCE L " \\ InProcServer32 " ) ;
wxRegKey key12 ( wxRegKey : : HKCR , L " CLSID \\ " CLSID_BAMBU_SOURCE L " \\ InProcServer32 " ) ;
wxString path = key11 . Exists ( ) ? key11 . QueryDefaultValue ( )
: key12 . Exists ( ) ? key12 . QueryDefaultValue ( ) : wxString { } ;
2022-08-12 02:27:57 +00:00
wxRegKey key2 ( wxRegKey : : HKCR , " bambu " ) ;
wxString clsid ;
2022-11-08 05:36:28 +00:00
if ( key2 . Exists ( ) )
key2 . QueryRawValue ( " Source Filter " , clsid ) ;
2022-10-19 01:02:19 +00:00
BOOST_LOG_TRIVIAL ( info ) < < __FUNCTION__ < < boost : : format ( " : clsid %1% path %2% " ) % clsid % path ;
2023-08-01 08:45:06 +00:00
std : : string data_dir_str = Slic3r : : data_dir ( ) ;
boost : : filesystem : : path data_dir_path ( data_dir_str ) ;
auto dll_path = data_dir_path / " plugins " / " BambuSource.dll " ;
2022-10-11 00:56:37 +00:00
if ( path . empty ( ) | | ! wxFile : : Exists ( path ) | | clsid ! = CLSID_BAMBU_SOURCE ) {
2022-11-22 03:15:01 +00:00
if ( boost : : filesystem : : exists ( dll_path ) ) {
2023-03-09 09:09:30 +00:00
CallAfter (
2022-11-22 03:15:01 +00:00
[ dll_path ] {
2023-08-01 08:45:06 +00:00
int res = wxMessageBox ( _L ( " BambuSource has not correctly been registered for media playing! Press Yes to re-register it. " ) , _L ( " Error " ) , wxYES_NO | wxICON_ERROR ) ;
2022-11-22 03:15:01 +00:00
if ( res = = wxYES ) {
2023-12-20 08:02:46 +00:00
auto path = dll_path . wstring ( ) ;
if ( path . find ( L ' ' ) ! = std : : wstring : : npos )
path = L " \" " + path + L " \" " ;
SHELLEXECUTEINFO info { sizeof ( info ) , 0 , NULL , L " open " , L " regsvr32 " , path . c_str ( ) , SW_HIDE } ;
2022-11-22 03:15:01 +00:00
: : ShellExecuteEx ( & info ) ;
}
} ) ;
2022-10-11 00:56:37 +00:00
} else {
2023-03-09 09:09:30 +00:00
CallAfter ( [ ] {
2023-08-01 08:45:06 +00:00
wxMessageBox ( _L ( " Missing BambuSource component registered for media playing! Please re-install BambuStutio or seek after-sales help. " ) , _L ( " Error " ) , wxOK | wxICON_ERROR ) ;
2022-10-11 00:56:37 +00:00
} ) ;
}
2023-01-18 07:00:09 +00:00
m_error = clsid ! = CLSID_BAMBU_SOURCE ? 101 : path . empty ( ) ? 102 : 103 ;
2022-08-12 02:27:57 +00:00
wxMediaEvent event ( wxEVT_MEDIA_STATECHANGED ) ;
event . SetId ( GetId ( ) ) ;
event . SetEventObject ( this ) ;
wxPostEvent ( this , event ) ;
return ;
}
2023-08-01 08:45:06 +00:00
if ( path ! = dll_path ) {
static bool notified = false ;
if ( ! notified ) CallAfter ( [ dll_path ] {
2023-10-20 10:56:21 +00:00
int res = wxMessageBox ( _L ( " Using a BambuSource from a different install, video play may not work correctly! Press Yes to fix it. " ) , _L ( " Warning " ) , wxYES_NO | wxICON_WARNING ) ;
2023-08-01 08:45:06 +00:00
if ( res = = wxYES ) {
2023-12-20 08:02:46 +00:00
auto path = dll_path . wstring ( ) ;
if ( path . find ( L ' ' ) ! = std : : wstring : : npos )
path = L " \" " + path + L " \" " ;
SHELLEXECUTEINFO info { sizeof ( info ) , 0 , NULL , L " open " , L " regsvr32 " , path . c_str ( ) , SW_HIDE } ;
2023-08-01 08:45:06 +00:00
: : ShellExecuteEx ( & info ) ;
}
} ) ;
notified = true ;
}
2022-09-07 06:03:53 +00:00
wxRegKey keyWmp ( wxRegKey : : HKCU , " SOFTWARE \\ Microsoft \\ MediaPlayer \\ Player \\ Extensions \\ . " ) ;
keyWmp . Create ( ) ;
long permissions = 0 ;
if ( keyWmp . HasValue ( " Permissions " ) )
keyWmp . QueryValue ( " Permissions " , & permissions ) ;
if ( ( permissions & 32 ) = = 0 ) {
permissions | = 32 ;
keyWmp . SetValue ( " Permissions " , permissions ) ;
}
2022-08-12 02:27:57 +00:00
}
2023-07-07 07:42:22 +00:00
url = wxURI ( url . BuildURI ( ) . append ( " &hwnd= " ) . append ( boost : : lexical_cast < std : : string > ( GetHandle ( ) ) ) . append ( " &tid= " ) . append (
boost : : lexical_cast < std : : string > ( GetCurrentThreadId ( ) ) ) ) ;
2023-01-11 22:52:48 +00:00
# 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 ) {
2023-03-09 09:09:30 +00:00
CallAfter ( [ ] {
2023-01-11 22:52:48 +00:00
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 ;
}
2023-03-06 08:02:57 +00:00
wxLog : : EnableLogging ( false ) ;
2022-07-15 15:37:19 +00:00
# endif
m_error = 0 ;
2023-03-06 08:02:57 +00:00
m_loaded = false ;
2022-07-15 15:37:19 +00:00
wxMediaCtrl : : Load ( url ) ;
2023-03-06 08:02:57 +00:00
# ifdef __WXGTK3__
wxMediaEvent event ( wxEVT_MEDIA_STATECHANGED ) ;
event . SetId ( GetId ( ) ) ;
event . SetEventObject ( this ) ;
wxPostEvent ( this , event ) ;
# endif
2022-07-15 15:37:19 +00:00
}
void wxMediaCtrl2 : : Play ( ) { wxMediaCtrl : : Play ( ) ; }
2023-04-06 11:37:18 +00:00
void wxMediaCtrl2 : : Stop ( )
{
2023-06-29 05:43:52 +00:00
wxMediaCtrl : : Stop ( ) ;
2023-04-06 11:37:18 +00:00
}
2022-07-15 15:37:19 +00:00
2023-03-06 08:02:57 +00:00
# ifdef __LINUX__
2023-07-12 07:26:25 +00:00
extern " C " int gst_bambu_last_error ;
2023-03-06 08:02:57 +00:00
# endif
int wxMediaCtrl2 : : GetLastError ( ) const
{
# ifdef __LINUX__
return gst_bambu_last_error ;
# else
return m_error ;
# endif
}
2022-07-15 15:37:19 +00:00
wxSize wxMediaCtrl2 : : GetVideoSize ( ) const
{
Add support for Bambu Lab X1 series live video stream on Linux.
wxWidgets on Linux uses GStreamer as its back-end for wxMediaCtrl, which
doesn't have a bambu: URI handler. On Windows, this is handled by a Windows
Media subsystem plugin, and on Mac, this is handled with a BambuPlayer
class. Luckily, the libBambuSource.so binary that is distributed with the
network plugin package already contains support for receiving h.264 data
from the network, and the API is the same as is used by the tiny
bambusource.exe binary on Windows; we glue this into a GStreamer source
plugin that registers a URI handler for bambu:.
To make this work, we make a few additional changes elsewhere. GStreamer
seems to have trouble rendering an Xv overlay onto a 32bpp X visual, but
Bambu Slicer seems to request a 32bpp visual for some background
transparency in the Notebook; it doesn't seem to use it in an interesting
way on Linux, though, so we remove that request for transparency to allow
Bambu Studio to render to a 24bpp visual. The media controller
infrastructure also makes a few assumptions about when sizing information
can be queried from a wxMediaCtrl backend that do not hold true on Linux; we
either fix those assumptions, or fake them out, as needed. We also make a
few changes needed to successfully compile C.
This has only been tested with the GStreamer backend for wxWidgets --
notably, not the GStreamer-play backend (these are, astonishingly, two
different things!). If you find that this seems not to work, consider
*un*installing the libgstreamer-plugins-bad1.0-dev package and then
rebuilding wxWidgets.
2023-01-10 09:40:39 +00:00
# ifdef __LINUX__
// Gstreamer doesn't give us a VideoSize until we're playing, which
// confuses the MediaPlayCtrl into claiming that it is stuck
// "Loading...". Fake it out for now.
2023-03-06 08:02:57 +00:00
return m_loaded ? wxSize ( 1280 , 720 ) : wxSize { } ;
Add support for Bambu Lab X1 series live video stream on Linux.
wxWidgets on Linux uses GStreamer as its back-end for wxMediaCtrl, which
doesn't have a bambu: URI handler. On Windows, this is handled by a Windows
Media subsystem plugin, and on Mac, this is handled with a BambuPlayer
class. Luckily, the libBambuSource.so binary that is distributed with the
network plugin package already contains support for receiving h.264 data
from the network, and the API is the same as is used by the tiny
bambusource.exe binary on Windows; we glue this into a GStreamer source
plugin that registers a URI handler for bambu:.
To make this work, we make a few additional changes elsewhere. GStreamer
seems to have trouble rendering an Xv overlay onto a 32bpp X visual, but
Bambu Slicer seems to request a 32bpp visual for some background
transparency in the Notebook; it doesn't seem to use it in an interesting
way on Linux, though, so we remove that request for transparency to allow
Bambu Studio to render to a 24bpp visual. The media controller
infrastructure also makes a few assumptions about when sizing information
can be queried from a wxMediaCtrl backend that do not hold true on Linux; we
either fix those assumptions, or fake them out, as needed. We also make a
few changes needed to successfully compile C.
This has only been tested with the GStreamer backend for wxWidgets --
notably, not the GStreamer-play backend (these are, astonishingly, two
different things!). If you find that this seems not to work, consider
*un*installing the libgstreamer-plugins-bad1.0-dev package and then
rebuilding wxWidgets.
2023-01-10 09:40:39 +00:00
# else
2024-02-02 00:52:04 +00:00
wxSize size = m_imp ? m_imp - > GetVideoSize ( ) : wxSize ( 0 , 0 ) ;
if ( size . GetWidth ( ) > 0 )
const_cast < wxSize & > ( m_video_size ) = size ;
return size ;
Add support for Bambu Lab X1 series live video stream on Linux.
wxWidgets on Linux uses GStreamer as its back-end for wxMediaCtrl, which
doesn't have a bambu: URI handler. On Windows, this is handled by a Windows
Media subsystem plugin, and on Mac, this is handled with a BambuPlayer
class. Luckily, the libBambuSource.so binary that is distributed with the
network plugin package already contains support for receiving h.264 data
from the network, and the API is the same as is used by the tiny
bambusource.exe binary on Windows; we glue this into a GStreamer source
plugin that registers a URI handler for bambu:.
To make this work, we make a few additional changes elsewhere. GStreamer
seems to have trouble rendering an Xv overlay onto a 32bpp X visual, but
Bambu Slicer seems to request a 32bpp visual for some background
transparency in the Notebook; it doesn't seem to use it in an interesting
way on Linux, though, so we remove that request for transparency to allow
Bambu Studio to render to a 24bpp visual. The media controller
infrastructure also makes a few assumptions about when sizing information
can be queried from a wxMediaCtrl backend that do not hold true on Linux; we
either fix those assumptions, or fake them out, as needed. We also make a
few changes needed to successfully compile C.
This has only been tested with the GStreamer backend for wxWidgets --
notably, not the GStreamer-play backend (these are, astonishingly, two
different things!). If you find that this seems not to work, consider
*un*installing the libgstreamer-plugins-bad1.0-dev package and then
rebuilding wxWidgets.
2023-01-10 09:40:39 +00:00
# endif
2022-07-15 15:37:19 +00:00
}
wxSize wxMediaCtrl2 : : DoGetBestSize ( ) const
{
return { - 1 , - 1 } ;
}
# ifdef __WIN32__
WXLRESULT wxMediaCtrl2 : : MSWWindowProc ( WXUINT nMsg ,
WXWPARAM wParam ,
WXLPARAM lParam )
{
if ( nMsg = = WM_USER + 1000 ) {
wxString msg ( ( wchar_t const * ) lParam ) ;
if ( wParam = = 1 ) {
if ( msg . EndsWith ( " ] " ) ) {
int n = msg . find_last_of ( ' [ ' ) ;
if ( n ! = wxString : : npos ) {
long val = 0 ;
if ( msg . SubString ( n + 1 , msg . Length ( ) - 2 ) . ToLong ( & val ) )
m_error = ( int ) val ;
}
2023-11-21 04:17:24 +00:00
} else if ( msg . Contains ( " stat_log " ) ) {
wxCommandEvent evt ( EVT_MEDIA_CTRL_STAT ) ;
evt . SetEventObject ( this ) ;
evt . SetString ( msg . Mid ( msg . Find ( ' ' ) + 1 ) ) ;
wxPostEvent ( this , evt ) ;
2022-07-15 15:37:19 +00:00
}
}
2024-01-25 06:51:57 +00:00
BOOST_LOG_TRIVIAL ( info ) < < msg . ToUTF8 ( ) . data ( ) ;
2022-07-15 15:37:19 +00:00
return 0 ;
}
return wxMediaCtrl : : MSWWindowProc ( nMsg , wParam , lParam ) ;
}
# endif