X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/95262b5fa5519e3d6ab848a04e86902e985a550a..9e477492e29e03c02827b1e42a16cb09a13f5149:/wxPython/src/media.i?ds=sidebyside diff --git a/wxPython/src/media.i b/wxPython/src/media.i index 416efc9a5b..129284aeb0 100644 --- a/wxPython/src/media.i +++ b/wxPython/src/media.i @@ -11,7 +11,7 @@ ///////////////////////////////////////////////////////////////////////////// %define DOCSTRING -"Classes for a medai player control" +"Classes for a media player control" %enddef %module(package="wx", docstring=DOCSTRING) media @@ -31,8 +31,6 @@ %pythoncode { wx = _core } %pythoncode { __docfilter__ = wx.__DocFilter(globals()) } -%include _media_rename.i - //--------------------------------------------------------------------------- %typemap(in) wxLongLong { @@ -55,12 +53,23 @@ enum wxMediaState wxMEDIASTATE_PLAYING=0 }; -enum wxMediaTimeFormat +enum wxMediaCtrlPlayerControls { - wxMEDIATIMEFORMAT_TIME=0 + wxMEDIACTRLPLAYERCONTROLS_NONE, + wxMEDIACTRLPLAYERCONTROLS_STEP, + wxMEDIACTRLPLAYERCONTROLS_VOLUME, + wxMEDIACTRLPLAYERCONTROLS_DEFAULT }; -class WXDLLIMPEXP_MEDIA wxMediaEvent : public wxNotifyEvent +static wxString wxMEDIABACKEND_DIRECTSHOW(wxEmptyString); +static wxString wxMEDIABACKEND_MCI (wxEmptyString); +static wxString wxMEDIABACKEND_QUICKTIME (wxEmptyString); +static wxString wxMEDIABACKEND_GSTREAMER (wxEmptyString); +static wxString wxMEDIABACKEND_REALPLAYER(wxEmptyString); +static wxString wxMEDIABACKEND_WMP10 (wxEmptyString); + + +class wxMediaEvent : public wxNotifyEvent { public: wxMediaEvent(wxEventType, int ) { wxPyRaiseNotImplemented(); } @@ -69,7 +78,7 @@ public: class wxMediaCtrl : public wxControl { public: - wxMediaCtrl() { wxPyRaiseNotImplemented(); } + wxMediaCtrl() { wxPyRaiseNotImplemented(); } wxMediaCtrl(wxWindow* , wxWindowID , const wxString& , @@ -80,16 +89,6 @@ public: const wxValidator& , const wxString& ) { wxPyRaiseNotImplemented(); } - wxMediaCtrl(wxWindow* , - wxWindowID , - const wxURI& , - const wxPoint&, - const wxSize& , - long style, - const wxString& , - const wxValidator& , - const wxString& ) { wxPyRaiseNotImplemented(); } - bool Create(wxWindow* , wxWindowID , const wxString& , const wxPoint& , @@ -99,38 +98,43 @@ public: const wxValidator& , const wxString& ) { return false; } - bool Create(wxWindow* , - wxWindowID , - const wxURI& , - const wxPoint&, - const wxSize& , - long style, - const wxString& , - const wxValidator& , - const wxString& ) { return false; } - bool Play() { return false; } bool Pause() { return false; } bool Stop() { return false; } - bool Load(const wxString& fileName) { return false; } - bool Load(const wxURI& location) { return false; } - - void Loop(bool bLoop = true) {} - bool IsLooped() { return false; } - wxMediaState GetState() { return wxMEDIASTATE_STOPPED; } - double GetPlaybackRate() { return 0.0; }; + double GetPlaybackRate() { return 0.0; } bool SetPlaybackRate(double dRate) { return false; } - bool SetPosition(wxLongLong where) { return false; } - wxLongLong GetPosition() { return 0; } - wxLongLong GetDuration() { return 0; } + wxFileOffset Seek(wxFileOffset where, wxSeekMode mode = wxFromStart) + { return 0; } + + wxFileOffset Tell() { return 0; } + wxFileOffset Length() { return 0; } + + double GetVolume() { return 0.0; } + bool SetVolume(double dVolume) { return false; } + + bool ShowPlayerControls( + wxMediaCtrlPlayerControls flags = wxMEDIACTRLPLAYERCONTROLS_DEFAULT) + { return false; } + + bool Load(const wxString& fileName) { return false; } + bool LoadURI(const wxString& fileName) { return false; } + bool LoadURIWithProxy(const wxString& fileName, const wxString& proxy) { return false; } + + wxFileOffset GetDownloadProgress() { return 0; } + wxFileOffset GetDownloadTotal() { return 0; } + }; const wxEventType wxEVT_MEDIA_FINISHED = 0; const wxEventType wxEVT_MEDIA_STOP = 0; +const wxEventType wxEVT_MEDIA_LOADED = 0; +const wxEventType wxEVT_MEDIA_STATECHANGED = 0; +const wxEventType wxEVT_MEDIA_PLAY = 0; +const wxEventType wxEVT_MEDIA_PAUSE = 0; #endif %} @@ -146,15 +150,22 @@ enum wxMediaState wxMEDIASTATE_PLAYING }; -enum wxMediaTimeFormat + +enum wxMediaCtrlPlayerControls { - wxMEDIATIMEFORMAT_TIME + wxMEDIACTRLPLAYERCONTROLS_NONE, + wxMEDIACTRLPLAYERCONTROLS_STEP, + wxMEDIACTRLPLAYERCONTROLS_VOLUME, + wxMEDIACTRLPLAYERCONTROLS_DEFAULT }; -// MAKE_CONST_WXSTRING(MEDIABACKEND_DIRECTSHOW); -// MAKE_CONST_WXSTRING(MEDIABACKEND_MCI ); -// MAKE_CONST_WXSTRING(MEDIABACKEND_QUICKTIME ); +MAKE_CONST_WXSTRING(MEDIABACKEND_DIRECTSHOW); +MAKE_CONST_WXSTRING(MEDIABACKEND_MCI ); +MAKE_CONST_WXSTRING(MEDIABACKEND_QUICKTIME ); +MAKE_CONST_WXSTRING(MEDIABACKEND_GSTREAMER ); +MAKE_CONST_WXSTRING(MEDIABACKEND_REALPLAYER); +MAKE_CONST_WXSTRING(MEDIABACKEND_WMP10); //--------------------------------------------------------------------------- @@ -189,39 +200,7 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxPyMediaCtrlNameStr); - %name(PreMediaCtrl) wxMediaCtrl(); - - %extend { - %name(MediaCtrlFromURI) - wxMediaCtrl(wxWindow* parent, - wxWindowID id=-1, - const wxString& location=wxPyEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& szBackend = wxPyEmptyString, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxPyMediaCtrlNameStr) - { - return new wxMediaCtrl(parent, id, wxURI(location), - pos, size, style, szBackend, validator, name); - } - - bool CreateFromURI(wxWindow* parent, - wxWindowID id=-1, - const wxString& location=wxPyEmptyString, - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = 0, - const wxString& szBackend = wxPyEmptyString, - const wxValidator& validator = wxDefaultValidator, - const wxString& name = wxPyMediaCtrlNameStr) - { - return self->Create(parent, id, wxURI(location), - pos, size, style, szBackend, validator, name); - } - } - + %RenameCtor(PreMediaCtrl, wxMediaCtrl()); bool Create(wxWindow* parent, wxWindowID id=-1, @@ -238,34 +217,53 @@ public: bool Pause(); bool Stop(); - bool Load(const wxString& fileName); - %extend { - bool LoadFromURI(const wxString& location) { - return self->Load(wxURI(location)); - } - } - - void Loop(bool bLoop = true); - bool IsLooped(); - wxMediaState GetState(); double GetPlaybackRate(); bool SetPlaybackRate(double dRate); - %name(SetMediaPosition) bool SetPosition(wxLongLong where); - %name(GetMediaPosition) wxLongLong GetPosition(); - %name(GetMediaDuration) wxLongLong GetDuration(); + wxFileOffset Seek(wxFileOffset where, wxSeekMode mode = wxFromStart); + wxFileOffset Tell(); + wxFileOffset Length(); + + double GetVolume(); + bool SetVolume(double dVolume); + + bool ShowPlayerControls( + wxMediaCtrlPlayerControls flags = wxMEDIACTRLPLAYERCONTROLS_DEFAULT); + + bool Load(const wxString& fileName); + bool LoadURI(const wxString& fileName); + bool LoadURIWithProxy(const wxString& fileName, const wxString& proxy); + %pythoncode { LoadFromURI = LoadURI } + + wxFileOffset GetDownloadProgress(); // DirectShow only + wxFileOffset GetDownloadTotal(); // DirectShow only + + %property(DownloadProgress, GetDownloadProgress, doc="See `GetDownloadProgress`"); + %property(DownloadTotal, GetDownloadTotal, doc="See `GetDownloadTotal`"); + %property(PlaybackRate, GetPlaybackRate, SetPlaybackRate, doc="See `GetPlaybackRate` and `SetPlaybackRate`"); + %property(State, GetState, doc="See `GetState`"); + %property(Volume, GetVolume, SetVolume, doc="See `GetVolume` and `SetVolume`"); }; %constant wxEventType wxEVT_MEDIA_FINISHED; %constant wxEventType wxEVT_MEDIA_STOP; +%constant wxEventType wxEVT_MEDIA_LOADED; +%constant wxEventType wxEVT_MEDIA_STATECHANGED; +%constant wxEventType wxEVT_MEDIA_PLAY; +%constant wxEventType wxEVT_MEDIA_PAUSE; + %pythoncode { -EVT_MEDIA_FINISHED = wx.PyEventBinder( wxEVT_MEDIA_FINISHED, 1) -EVT_MEDIA_STOP = wx.PyEventBinder( wxEVT_MEDIA_STOP, 1) +EVT_MEDIA_FINISHED = wx.PyEventBinder( wxEVT_MEDIA_FINISHED, 1) +EVT_MEDIA_STOP = wx.PyEventBinder( wxEVT_MEDIA_STOP, 1) +EVT_MEDIA_LOADED = wx.PyEventBinder( wxEVT_MEDIA_LOADED, 1) +EVT_MEDIA_STATECHANGED = wx.PyEventBinder( wxEVT_MEDIA_STATECHANGED, 1) +EVT_MEDIA_PLAY = wx.PyEventBinder( wxEVT_MEDIA_PLAY, 1) +EVT_MEDIA_PAUSE = wx.PyEventBinder( wxEVT_MEDIA_PAUSE, 1) } //---------------------------------------------------------------------------