]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/media.i
Tweaks for demos on MacOSX
[wxWidgets.git] / wxPython / src / media.i
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: media.i
3 // Purpose: SWIG definitions for the wxMediaCtrl
4 //
5 // Author: Robin Dunn
6 //
7 // Created: 23-Nov-2004
8 // RCS-ID: $Id$
9 // Copyright: (c) 2004 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
12
13 %define DOCSTRING
14 "Classes for a media player control"
15 %enddef
16
17 %module(package="wx", docstring=DOCSTRING) media
18
19
20 %{
21 #include "wx/wxPython/wxPython.h"
22 #include "wx/wxPython/pyclasses.h"
23
24 #include <wx/mediactrl.h>
25 #include <wx/uri.h>
26 %}
27
28 //----------------------------------------------------------------------
29
30 %import core.i
31 %pythoncode { wx = _core }
32 %pythoncode { __docfilter__ = wx.__DocFilter(globals()) }
33
34 %include _media_rename.i
35
36 //---------------------------------------------------------------------------
37
38 %typemap(in) wxLongLong {
39 $1 = PyLong_AsLongLong($input);
40 }
41
42
43 %typemap(out) wxLongLong {
44 $result = PyLong_FromLongLong($1.GetValue());
45 }
46
47 //---------------------------------------------------------------------------
48 // Make a stubbed out class for platforms that don't have wxMediaCtrl
49 %{
50 #if !wxUSE_MEDIACTRL
51 enum wxMediaState
52 {
53 wxMEDIASTATE_STOPPED=0,
54 wxMEDIASTATE_PAUSED=0,
55 wxMEDIASTATE_PLAYING=0
56 };
57
58 enum wxMediaCtrlPlayerControls
59 {
60 wxMEDIACTRLPLAYERCONTROLS_NONE,
61 wxMEDIACTRLPLAYERCONTROLS_STEP,
62 wxMEDIACTRLPLAYERCONTROLS_VOLUME,
63 wxMEDIACTRLPLAYERCONTROLS_DEFAULT
64 };
65
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);
72
73
74 class wxMediaEvent : public wxNotifyEvent
75 {
76 public:
77 wxMediaEvent(wxEventType, int ) { wxPyRaiseNotImplemented(); }
78 };
79
80 class wxMediaCtrl : public wxControl
81 {
82 public:
83 wxMediaCtrl() { wxPyRaiseNotImplemented(); }
84
85 wxMediaCtrl(wxWindow* , wxWindowID ,
86 const wxString& ,
87 const wxPoint& ,
88 const wxSize& ,
89 long style ,
90 const wxString& ,
91 const wxValidator& ,
92 const wxString& ) { wxPyRaiseNotImplemented(); }
93
94 bool Create(wxWindow* , wxWindowID ,
95 const wxString& ,
96 const wxPoint& ,
97 const wxSize& ,
98 long style ,
99 const wxString& ,
100 const wxValidator& ,
101 const wxString& ) { return false; }
102
103 bool Play() { return false; }
104 bool Pause() { return false; }
105 bool Stop() { return false; }
106
107 wxMediaState GetState() { return wxMEDIASTATE_STOPPED; }
108
109 double GetPlaybackRate() { return 0.0; }
110 bool SetPlaybackRate(double dRate) { return false; }
111
112 wxFileOffset Seek(wxFileOffset where, wxSeekMode mode = wxFromStart)
113 { return 0; }
114
115 wxFileOffset Tell() { return 0; }
116 wxFileOffset Length() { return 0; }
117
118 double GetVolume() { return 0.0; }
119 bool SetVolume(double dVolume) { return false; }
120
121 bool ShowPlayerControls(
122 wxMediaCtrlPlayerControls flags = wxMEDIACTRLPLAYERCONTROLS_DEFAULT)
123 { return false; }
124
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; }
128
129 wxFileOffset GetDownloadProgress() { return 0; }
130 wxFileOffset GetDownloadTotal() { return 0; }
131
132 };
133
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;
140
141 #endif
142 %}
143
144
145
146 //---------------------------------------------------------------------------
147
148 enum wxMediaState
149 {
150 wxMEDIASTATE_STOPPED,
151 wxMEDIASTATE_PAUSED,
152 wxMEDIASTATE_PLAYING
153 };
154
155
156 enum wxMediaCtrlPlayerControls
157 {
158 wxMEDIACTRLPLAYERCONTROLS_NONE,
159 wxMEDIACTRLPLAYERCONTROLS_STEP,
160 wxMEDIACTRLPLAYERCONTROLS_VOLUME,
161 wxMEDIACTRLPLAYERCONTROLS_DEFAULT
162 };
163
164
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);
171
172 //---------------------------------------------------------------------------
173
174 class wxMediaEvent : public wxNotifyEvent
175 {
176 public:
177 wxMediaEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
178 };
179
180
181 //---------------------------------------------------------------------------
182
183 MAKE_CONST_WXSTRING_NOSWIG(EmptyString);
184 MAKE_CONST_WXSTRING2(MediaCtrlNameStr, wxT("mediaCtrl"));
185 MustHaveApp(wxMediaCtrl);
186
187
188 class wxMediaCtrl : public wxControl
189 {
190 public:
191 %pythonAppend wxMediaCtrl "self._setOORInfo(self)"
192 %pythonAppend wxMediaCtrl() ""
193
194
195 wxMediaCtrl(wxWindow* parent,
196 wxWindowID id=-1,
197 const wxString& fileName = wxPyEmptyString,
198 const wxPoint& pos = wxDefaultPosition,
199 const wxSize& size = wxDefaultSize,
200 long style = 0,
201 const wxString& szBackend = wxPyEmptyString,
202 const wxValidator& validator = wxDefaultValidator,
203 const wxString& name = wxPyMediaCtrlNameStr);
204
205 %RenameCtor(PreMediaCtrl, wxMediaCtrl());
206
207 bool Create(wxWindow* parent,
208 wxWindowID id=-1,
209 const wxString& fileName = wxPyEmptyString,
210 const wxPoint& pos = wxDefaultPosition,
211 const wxSize& size = wxDefaultSize,
212 long style = 0,
213 const wxString& szBackend = wxPyEmptyString,
214 const wxValidator& validator = wxDefaultValidator,
215 const wxString& name = wxPyMediaCtrlNameStr);
216
217
218 bool Play();
219 bool Pause();
220 bool Stop();
221
222 wxMediaState GetState();
223
224 double GetPlaybackRate();
225 bool SetPlaybackRate(double dRate);
226
227 wxFileOffset Seek(wxFileOffset where, wxSeekMode mode = wxFromStart);
228 wxFileOffset Tell();
229 wxFileOffset Length();
230
231 double GetVolume();
232 bool SetVolume(double dVolume);
233
234 bool ShowPlayerControls(
235 wxMediaCtrlPlayerControls flags = wxMEDIACTRLPLAYERCONTROLS_DEFAULT);
236
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 }
241
242 wxFileOffset GetDownloadProgress(); // DirectShow only
243 wxFileOffset GetDownloadTotal(); // DirectShow only
244
245 };
246
247
248
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;
255
256
257 %pythoncode {
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)
264 }
265
266 //---------------------------------------------------------------------------
267
268 %init %{
269 %}
270
271 //---------------------------------------------------------------------------
272