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);
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; }
128 const wxEventType wxEVT_MEDIA_FINISHED = 0;
129 const wxEventType wxEVT_MEDIA_STOP = 0;
130 const wxEventType wxEVT_MEDIA_LOADED = 0;
137 //---------------------------------------------------------------------------
141 wxMEDIASTATE_STOPPED,
147 enum wxMediaCtrlPlayerControls
149 wxMEDIACTRLPLAYERCONTROLS_NONE,
150 wxMEDIACTRLPLAYERCONTROLS_STEP,
151 wxMEDIACTRLPLAYERCONTROLS_VOLUME,
152 wxMEDIACTRLPLAYERCONTROLS_DEFAULT
156 MAKE_CONST_WXSTRING(MEDIABACKEND_DIRECTSHOW);
157 MAKE_CONST_WXSTRING(MEDIABACKEND_MCI );
158 MAKE_CONST_WXSTRING(MEDIABACKEND_QUICKTIME );
159 MAKE_CONST_WXSTRING(MEDIABACKEND_GSTREAMER );
161 //---------------------------------------------------------------------------
163 class wxMediaEvent : public wxNotifyEvent
166 wxMediaEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
170 //---------------------------------------------------------------------------
172 MAKE_CONST_WXSTRING_NOSWIG(EmptyString);
173 MAKE_CONST_WXSTRING2(MediaCtrlNameStr, wxT("mediaCtrl"));
174 MustHaveApp(wxMediaCtrl);
177 class wxMediaCtrl : public wxControl
180 %pythonAppend wxMediaCtrl "self._setOORInfo(self)"
181 %pythonAppend wxMediaCtrl() ""
184 wxMediaCtrl(wxWindow* parent,
186 const wxString& fileName = wxPyEmptyString,
187 const wxPoint& pos = wxDefaultPosition,
188 const wxSize& size = wxDefaultSize,
190 const wxString& szBackend = wxPyEmptyString,
191 const wxValidator& validator = wxDefaultValidator,
192 const wxString& name = wxPyMediaCtrlNameStr);
194 %RenameCtor(PreMediaCtrl, wxMediaCtrl());
196 bool Create(wxWindow* parent,
198 const wxString& fileName = wxPyEmptyString,
199 const wxPoint& pos = wxDefaultPosition,
200 const wxSize& size = wxDefaultSize,
202 const wxString& szBackend = wxPyEmptyString,
203 const wxValidator& validator = wxDefaultValidator,
204 const wxString& name = wxPyMediaCtrlNameStr);
211 wxMediaState GetState();
213 double GetPlaybackRate();
214 bool SetPlaybackRate(double dRate);
216 wxFileOffset Seek(wxFileOffset where, wxSeekMode mode = wxFromStart);
218 wxFileOffset Length();
221 bool SetVolume(double dVolume);
223 bool ShowPlayerControls(
224 wxMediaCtrlPlayerControls flags = wxMEDIACTRLPLAYERCONTROLS_DEFAULT);
226 bool Load(const wxString& fileName);
227 bool LoadURI(const wxString& fileName);
228 bool LoadURIWithProxy(const wxString& fileName, const wxString& proxy);
229 %pythoncode { LoadFromURI = LoadURI }
234 %constant wxEventType wxEVT_MEDIA_FINISHED;
235 %constant wxEventType wxEVT_MEDIA_STOP;
236 %constant wxEventType wxEVT_MEDIA_LOADED;
239 EVT_MEDIA_FINISHED = wx.PyEventBinder( wxEVT_MEDIA_FINISHED, 1)
240 EVT_MEDIA_STOP = wx.PyEventBinder( wxEVT_MEDIA_STOP, 1)
241 EVT_MEDIA_LOADED = wx.PyEventBinder( wxEVT_MEDIA_LOADED, 1)
244 //---------------------------------------------------------------------------
249 //---------------------------------------------------------------------------