1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: SWIG definitions for the wxMediaCtrl
7 // Created: 23-Nov-2004
9 // Copyright: (c) 2004 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
14 "Classes for a media player control"
17 %module(package="wx", docstring=DOCSTRING) media
21 #include "wx/wxPython/wxPython.h"
22 #include "wx/wxPython/pyclasses.h"
24 #include <wx/mediactrl.h>
28 //----------------------------------------------------------------------
31 %pythoncode { wx = _core }
32 %pythoncode { __docfilter__ = wx.__DocFilter(globals()) }
34 //---------------------------------------------------------------------------
36 %typemap(in) wxLongLong {
37 $1 = PyLong_AsLongLong($input);
41 %typemap(out) wxLongLong {
42 $result = PyLong_FromLongLong($1.GetValue());
45 //---------------------------------------------------------------------------
46 // Make a stubbed out class for platforms that don't have wxMediaCtrl
51 wxMEDIASTATE_STOPPED=0,
52 wxMEDIASTATE_PAUSED=0,
53 wxMEDIASTATE_PLAYING=0
56 enum wxMediaCtrlPlayerControls
58 wxMEDIACTRLPLAYERCONTROLS_NONE,
59 wxMEDIACTRLPLAYERCONTROLS_STEP,
60 wxMEDIACTRLPLAYERCONTROLS_VOLUME,
61 wxMEDIACTRLPLAYERCONTROLS_DEFAULT
64 static wxString wxMEDIABACKEND_DIRECTSHOW(wxEmptyString);
65 static wxString wxMEDIABACKEND_MCI (wxEmptyString);
66 static wxString wxMEDIABACKEND_QUICKTIME (wxEmptyString);
67 static wxString wxMEDIABACKEND_GSTREAMER (wxEmptyString);
68 static wxString wxMEDIABACKEND_REALPLAYER(wxEmptyString);
69 static wxString wxMEDIABACKEND_WMP10 (wxEmptyString);
72 class wxMediaEvent : public wxNotifyEvent
75 wxMediaEvent(wxEventType, int ) { wxPyRaiseNotImplemented(); }
78 class wxMediaCtrl : public wxControl
81 wxMediaCtrl() { wxPyRaiseNotImplemented(); }
83 wxMediaCtrl(wxWindow* , wxWindowID ,
90 const wxString& ) { wxPyRaiseNotImplemented(); }
92 bool Create(wxWindow* , wxWindowID ,
99 const wxString& ) { return false; }
101 bool Play() { return false; }
102 bool Pause() { return false; }
103 bool Stop() { return false; }
105 wxMediaState GetState() { return wxMEDIASTATE_STOPPED; }
107 double GetPlaybackRate() { return 0.0; }
108 bool SetPlaybackRate(double dRate) { return false; }
110 wxFileOffset Seek(wxFileOffset where, wxSeekMode mode = wxFromStart)
113 wxFileOffset Tell() { return 0; }
114 wxFileOffset Length() { return 0; }
116 double GetVolume() { return 0.0; }
117 bool SetVolume(double dVolume) { return false; }
119 bool ShowPlayerControls(
120 wxMediaCtrlPlayerControls flags = wxMEDIACTRLPLAYERCONTROLS_DEFAULT)
123 bool Load(const wxString& fileName) { return false; }
124 bool LoadURI(const wxString& fileName) { return false; }
125 bool LoadURIWithProxy(const wxString& fileName, const wxString& proxy) { return false; }
127 wxFileOffset GetDownloadProgress() { return 0; }
128 wxFileOffset GetDownloadTotal() { return 0; }
132 const wxEventType wxEVT_MEDIA_FINISHED = 0;
133 const wxEventType wxEVT_MEDIA_STOP = 0;
134 const wxEventType wxEVT_MEDIA_LOADED = 0;
135 const wxEventType wxEVT_MEDIA_STATECHANGED = 0;
136 const wxEventType wxEVT_MEDIA_PLAY = 0;
137 const wxEventType wxEVT_MEDIA_PAUSE = 0;
144 //---------------------------------------------------------------------------
148 wxMEDIASTATE_STOPPED,
154 enum wxMediaCtrlPlayerControls
156 wxMEDIACTRLPLAYERCONTROLS_NONE,
157 wxMEDIACTRLPLAYERCONTROLS_STEP,
158 wxMEDIACTRLPLAYERCONTROLS_VOLUME,
159 wxMEDIACTRLPLAYERCONTROLS_DEFAULT
163 MAKE_CONST_WXSTRING(MEDIABACKEND_DIRECTSHOW);
164 MAKE_CONST_WXSTRING(MEDIABACKEND_MCI );
165 MAKE_CONST_WXSTRING(MEDIABACKEND_QUICKTIME );
166 MAKE_CONST_WXSTRING(MEDIABACKEND_GSTREAMER );
167 MAKE_CONST_WXSTRING(MEDIABACKEND_REALPLAYER);
168 MAKE_CONST_WXSTRING(MEDIABACKEND_WMP10);
170 //---------------------------------------------------------------------------
172 class wxMediaEvent : public wxNotifyEvent
175 wxMediaEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
179 //---------------------------------------------------------------------------
181 MAKE_CONST_WXSTRING_NOSWIG(EmptyString);
182 MAKE_CONST_WXSTRING2(MediaCtrlNameStr, wxT("mediaCtrl"));
183 MustHaveApp(wxMediaCtrl);
186 class wxMediaCtrl : public wxControl
189 %pythonAppend wxMediaCtrl "self._setOORInfo(self)"
190 %pythonAppend wxMediaCtrl() ""
193 wxMediaCtrl(wxWindow* parent,
195 const wxString& fileName = wxPyEmptyString,
196 const wxPoint& pos = wxDefaultPosition,
197 const wxSize& size = wxDefaultSize,
199 const wxString& szBackend = wxPyEmptyString,
200 const wxValidator& validator = wxDefaultValidator,
201 const wxString& name = wxPyMediaCtrlNameStr);
203 %RenameCtor(PreMediaCtrl, wxMediaCtrl());
205 bool Create(wxWindow* parent,
207 const wxString& fileName = wxPyEmptyString,
208 const wxPoint& pos = wxDefaultPosition,
209 const wxSize& size = wxDefaultSize,
211 const wxString& szBackend = wxPyEmptyString,
212 const wxValidator& validator = wxDefaultValidator,
213 const wxString& name = wxPyMediaCtrlNameStr);
220 wxMediaState GetState();
222 double GetPlaybackRate();
223 bool SetPlaybackRate(double dRate);
225 wxFileOffset Seek(wxFileOffset where, wxSeekMode mode = wxFromStart);
227 wxFileOffset Length();
230 bool SetVolume(double dVolume);
232 bool ShowPlayerControls(
233 wxMediaCtrlPlayerControls flags = wxMEDIACTRLPLAYERCONTROLS_DEFAULT);
235 bool Load(const wxString& fileName);
236 bool LoadURI(const wxString& fileName);
237 bool LoadURIWithProxy(const wxString& fileName, const wxString& proxy);
238 %pythoncode { LoadFromURI = LoadURI }
240 wxFileOffset GetDownloadProgress(); // DirectShow only
241 wxFileOffset GetDownloadTotal(); // DirectShow only
243 %property(DownloadProgress, GetDownloadProgress, doc="See `GetDownloadProgress`");
244 %property(DownloadTotal, GetDownloadTotal, doc="See `GetDownloadTotal`");
245 %property(PlaybackRate, GetPlaybackRate, SetPlaybackRate, doc="See `GetPlaybackRate` and `SetPlaybackRate`");
246 %property(State, GetState, doc="See `GetState`");
247 %property(Volume, GetVolume, SetVolume, doc="See `GetVolume` and `SetVolume`");
252 %constant wxEventType wxEVT_MEDIA_FINISHED;
253 %constant wxEventType wxEVT_MEDIA_STOP;
254 %constant wxEventType wxEVT_MEDIA_LOADED;
255 %constant wxEventType wxEVT_MEDIA_STATECHANGED;
256 %constant wxEventType wxEVT_MEDIA_PLAY;
257 %constant wxEventType wxEVT_MEDIA_PAUSE;
261 EVT_MEDIA_FINISHED = wx.PyEventBinder( wxEVT_MEDIA_FINISHED, 1)
262 EVT_MEDIA_STOP = wx.PyEventBinder( wxEVT_MEDIA_STOP, 1)
263 EVT_MEDIA_LOADED = wx.PyEventBinder( wxEVT_MEDIA_LOADED, 1)
264 EVT_MEDIA_STATECHANGED = wx.PyEventBinder( wxEVT_MEDIA_STATECHANGED, 1)
265 EVT_MEDIA_PLAY = wx.PyEventBinder( wxEVT_MEDIA_PLAY, 1)
266 EVT_MEDIA_PAUSE = wx.PyEventBinder( wxEVT_MEDIA_PAUSE, 1)
269 //---------------------------------------------------------------------------
274 //---------------------------------------------------------------------------