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 %include _media_rename.i
36 //---------------------------------------------------------------------------
38 %typemap(in) wxLongLong {
39 $1 = PyLong_AsLongLong($input);
43 %typemap(out) wxLongLong {
44 $result = PyLong_FromLongLong($1.GetValue());
47 //---------------------------------------------------------------------------
48 // Make a stubbed out class for platforms that don't have wxMediaCtrl
53 wxMEDIASTATE_STOPPED=0,
54 wxMEDIASTATE_PAUSED=0,
55 wxMEDIASTATE_PLAYING=0
58 enum wxMediaCtrlPlayerControls
60 wxMEDIACTRLPLAYERCONTROLS_NONE,
61 wxMEDIACTRLPLAYERCONTROLS_STEP,
62 wxMEDIACTRLPLAYERCONTROLS_VOLUME,
63 wxMEDIACTRLPLAYERCONTROLS_DEFAULT
66 static wxString wxMEDIABACKEND_DIRECTSHOW(wxEmptyString);
67 static wxString wxMEDIABACKEND_MCI (wxEmptyString);
68 static wxString wxMEDIABACKEND_QUICKTIME (wxEmptyString);
69 static wxString wxMEDIABACKEND_GSTREAMER (wxEmptyString);
70 static wxString wxMEDIABACKEND_REALPLAYER(wxEmptyString);
71 static wxString wxMEDIABACKEND_WMP10 (wxEmptyString);
74 class wxMediaEvent : public wxNotifyEvent
77 wxMediaEvent(wxEventType, int ) { wxPyRaiseNotImplemented(); }
80 class wxMediaCtrl : public wxControl
83 wxMediaCtrl() { wxPyRaiseNotImplemented(); }
85 wxMediaCtrl(wxWindow* , wxWindowID ,
92 const wxString& ) { wxPyRaiseNotImplemented(); }
94 bool Create(wxWindow* , wxWindowID ,
101 const wxString& ) { return false; }
103 bool Play() { return false; }
104 bool Pause() { return false; }
105 bool Stop() { return false; }
107 wxMediaState GetState() { return wxMEDIASTATE_STOPPED; }
109 double GetPlaybackRate() { return 0.0; }
110 bool SetPlaybackRate(double dRate) { return false; }
112 wxFileOffset Seek(wxFileOffset where, wxSeekMode mode = wxFromStart)
115 wxFileOffset Tell() { return 0; }
116 wxFileOffset Length() { return 0; }
118 double GetVolume() { return 0.0; }
119 bool SetVolume(double dVolume) { return false; }
121 bool ShowPlayerControls(
122 wxMediaCtrlPlayerControls flags = wxMEDIACTRLPLAYERCONTROLS_DEFAULT)
125 bool Load(const wxString& fileName) { return false; }
126 bool LoadURI(const wxString& fileName) { return false; }
127 bool LoadURIWithProxy(const wxString& fileName, const wxString& proxy) { return false; }
129 wxFileOffset GetDownloadProgress() { return 0; }
130 wxFileOffset GetDownloadTotal() { return 0; }
134 const wxEventType wxEVT_MEDIA_FINISHED = 0;
135 const wxEventType wxEVT_MEDIA_STOP = 0;
136 const wxEventType wxEVT_MEDIA_LOADED = 0;
137 const wxEventType wxEVT_MEDIA_STATECHANGED = 0;
138 const wxEventType wxEVT_MEDIA_PLAY = 0;
139 const wxEventType wxEVT_MEDIA_PAUSE = 0;
146 //---------------------------------------------------------------------------
150 wxMEDIASTATE_STOPPED,
156 enum wxMediaCtrlPlayerControls
158 wxMEDIACTRLPLAYERCONTROLS_NONE,
159 wxMEDIACTRLPLAYERCONTROLS_STEP,
160 wxMEDIACTRLPLAYERCONTROLS_VOLUME,
161 wxMEDIACTRLPLAYERCONTROLS_DEFAULT
165 MAKE_CONST_WXSTRING(MEDIABACKEND_DIRECTSHOW);
166 MAKE_CONST_WXSTRING(MEDIABACKEND_MCI );
167 MAKE_CONST_WXSTRING(MEDIABACKEND_QUICKTIME );
168 MAKE_CONST_WXSTRING(MEDIABACKEND_GSTREAMER );
169 MAKE_CONST_WXSTRING(MEDIABACKEND_REALPLAYER);
170 MAKE_CONST_WXSTRING(MEDIABACKEND_WMP10);
172 //---------------------------------------------------------------------------
174 class wxMediaEvent : public wxNotifyEvent
177 wxMediaEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
181 //---------------------------------------------------------------------------
183 MAKE_CONST_WXSTRING_NOSWIG(EmptyString);
184 MAKE_CONST_WXSTRING2(MediaCtrlNameStr, wxT("mediaCtrl"));
185 MustHaveApp(wxMediaCtrl);
188 class wxMediaCtrl : public wxControl
191 %pythonAppend wxMediaCtrl "self._setOORInfo(self)"
192 %pythonAppend wxMediaCtrl() ""
195 wxMediaCtrl(wxWindow* parent,
197 const wxString& fileName = wxPyEmptyString,
198 const wxPoint& pos = wxDefaultPosition,
199 const wxSize& size = wxDefaultSize,
201 const wxString& szBackend = wxPyEmptyString,
202 const wxValidator& validator = wxDefaultValidator,
203 const wxString& name = wxPyMediaCtrlNameStr);
205 %RenameCtor(PreMediaCtrl, wxMediaCtrl());
207 bool Create(wxWindow* parent,
209 const wxString& fileName = wxPyEmptyString,
210 const wxPoint& pos = wxDefaultPosition,
211 const wxSize& size = wxDefaultSize,
213 const wxString& szBackend = wxPyEmptyString,
214 const wxValidator& validator = wxDefaultValidator,
215 const wxString& name = wxPyMediaCtrlNameStr);
222 wxMediaState GetState();
224 double GetPlaybackRate();
225 bool SetPlaybackRate(double dRate);
227 wxFileOffset Seek(wxFileOffset where, wxSeekMode mode = wxFromStart);
229 wxFileOffset Length();
232 bool SetVolume(double dVolume);
234 bool ShowPlayerControls(
235 wxMediaCtrlPlayerControls flags = wxMEDIACTRLPLAYERCONTROLS_DEFAULT);
237 bool Load(const wxString& fileName);
238 bool LoadURI(const wxString& fileName);
239 bool LoadURIWithProxy(const wxString& fileName, const wxString& proxy);
240 %pythoncode { LoadFromURI = LoadURI }
242 wxFileOffset GetDownloadProgress(); // DirectShow only
243 wxFileOffset GetDownloadTotal(); // DirectShow only
249 %constant wxEventType wxEVT_MEDIA_FINISHED;
250 %constant wxEventType wxEVT_MEDIA_STOP;
251 %constant wxEventType wxEVT_MEDIA_LOADED;
252 %constant wxEventType wxEVT_MEDIA_STATECHANGED;
253 %constant wxEventType wxEVT_MEDIA_PLAY;
254 %constant wxEventType wxEVT_MEDIA_PAUSE;
258 EVT_MEDIA_FINISHED = wx.PyEventBinder( wxEVT_MEDIA_FINISHED, 1)
259 EVT_MEDIA_STOP = wx.PyEventBinder( wxEVT_MEDIA_STOP, 1)
260 EVT_MEDIA_LOADED = wx.PyEventBinder( wxEVT_MEDIA_LOADED, 1)
261 EVT_MEDIA_STATECHANGED = wx.PyEventBinder( wxEVT_MEDIA_STATECHANGED, 1)
262 EVT_MEDIA_PLAY = wx.PyEventBinder( wxEVT_MEDIA_PLAY, 1)
263 EVT_MEDIA_PAUSE = wx.PyEventBinder( wxEVT_MEDIA_PAUSE, 1)
266 //---------------------------------------------------------------------------
271 //---------------------------------------------------------------------------