]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/media.i
Respect the REUSEADDR flag to allow rebinding; bind to local port prior to connecting...
[wxWidgets.git] / wxPython / src / media.i
CommitLineData
256c055e
RD
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
e3f1b5b5 14"Classes for a media player control"
256c055e
RD
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>
4d5009f9 25#include <wx/uri.h>
256c055e
RD
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
51enum wxMediaState
52{
53 wxMEDIASTATE_STOPPED=0,
54 wxMEDIASTATE_PAUSED=0,
55 wxMEDIASTATE_PLAYING=0
56};
57
02b800ce
RD
58enum wxMediaCtrlPlayerControls
59{
60 wxMEDIACTRLPLAYERCONTROLS_NONE,
61 wxMEDIACTRLPLAYERCONTROLS_STEP,
62 wxMEDIACTRLPLAYERCONTROLS_VOLUME,
63 wxMEDIACTRLPLAYERCONTROLS_DEFAULT
64};
256c055e 65
b15ce821
RD
66static wxString wxMEDIABACKEND_DIRECTSHOW(wxEmptyString);
67static wxString wxMEDIABACKEND_MCI (wxEmptyString);
68static wxString wxMEDIABACKEND_QUICKTIME (wxEmptyString);
69static wxString wxMEDIABACKEND_GSTREAMER (wxEmptyString);
70
71
63cd6e0b 72class wxMediaEvent : public wxNotifyEvent
256c055e
RD
73{
74public:
4d5009f9 75 wxMediaEvent(wxEventType, int ) { wxPyRaiseNotImplemented(); }
256c055e
RD
76};
77
78class wxMediaCtrl : public wxControl
79{
80public:
6ed7f20d 81 wxMediaCtrl() { wxPyRaiseNotImplemented(); }
256c055e
RD
82
83 wxMediaCtrl(wxWindow* , wxWindowID ,
84 const wxString& ,
85 const wxPoint& ,
86 const wxSize& ,
87 long style ,
88 const wxString& ,
89 const wxValidator& ,
90 const wxString& ) { wxPyRaiseNotImplemented(); }
91
256c055e
RD
92 bool Create(wxWindow* , wxWindowID ,
93 const wxString& ,
94 const wxPoint& ,
95 const wxSize& ,
96 long style ,
97 const wxString& ,
98 const wxValidator& ,
99 const wxString& ) { return false; }
100
256c055e
RD
101 bool Play() { return false; }
102 bool Pause() { return false; }
103 bool Stop() { return false; }
104
256c055e
RD
105 wxMediaState GetState() { return wxMEDIASTATE_STOPPED; }
106
e3f1b5b5 107 double GetPlaybackRate() { return 0.0; }
256c055e
RD
108 bool SetPlaybackRate(double dRate) { return false; }
109
e3f1b5b5
RD
110 wxFileOffset Seek(wxFileOffset where, wxSeekMode mode = wxFromStart)
111 { return 0; }
112
113 wxFileOffset Tell() { return 0; }
114 wxFileOffset Length() { return 0; }
6c75a4cf
RD
115
116 double GetVolume() { return 0.0; }
117 bool SetVolume(double dVolume) { return false; }
02b800ce
RD
118
119 bool ShowPlayerControls(
120 wxMediaCtrlPlayerControls flags = wxMEDIACTRLPLAYERCONTROLS_DEFAULT)
121 { return false; }
122
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; }
256c055e 126};
4d5009f9
RD
127
128const wxEventType wxEVT_MEDIA_FINISHED = 0;
129const wxEventType wxEVT_MEDIA_STOP = 0;
095315e2 130const wxEventType wxEVT_MEDIA_LOADED = 0;
4d5009f9 131
256c055e
RD
132#endif
133%}
134
135
136
137//---------------------------------------------------------------------------
138
139enum wxMediaState
140{
141 wxMEDIASTATE_STOPPED,
142 wxMEDIASTATE_PAUSED,
143 wxMEDIASTATE_PLAYING
144};
145
256c055e 146
b15ce821
RD
147enum wxMediaCtrlPlayerControls
148{
149 wxMEDIACTRLPLAYERCONTROLS_NONE,
150 wxMEDIACTRLPLAYERCONTROLS_STEP,
151 wxMEDIACTRLPLAYERCONTROLS_VOLUME,
152 wxMEDIACTRLPLAYERCONTROLS_DEFAULT
153};
154
256c055e 155
b15ce821
RD
156MAKE_CONST_WXSTRING(MEDIABACKEND_DIRECTSHOW);
157MAKE_CONST_WXSTRING(MEDIABACKEND_MCI );
158MAKE_CONST_WXSTRING(MEDIABACKEND_QUICKTIME );
159MAKE_CONST_WXSTRING(MEDIABACKEND_GSTREAMER );
256c055e
RD
160
161//---------------------------------------------------------------------------
162
163class wxMediaEvent : public wxNotifyEvent
164{
165public:
166 wxMediaEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
167};
168
169
170//---------------------------------------------------------------------------
171
172MAKE_CONST_WXSTRING_NOSWIG(EmptyString);
4d5009f9 173MAKE_CONST_WXSTRING2(MediaCtrlNameStr, wxT("mediaCtrl"));
256c055e
RD
174MustHaveApp(wxMediaCtrl);
175
176
177class wxMediaCtrl : public wxControl
178{
179public:
180 %pythonAppend wxMediaCtrl "self._setOORInfo(self)"
181 %pythonAppend wxMediaCtrl() ""
182
183
95262b5f
RD
184 wxMediaCtrl(wxWindow* parent,
185 wxWindowID id=-1,
256c055e
RD
186 const wxString& fileName = wxPyEmptyString,
187 const wxPoint& pos = wxDefaultPosition,
188 const wxSize& size = wxDefaultSize,
189 long style = 0,
190 const wxString& szBackend = wxPyEmptyString,
191 const wxValidator& validator = wxDefaultValidator,
192 const wxString& name = wxPyMediaCtrlNameStr);
193
1b8c7ba6 194 %RenameCtor(PreMediaCtrl, wxMediaCtrl());
256c055e 195
95262b5f
RD
196 bool Create(wxWindow* parent,
197 wxWindowID id=-1,
256c055e
RD
198 const wxString& fileName = wxPyEmptyString,
199 const wxPoint& pos = wxDefaultPosition,
200 const wxSize& size = wxDefaultSize,
201 long style = 0,
202 const wxString& szBackend = wxPyEmptyString,
203 const wxValidator& validator = wxDefaultValidator,
204 const wxString& name = wxPyMediaCtrlNameStr);
205
206
207 bool Play();
208 bool Pause();
209 bool Stop();
210
256c055e
RD
211 wxMediaState GetState();
212
213 double GetPlaybackRate();
214 bool SetPlaybackRate(double dRate);
215
e3f1b5b5
RD
216 wxFileOffset Seek(wxFileOffset where, wxSeekMode mode = wxFromStart);
217 wxFileOffset Tell();
218 wxFileOffset Length();
02b800ce
RD
219
220 double GetVolume();
221 bool SetVolume(double dVolume);
222
223 bool ShowPlayerControls(
224 wxMediaCtrlPlayerControls flags = wxMEDIACTRLPLAYERCONTROLS_DEFAULT);
225
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 }
256c055e
RD
230};
231
232
233
234%constant wxEventType wxEVT_MEDIA_FINISHED;
235%constant wxEventType wxEVT_MEDIA_STOP;
095315e2 236%constant wxEventType wxEVT_MEDIA_LOADED;
256c055e
RD
237
238%pythoncode {
239EVT_MEDIA_FINISHED = wx.PyEventBinder( wxEVT_MEDIA_FINISHED, 1)
240EVT_MEDIA_STOP = wx.PyEventBinder( wxEVT_MEDIA_STOP, 1)
095315e2 241EVT_MEDIA_LOADED = wx.PyEventBinder( wxEVT_MEDIA_LOADED, 1)
256c055e
RD
242}
243
244//---------------------------------------------------------------------------
245
246%init %{
247%}
248
249//---------------------------------------------------------------------------
250