]> git.saurik.com Git - wxWidgets.git/blame - src/msw/mediactrl.cpp
fix off by 1 error in GetTextRaw() (#4317)
[wxWidgets.git] / src / msw / mediactrl.cpp
CommitLineData
1a680109 1/////////////////////////////////////////////////////////////////////////////
7ec69821 2// Name: src/msw/mediactrl.cpp
ff4aedc5 3// Purpose: Built-in Media Backends for Windows
1a680109 4// Author: Ryan Norton <wxprojects@comcast.net>
72259e00 5// Modified by:
1a680109
RN
6// Created: 11/07/04
7// RCS-ID: $Id$
8// Copyright: (c) Ryan Norton
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
b1ec2381
DS
12// FIXME FIXME FIXME:
13// extract different backends in different files (better yet, make backends
14// dynamically loadable...), they have nothing to do with each other and this
15// file is huge and also separate the standard contents from our code itself
16
aa200e97 17
ff4aedc5
RN
18//===========================================================================
19// DECLARATIONS
20//===========================================================================
21
1a680109 22//---------------------------------------------------------------------------
ff4aedc5 23// Pre-compiled header stuff
1a680109
RN
24//---------------------------------------------------------------------------
25
1a680109
RN
26// For compilers that support precompilation, includes "wx.h".
27#include "wx/wxprec.h"
28
29#ifdef __BORLANDC__
e4db172a 30 #pragma hdrstop
1a680109
RN
31#endif
32
e4db172a
WS
33#if wxUSE_MEDIACTRL
34
1a680109
RN
35#include "wx/mediactrl.h"
36
e4db172a
WS
37#ifndef WX_PRECOMP
38 #include "wx/log.h"
ed4b0fdc 39 #include "wx/dcclient.h"
c0badb70 40 #include "wx/timer.h"
18680f86 41 #include "wx/math.h" // log10 & pow
e4db172a 42#endif
1a680109 43
9d7d3b1f 44#include "wx/msw/private.h" // user info and wndproc setting/getting
40d4efa8 45#include "wx/dynlib.h"
b195b4fa 46
1a680109 47//---------------------------------------------------------------------------
c5191fbd 48// Externals (somewhere in src/msw/app.cpp and src/msw/window.cpp)
1a680109 49//---------------------------------------------------------------------------
ff4aedc5
RN
50extern "C" WXDLLIMPEXP_BASE HINSTANCE wxGetInstance(void);
51#ifdef __WXWINCE__
7a4d2469 52extern WXDLLIMPEXP_CORE wxChar *wxCanvasClassName;
ff4aedc5 53#else
316d19ac 54extern WXDLLIMPEXP_CORE const wxChar *wxCanvasClassName;
ff4aedc5 55#endif
1a680109 56
c5191fbd
VZ
57LRESULT WXDLLIMPEXP_CORE APIENTRY _EXPORT wxWndProc(HWND hWnd, UINT message,
58 WPARAM wParam, LPARAM lParam);
59
de63b922
JS
60//---------------------------------------------------------------------------
61// Killed MSVC warnings
62//---------------------------------------------------------------------------
63//disable "cast truncates constant value" for VARIANT_BOOL values
64//passed as parameters in VC5 and up
65#ifdef _MSC_VER
66#pragma warning (disable:4310)
67#endif
68
ff4aedc5 69//===========================================================================
9d7d3b1f 70// BACKEND DECLARATIONS
ff4aedc5 71//===========================================================================
1a680109
RN
72
73//---------------------------------------------------------------------------
9d7d3b1f 74// wxAMMediaBackend
1a680109
RN
75//---------------------------------------------------------------------------
76
ff4aedc5 77//---------------------------------------------------------------------------
9d7d3b1f 78// wxActiveXContainer - includes all the COM-specific stuff we need
920a7c15 79//---------------------------------------------------------------------------
bf354396 80#include "wx/msw/ole/activex.h"
c5191fbd 81
a2a444e3 82//---------------------------------------------------------------------------
9d7d3b1f 83// IIDS - used by CoCreateInstance and IUnknown::QueryInterface
c5191fbd
VZ
84//
85// [idl name] [idl decription]
86// amcompat.idl Microsoft Active Movie Control (Ver 2.0)
87// nscompat.idl Microsoft NetShow Player (Ver 1.0)
88// msdxm.idl Windows Media Player (Ver 1.0)
89// quartz.idl
90//
9d7d3b1f
DS
91// First, when I say I "from XXX.idl", I mean I go into the COM Browser
92// ($Microsoft Visual Studio$/Common/Tools/OLEVIEW.EXE), open
93// "type libraries", open a specific type library (for quartz for example its
94// "ActiveMovie control type library (V1.0)"), save it as an .idl, compile the
95// idl using the midl compiler that comes with visual studio
96// ($Microsoft Visual Studio$/VC98/bin/midl.exe on VC6) with the /h argument
97// to make it generate stubs (a .h & .c file), then clean up the generated
98// interfaces I want with the STDMETHOD wrappers and then put them into
99// mediactrl.cpp.
c5191fbd 100//
9d7d3b1f
DS
101// According to the MSDN docs, IMediaPlayer requires Windows 98 SE
102// or greater. NetShow is available on Windows 3.1 and I'm guessing
103// IActiveMovie is too. IMediaPlayer is essentially the Windows Media
104// Player 6.4 SDK.
920a7c15 105//
9d7d3b1f
DS
106// IWMP is from PlayerOCX.idl on PocketPC 2000, which uses CLSID_MediaPlayer
107// as well as the main windows line.
c137ddc9 108//
9d7d3b1f 109// Some of these are not used but are kept here for future reference anyway
a2a444e3 110//---------------------------------------------------------------------------
c5191fbd
VZ
111const IID IID_IActiveMovie = {0x05589FA2,0xC356,0x11CE,{0xBF,0x01,0x00,0xAA,0x00,0x55,0x59,0x5A}};
112const IID IID_IActiveMovie2 = {0xB6CD6554,0xE9CB,0x11D0,{0x82,0x1F,0x00,0xA0,0xC9,0x1F,0x9C,0xA0}};
113const IID IID_IActiveMovie3 = {0x265EC140,0xAE62,0x11D1,{0x85,0x00,0x00,0xA0,0xC9,0x1F,0x9C,0xA0}};
920a7c15 114
c5191fbd
VZ
115const IID IID_INSOPlay = {0x2179C5D1,0xEBFF,0x11CF,{0xB6,0xFD,0x00,0xAA,0x00,0xB4,0xE2,0x20}};
116const IID IID_INSPlay = {0xE7C4BE80,0x7960,0x11D0,{0xB7,0x27,0x00,0xAA,0x00,0xB4,0xE2,0x20}};
117const IID IID_INSPlay1 = {0x265EC141,0xAE62,0x11D1,{0x85,0x00,0x00,0xA0,0xC9,0x1F,0x9C,0xA0}};
118
119const IID IID_IMediaPlayer = {0x22D6F311,0xB0F6,0x11D0,{0x94,0xAB,0x00,0x80,0xC7,0x4C,0x7E,0x95}};
120const IID IID_IMediaPlayer2 = {0x20D4F5E0,0x5475,0x11D2,{0x97,0x74,0x00,0x00,0xF8,0x08,0x55,0xE6}};
a2a444e3 121
c137ddc9
JS
122const IID IID_IWMP = {0x136B66EC,0xF30D,0x46A8,{0x88,0xDD,0xF2,0xD0,0x55,0x16,0x3E,0x49}};
123
c5191fbd
VZ
124const CLSID CLSID_ActiveMovie = {0x05589FA1,0xC356,0x11CE,{0xBF,0x01,0x00,0xAA,0x00,0x55,0x59,0x5A}};
125const CLSID CLSID_MediaPlayer = {0x22D6F312,0xB0F6,0x11D0,{0x94,0xAB,0x00,0x80,0xC7,0x4C,0x7E,0x95}};
126const CLSID CLSID_NSPlay = {0x2179C5D3,0xEBFF,0x11CF,{0xB6,0xFD,0x00,0xAA,0x00,0xB4,0xE2,0x20}};
920a7c15 127
c5191fbd
VZ
128const IID IID_IAMOpenProgress = {0x8E1C39A1, 0xDE53, 0x11CF,{0xAA, 0x63, 0x00, 0x80, 0xC7, 0x44, 0x52, 0x8D}};
129
130// QUARTZ
131const CLSID CLSID_FilgraphManager = {0xE436EBB3,0x524F,0x11CE,{0x9F,0x53,0x00,0x20,0xAF,0x0B,0xA7,0x70}};
132const IID IID_IMediaEvent = {0x56A868B6,0x0AD4,0x11CE,{0xB0,0x3A,0x00,0x20,0xAF,0x0B,0xA7,0x70}};
920a7c15
JS
133
134//?? QUARTZ Also?
c5191fbd
VZ
135const CLSID CLSID_VideoMixingRenderer9 ={0x51B4ABF3, 0x748F, 0x4E3B,{0xA2, 0x76, 0xC8, 0x28, 0x33, 0x0E, 0x92, 0x6A}};
136const IID IID_IVMRWindowlessControl9 = {0x8F537D09, 0xF85E, 0x4414,{0xB2, 0x3B, 0x50, 0x2E, 0x54, 0xC7, 0x99, 0x27}};
920a7c15
JS
137const IID IID_IFilterGraph = {0x56A8689F, 0x0AD4, 0x11CE,{0xB0, 0x3A, 0x00, 0x20, 0xAF, 0x0B, 0xA7, 0x70}};
138const IID IID_IGraphBuilder = {0x56A868A9, 0x0AD4, 0x11CE,{0xB0, 0x3A, 0x00, 0x20, 0xAF, 0x0B, 0xA7, 0x70}};
c5191fbd 139const IID IID_IVMRFilterConfig9 = {0x5A804648, 0x4F66, 0x4867,{0x9C, 0x43, 0x4F, 0x5C, 0x82, 0x2C, 0xF1, 0xB8}};
920a7c15
JS
140const IID IID_IBaseFilter = {0x56A86895, 0x0AD4, 0x11CE,{0xB0, 0x3A, 0x00, 0x20, 0xAF, 0x0B, 0xA7, 0x70}};
141
142//---------------------------------------------------------------------------
c5191fbd 143// QUARTZ COM INTERFACES (dumped from quartz.idl from MSVC COM Browser)
920a7c15 144//---------------------------------------------------------------------------
920a7c15 145
c5191fbd
VZ
146struct IAMOpenProgress : public IUnknown
147{
148 STDMETHOD(QueryProgress)(LONGLONG *pllTotal, LONGLONG *pllCurrent) PURE;
149 STDMETHOD(AbortOperation)(void) PURE;
150};
920a7c15 151
c5191fbd 152struct IMediaEvent : public IDispatch
920a7c15 153{
c5191fbd
VZ
154 STDMETHOD(GetEventHandle)(LONG_PTR *) PURE;
155 STDMETHOD(GetEvent)(long *, LONG_PTR *, LONG_PTR *, long) PURE;
156 STDMETHOD(WaitForCompletion)(long, long *) PURE;
157 STDMETHOD(CancelDefaultHandling)(long) PURE;
158 STDMETHOD(RestoreDefaultHandling)(long) PURE;
159 STDMETHOD(FreeEventParams)(long, LONG_PTR, LONG_PTR) PURE;
a2a444e3
RN
160};
161
c5191fbd 162//---------------------------------------------------------------------------
9d7d3b1f 163// ACTIVEMOVIE COM INTERFACES (dumped from amcompat.idl from MSVC COM Browser)
c5191fbd
VZ
164//---------------------------------------------------------------------------
165
166enum ReadyStateConstants
a2a444e3 167{
7ec69821
WS
168 amvUninitialized = 0,
169 amvLoading = 1,
c5191fbd 170 amvInteractive = 3,
7ec69821 171 amvComplete = 4
a2a444e3
RN
172};
173
c5191fbd
VZ
174enum StateConstants
175{
176 amvNotLoaded = -1,
7ec69821
WS
177 amvStopped = 0,
178 amvPaused = 1,
179 amvRunning = 2
a2a444e3
RN
180};
181
c5191fbd
VZ
182enum DisplayModeConstants
183{
7ec69821 184 amvTime = 0,
c5191fbd 185 amvFrames = 1
920a7c15 186};
32f65e50 187
c5191fbd 188enum WindowSizeConstants
a2a444e3 189{
c5191fbd
VZ
190 amvOriginalSize = 0,
191 amvDoubleOriginalSize = 1,
192 amvOneSixteenthScreen = 2,
193 amvOneFourthScreen = 3,
194 amvOneHalfScreen = 4
a2a444e3 195};
b11eba7e 196
c5191fbd 197enum AppearanceConstants
a2a444e3 198{
c5191fbd
VZ
199 amvFlat = 0,
200 amv3D = 1
a2a444e3
RN
201};
202
c5191fbd 203enum BorderStyleConstants
a2a444e3 204{
c5191fbd
VZ
205 amvNone = 0,
206 amvFixedSingle = 1
a2a444e3 207};
b11eba7e 208
c5191fbd 209struct IActiveMovie : public IDispatch
a2a444e3 210{
c5191fbd
VZ
211 STDMETHOD(AboutBox)( void) PURE;
212 STDMETHOD(Run)( void) PURE;
213 STDMETHOD(Pause)( void) PURE;
214 STDMETHOD(Stop)( void) PURE;
215 STDMETHOD(get_ImageSourceWidth)(long __RPC_FAR *pWidth) PURE;
216 STDMETHOD(get_ImageSourceHeight)(long __RPC_FAR *pHeight) PURE;
217 STDMETHOD(get_Author)(BSTR __RPC_FAR *pbstrAuthor) PURE;
218 STDMETHOD(get_Title)(BSTR __RPC_FAR *pbstrTitle) PURE;
219 STDMETHOD(get_Copyright)(BSTR __RPC_FAR *pbstrCopyright) PURE;
220 STDMETHOD(get_Description)(BSTR __RPC_FAR *pbstrDescription) PURE;
221 STDMETHOD(get_Rating)(BSTR __RPC_FAR *pbstrRating) PURE;
222 STDMETHOD(get_FileName)(BSTR __RPC_FAR *pbstrFileName) PURE;
223 STDMETHOD(put_FileName)(BSTR pbstrFileName) PURE;
224 STDMETHOD(get_Duration)(double __RPC_FAR *pValue) PURE;
225 STDMETHOD(get_CurrentPosition)(double __RPC_FAR *pValue) PURE;
226 STDMETHOD(put_CurrentPosition)(double pValue) PURE;
227 STDMETHOD(get_PlayCount)(long __RPC_FAR *pPlayCount) PURE;
228 STDMETHOD(put_PlayCount)(long pPlayCount) PURE;
229 STDMETHOD(get_SelectionStart)(double __RPC_FAR *pValue) PURE;
230 STDMETHOD(put_SelectionStart)(double pValue) PURE;
231 STDMETHOD(get_SelectionEnd)(double __RPC_FAR *pValue) PURE;
232 STDMETHOD(put_SelectionEnd)(double pValue) PURE;
233 STDMETHOD(get_CurrentState)(StateConstants __RPC_FAR *pState) PURE;
234 STDMETHOD(get_Rate)(double __RPC_FAR *pValue) PURE;
235 STDMETHOD(put_Rate)(double pValue) PURE;
236 STDMETHOD(get_Volume)(long __RPC_FAR *pValue) PURE;
237 STDMETHOD(put_Volume)(long pValue) PURE;
238 STDMETHOD(get_Balance)(long __RPC_FAR *pValue) PURE;
239 STDMETHOD(put_Balance)(long pValue) PURE;
240 STDMETHOD(get_EnableContextMenu)(VARIANT_BOOL __RPC_FAR *pEnable) PURE;
241 STDMETHOD(put_EnableContextMenu)(VARIANT_BOOL pEnable) PURE;
242 STDMETHOD(get_ShowDisplay)(VARIANT_BOOL __RPC_FAR *Show) PURE;
243 STDMETHOD(put_ShowDisplay)(VARIANT_BOOL Show) PURE;
244 STDMETHOD(get_ShowControls)(VARIANT_BOOL __RPC_FAR *Show) PURE;
245 STDMETHOD(put_ShowControls)(VARIANT_BOOL Show) PURE;
246 STDMETHOD(get_ShowPositionControls)(VARIANT_BOOL __RPC_FAR *Show) PURE;
247 STDMETHOD(put_ShowPositionControls)(VARIANT_BOOL Show) PURE;
248 STDMETHOD(get_ShowSelectionControls)(VARIANT_BOOL __RPC_FAR *Show) PURE;
249 STDMETHOD(put_ShowSelectionControls)(VARIANT_BOOL Show) PURE;
250 STDMETHOD(get_ShowTracker)(VARIANT_BOOL __RPC_FAR *Show) PURE;
251 STDMETHOD(put_ShowTracker)(VARIANT_BOOL Show) PURE;
252 STDMETHOD(get_EnablePositionControls)(VARIANT_BOOL __RPC_FAR *Enable) PURE;
253 STDMETHOD(put_EnablePositionControls)(VARIANT_BOOL Enable) PURE;
254 STDMETHOD(get_EnableSelectionControls)(VARIANT_BOOL __RPC_FAR *Enable) PURE;
255 STDMETHOD(put_EnableSelectionControls)(VARIANT_BOOL Enable) PURE;
256 STDMETHOD(get_EnableTracker)(VARIANT_BOOL __RPC_FAR *Enable) PURE;
257 STDMETHOD(put_EnableTracker)(VARIANT_BOOL Enable) PURE;
258 STDMETHOD(get_AllowHideDisplay)(VARIANT_BOOL __RPC_FAR *Show) PURE;
259 STDMETHOD(put_AllowHideDisplay)(VARIANT_BOOL Show) PURE;
260 STDMETHOD(get_AllowHideControls)(VARIANT_BOOL __RPC_FAR *Show) PURE;
261 STDMETHOD(put_AllowHideControls)(VARIANT_BOOL Show) PURE;
262 STDMETHOD(get_DisplayMode)(DisplayModeConstants __RPC_FAR *pValue) PURE;
263 STDMETHOD(put_DisplayMode)(DisplayModeConstants pValue) PURE;
264 STDMETHOD(get_AllowChangeDisplayMode)(VARIANT_BOOL __RPC_FAR *fAllow) PURE;
265 STDMETHOD(put_AllowChangeDisplayMode)(VARIANT_BOOL fAllow) PURE;
266 STDMETHOD(get_FilterGraph)(IUnknown __RPC_FAR *__RPC_FAR *ppFilterGraph) PURE;
267 STDMETHOD(put_FilterGraph)(IUnknown __RPC_FAR *ppFilterGraph) PURE;
268 STDMETHOD(get_FilterGraphDispatch)(IDispatch __RPC_FAR *__RPC_FAR *pDispatch) PURE;
269 STDMETHOD(get_DisplayForeColor)(unsigned long __RPC_FAR *ForeColor) PURE;
270 STDMETHOD(put_DisplayForeColor)(unsigned long ForeColor) PURE;
271 STDMETHOD(get_DisplayBackColor)(unsigned long __RPC_FAR *BackColor) PURE;
272 STDMETHOD(put_DisplayBackColor)(unsigned long BackColor) PURE;
273 STDMETHOD(get_MovieWindowSize)(WindowSizeConstants __RPC_FAR *WindowSize) PURE;
274 STDMETHOD(put_MovieWindowSize)(WindowSizeConstants WindowSize) PURE;
275 STDMETHOD(get_FullScreenMode)(VARIANT_BOOL __RPC_FAR *pEnable) PURE;
276 STDMETHOD(put_FullScreenMode)(VARIANT_BOOL pEnable) PURE;
277 STDMETHOD(get_AutoStart)(VARIANT_BOOL __RPC_FAR *pEnable) PURE;
278 STDMETHOD(put_AutoStart)(VARIANT_BOOL pEnable) PURE;
279 STDMETHOD(get_AutoRewind)(VARIANT_BOOL __RPC_FAR *pEnable) PURE;
280 STDMETHOD(put_AutoRewind)(VARIANT_BOOL pEnable) PURE;
281 STDMETHOD(get_hWnd)(long __RPC_FAR *hWnd) PURE;
282 STDMETHOD(get_Appearance)(AppearanceConstants __RPC_FAR *pAppearance) PURE;
283 STDMETHOD(put_Appearance)(AppearanceConstants pAppearance) PURE;
284 STDMETHOD(get_BorderStyle)(BorderStyleConstants __RPC_FAR *pBorderStyle) PURE;
285 STDMETHOD(put_BorderStyle)(BorderStyleConstants pBorderStyle) PURE;
286 STDMETHOD(get_Enabled)(VARIANT_BOOL __RPC_FAR *pEnabled) PURE;
287 STDMETHOD(put_Enabled)(VARIANT_BOOL pEnabled) PURE;
288 STDMETHOD(get_Info)(long __RPC_FAR *ppInfo) PURE;
920a7c15 289};
b11eba7e 290
c5191fbd 291
c5191fbd
VZ
292struct IActiveMovie2 : public IActiveMovie
293{
294 STDMETHOD(IsSoundCardEnabled)(VARIANT_BOOL __RPC_FAR *pbSoundCard) PURE;
295 STDMETHOD(get_ReadyState)(ReadyStateConstants __RPC_FAR *pValue) PURE;
a2a444e3 296};
1a680109 297
c5191fbd 298struct IActiveMovie3 : public IActiveMovie2
a2a444e3 299{
c5191fbd 300 STDMETHOD(get_MediaPlayer)(IDispatch __RPC_FAR *__RPC_FAR *ppDispatch) PURE;
a2a444e3 301};
b11eba7e 302
c5191fbd 303
920a7c15 304//---------------------------------------------------------------------------
c5191fbd 305// MEDIAPLAYER COM INTERFACES (dumped from msdxm.idl from MSVC COM Browser)
920a7c15 306//---------------------------------------------------------------------------
c5191fbd
VZ
307
308enum MPPlayStateConstants
a2a444e3 309{
c5191fbd
VZ
310 mpStopped = 0,
311 mpPaused = 1,
312 mpPlaying = 2,
313 mpWaiting = 3,
314 mpScanForward = 4,
315 mpScanReverse = 5,
316 mpClosed = 6
920a7c15 317};
b11eba7e 318
c5191fbd
VZ
319enum MPDisplaySizeConstants
320{
321 mpDefaultSize = 0,
322 mpHalfSize = 1,
323 mpDoubleSize = 2,
324 mpFullScreen = 3,
325 mpFitToSize = 4,
326 mpOneSixteenthScreen = 5,
327 mpOneFourthScreen = 6,
328 mpOneHalfScreen = 7
a2a444e3 329};
b11eba7e 330
c5191fbd 331enum MPReadyStateConstants
a2a444e3 332{
c5191fbd
VZ
333 mpReadyStateUninitialized = 0,
334 mpReadyStateLoading = 1,
335 mpReadyStateInteractive = 3,
336 mpReadyStateComplete = 4
a2a444e3
RN
337};
338
c5191fbd
VZ
339typedef unsigned long VB_OLE_COLOR;
340
341enum MPDisplayModeConstants
a2a444e3 342{
c5191fbd
VZ
343 mpTime = 0,
344 mpFrames = 1
920a7c15 345};
b11eba7e 346
c5191fbd
VZ
347enum MPMoreInfoType
348{
349 mpShowURL = 0,
350 mpClipURL = 1,
351 mpBannerURL = 2
a2a444e3 352};
b11eba7e 353
c5191fbd 354enum MPMediaInfoType
a2a444e3 355{
c5191fbd
VZ
356 mpShowFilename = 0,
357 mpShowTitle = 1,
358 mpShowAuthor = 2,
359 mpShowCopyright = 3,
360 mpShowRating = 4,
361 mpShowDescription = 5,
362 mpShowLogoIcon = 6,
363 mpClipFilename = 7,
364 mpClipTitle = 8,
365 mpClipAuthor = 9,
366 mpClipCopyright = 10,
367 mpClipRating = 11,
368 mpClipDescription = 12,
369 mpClipLogoIcon = 13,
370 mpBannerImage = 14,
371 mpBannerMoreInfo = 15,
372 mpWatermark = 16
373};
374
375enum DVDMenuIDConstants
376{
377 dvdMenu_Title = 2,
378 dvdMenu_Root = 3,
379 dvdMenu_Subpicture = 4,
380 dvdMenu_Audio = 5,
381 dvdMenu_Angle = 6,
382 dvdMenu_Chapter = 7
383};
384
385enum MPShowDialogConstants
386{
387 mpShowDialogHelp = 0,
388 mpShowDialogStatistics = 1,
389 mpShowDialogOptions = 2,
390 mpShowDialogContextMenu = 3
391};
392
393
394struct IMediaPlayer : public IDispatch
395{
396 STDMETHOD(get_CurrentPosition)(double __RPC_FAR *pCurrentPosition) PURE;
397 STDMETHOD(put_CurrentPosition)(double pCurrentPosition) PURE;
398 STDMETHOD(get_Duration)(double __RPC_FAR *pDuration) PURE;
399 STDMETHOD(get_ImageSourceWidth)(long __RPC_FAR *pWidth) PURE;
400 STDMETHOD(get_ImageSourceHeight)(long __RPC_FAR *pHeight) PURE;
401 STDMETHOD(get_MarkerCount)(long __RPC_FAR *pMarkerCount) PURE;
402 STDMETHOD(get_CanScan)(VARIANT_BOOL __RPC_FAR *pCanScan) PURE;
403 STDMETHOD(get_CanSeek)(VARIANT_BOOL __RPC_FAR *pCanSeek) PURE;
404 STDMETHOD(get_CanSeekToMarkers)(VARIANT_BOOL __RPC_FAR *pCanSeekToMarkers) PURE;
405 STDMETHOD(get_CurrentMarker)(long __RPC_FAR *pCurrentMarker) PURE;
406 STDMETHOD(put_CurrentMarker)(long pCurrentMarker) PURE;
407 STDMETHOD(get_FileName)(BSTR __RPC_FAR *pbstrFileName) PURE;
408 STDMETHOD(put_FileName)(BSTR pbstrFileName) PURE;
409 STDMETHOD(get_SourceLink)(BSTR __RPC_FAR *pbstrSourceLink) PURE;
410 STDMETHOD(get_CreationDate)(DATE __RPC_FAR *pCreationDate) PURE;
411 STDMETHOD(get_ErrorCorrection)(BSTR __RPC_FAR *pbstrErrorCorrection) PURE;
412 STDMETHOD(get_Bandwidth)(long __RPC_FAR *pBandwidth) PURE;
413 STDMETHOD(get_SourceProtocol)(long __RPC_FAR *pSourceProtocol) PURE;
414 STDMETHOD(get_ReceivedPackets)(long __RPC_FAR *pReceivedPackets) PURE;
415 STDMETHOD(get_RecoveredPackets)(long __RPC_FAR *pRecoveredPackets) PURE;
416 STDMETHOD(get_LostPackets)(long __RPC_FAR *pLostPackets) PURE;
417 STDMETHOD(get_ReceptionQuality)(long __RPC_FAR *pReceptionQuality) PURE;
418 STDMETHOD(get_BufferingCount)(long __RPC_FAR *pBufferingCount) PURE;
419 STDMETHOD(get_IsBroadcast)(VARIANT_BOOL __RPC_FAR *pIsBroadcast) PURE;
420 STDMETHOD(get_BufferingProgress)(long __RPC_FAR *pBufferingProgress) PURE;
421 STDMETHOD(get_ChannelName)(BSTR __RPC_FAR *pbstrChannelName) PURE;
422 STDMETHOD(get_ChannelDescription)(BSTR __RPC_FAR *pbstrChannelDescription) PURE;
423 STDMETHOD(get_ChannelURL)(BSTR __RPC_FAR *pbstrChannelURL) PURE;
424 STDMETHOD(get_ContactAddress)(BSTR __RPC_FAR *pbstrContactAddress) PURE;
425 STDMETHOD(get_ContactPhone)(BSTR __RPC_FAR *pbstrContactPhone) PURE;
426 STDMETHOD(get_ContactEmail)(BSTR __RPC_FAR *pbstrContactEmail) PURE;
427 STDMETHOD(get_BufferingTime)(double __RPC_FAR *pBufferingTime) PURE;
428 STDMETHOD(put_BufferingTime)(double pBufferingTime) PURE;
429 STDMETHOD(get_AutoStart)(VARIANT_BOOL __RPC_FAR *pAutoStart) PURE;
430 STDMETHOD(put_AutoStart)(VARIANT_BOOL pAutoStart) PURE;
431 STDMETHOD(get_AutoRewind)(VARIANT_BOOL __RPC_FAR *pAutoRewind) PURE;
432 STDMETHOD(put_AutoRewind)(VARIANT_BOOL pAutoRewind) PURE;
433 STDMETHOD(get_Rate)(double __RPC_FAR *pRate) PURE;
434 STDMETHOD(put_Rate)(double pRate) PURE;
435 STDMETHOD(get_SendKeyboardEvents)(VARIANT_BOOL __RPC_FAR *pSendKeyboardEvents) PURE;
436 STDMETHOD(put_SendKeyboardEvents)(VARIANT_BOOL pSendKeyboardEvents) PURE;
437 STDMETHOD(get_SendMouseClickEvents)(VARIANT_BOOL __RPC_FAR *pSendMouseClickEvents) PURE;
438 STDMETHOD(put_SendMouseClickEvents)(VARIANT_BOOL pSendMouseClickEvents) PURE;
439 STDMETHOD(get_SendMouseMoveEvents)(VARIANT_BOOL __RPC_FAR *pSendMouseMoveEvents) PURE;
440 STDMETHOD(put_SendMouseMoveEvents)(VARIANT_BOOL pSendMouseMoveEvents) PURE;
441 STDMETHOD(get_PlayCount)(long __RPC_FAR *pPlayCount) PURE;
442 STDMETHOD(put_PlayCount)(long pPlayCount) PURE;
443 STDMETHOD(get_ClickToPlay)(VARIANT_BOOL __RPC_FAR *pClickToPlay) PURE;
444 STDMETHOD(put_ClickToPlay)(VARIANT_BOOL pClickToPlay) PURE;
445 STDMETHOD(get_AllowScan)(VARIANT_BOOL __RPC_FAR *pAllowScan) PURE;
446 STDMETHOD(put_AllowScan)(VARIANT_BOOL pAllowScan) PURE;
447 STDMETHOD(get_EnableContextMenu)(VARIANT_BOOL __RPC_FAR *pEnableContextMenu) PURE;
448 STDMETHOD(put_EnableContextMenu)(VARIANT_BOOL pEnableContextMenu) PURE;
449 STDMETHOD(get_CursorType)(long __RPC_FAR *pCursorType) PURE;
450 STDMETHOD(put_CursorType)(long pCursorType) PURE;
451 STDMETHOD(get_CodecCount)(long __RPC_FAR *pCodecCount) PURE;
452 STDMETHOD(get_AllowChangeDisplaySize)(VARIANT_BOOL __RPC_FAR *pAllowChangeDisplaySize) PURE;
453 STDMETHOD(put_AllowChangeDisplaySize)( VARIANT_BOOL pAllowChangeDisplaySize) PURE;
454 STDMETHOD(get_IsDurationValid)(VARIANT_BOOL __RPC_FAR *pIsDurationValid) PURE;
455 STDMETHOD(get_OpenState)(long __RPC_FAR *pOpenState) PURE;
456 STDMETHOD(get_SendOpenStateChangeEvents)(VARIANT_BOOL __RPC_FAR *pSendOpenStateChangeEvents) PURE;
457 STDMETHOD(put_SendOpenStateChangeEvents)(VARIANT_BOOL pSendOpenStateChangeEvents) PURE;
458 STDMETHOD(get_SendWarningEvents)( VARIANT_BOOL __RPC_FAR *pSendWarningEvents) PURE;
459 STDMETHOD(put_SendWarningEvents)(VARIANT_BOOL pSendWarningEvents) PURE;
460 STDMETHOD(get_SendErrorEvents)(VARIANT_BOOL __RPC_FAR *pSendErrorEvents) PURE;
461 STDMETHOD(put_SendErrorEvents)(VARIANT_BOOL pSendErrorEvents) PURE;
462 STDMETHOD(get_PlayState)(MPPlayStateConstants __RPC_FAR *pPlayState) PURE;
463 STDMETHOD(get_SendPlayStateChangeEvents)(VARIANT_BOOL __RPC_FAR *pSendPlayStateChangeEvents) PURE;
464 STDMETHOD(put_SendPlayStateChangeEvents)(VARIANT_BOOL pSendPlayStateChangeEvents) PURE;
465 STDMETHOD(get_DisplaySize)(MPDisplaySizeConstants __RPC_FAR *pDisplaySize) PURE;
466 STDMETHOD(put_DisplaySize)(MPDisplaySizeConstants pDisplaySize) PURE;
467 STDMETHOD(get_InvokeURLs)(VARIANT_BOOL __RPC_FAR *pInvokeURLs) PURE;
468 STDMETHOD(put_InvokeURLs)(VARIANT_BOOL pInvokeURLs) PURE;
469 STDMETHOD(get_BaseURL)(BSTR __RPC_FAR *pbstrBaseURL) PURE;
470 STDMETHOD(put_BaseURL)(BSTR pbstrBaseURL) PURE;
471 STDMETHOD(get_DefaultFrame)(BSTR __RPC_FAR *pbstrDefaultFrame) PURE;
472 STDMETHOD(put_DefaultFrame)(BSTR pbstrDefaultFrame) PURE;
473 STDMETHOD(get_HasError)(VARIANT_BOOL __RPC_FAR *pHasError) PURE;
474 STDMETHOD(get_ErrorDescription)(BSTR __RPC_FAR *pbstrErrorDescription) PURE;
475 STDMETHOD(get_ErrorCode)(long __RPC_FAR *pErrorCode) PURE;
476 STDMETHOD(get_AnimationAtStart)(VARIANT_BOOL __RPC_FAR *pAnimationAtStart) PURE;
477 STDMETHOD(put_AnimationAtStart)(VARIANT_BOOL pAnimationAtStart) PURE;
478 STDMETHOD(get_TransparentAtStart)( VARIANT_BOOL __RPC_FAR *pTransparentAtStart) PURE;
479 STDMETHOD(put_TransparentAtStart)(VARIANT_BOOL pTransparentAtStart) PURE;
480 STDMETHOD(get_Volume)(long __RPC_FAR *pVolume) PURE;
481 STDMETHOD(put_Volume)(long pVolume) PURE;
482 STDMETHOD(get_Balance)(long __RPC_FAR *pBalance) PURE;
483 STDMETHOD(put_Balance)(long pBalance) PURE;
484 STDMETHOD(get_ReadyState)(MPReadyStateConstants __RPC_FAR *pValue) PURE;
485 STDMETHOD(get_SelectionStart)(double __RPC_FAR *pValue) PURE;
486 STDMETHOD(put_SelectionStart)(double pValue) PURE;
487 STDMETHOD(get_SelectionEnd)(double __RPC_FAR *pValue) PURE;
488 STDMETHOD(put_SelectionEnd)(double pValue) PURE;
489 STDMETHOD(get_ShowDisplay)(VARIANT_BOOL __RPC_FAR *Show) PURE;
490 STDMETHOD(put_ShowDisplay)(VARIANT_BOOL Show) PURE;
491 STDMETHOD(get_ShowControls)(VARIANT_BOOL __RPC_FAR *Show) PURE;
492 STDMETHOD(put_ShowControls)(VARIANT_BOOL Show) PURE;
493 STDMETHOD(get_ShowPositionControls)(VARIANT_BOOL __RPC_FAR *Show) PURE;
494 STDMETHOD(put_ShowPositionControls)(VARIANT_BOOL Show) PURE;
495 STDMETHOD(get_ShowTracker)(VARIANT_BOOL __RPC_FAR *Show) PURE;
496 STDMETHOD(put_ShowTracker)(VARIANT_BOOL Show) PURE;
497 STDMETHOD(get_EnablePositionControls)(VARIANT_BOOL __RPC_FAR *Enable) PURE;
498 STDMETHOD(put_EnablePositionControls)(VARIANT_BOOL Enable) PURE;
499 STDMETHOD(get_EnableTracker)(VARIANT_BOOL __RPC_FAR *Enable) PURE;
500 STDMETHOD(put_EnableTracker)(VARIANT_BOOL Enable) PURE;
501 STDMETHOD(get_Enabled)(VARIANT_BOOL __RPC_FAR *pEnabled) PURE;
502 STDMETHOD(put_Enabled)(VARIANT_BOOL pEnabled) PURE;
503 STDMETHOD(get_DisplayForeColor)(VB_OLE_COLOR __RPC_FAR *ForeColor) PURE;
504 STDMETHOD(put_DisplayForeColor)(VB_OLE_COLOR ForeColor) PURE;
505 STDMETHOD(get_DisplayBackColor)(VB_OLE_COLOR __RPC_FAR *BackColor) PURE;
506 STDMETHOD(put_DisplayBackColor)(VB_OLE_COLOR BackColor) PURE;
507 STDMETHOD(get_DisplayMode)(MPDisplayModeConstants __RPC_FAR *pValue) PURE;
508 STDMETHOD(put_DisplayMode)(MPDisplayModeConstants pValue) PURE;
509 STDMETHOD(get_VideoBorder3D)(VARIANT_BOOL __RPC_FAR *pVideoBorderWidth) PURE;
510 STDMETHOD(put_VideoBorder3D)(VARIANT_BOOL pVideoBorderWidth) PURE;
511 STDMETHOD(get_VideoBorderWidth)(long __RPC_FAR *pVideoBorderWidth) PURE;
512 STDMETHOD(put_VideoBorderWidth)(long pVideoBorderWidth) PURE;
513 STDMETHOD(get_VideoBorderColor)(VB_OLE_COLOR __RPC_FAR *pVideoBorderWidth) PURE;
514 STDMETHOD(put_VideoBorderColor)(VB_OLE_COLOR pVideoBorderWidth) PURE;
515 STDMETHOD(get_ShowGotoBar)(VARIANT_BOOL __RPC_FAR *pbool) PURE;
516 STDMETHOD(put_ShowGotoBar)(VARIANT_BOOL pbool) PURE;
517 STDMETHOD(get_ShowStatusBar)(VARIANT_BOOL __RPC_FAR *pbool) PURE;
518 STDMETHOD(put_ShowStatusBar)(VARIANT_BOOL pbool) PURE;
519 STDMETHOD(get_ShowCaptioning)(VARIANT_BOOL __RPC_FAR *pbool) PURE;
520 STDMETHOD(put_ShowCaptioning)(VARIANT_BOOL pbool) PURE;
521 STDMETHOD(get_ShowAudioControls)(VARIANT_BOOL __RPC_FAR *pbool) PURE;
522 STDMETHOD(put_ShowAudioControls)(VARIANT_BOOL pbool) PURE;
523 STDMETHOD(get_CaptioningID)( BSTR __RPC_FAR *pstrText) PURE;
524 STDMETHOD(put_CaptioningID)(BSTR pstrText) PURE;
525 STDMETHOD(get_Mute)(VARIANT_BOOL __RPC_FAR *vbool) PURE;
526 STDMETHOD(put_Mute)(VARIANT_BOOL vbool) PURE;
527 STDMETHOD(get_CanPreview)(VARIANT_BOOL __RPC_FAR *pCanPreview) PURE;
528 STDMETHOD(get_PreviewMode)(VARIANT_BOOL __RPC_FAR *pPreviewMode) PURE;
529 STDMETHOD(put_PreviewMode)(VARIANT_BOOL pPreviewMode) PURE;
530 STDMETHOD(get_HasMultipleItems)(VARIANT_BOOL __RPC_FAR *pHasMuliItems) PURE;
531 STDMETHOD(get_Language)(long __RPC_FAR *pLanguage) PURE;
532 STDMETHOD(put_Language)(long pLanguage) PURE;
533 STDMETHOD(get_AudioStream)(long __RPC_FAR *pStream) PURE;
534 STDMETHOD(put_AudioStream)(long pStream) PURE;
535 STDMETHOD(get_SAMIStyle)(BSTR __RPC_FAR *pbstrStyle) PURE;
536 STDMETHOD(put_SAMIStyle)(BSTR pbstrStyle) PURE;
537 STDMETHOD(get_SAMILang)(BSTR __RPC_FAR *pbstrLang) PURE;
538 STDMETHOD(put_SAMILang)(BSTR pbstrLang) PURE;
539 STDMETHOD(get_SAMIFileName)(BSTR __RPC_FAR *pbstrFileName) PURE;
540 STDMETHOD(put_SAMIFileName)(BSTR pbstrFileName) PURE;
541 STDMETHOD(get_StreamCount)( long __RPC_FAR *pStreamCount) PURE;
542 STDMETHOD(get_ClientId)(BSTR __RPC_FAR *pbstrClientId) PURE;
543 STDMETHOD(get_ConnectionSpeed)(long __RPC_FAR *plConnectionSpeed) PURE;
544 STDMETHOD(get_AutoSize)(VARIANT_BOOL __RPC_FAR *pbool) PURE;
545 STDMETHOD(put_AutoSize)(VARIANT_BOOL pbool) PURE;
546 STDMETHOD(get_EnableFullScreenControls)(VARIANT_BOOL __RPC_FAR *pbVal) PURE;
547 STDMETHOD(put_EnableFullScreenControls)(VARIANT_BOOL pbVal) PURE;
548 STDMETHOD(get_ActiveMovie)(IDispatch __RPC_FAR *__RPC_FAR *ppdispatch) PURE;
549 STDMETHOD(get_NSPlay)(IDispatch __RPC_FAR *__RPC_FAR *ppdispatch) PURE;
550 STDMETHOD(get_WindowlessVideo)(VARIANT_BOOL __RPC_FAR *pbool) PURE;
551 STDMETHOD(put_WindowlessVideo)(VARIANT_BOOL pbool) PURE;
552 STDMETHOD(Play)(void) PURE;
553 STDMETHOD(Stop)(void) PURE;
554 STDMETHOD(Pause)(void) PURE;
555 STDMETHOD(GetMarkerTime)(long MarkerNum,
556 double __RPC_FAR *pMarkerTime) PURE;
557 STDMETHOD(GetMarkerName)(long MarkerNum,
558 BSTR __RPC_FAR *pbstrMarkerName) PURE;
559 STDMETHOD(AboutBox)(void) PURE;
560 STDMETHOD(GetCodecInstalled)(long CodecNum,
561 VARIANT_BOOL __RPC_FAR *pCodecInstalled) PURE;
562 STDMETHOD(GetCodecDescription)(long CodecNum,
563 BSTR __RPC_FAR *pbstrCodecDescription) PURE;
564 STDMETHOD(GetCodecURL)(long CodecNum,
565 BSTR __RPC_FAR *pbstrCodecURL) PURE;
566 STDMETHOD(GetMoreInfoURL)(MPMoreInfoType MoreInfoType,
567 BSTR __RPC_FAR *pbstrMoreInfoURL) PURE;
568 STDMETHOD(GetMediaInfoString)(MPMediaInfoType MediaInfoType,
569 BSTR __RPC_FAR *pbstrMediaInfo) PURE;
570 STDMETHOD(Cancel)(void) PURE;
571 STDMETHOD(Open)(BSTR bstrFileName) PURE;
572 STDMETHOD(IsSoundCardEnabled)(VARIANT_BOOL __RPC_FAR *pbSoundCard) PURE;
573 STDMETHOD(Next)(void) PURE;
574 STDMETHOD(Previous)(void) PURE;
575 STDMETHOD(StreamSelect)(long StreamNum) PURE;
576 STDMETHOD(FastForward)(void) PURE;
577 STDMETHOD(FastReverse)(void) PURE;
578 STDMETHOD(GetStreamName)(long StreamNum,
579 BSTR __RPC_FAR *pbstrStreamName) PURE;
580 STDMETHOD(GetStreamGroup)(long StreamNum,
581 long __RPC_FAR *pStreamGroup) PURE;
582 STDMETHOD(GetStreamSelected)(long StreamNum, VARIANT_BOOL __RPC_FAR *pStreamSelected) PURE;
583};
584
585struct IMediaPlayer2 : public IMediaPlayer
586{
587 STDMETHOD(get_DVD)(struct IMediaPlayerDvd __RPC_FAR *__RPC_FAR *ppdispatch) PURE;
588 STDMETHOD(GetMediaParameter)(long EntryNum, BSTR bstrParameterName, BSTR __RPC_FAR *pbstrParameterValue) PURE;
589 STDMETHOD(GetMediaParameterName(long EntryNum, long Index, BSTR __RPC_FAR *pbstrParameterName) PURE;
590 STDMETHOD(get_EntryCount)(long __RPC_FAR *pNumberEntries) PURE;
591 STDMETHOD(GetCurrentEntry)(long __RPC_FAR *pEntryNumber) PURE;
592 STDMETHOD(SetCurrentEntry)(long EntryNumber) PURE;
593 STDMETHOD(ShowDialog)(MPShowDialogConstants mpDialogIndex) PURE;
a2a444e3 594};
b11eba7e 595
920a7c15 596//---------------------------------------------------------------------------
c5191fbd 597// NETSHOW COM INTERFACES (dumped from nscompat.idl from MSVC COM Browser)
920a7c15 598//---------------------------------------------------------------------------
c5191fbd
VZ
599
600struct INSOPlay : public IDispatch
601{
602 STDMETHOD(get_ImageSourceWidth)(long __RPC_FAR *pWidth) PURE;
603 STDMETHOD(get_ImageSourceHeight)(long __RPC_FAR *pHeight) PURE;
604 STDMETHOD(get_Duration)(double __RPC_FAR *pDuration) PURE;
605 STDMETHOD(get_Author)(BSTR __RPC_FAR *pbstrAuthor) PURE;
606 STDMETHOD(get_Copyright)(BSTR __RPC_FAR *pbstrCopyright) PURE;
607 STDMETHOD(get_Description)(BSTR __RPC_FAR *pbstrDescription) PURE;
608 STDMETHOD(get_Rating)(BSTR __RPC_FAR *pbstrRating) PURE;
609 STDMETHOD(get_Title)(BSTR __RPC_FAR *pbstrTitle) PURE;
610 STDMETHOD(get_SourceLink)(BSTR __RPC_FAR *pbstrSourceLink) PURE;
611 STDMETHOD(get_MarkerCount)(long __RPC_FAR *pMarkerCount) PURE;
612 STDMETHOD(get_CanScan)(VARIANT_BOOL __RPC_FAR *pCanScan) PURE;
613 STDMETHOD(get_CanSeek)(VARIANT_BOOL __RPC_FAR *pCanSeek) PURE;
614 STDMETHOD(get_CanSeekToMarkers)(VARIANT_BOOL __RPC_FAR *pCanSeekToMarkers) PURE;
615 STDMETHOD(get_CreationDate)(DATE __RPC_FAR *pCreationDate) PURE;
616 STDMETHOD(get_Bandwidth)(long __RPC_FAR *pBandwidth) PURE;
617 STDMETHOD(get_ErrorCorrection)(BSTR __RPC_FAR *pbstrErrorCorrection) PURE;
618 STDMETHOD(get_AutoStart)(VARIANT_BOOL __RPC_FAR *pAutoStart) PURE;
619 STDMETHOD(put_AutoStart)(VARIANT_BOOL pAutoStart) PURE;
620 STDMETHOD(get_AutoRewind)(VARIANT_BOOL __RPC_FAR *pAutoRewind) PURE;
621 STDMETHOD(put_AutoRewind)(VARIANT_BOOL pAutoRewind) PURE;
622 STDMETHOD(get_AllowChangeControlType)(VARIANT_BOOL __RPC_FAR *pAllowChangeControlType) PURE;
623 STDMETHOD(put_AllowChangeControlType)(VARIANT_BOOL pAllowChangeControlType) PURE;
624 STDMETHOD(get_InvokeURLs)(VARIANT_BOOL __RPC_FAR *pInvokeURLs) PURE;
625 STDMETHOD(put_InvokeURLs)(VARIANT_BOOL pInvokeURLs) PURE;
626 STDMETHOD(get_EnableContextMenu)(VARIANT_BOOL __RPC_FAR *pEnableContextMenu) PURE;
627 STDMETHOD(put_EnableContextMenu)(VARIANT_BOOL pEnableContextMenu) PURE;
628 STDMETHOD(get_TransparentAtStart)(VARIANT_BOOL __RPC_FAR *pTransparentAtStart) PURE;
629 STDMETHOD(put_TransparentAtStart)(VARIANT_BOOL pTransparentAtStart) PURE;
630 STDMETHOD(get_TransparentOnStop)(VARIANT_BOOL __RPC_FAR *pTransparentOnStop) PURE;
631 STDMETHOD(put_TransparentOnStop)(VARIANT_BOOL pTransparentOnStop) PURE;
632 STDMETHOD(get_ClickToPlay)(VARIANT_BOOL __RPC_FAR *pClickToPlay) PURE;
633 STDMETHOD(put_ClickToPlay)(VARIANT_BOOL pClickToPlay) PURE;
634 STDMETHOD(get_FileName)(BSTR __RPC_FAR *pbstrFileName) PURE;
635 STDMETHOD(put_FileName)(BSTR pbstrFileName) PURE;
636 STDMETHOD(get_CurrentPosition)(double __RPC_FAR *pCurrentPosition) PURE;
637 STDMETHOD(put_CurrentPosition)(double pCurrentPosition) PURE;
638 STDMETHOD(get_Rate)(double __RPC_FAR *pRate) PURE;
639 STDMETHOD(put_Rate)(double pRate) PURE;
640 STDMETHOD(get_CurrentMarker)(long __RPC_FAR *pCurrentMarker) PURE;
641 STDMETHOD(put_CurrentMarker)(long pCurrentMarker) PURE;
642 STDMETHOD(get_PlayCount)(long __RPC_FAR *pPlayCount) PURE;
643 STDMETHOD(put_PlayCount)(long pPlayCount) PURE;
644 STDMETHOD(get_CurrentState)(long __RPC_FAR *pCurrentState) PURE;
645 STDMETHOD(get_DisplaySize)(long __RPC_FAR *pDisplaySize) PURE;
646 STDMETHOD(put_DisplaySize)(long pDisplaySize) PURE;
647 STDMETHOD(get_MainWindow)(long __RPC_FAR *pMainWindow) PURE;
648 STDMETHOD(get_ControlType)(long __RPC_FAR *pControlType) PURE;
649 STDMETHOD(put_ControlType)(long pControlType) PURE;
650 STDMETHOD(get_AllowScan)(VARIANT_BOOL __RPC_FAR *pAllowScan) PURE;
651 STDMETHOD(put_AllowScan)(VARIANT_BOOL pAllowScan) PURE;
652 STDMETHOD(get_SendKeyboardEvents)(VARIANT_BOOL __RPC_FAR *pSendKeyboardEvents) PURE;
653 STDMETHOD(put_SendKeyboardEvents)(VARIANT_BOOL pSendKeyboardEvents) PURE;
654 STDMETHOD(get_SendMouseClickEvents)(VARIANT_BOOL __RPC_FAR *pSendMouseClickEvents) PURE;
655 STDMETHOD(put_SendMouseClickEvents)(VARIANT_BOOL pSendMouseClickEvents) PURE;
656 STDMETHOD(get_SendMouseMoveEvents)(VARIANT_BOOL __RPC_FAR *pSendMouseMoveEvents) PURE;
657 STDMETHOD(put_SendMouseMoveEvents)(VARIANT_BOOL pSendMouseMoveEvents) PURE;
658 STDMETHOD(get_SendStateChangeEvents)(VARIANT_BOOL __RPC_FAR *pSendStateChangeEvents) PURE;
659 STDMETHOD(put_SendStateChangeEvents)(VARIANT_BOOL pSendStateChangeEvents) PURE;
660 STDMETHOD(get_ReceivedPackets)(long __RPC_FAR *pReceivedPackets) PURE;
661 STDMETHOD(get_RecoveredPackets)(long __RPC_FAR *pRecoveredPackets) PURE;
662 STDMETHOD(get_LostPackets)(long __RPC_FAR *pLostPackets) PURE;
663 STDMETHOD(get_ReceptionQuality)(long __RPC_FAR *pReceptionQuality) PURE;
664 STDMETHOD(get_BufferingCount)(long __RPC_FAR *pBufferingCount) PURE;
665 STDMETHOD(get_CursorType)(long __RPC_FAR *pCursorType) PURE;
666 STDMETHOD(put_CursorType)(long pCursorType) PURE;
667 STDMETHOD(get_AnimationAtStart)(VARIANT_BOOL __RPC_FAR *pAnimationAtStart) PURE;
668 STDMETHOD(put_AnimationAtStart)(VARIANT_BOOL pAnimationAtStart) PURE;
669 STDMETHOD(get_AnimationOnStop)(VARIANT_BOOL __RPC_FAR *pAnimationOnStop) PURE;
670 STDMETHOD(put_AnimationOnStop)(VARIANT_BOOL pAnimationOnStop) PURE;
671 STDMETHOD(Play)(void) PURE;
672 STDMETHOD(Pause)(void) PURE;
673 STDMETHOD(Stop)(void) PURE;
674 STDMETHOD(GetMarkerTime)(long MarkerNum, double __RPC_FAR *pMarkerTime) PURE;
675 STDMETHOD(GetMarkerName)(long MarkerNum, BSTR __RPC_FAR *pbstrMarkerName) PURE;
920a7c15 676};
b11eba7e 677
c5191fbd
VZ
678struct INSPlay : public INSOPlay
679{
680 STDMETHOD(get_ChannelName)(BSTR __RPC_FAR *pbstrChannelName) PURE;
681 STDMETHOD(get_ChannelDescription)(BSTR __RPC_FAR *pbstrChannelDescription) PURE;
682 STDMETHOD(get_ChannelURL)(BSTR __RPC_FAR *pbstrChannelURL) PURE;
683 STDMETHOD(get_ContactAddress)(BSTR __RPC_FAR *pbstrContactAddress) PURE;
684 STDMETHOD(get_ContactPhone)(BSTR __RPC_FAR *pbstrContactPhone) PURE;
685 STDMETHOD(get_ContactEmail)(BSTR __RPC_FAR *pbstrContactEmail) PURE;
686 STDMETHOD(get_AllowChangeDisplaySize)(VARIANT_BOOL __RPC_FAR *pAllowChangeDisplaySize) PURE;
687 STDMETHOD(put_AllowChangeDisplaySize)(VARIANT_BOOL pAllowChangeDisplaySize) PURE;
688 STDMETHOD(get_CodecCount)(long __RPC_FAR *pCodecCount) PURE;
689 STDMETHOD(get_IsBroadcast)(VARIANT_BOOL __RPC_FAR *pIsBroadcast) PURE;
690 STDMETHOD(get_IsDurationValid)(VARIANT_BOOL __RPC_FAR *pIsDurationValid) PURE;
691 STDMETHOD(get_SourceProtocol)(long __RPC_FAR *pSourceProtocol) PURE;
692 STDMETHOD(get_OpenState)(long __RPC_FAR *pOpenState) PURE;
693 STDMETHOD(get_SendOpenStateChangeEvents)(VARIANT_BOOL __RPC_FAR *pSendOpenStateChangeEvents) PURE;
694 STDMETHOD(put_SendOpenStateChangeEvents)(VARIANT_BOOL pSendOpenStateChangeEvents) PURE;
695 STDMETHOD(get_SendWarningEvents)(VARIANT_BOOL __RPC_FAR *pSendWarningEvents) PURE;
696 STDMETHOD(put_SendWarningEvents)(VARIANT_BOOL pSendWarningEvents) PURE;
697 STDMETHOD(get_SendErrorEvents)(VARIANT_BOOL __RPC_FAR *pSendErrorEvents) PURE;
698 STDMETHOD(put_SendErrorEvents)(VARIANT_BOOL pSendErrorEvents) PURE;
699 STDMETHOD(get_HasError)(VARIANT_BOOL __RPC_FAR *pHasError) PURE;
700 STDMETHOD(get_ErrorDescription)(BSTR __RPC_FAR *pbstrErrorDescription) PURE;
701 STDMETHOD(get_ErrorCode)(long __RPC_FAR *pErrorCode) PURE;
702 STDMETHOD(get_PlayState)(long __RPC_FAR *pPlayState) PURE;
703 STDMETHOD(get_SendPlayStateChangeEvents)(VARIANT_BOOL __RPC_FAR *pSendPlayStateChangeEvents) PURE;
704 STDMETHOD(put_SendPlayStateChangeEvents)(VARIANT_BOOL pSendPlayStateChangeEvents) PURE;
705 STDMETHOD(get_BufferingTime)(double __RPC_FAR *pBufferingTime) PURE;
706 STDMETHOD(put_BufferingTime)(double pBufferingTime) PURE;
707 STDMETHOD(get_UseFixedUDPPort)(VARIANT_BOOL __RPC_FAR *pUseFixedUDPPort) PURE;
708 STDMETHOD(put_UseFixedUDPPort)(VARIANT_BOOL pUseFixedUDPPort) PURE;
709 STDMETHOD(get_FixedUDPPort)(long __RPC_FAR *pFixedUDPPort) PURE;
710 STDMETHOD(put_FixedUDPPort)(long pFixedUDPPort) PURE;
711 STDMETHOD(get_UseHTTPProxy)(VARIANT_BOOL __RPC_FAR *pUseHTTPProxy) PURE;
712 STDMETHOD(put_UseHTTPProxy)(VARIANT_BOOL pUseHTTPProxy) PURE;
713 STDMETHOD(get_EnableAutoProxy)(VARIANT_BOOL __RPC_FAR *pEnableAutoProxy) PURE;
714 STDMETHOD(put_EnableAutoProxy)(VARIANT_BOOL pEnableAutoProxy) PURE;
715 STDMETHOD(get_HTTPProxyHost)(BSTR __RPC_FAR *pbstrHTTPProxyHost) PURE;
716 STDMETHOD(put_HTTPProxyHost)(BSTR pbstrHTTPProxyHost) PURE;
717 STDMETHOD(get_HTTPProxyPort)(long __RPC_FAR *pHTTPProxyPort) PURE;
718 STDMETHOD(put_HTTPProxyPort)(long pHTTPProxyPort) PURE;
719 STDMETHOD(get_EnableMulticast)(VARIANT_BOOL __RPC_FAR *pEnableMulticast) PURE;
720 STDMETHOD(put_EnableMulticast)(VARIANT_BOOL pEnableMulticast) PURE;
721 STDMETHOD(get_EnableUDP)(VARIANT_BOOL __RPC_FAR *pEnableUDP) PURE;
722 STDMETHOD(put_EnableUDP)(VARIANT_BOOL pEnableUDP) PURE;
723 STDMETHOD(get_EnableTCP)(VARIANT_BOOL __RPC_FAR *pEnableTCP) PURE;
724 STDMETHOD(put_EnableTCP)(VARIANT_BOOL pEnableTCP) PURE;
725 STDMETHOD(get_EnableHTTP)(VARIANT_BOOL __RPC_FAR *pEnableHTTP) PURE;
726 STDMETHOD(put_EnableHTTP)(VARIANT_BOOL pEnableHTTP) PURE;
727 STDMETHOD(get_BufferingProgress)(long __RPC_FAR *pBufferingProgress) PURE;
728 STDMETHOD(get_BaseURL)(BSTR __RPC_FAR *pbstrBaseURL) PURE;
729 STDMETHOD(put_BaseURL)(BSTR pbstrBaseURL) PURE;
730 STDMETHOD(get_DefaultFrame)(BSTR __RPC_FAR *pbstrDefaultFrame) PURE;
731 STDMETHOD(put_DefaultFrame)(BSTR pbstrDefaultFrame) PURE;
732 STDMETHOD(AboutBox))(void) PURE;
733 STDMETHOD(Cancel)(void) PURE;
734 STDMETHOD(GetCodecInstalled)(long CodecNum, VARIANT_BOOL __RPC_FAR *pCodecInstalled) PURE;
735 STDMETHOD(GetCodecDescription)(long CodecNum, BSTR __RPC_FAR *pbstrCodecDescription) PURE;
736 STDMETHOD(GetCodecURL)(long CodecNum, BSTR __RPC_FAR *pbstrCodecURL) PURE;
737 STDMETHOD(Open)(BSTR bstrFileName) PURE;
738};
b11eba7e 739
c5191fbd
VZ
740
741struct INSPlay1 : public INSPlay
920a7c15 742{
c5191fbd 743 STDMETHOD(get_MediaPlayer)(IDispatch __RPC_FAR *__RPC_FAR *ppdispatch) PURE;
920a7c15 744};
32f65e50 745
c137ddc9
JS
746//---------------------------------------------------------------------------
747// IWMP (PocketPC 2000) COM INTERFACES (dumped from PlayerOCX.idl)
748//---------------------------------------------------------------------------
749
750struct IWMP : public IDispatch
751{
752public:
9d7d3b1f 753 virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_AutoSize(
c137ddc9 754 /* [in] */ VARIANT_BOOL vbool) = 0;
9d7d3b1f
DS
755
756 virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_AutoSize(
c137ddc9 757 /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbool) = 0;
9d7d3b1f
DS
758
759 virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_BorderStyle(
c137ddc9 760 /* [in] */ long style) = 0;
9d7d3b1f
DS
761
762 virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_BorderStyle(
c137ddc9 763 /* [retval][out] */ long __RPC_FAR *pstyle) = 0;
9d7d3b1f
DS
764
765 virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_Enabled(
c137ddc9 766 /* [in] */ VARIANT_BOOL vbool) = 0;
9d7d3b1f
DS
767
768 virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_Enabled(
c137ddc9 769 /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pbool) = 0;
9d7d3b1f
DS
770
771 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_FileName(
c137ddc9 772 /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
773
774 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_FileName(
c137ddc9 775 /* [in] */ BSTR newVal) = 0;
9d7d3b1f
DS
776
777 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Volume(
c137ddc9 778 /* [retval][out] */ long __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
779
780 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_Volume(
c137ddc9 781 /* [in] */ long newVal) = 0;
9d7d3b1f
DS
782
783 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Mute(
c137ddc9 784 /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
785
786 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_Mute(
c137ddc9 787 /* [in] */ VARIANT_BOOL newVal) = 0;
9d7d3b1f
DS
788
789 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_AutoStart(
c137ddc9 790 /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
791
792 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_AutoStart(
c137ddc9 793 /* [in] */ VARIANT_BOOL newVal) = 0;
9d7d3b1f
DS
794
795 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_PlayCount(
c137ddc9 796 /* [retval][out] */ long __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
797
798 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_PlayCount(
c137ddc9 799 /* [in] */ long newVal) = 0;
9d7d3b1f
DS
800
801 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ShowStatusBar(
c137ddc9 802 /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
803
804 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_ShowStatusBar(
c137ddc9 805 /* [in] */ VARIANT_BOOL newVal) = 0;
9d7d3b1f
DS
806
807 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ShowAudioControls(
c137ddc9 808 /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
809
810 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_ShowAudioControls(
c137ddc9 811 /* [in] */ VARIANT_BOOL newVal) = 0;
9d7d3b1f
DS
812
813 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ShowCaptioning(
c137ddc9 814 /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
815
816 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_ShowCaptioning(
c137ddc9 817 /* [in] */ VARIANT_BOOL newVal) = 0;
9d7d3b1f
DS
818
819 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ShowControls(
c137ddc9 820 /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
821
822 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_ShowControls(
c137ddc9 823 /* [in] */ VARIANT_BOOL newVal) = 0;
9d7d3b1f
DS
824
825 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ShowDisplay(
c137ddc9 826 /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
827
828 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_ShowDisplay(
c137ddc9 829 /* [in] */ VARIANT_BOOL newVal) = 0;
9d7d3b1f
DS
830
831 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ShowGotoBar(
c137ddc9 832 /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
833
834 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_ShowGotoBar(
c137ddc9 835 /* [in] */ VARIANT_BOOL newVal) = 0;
9d7d3b1f
DS
836
837 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ShowPositionControls(
c137ddc9 838 /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
839
840 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_ShowPositionControls(
c137ddc9 841 /* [in] */ VARIANT_BOOL newVal) = 0;
9d7d3b1f
DS
842
843 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ShowTracker(
c137ddc9 844 /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
845
846 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_ShowTracker(
c137ddc9 847 /* [in] */ VARIANT_BOOL newVal) = 0;
9d7d3b1f
DS
848
849 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Startup( void ) = 0;
850
851 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Shutdown( void ) = 0;
852
853 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Bandwidth(
c137ddc9 854 /* [retval][out] */ long __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
855
856 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_BaseURL(
c137ddc9 857 /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
858
859 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_BaseURL(
c137ddc9 860 /* [in] */ BSTR pVal) = 0;
9d7d3b1f
DS
861
862 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_BufferingCount(
c137ddc9 863 /* [retval][out] */ long __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
864
865 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_BufferingProgress(
c137ddc9 866 /* [retval][out] */ long __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
867
868 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_BufferingTime(
c137ddc9 869 /* [retval][out] */ double __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
870
871 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_CanSeek(
c137ddc9 872 /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
873
874 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_CanSeekToMarkers(
c137ddc9 875 /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
876
877 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ChannelDescription(
c137ddc9 878 /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
879
880 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ChannelName(
c137ddc9 881 /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
882
883 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ChannelURL(
c137ddc9 884 /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
885
886 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ClientID(
c137ddc9 887 /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
888
889 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ConnectionSpeed(
c137ddc9 890 /* [retval][out] */ long __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
891
892 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ContactAddress(
c137ddc9 893 /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
894
895 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ContactEmail(
c137ddc9 896 /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
897
898 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ContactPhone(
c137ddc9 899 /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
900
901 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_CurrentMarker(
c137ddc9 902 /* [retval][out] */ long __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
903
904 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_CurrentMarker(
c137ddc9 905 /* [in] */ long newVal) = 0;
9d7d3b1f
DS
906
907 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_CurrentPosition(
c137ddc9 908 /* [retval][out] */ double __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
909
910 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_CurrentPosition(
c137ddc9 911 /* [in] */ double newVal) = 0;
9d7d3b1f
DS
912
913 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_DefaultFrame(
c137ddc9 914 /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
915
916 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_DefaultFrame(
c137ddc9 917 /* [in] */ BSTR newVal) = 0;
9d7d3b1f
DS
918
919 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Duration(
c137ddc9 920 /* [retval][out] */ double __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
921
922 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_EntryCount(
c137ddc9 923 /* [retval][out] */ long __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
924
925 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ErrorCode(
c137ddc9 926 /* [retval][out] */ long __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
927
928 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ErrorDescription(
c137ddc9 929 /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
930
931 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_HasError(
c137ddc9 932 /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
933
934 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_HasMultipleItems(
c137ddc9 935 /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
936
937 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ImageSourceHeight(
c137ddc9 938 /* [retval][out] */ long __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
939
940 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ImageSourceWidth(
c137ddc9 941 /* [retval][out] */ long __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
942
943 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_InvokeURLs(
c137ddc9 944 /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
945
946 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_InvokeURLs(
c137ddc9 947 /* [in] */ VARIANT_BOOL newVal) = 0;
9d7d3b1f
DS
948
949 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_IsBroadcast(
c137ddc9 950 /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
951
952 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_IsDurationValid(
c137ddc9 953 /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
954
955 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_LostPackets(
c137ddc9 956 /* [retval][out] */ long __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
957
958 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_MarkerCount(
c137ddc9 959 /* [retval][out] */ long __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
960
961 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_OpenState(
c137ddc9 962 /* [retval][out] */ long __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
963
964 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_PlayState(
c137ddc9 965 /* [retval][out] */ long __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
966
967 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_PreviewMode(
c137ddc9 968 /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
969
970 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_PreviewMode(
c137ddc9 971 /* [in] */ VARIANT_BOOL newVal) = 0;
9d7d3b1f
DS
972
973 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ReadyState(
c137ddc9 974 /* [retval][out] */ long __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
975
976 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ReceivedPackets(
c137ddc9 977 /* [retval][out] */ long __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
978
979 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ReceptionQuality(
c137ddc9 980 /* [retval][out] */ long __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
981
982 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_RecoveredPackets(
c137ddc9 983 /* [retval][out] */ long __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
984
985 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SAMIFileName(
c137ddc9 986 /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
987
988 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SAMIFileName(
c137ddc9 989 /* [in] */ BSTR newVal) = 0;
9d7d3b1f
DS
990
991 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SAMILang(
c137ddc9 992 /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
993
994 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SAMILang(
c137ddc9 995 /* [in] */ BSTR newVal) = 0;
9d7d3b1f
DS
996
997 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SAMIStyle(
c137ddc9 998 /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
999
1000 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SAMIStyle(
c137ddc9 1001 /* [in] */ BSTR newVal) = 0;
9d7d3b1f
DS
1002
1003 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SelectionEnd(
c137ddc9 1004 /* [retval][out] */ double __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
1005
1006 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SelectionEnd(
c137ddc9 1007 /* [in] */ double newVal) = 0;
9d7d3b1f
DS
1008
1009 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SelectionStart(
c137ddc9 1010 /* [retval][out] */ double __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
1011
1012 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SelectionStart(
c137ddc9 1013 /* [in] */ double newVal) = 0;
9d7d3b1f
DS
1014
1015 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SendErrorEvents(
c137ddc9 1016 /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
1017
1018 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SendErrorEvents(
c137ddc9 1019 /* [in] */ VARIANT_BOOL newVal) = 0;
9d7d3b1f
DS
1020
1021 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SendKeyboardEvents(
c137ddc9 1022 /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
1023
1024 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SendKeyboardEvents(
c137ddc9 1025 /* [in] */ VARIANT_BOOL newVal) = 0;
9d7d3b1f
DS
1026
1027 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SendMouseClickEvents(
c137ddc9 1028 /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
1029
1030 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SendMouseClickEvents(
c137ddc9 1031 /* [in] */ VARIANT_BOOL newVal) = 0;
9d7d3b1f
DS
1032
1033 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SendMouseMoveEvents(
c137ddc9 1034 /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
1035
1036 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SendMouseMoveEvents(
c137ddc9 1037 /* [in] */ VARIANT_BOOL newVal) = 0;
9d7d3b1f
DS
1038
1039 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SendOpenStateChangeEvents(
c137ddc9 1040 /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
1041
1042 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SendOpenStateChangeEvents(
c137ddc9 1043 /* [in] */ VARIANT_BOOL newVal) = 0;
9d7d3b1f
DS
1044
1045 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SendPlayStateChangeEvents(
c137ddc9 1046 /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
1047
1048 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SendPlayStateChangeEvents(
c137ddc9 1049 /* [in] */ VARIANT_BOOL newVal) = 0;
9d7d3b1f
DS
1050
1051 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SendWarningEvents(
c137ddc9 1052 /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
1053
1054 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_SendWarningEvents(
c137ddc9 1055 /* [in] */ VARIANT_BOOL newVal) = 0;
9d7d3b1f
DS
1056
1057 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SourceLink(
c137ddc9 1058 /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0;
9d7d3b1f 1059
c137ddc9 1060 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE AboutBox( void) = 0;
9d7d3b1f 1061
c137ddc9 1062 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Cancel( void) = 0;
9d7d3b1f
DS
1063
1064 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetCodecDescription(
c137ddc9
JS
1065 /* [in] */ long nCodec,
1066 /* [retval][out] */ BSTR __RPC_FAR *pDescription) = 0;
9d7d3b1f
DS
1067
1068 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetCodecInstalled(
c137ddc9
JS
1069 /* [in] */ BSTR __RPC_FAR *pstrCodec,
1070 /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pIsInstalled) = 0;
9d7d3b1f
DS
1071
1072 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetCurrentEntry(
c137ddc9 1073 /* [retval][out] */ long __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
1074
1075 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetMarkerName(
c137ddc9
JS
1076 /* [in] */ long nMarker,
1077 /* [retval][out] */ BSTR __RPC_FAR *pMarkerName) = 0;
9d7d3b1f
DS
1078
1079 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetMarkerTime(
c137ddc9
JS
1080 /* [in] */ long nMarker,
1081 /* [retval][out] */ double __RPC_FAR *pMarkerTime) = 0;
9d7d3b1f
DS
1082
1083 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetMediaInfoString(
c137ddc9
JS
1084 /* [in] */ long MPMediaInfoType,
1085 /* [retval][out] */ BSTR __RPC_FAR *pstrMediaInfo) = 0;
9d7d3b1f 1086
c137ddc9 1087 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Next( void) = 0;
9d7d3b1f
DS
1088
1089 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Open(
c137ddc9 1090 BSTR pstrClip) = 0;
9d7d3b1f 1091
c137ddc9 1092 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Pause( void) = 0;
9d7d3b1f 1093
c137ddc9 1094 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Play( void) = 0;
9d7d3b1f 1095
c137ddc9 1096 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Previous( void) = 0;
9d7d3b1f 1097
c137ddc9 1098 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Stop( void) = 0;
9d7d3b1f
DS
1099
1100 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Rate(
c137ddc9 1101 /* [retval][out] */ double __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
1102
1103 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_Rate(
c137ddc9 1104 /* [in] */ double newVal) = 0;
9d7d3b1f
DS
1105
1106 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_DisplaySize(
c137ddc9 1107 /* [retval][out] */ long __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
1108
1109 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_DisplaySize(
c137ddc9 1110 /* [in] */ long newVal) = 0;
9d7d3b1f
DS
1111
1112 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_SourceProtocol(
c137ddc9 1113 /* [retval][out] */ long __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
1114
1115 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ErrorCorrection(
c137ddc9 1116 /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0;
9d7d3b1f 1117
c137ddc9 1118 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE FinalConstruct( void) = 0;
9d7d3b1f
DS
1119
1120 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_AllowChangeDisplaySize(
c137ddc9 1121 /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
1122
1123 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_AllowChangeDisplaySize(
c137ddc9 1124 /* [in] */ VARIANT_BOOL newVal) = 0;
9d7d3b1f
DS
1125
1126 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_AllowScan(
c137ddc9 1127 /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
1128
1129 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_AllowScan(
c137ddc9 1130 /* [in] */ VARIANT_BOOL newVal) = 0;
9d7d3b1f
DS
1131
1132 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_AnimationAtStart(
c137ddc9 1133 /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
1134
1135 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_AnimationAtStart(
c137ddc9 1136 /* [in] */ VARIANT_BOOL newVal) = 0;
9d7d3b1f
DS
1137
1138 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_AudioStream(
c137ddc9 1139 /* [retval][out] */ long __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
1140
1141 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_AudioStream(
c137ddc9 1142 /* [in] */ long newVal) = 0;
9d7d3b1f
DS
1143
1144 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_AutoRewind(
c137ddc9 1145 /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
1146
1147 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_AutoRewind(
c137ddc9 1148 /* [in] */ VARIANT_BOOL newVal) = 0;
9d7d3b1f
DS
1149
1150 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Balance(
c137ddc9 1151 /* [retval][out] */ long __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
1152
1153 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_Balance(
c137ddc9 1154 /* [in] */ long newVal) = 0;
9d7d3b1f
DS
1155
1156 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_CanPreview(
c137ddc9 1157 /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
1158
1159 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_CanScan(
c137ddc9 1160 /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
1161
1162 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_CaptioningID(
c137ddc9 1163 /* [retval][out] */ BSTR __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
1164
1165 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_ClickToPlay(
c137ddc9 1166 /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
1167
1168 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_ClickToPlay(
c137ddc9 1169 /* [in] */ VARIANT_BOOL newVal) = 0;
9d7d3b1f
DS
1170
1171 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_CodecCount(
c137ddc9 1172 /* [retval][out] */ long __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
1173
1174 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_CreationDate(
c137ddc9 1175 /* [retval][out] */ DATE __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
1176
1177 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_CursorType(
c137ddc9 1178 /* [retval][out] */ long __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
1179
1180 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_CursorType(
c137ddc9 1181 /* [in] */ long newVal) = 0;
9d7d3b1f
DS
1182
1183 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_DisplayBackColor(
c137ddc9 1184 /* [retval][out] */ VB_OLE_COLOR __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
1185
1186 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_DisplayBackColor(
c137ddc9 1187 /* [in] */ VB_OLE_COLOR newVal) = 0;
9d7d3b1f
DS
1188
1189 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_DisplayForeColor(
c137ddc9 1190 /* [retval][out] */ VB_OLE_COLOR __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
1191
1192 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_DisplayForeColor(
c137ddc9 1193 /* [in] */ VB_OLE_COLOR newVal) = 0;
9d7d3b1f
DS
1194
1195 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_DisplayMode(
c137ddc9 1196 /* [retval][out] */ long __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
1197
1198 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_DisplayMode(
c137ddc9 1199 /* [in] */ long newVal) = 0;
9d7d3b1f
DS
1200
1201 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_EnableContextMenu(
c137ddc9 1202 /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
1203
1204 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_EnableContextMenu(
c137ddc9 1205 /* [in] */ VARIANT_BOOL newVal) = 0;
9d7d3b1f
DS
1206
1207 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_EnableFullScreenControls(
c137ddc9 1208 /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
1209
1210 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_EnableFullScreenControls(
c137ddc9 1211 /* [in] */ VARIANT_BOOL newVal) = 0;
9d7d3b1f
DS
1212
1213 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_EnablePositionControls(
c137ddc9 1214 /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
1215
1216 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_EnablePositionControls(
c137ddc9 1217 /* [in] */ VARIANT_BOOL newVal) = 0;
9d7d3b1f
DS
1218
1219 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_EnableTracker(
c137ddc9 1220 /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
1221
1222 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_EnableTracker(
c137ddc9 1223 /* [in] */ VARIANT_BOOL newVal) = 0;
9d7d3b1f
DS
1224
1225 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Language(
c137ddc9 1226 /* [retval][out] */ long __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
1227
1228 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_StreamCount(
c137ddc9 1229 /* [retval][out] */ long __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
1230
1231 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_TransparentAtStart(
c137ddc9 1232 /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
1233
1234 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_TransparentAtStart(
c137ddc9 1235 /* [in] */ VARIANT_BOOL newVal) = 0;
9d7d3b1f
DS
1236
1237 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_VideoBorder3D(
c137ddc9 1238 /* [retval][out] */ VARIANT_BOOL __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
1239
1240 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_VideoBorder3D(
c137ddc9 1241 /* [in] */ VARIANT_BOOL newVal) = 0;
9d7d3b1f
DS
1242
1243 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_VideoBorderColor(
c137ddc9 1244 /* [retval][out] */ long __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
1245
1246 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_VideoBorderColor(
c137ddc9 1247 /* [in] */ long newVal) = 0;
9d7d3b1f
DS
1248
1249 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_VideoBorderWidth(
c137ddc9 1250 /* [retval][out] */ long __RPC_FAR *pVal) = 0;
9d7d3b1f
DS
1251
1252 virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_VideoBorderWidth(
c137ddc9 1253 /* [in] */ long newVal) = 0;
9d7d3b1f 1254
c137ddc9 1255 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE FastForward( void) = 0;
9d7d3b1f 1256
c137ddc9 1257 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE FastReverse( void) = 0;
9d7d3b1f
DS
1258
1259 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetCodecURL(
c137ddc9 1260 /* [retval][out] */ BSTR __RPC_FAR *pstrCodecURL) = 0;
9d7d3b1f
DS
1261
1262 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetMediaParameter(
c137ddc9
JS
1263 /* [in] */ long nParam,
1264 BSTR szParameterName,
1265 /* [retval][out] */ BSTR __RPC_FAR *pstrParameterValue) = 0;
9d7d3b1f
DS
1266
1267 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetMediaParameterName(
c137ddc9
JS
1268 /* [in] */ long nParam,
1269 long nIndex,
1270 /* [retval][out] */ BSTR __RPC_FAR *pstrParameterName) = 0;
9d7d3b1f
DS
1271
1272 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetMoreInfoURL(
c137ddc9 1273 /* [retval][out] */ BSTR __RPC_FAR *pstrMoreInfoURL) = 0;
9d7d3b1f
DS
1274
1275 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetStreamGroup(
c137ddc9 1276 /* [retval][out] */ BSTR __RPC_FAR *pstrStreamGroup) = 0;
9d7d3b1f
DS
1277
1278 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetStreamName(
c137ddc9 1279 /* [retval][out] */ BSTR __RPC_FAR *pstrStreamName) = 0;
9d7d3b1f
DS
1280
1281 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetStreamSelected(
c137ddc9
JS
1282 /* [in] */ long nStream,
1283 /* [retval][out] */ VARIANT_BOOL __RPC_FAR *fIsSelected) = 0;
9d7d3b1f
DS
1284
1285 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE IsSoundCardEnabled(
c137ddc9 1286 /* [retval][out] */ VARIANT_BOOL __RPC_FAR *fIsEnabled) = 0;
9d7d3b1f
DS
1287
1288 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SetCurrentEntry(
c137ddc9 1289 long nValue) = 0;
9d7d3b1f
DS
1290
1291 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE ShowDialog(
c137ddc9 1292 long nValue) = 0;
9d7d3b1f
DS
1293
1294 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE StreamSelect(
c137ddc9 1295 long nSelect) = 0;
9d7d3b1f
DS
1296
1297 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE OnWindowMessage(
c137ddc9
JS
1298 UINT msg,
1299 WPARAM wParam,
1300 LPARAM lParam,
1301 LRESULT __RPC_FAR *plResult) = 0;
c137ddc9
JS
1302};
1303
c5191fbd
VZ
1304//---------------------------------------------------------------------------
1305// MISC COM INTERFACES
1306//---------------------------------------------------------------------------
1307typedef enum _FilterState
1308{
1309 State_Stopped,
1310 State_Paused,
1311 State_Running
b1ec2381
DS
1312}
1313FILTER_STATE;
1314
1315typedef enum _PinDirection
1316{
c5191fbd
VZ
1317 PINDIR_INPUT,
1318 PINDIR_OUTPUT
b1ec2381
DS
1319}
1320PIN_DIRECTION;
c5191fbd 1321
b1ec2381
DS
1322typedef struct _FilterInfo
1323{
c5191fbd
VZ
1324 WCHAR achName[128];
1325 struct IFilterGraph *pGraph;
b1ec2381
DS
1326}
1327FILTER_INFO;
c5191fbd 1328
b1ec2381
DS
1329typedef struct _PinInfo
1330{
c5191fbd
VZ
1331 struct IBaseFilter *pFilter;
1332 PIN_DIRECTION dir;
1333 WCHAR achName[128];
b1ec2381
DS
1334}
1335PIN_INFO;
c5191fbd
VZ
1336
1337struct IBaseFilter;
1338struct IPin;
1339struct IEnumFilters;
b1ec2381
DS
1340typedef struct _MediaType
1341{
c5191fbd
VZ
1342 GUID majortype;
1343 GUID subtype;
1344 BOOL bFixedSizeSamples;
1345 BOOL bTemporalCompression;
1346 ULONG lSampleSize;
1347 GUID formattype;
1348 IUnknown *pUnk;
1349 ULONG cbFormat;
1350 BYTE *pbFormat;
b1ec2381
DS
1351}
1352AM_MEDIA_TYPE;
920a7c15
JS
1353
1354struct IFilterGraph : public IUnknown
1355{
1356 STDMETHOD(AddFilter)(IBaseFilter *, LPCWSTR) PURE;
1357 STDMETHOD(RemoveFilter)(IBaseFilter *) PURE;
1358 STDMETHOD(EnumFilters)(IEnumFilters **) PURE;
1359 STDMETHOD(FindFilterByName)(LPCWSTR, IBaseFilter **) PURE;
1360 STDMETHOD(ConnectDirect)(IPin *, IPin *, const AM_MEDIA_TYPE *) PURE;
1361 STDMETHOD(Reconnect)(IPin *) PURE;
1362 STDMETHOD(Disconnect)(IPin *) PURE;
1363 STDMETHOD(SetDefaultSyncSource)() PURE;
a2a444e3 1364};
b11eba7e 1365
920a7c15 1366struct IGraphBuilder : public IFilterGraph
a2a444e3 1367{
920a7c15
JS
1368 STDMETHOD(Connect)(IPin *, IPin *) PURE;
1369 STDMETHOD(Render)(IPin *) PURE;
1370 STDMETHOD(RenderFile)(LPCWSTR, LPCWSTR) PURE;
1371 STDMETHOD(AddSourceFilter)(LPCWSTR, LPCWSTR, IBaseFilter **) PURE;
1372 STDMETHOD(SetLogFile)(DWORD_PTR) PURE;
1373 STDMETHOD(Abort)() PURE;
1374 STDMETHOD(ShouldOperationContinue)() PURE;
a2a444e3 1375};
b11eba7e 1376
c5191fbd
VZ
1377struct IReferenceClock;
1378struct IEnumPins;
1379#define REFERENCE_TIME LONGLONG
1380struct IMediaFilter : public IPersist
1381{
1382 STDMETHOD(Stop)( void) PURE;
1383 STDMETHOD(Pause)( void) PURE;
1384 STDMETHOD(Run)(REFERENCE_TIME tStart) PURE;
1385 STDMETHOD(GetState)(DWORD dwMilliSecsTimeout,
1386 FILTER_STATE *State) PURE;
1387 STDMETHOD(SetSyncSource)(IReferenceClock *pClock) PURE;
1388 STDMETHOD(GetSyncSource)(IReferenceClock **pClock) PURE;
1389};
1390
1391struct IBaseFilter : public IMediaFilter
a2a444e3 1392{
c5191fbd
VZ
1393 STDMETHOD(EnumPins)(IEnumPins **ppEnum) PURE;
1394 STDMETHOD(FindPin)(LPCWSTR Id, IPin **ppPin) PURE;
1395 STDMETHOD(QueryFilterInfo)(FILTER_INFO *pInfo) PURE;
1396 STDMETHOD(JoinFilterGraph)(IFilterGraph *pGraph, LPCWSTR pName) PURE;
1397 STDMETHOD(QueryVendorInfo)(LPWSTR *pVendorInfo) PURE;
1398};
1399
c5191fbd 1400
b1ec2381 1401//---------------------------------------------------------------------------
c5191fbd 1402// wxAMMediaBackend
b1ec2381 1403//---------------------------------------------------------------------------
c5191fbd
VZ
1404
1405typedef BOOL (WINAPI* LPAMGETERRORTEXT)(HRESULT, wxChar *, DWORD);
1406
7e41b689 1407class WXDLLIMPEXP_MEDIA wxAMMediaBackend : public wxMediaBackendCommonBase
1a680109
RN
1408{
1409public:
ff4aedc5 1410 wxAMMediaBackend();
ff4aedc5 1411 virtual ~wxAMMediaBackend();
c5191fbd 1412 void Clear();
1a680109 1413
226ec5a7 1414 virtual bool CreateControl(wxControl* ctrl, wxWindow* parent,
ff4aedc5 1415 wxWindowID id,
226ec5a7 1416 const wxPoint& pos,
ff4aedc5 1417 const wxSize& size,
226ec5a7 1418 long style,
ff4aedc5
RN
1419 const wxValidator& validator,
1420 const wxString& name);
1a680109
RN
1421
1422 virtual bool Play();
1423 virtual bool Pause();
1424 virtual bool Stop();
1425
1426 virtual bool Load(const wxString& fileName);
1427 virtual bool Load(const wxURI& location);
c5191fbd
VZ
1428 virtual bool Load(const wxURI& location, const wxURI& proxy);
1429
1430 bool DoLoad(const wxString& location);
1431 void FinishLoad();
1a680109
RN
1432
1433 virtual wxMediaState GetState();
1434
ff4aedc5
RN
1435 virtual bool SetPosition(wxLongLong where);
1436 virtual wxLongLong GetPosition();
1437 virtual wxLongLong GetDuration();
1a680109 1438
ff4aedc5
RN
1439 virtual void Move(int x, int y, int w, int h);
1440 wxSize GetVideoSize() const;
1a680109
RN
1441
1442 virtual double GetPlaybackRate();
1443 virtual bool SetPlaybackRate(double);
1444
6f8c67e7
JS
1445 virtual double GetVolume();
1446 virtual bool SetVolume(double);
1447
c5191fbd 1448 virtual bool ShowPlayerControls(wxMediaCtrlPlayerControls flags);
1a680109 1449 void Cleanup();
920a7c15 1450
c5191fbd 1451 void DoGetDownloadProgress(wxLongLong*, wxLongLong*);
b1ec2381 1452
c5191fbd
VZ
1453 virtual wxLongLong GetDownloadProgress()
1454 {
1455 wxLongLong progress, total;
1456 DoGetDownloadProgress(&progress, &total);
1457 return progress;
1458 }
b1ec2381 1459
c5191fbd
VZ
1460 virtual wxLongLong GetDownloadTotal()
1461 {
1462 wxLongLong progress, total;
1463 DoGetDownloadProgress(&progress, &total);
1464 return total;
1465 }
1a680109 1466
9d7d3b1f 1467 // WinCE helpers
c137ddc9 1468
bf354396 1469 wxActiveXContainer* m_pAX;
9d7d3b1f 1470
c137ddc9
JS
1471#ifdef __WXWINCE__
1472 IWMP* m_pWMP;
1473
09e28f7f
DS
1474 IWMP* GetMP() { return m_pWMP; }
1475 IWMP* GetAM() { return m_pWMP; }
c137ddc9 1476#else
c5191fbd
VZ
1477 IActiveMovie* m_pAM;
1478 IMediaPlayer* m_pMP;
c137ddc9 1479
09e28f7f
DS
1480 IMediaPlayer* GetMP() { return m_pMP; }
1481 IActiveMovie* GetAM() { return m_pAM; }
c137ddc9 1482#endif
9d7d3b1f 1483
c5191fbd 1484 wxTimer* m_pTimer;
1a680109 1485 wxSize m_bestSize;
aa200e97 1486
920a7c15 1487#ifdef __WXDEBUG__
aa200e97 1488 wxDynamicLibrary m_dllQuartz;
920a7c15 1489 LPAMGETERRORTEXT m_lpAMGetErrorText;
a3c1ce50 1490 wxString GetErrorString(HRESULT hrdsv);
b1ec2381 1491#endif
920a7c15 1492
19b6f122 1493 DECLARE_DYNAMIC_CLASS(wxAMMediaBackend)
1a680109
RN
1494};
1495
1a680109 1496//---------------------------------------------------------------------------
ff4aedc5 1497// wxMCIMediaBackend
1a680109
RN
1498//---------------------------------------------------------------------------
1499
ff4aedc5
RN
1500//---------------------------------------------------------------------------
1501// MCI Includes
1502//---------------------------------------------------------------------------
a45d2855 1503#ifndef __WXWINCE__
1a680109 1504#include <mmsystem.h>
1a680109 1505
7e41b689 1506class WXDLLIMPEXP_MEDIA wxMCIMediaBackend : public wxMediaBackendCommonBase
1a680109
RN
1507{
1508public:
ff4aedc5 1509 wxMCIMediaBackend();
d3c7fc99 1510 virtual ~wxMCIMediaBackend();
1a680109 1511
226ec5a7 1512 virtual bool CreateControl(wxControl* ctrl, wxWindow* parent,
ff4aedc5 1513 wxWindowID id,
226ec5a7 1514 const wxPoint& pos,
ff4aedc5 1515 const wxSize& size,
226ec5a7 1516 long style,
ff4aedc5
RN
1517 const wxValidator& validator,
1518 const wxString& name);
1a680109
RN
1519
1520 virtual bool Play();
1521 virtual bool Pause();
1522 virtual bool Stop();
1523
3832f946
WS
1524 virtual bool Load(const wxURI& location,
1525 const wxURI& proxy)
1526 { return wxMediaBackend::Load(location, proxy); }
1527
1a680109
RN
1528 virtual bool Load(const wxString& fileName);
1529 virtual bool Load(const wxURI& location);
1530
1531 virtual wxMediaState GetState();
1532
ff4aedc5
RN
1533 virtual bool SetPosition(wxLongLong where);
1534 virtual wxLongLong GetPosition();
1535 virtual wxLongLong GetDuration();
1a680109 1536
ff4aedc5
RN
1537 virtual void Move(int x, int y, int w, int h);
1538 wxSize GetVideoSize() const;
1a680109
RN
1539
1540 virtual double GetPlaybackRate();
ff4aedc5 1541 virtual bool SetPlaybackRate(double dRate);
3f9a3bf9 1542
6f8c67e7
JS
1543 virtual double GetVolume();
1544 virtual bool SetVolume(double);
1545
226ec5a7 1546 static LRESULT CALLBACK NotifyWndProc(HWND hWnd, UINT nMsg,
ff4aedc5 1547 WPARAM wParam, LPARAM lParam);
5987f174 1548
226ec5a7 1549 LRESULT CALLBACK OnNotifyWndProc(HWND hWnd, UINT nMsg,
ff4aedc5 1550 WPARAM wParam, LPARAM lParam);
1a680109 1551
ff4aedc5 1552 MCIDEVICEID m_hDev; //Our MCI Device ID/Handler
ff4aedc5
RN
1553 HWND m_hNotifyWnd; //Window to use for MCI events
1554 bool m_bVideo; //Whether or not we have video
1555
3839f37e 1556 DECLARE_DYNAMIC_CLASS(wxMCIMediaBackend)
ff4aedc5 1557};
a45d2855 1558#endif
1a680109
RN
1559
1560//---------------------------------------------------------------------------
ff4aedc5 1561// wxQTMediaBackend
1a680109 1562//
c5191fbd
VZ
1563// We don't include Quicktime headers here and define all the types
1564// ourselves because looking for the quicktime libaries etc. would
1565// be tricky to do and making this a dependency for the MSVC projects
1566// would be unrealistic.
1567//
1568// Thanks to Robert Roebling for the wxDL macro/library idea
1a680109
RN
1569//---------------------------------------------------------------------------
1570
ff4aedc5
RN
1571//---------------------------------------------------------------------------
1572// QT Includes
1573//---------------------------------------------------------------------------
9d7d3b1f
DS
1574//#include <qtml.h> // Windoze QT include
1575//#include <QuickTimeComponents.h> // Standard QT stuff
d7a9c895
RN
1576#include "wx/dynlib.h"
1577
1578//---------------------------------------------------------------------------
1579// QT Types
1580//---------------------------------------------------------------------------
1581typedef struct MovieRecord* Movie;
1582typedef wxInt16 OSErr;
1583typedef wxInt32 OSStatus;
1584#define noErr 0
1585#define fsRdPerm 1
1586typedef unsigned char Str255[256];
1587#define StringPtr unsigned char*
1588#define newMovieActive 1
c5191fbd 1589#define newMovieAsyncOK (1 << 8)
b11eba7e 1590#define Ptr char*
d7a9c895
RN
1591#define Handle Ptr*
1592#define Fixed long
1593#define OSType unsigned long
b11eba7e 1594#define CGrafPtr struct GrafPort *
d7a9c895 1595#define TimeScale long
b11eba7e 1596#define TimeBase struct TimeBaseRecord *
c5191fbd
VZ
1597typedef struct ComponentInstanceRecord * ComponentInstance;
1598#define kMovieLoadStatePlayable 10000
1599#define Boolean int
1600#define MovieController ComponentInstance
d7a9c895 1601
19b6f122
WS
1602#ifndef URLDataHandlerSubType
1603#if defined(__WATCOMC__) || defined(__MINGW32__)
1604// use magic numbers for compilers which complain about multicharacter integers
1605const OSType URLDataHandlerSubType = 1970433056;
1606const OSType VisualMediaCharacteristic = 1702454643;
1607#else
1608const OSType URLDataHandlerSubType = 'url ';
1609const OSType VisualMediaCharacteristic = 'eyes';
1610#endif
1611#endif
1612
b1ec2381
DS
1613struct FSSpec
1614{
600ffb32
WS
1615 short vRefNum;
1616 long parID;
b1ec2381 1617 Str255 name; // Str63 on mac, Str255 on msw
d7a9c895
RN
1618};
1619
b1ec2381
DS
1620struct Rect
1621{
600ffb32
WS
1622 short top;
1623 short left;
1624 short bottom;
1625 short right;
d7a9c895
RN
1626};
1627
b1ec2381
DS
1628struct wide
1629{
600ffb32
WS
1630 wxInt32 hi;
1631 wxUint32 lo;
d7a9c895
RN
1632};
1633
b1ec2381
DS
1634struct TimeRecord
1635{
1636 wide value; // units
1637 TimeScale scale; // units per second
600ffb32 1638 TimeBase base;
d7a9c895
RN
1639};
1640
b1ec2381
DS
1641struct Point
1642{
c5191fbd
VZ
1643 short v;
1644 short h;
1645};
1646
b1ec2381
DS
1647struct EventRecord
1648{
c5191fbd
VZ
1649 wxUint16 what;
1650 wxUint32 message;
1651 wxUint32 when;
1652 Point where;
1653 wxUint16 modifiers;
1654};
1655
9d7d3b1f
DS
1656enum
1657{
c5191fbd
VZ
1658 mcTopLeftMovie = 1,
1659 mcScaleMovieToFit = 2,
1660 mcWithBadge = 4,
1661 mcNotVisible = 8,
1662 mcWithFrame = 16
1663};
1664
d7a9c895
RN
1665//---------------------------------------------------------------------------
1666// QT Library
1667//---------------------------------------------------------------------------
d7a9c895 1668
b11eba7e 1669class WXDLLIMPEXP_MEDIA wxQuickTimeLibrary
d7a9c895
RN
1670{
1671public:
1672 ~wxQuickTimeLibrary()
b11eba7e 1673 {
b1ec2381 1674 if (m_dll.IsLoaded())
d7a9c895
RN
1675 m_dll.Unload();
1676 }
1677
1678 bool Initialize();
1679 bool IsOk() const {return m_ok;}
1680
1681protected:
1682 wxDynamicLibrary m_dll;
1683 bool m_ok;
1684
1685public:
1686 wxDL_VOIDMETHOD_DEFINE( StartMovie, (Movie m), (m) );
1687 wxDL_VOIDMETHOD_DEFINE( StopMovie, (Movie m), (m) );
1688 wxDL_METHOD_DEFINE( bool, IsMovieDone, (Movie m), (m), false);
1689 wxDL_VOIDMETHOD_DEFINE( GoToBeginningOfMovie, (Movie m), (m) );
1690 wxDL_METHOD_DEFINE( OSErr, GetMoviesError, (), (), -1);
1691 wxDL_METHOD_DEFINE( OSErr, EnterMovies, (), (), -1);
1692 wxDL_VOIDMETHOD_DEFINE( ExitMovies, (), () );
1693 wxDL_METHOD_DEFINE( OSErr, InitializeQTML, (long flags), (flags), -1);
1694 wxDL_VOIDMETHOD_DEFINE( TerminateQTML, (), () );
1695
b11eba7e
WS
1696 wxDL_METHOD_DEFINE( OSErr, NativePathNameToFSSpec,
1697 (char* inName, FSSpec* outFile, long flags),
d7a9c895
RN
1698 (inName, outFile, flags), -1);
1699
b11eba7e 1700 wxDL_METHOD_DEFINE( OSErr, OpenMovieFile,
d7a9c895
RN
1701 (const FSSpec * fileSpec, short * resRefNum, wxInt8 permission),
1702 (fileSpec, resRefNum, permission), -1 );
1703
1704 wxDL_METHOD_DEFINE( OSErr, CloseMovieFile,
1705 (short resRefNum), (resRefNum), -1);
1706
1707 wxDL_METHOD_DEFINE( OSErr, NewMovieFromFile,
1708 (Movie * theMovie, short resRefNum, short * resId,
1709 StringPtr resName, short newMovieFlags,
b11eba7e 1710 bool * dataRefWasChanged),
d7a9c895
RN
1711 (theMovie, resRefNum, resId, resName, newMovieFlags,
1712 dataRefWasChanged), -1);
1713
1714 wxDL_VOIDMETHOD_DEFINE( SetMovieRate, (Movie m, Fixed rate), (m, rate) );
1715 wxDL_METHOD_DEFINE( Fixed, GetMovieRate, (Movie m), (m), 0);
1716 wxDL_VOIDMETHOD_DEFINE( MoviesTask, (Movie m, long maxms), (m, maxms) );
b11eba7e 1717 wxDL_VOIDMETHOD_DEFINE( BlockMove,
d7a9c895
RN
1718 (const char* p1, const char* p2, long s), (p1,p2,s) );
1719 wxDL_METHOD_DEFINE( Handle, NewHandleClear, (long s), (s), NULL );
1720
b11eba7e 1721 wxDL_METHOD_DEFINE( OSErr, NewMovieFromDataRef,
d7a9c895
RN
1722 (Movie * m, short flags, short * id,
1723 Handle dataRef, OSType dataRefType),
1724 (m,flags,id,dataRef,dataRefType), -1 );
1725
1726 wxDL_VOIDMETHOD_DEFINE( DisposeHandle, (Handle h), (h) );
1727 wxDL_VOIDMETHOD_DEFINE( GetMovieNaturalBoundsRect, (Movie m, Rect* r), (m,r) );
b11eba7e
WS
1728 wxDL_METHOD_DEFINE( void*, GetMovieIndTrackType,
1729 (Movie m, long index, OSType type, long flags),
d7a9c895 1730 (m,index,type,flags), NULL );
b11eba7e 1731 wxDL_VOIDMETHOD_DEFINE( CreatePortAssociation,
d7a9c895
RN
1732 (void* hWnd, void* junk, long morejunk), (hWnd, junk, morejunk) );
1733 wxDL_METHOD_DEFINE(void*, GetNativeWindowPort, (void* hWnd), (hWnd), NULL);
1734 wxDL_VOIDMETHOD_DEFINE(SetMovieGWorld, (Movie m, CGrafPtr port, void* whatever),
1735 (m, port, whatever) );
1736 wxDL_VOIDMETHOD_DEFINE(DisposeMovie, (Movie m), (m) );
1737 wxDL_VOIDMETHOD_DEFINE(SetMovieBox, (Movie m, Rect* r), (m,r));
1738 wxDL_VOIDMETHOD_DEFINE(SetMovieTimeScale, (Movie m, long s), (m,s));
1739 wxDL_METHOD_DEFINE(long, GetMovieDuration, (Movie m), (m), 0);
1740 wxDL_METHOD_DEFINE(TimeBase, GetMovieTimeBase, (Movie m), (m), 0);
1741 wxDL_METHOD_DEFINE(TimeScale, GetMovieTimeScale, (Movie m), (m), 0);
1742 wxDL_METHOD_DEFINE(long, GetMovieTime, (Movie m, void* cruft), (m,cruft), 0);
1743 wxDL_VOIDMETHOD_DEFINE(SetMovieTime, (Movie m, TimeRecord* tr), (m,tr) );
6f8c67e7
JS
1744 wxDL_METHOD_DEFINE(short, GetMovieVolume, (Movie m), (m), 0);
1745 wxDL_VOIDMETHOD_DEFINE(SetMovieVolume, (Movie m, short sVolume), (m,sVolume) );
c5191fbd
VZ
1746 wxDL_VOIDMETHOD_DEFINE(SetMovieTimeValue, (Movie m, long s), (m,s));
1747 wxDL_METHOD_DEFINE(ComponentInstance, NewMovieController, (Movie m, const Rect* mr, long fl), (m,mr,fl), 0);
1748 wxDL_VOIDMETHOD_DEFINE(DisposeMovieController, (ComponentInstance ci), (ci));
1749 wxDL_METHOD_DEFINE(int, MCSetVisible, (ComponentInstance m, int b), (m, b), 0);
1750
c5191fbd
VZ
1751 wxDL_VOIDMETHOD_DEFINE(PrePrerollMovie, (Movie m, long t, Fixed r, WXFARPROC p1, void* p2), (m,t,r,p1,p2) );
1752 wxDL_VOIDMETHOD_DEFINE(PrerollMovie, (Movie m, long t, Fixed r), (m,t,r) );
1753 wxDL_METHOD_DEFINE(Fixed, GetMoviePreferredRate, (Movie m), (m), 0);
1754 wxDL_METHOD_DEFINE(long, GetMovieLoadState, (Movie m), (m), 0);
1755 wxDL_METHOD_DEFINE(void*, NewRoutineDescriptor, (WXFARPROC f, int l, void* junk), (f, l, junk), 0);
1756 wxDL_VOIDMETHOD_DEFINE(DisposeRoutineDescriptor, (void* f), (f));
1757 wxDL_METHOD_DEFINE(void*, GetCurrentArchitecture, (), (), 0);
1758 wxDL_METHOD_DEFINE(int, MCDoAction, (ComponentInstance ci, long f, void* p), (ci,f,p), 0);
1759 wxDL_VOIDMETHOD_DEFINE(MCSetControllerBoundsRect, (ComponentInstance ci, Rect* r), (ci,r));
1760 wxDL_VOIDMETHOD_DEFINE(DestroyPortAssociation, (CGrafPtr g), (g));
1761 wxDL_VOIDMETHOD_DEFINE(NativeEventToMacEvent, (MSG* p1, EventRecord* p2), (p1,p2));
1762 wxDL_VOIDMETHOD_DEFINE(MCIsPlayerEvent, (ComponentInstance ci, EventRecord* p2), (ci, p2));
a843caf3 1763 wxDL_METHOD_DEFINE(int, MCSetMovie, (ComponentInstance ci, Movie m, void* p1, Point w),
c5191fbd
VZ
1764 (ci,m,p1,w),0);
1765 wxDL_VOIDMETHOD_DEFINE(MCPositionController,
1766 (ComponentInstance ci, Rect* r, void* junk, void* morejunk), (ci,r,junk,morejunk));
1767 wxDL_VOIDMETHOD_DEFINE(MCSetActionFilterWithRefCon,
1768 (ComponentInstance ci, WXFARPROC cb, void* ref), (ci,cb,ref));
1769 wxDL_VOIDMETHOD_DEFINE(MCGetControllerInfo, (MovieController mc, long* flags), (mc,flags));
1770 wxDL_VOIDMETHOD_DEFINE(BeginUpdate, (CGrafPtr port), (port));
1771 wxDL_VOIDMETHOD_DEFINE(UpdateMovie, (Movie m), (m));
1772 wxDL_VOIDMETHOD_DEFINE(EndUpdate, (CGrafPtr port), (port));
1773 wxDL_METHOD_DEFINE( OSErr, GetMoviesStickyError, (), (), -1);
d7a9c895
RN
1774};
1775
1776bool wxQuickTimeLibrary::Initialize()
1777{
d0914b9d
VZ
1778 // Turn off the wxDynamicLibrary logging as we're prepared to handle the
1779 // errors
1780 wxLogNull nolog;
32f65e50 1781
ced3df77
VZ
1782 m_ok = m_dll.Load(wxT("qtmlClient.dll"));
1783 if ( !m_ok )
d7a9c895
RN
1784 return false;
1785
ced3df77
VZ
1786 wxDL_METHOD_LOAD( m_dll, StartMovie );
1787 wxDL_METHOD_LOAD( m_dll, StopMovie );
1788 wxDL_METHOD_LOAD( m_dll, IsMovieDone );
1789 wxDL_METHOD_LOAD( m_dll, GoToBeginningOfMovie );
1790 wxDL_METHOD_LOAD( m_dll, GetMoviesError );
1791 wxDL_METHOD_LOAD( m_dll, EnterMovies );
1792 wxDL_METHOD_LOAD( m_dll, ExitMovies );
1793 wxDL_METHOD_LOAD( m_dll, InitializeQTML );
1794 wxDL_METHOD_LOAD( m_dll, TerminateQTML );
1795 wxDL_METHOD_LOAD( m_dll, NativePathNameToFSSpec );
1796 wxDL_METHOD_LOAD( m_dll, OpenMovieFile );
1797 wxDL_METHOD_LOAD( m_dll, CloseMovieFile );
1798 wxDL_METHOD_LOAD( m_dll, NewMovieFromFile );
1799 wxDL_METHOD_LOAD( m_dll, GetMovieRate );
1800 wxDL_METHOD_LOAD( m_dll, SetMovieRate );
1801 wxDL_METHOD_LOAD( m_dll, MoviesTask );
1802 wxDL_METHOD_LOAD( m_dll, BlockMove );
1803 wxDL_METHOD_LOAD( m_dll, NewHandleClear );
1804 wxDL_METHOD_LOAD( m_dll, NewMovieFromDataRef );
1805 wxDL_METHOD_LOAD( m_dll, DisposeHandle );
1806 wxDL_METHOD_LOAD( m_dll, GetMovieNaturalBoundsRect );
1807 wxDL_METHOD_LOAD( m_dll, GetMovieIndTrackType );
1808 wxDL_METHOD_LOAD( m_dll, CreatePortAssociation );
1809 wxDL_METHOD_LOAD( m_dll, DestroyPortAssociation );
1810 wxDL_METHOD_LOAD( m_dll, GetNativeWindowPort );
1811 wxDL_METHOD_LOAD( m_dll, SetMovieGWorld );
1812 wxDL_METHOD_LOAD( m_dll, DisposeMovie );
1813 wxDL_METHOD_LOAD( m_dll, SetMovieBox );
1814 wxDL_METHOD_LOAD( m_dll, SetMovieTimeScale );
1815 wxDL_METHOD_LOAD( m_dll, GetMovieDuration );
1816 wxDL_METHOD_LOAD( m_dll, GetMovieTimeBase );
1817 wxDL_METHOD_LOAD( m_dll, GetMovieTimeScale );
1818 wxDL_METHOD_LOAD( m_dll, GetMovieTime );
1819 wxDL_METHOD_LOAD( m_dll, SetMovieTime );
1820 wxDL_METHOD_LOAD( m_dll, GetMovieVolume );
1821 wxDL_METHOD_LOAD( m_dll, SetMovieVolume );
1822 wxDL_METHOD_LOAD( m_dll, SetMovieTimeValue );
1823 wxDL_METHOD_LOAD( m_dll, NewMovieController );
1824 wxDL_METHOD_LOAD( m_dll, DisposeMovieController );
1825 wxDL_METHOD_LOAD( m_dll, MCSetVisible );
1826 wxDL_METHOD_LOAD( m_dll, PrePrerollMovie );
1827 wxDL_METHOD_LOAD( m_dll, PrerollMovie );
1828 wxDL_METHOD_LOAD( m_dll, GetMoviePreferredRate );
1829 wxDL_METHOD_LOAD( m_dll, GetMovieLoadState );
1830 wxDL_METHOD_LOAD( m_dll, MCDoAction );
1831 wxDL_METHOD_LOAD( m_dll, MCSetControllerBoundsRect );
1832 wxDL_METHOD_LOAD( m_dll, NativeEventToMacEvent );
1833 wxDL_METHOD_LOAD( m_dll, MCIsPlayerEvent );
1834 wxDL_METHOD_LOAD( m_dll, MCSetMovie );
1835 wxDL_METHOD_LOAD( m_dll, MCSetActionFilterWithRefCon );
1836 wxDL_METHOD_LOAD( m_dll, MCGetControllerInfo );
1837 wxDL_METHOD_LOAD( m_dll, BeginUpdate );
1838 wxDL_METHOD_LOAD( m_dll, UpdateMovie );
1839 wxDL_METHOD_LOAD( m_dll, EndUpdate );
1840 wxDL_METHOD_LOAD( m_dll, GetMoviesStickyError );
1841
1842 return m_ok;
d7a9c895 1843}
1a680109 1844
7e41b689 1845class WXDLLIMPEXP_MEDIA wxQTMediaBackend : public wxMediaBackendCommonBase
ff4aedc5
RN
1846{
1847public:
ff4aedc5 1848 wxQTMediaBackend();
d3c7fc99 1849 virtual ~wxQTMediaBackend();
1a680109 1850
226ec5a7 1851 virtual bool CreateControl(wxControl* ctrl, wxWindow* parent,
ff4aedc5 1852 wxWindowID id,
226ec5a7 1853 const wxPoint& pos,
ff4aedc5 1854 const wxSize& size,
226ec5a7 1855 long style,
ff4aedc5
RN
1856 const wxValidator& validator,
1857 const wxString& name);
1a680109 1858
ff4aedc5
RN
1859 virtual bool Play();
1860 virtual bool Pause();
1861 virtual bool Stop();
1a680109 1862
3832f946
WS
1863 virtual bool Load(const wxURI& location,
1864 const wxURI& proxy)
1865 { return wxMediaBackend::Load(location, proxy); }
1866
ff4aedc5
RN
1867 virtual bool Load(const wxString& fileName);
1868 virtual bool Load(const wxURI& location);
1a680109 1869
ff4aedc5 1870 virtual wxMediaState GetState();
1a680109 1871
ff4aedc5
RN
1872 virtual bool SetPosition(wxLongLong where);
1873 virtual wxLongLong GetPosition();
1874 virtual wxLongLong GetDuration();
1a680109 1875
ff4aedc5
RN
1876 virtual void Move(int x, int y, int w, int h);
1877 wxSize GetVideoSize() const;
1a680109 1878
ff4aedc5
RN
1879 virtual double GetPlaybackRate();
1880 virtual bool SetPlaybackRate(double dRate);
1a680109 1881
6f8c67e7
JS
1882 virtual double GetVolume();
1883 virtual bool SetVolume(double);
1884
ff4aedc5
RN
1885 void Cleanup();
1886 void FinishLoad();
1a680109 1887
c5191fbd 1888 static void PPRMProc (Movie theMovie, OSErr theErr, void* theRefCon);
b1ec2381
DS
1889
1890 // TODO: Last param actually long - does this work on 64bit machines?
09e28f7f 1891 static Boolean MCFilterProc(MovieController theController,
c5191fbd
VZ
1892 short action, void *params, LONG_PTR refCon);
1893
1894 static LRESULT CALLBACK QTWndProc(HWND, UINT, WPARAM, LPARAM);
1895
1896 virtual bool ShowPlayerControls(wxMediaCtrlPlayerControls flags);
1897
b1ec2381
DS
1898 wxSize m_bestSize; // Original movie size
1899 Movie m_movie; // QT Movie handle/instance
1900 bool m_bVideo; // Whether or not we have video
1901 bool m_bPlaying; // Whether or not movie is playing
1902 wxTimer* m_timer; // Load or Play timer
1903 wxQuickTimeLibrary m_lib; // DLL to load functions from
1904 ComponentInstance m_pMC; // Movie Controller
d7a9c895 1905
bf354396 1906 friend class wxQTMediaEvtHandler;
9d7d3b1f 1907
19b6f122 1908 DECLARE_DYNAMIC_CLASS(wxQTMediaBackend)
ff4aedc5 1909};
1a680109 1910
6ab9bf57
VZ
1911// helper to hijack background erasing for the QT window
1912class WXDLLIMPEXP_MEDIA wxQTMediaEvtHandler : public wxEvtHandler
1913{
1914public:
7e41b689
VZ
1915 wxQTMediaEvtHandler(wxQTMediaBackend *qtb, WXHWND hwnd)
1916 {
1917 m_qtb = qtb;
1918 m_hwnd = hwnd;
bf354396
VZ
1919
1920 m_qtb->m_ctrl->Connect(m_qtb->m_ctrl->GetId(),
7ec69821 1921 wxEVT_ERASE_BACKGROUND,
bf354396 1922 wxEraseEventHandler(wxQTMediaEvtHandler::OnEraseBackground),
b1ec2381 1923 NULL, this);
7e41b689 1924 }
6ab9bf57
VZ
1925
1926 void OnEraseBackground(wxEraseEvent& event);
1927
1928private:
1929 wxQTMediaBackend *m_qtb;
7e41b689 1930 WXHWND m_hwnd;
6ab9bf57
VZ
1931
1932 DECLARE_NO_COPY_CLASS(wxQTMediaEvtHandler)
1933};
1934
1a680109 1935
ff4aedc5
RN
1936//===========================================================================
1937// IMPLEMENTATION
1938//===========================================================================
1a680109 1939
b1ec2381 1940//---------------------------------------------------------------------------
ff4aedc5 1941// wxAMMediaBackend
b1ec2381 1942//---------------------------------------------------------------------------
1a680109 1943
412e0d47 1944IMPLEMENT_DYNAMIC_CLASS(wxAMMediaBackend, wxMediaBackend)
1a680109 1945
ff4aedc5
RN
1946//---------------------------------------------------------------------------
1947// Usual debugging macros
1948//---------------------------------------------------------------------------
1949#ifdef __WXDEBUG__
920a7c15 1950#define MAX_ERROR_TEXT_LEN 160
a3c1ce50 1951
b1ec2381 1952// Get the error string for Active Movie
a3c1ce50
JS
1953wxString wxAMMediaBackend::GetErrorString(HRESULT hrdsv)
1954{
32f65e50 1955 wxChar szError[MAX_ERROR_TEXT_LEN];
b1ec2381
DS
1956 if ( m_lpAMGetErrorText != NULL &&
1957 (*m_lpAMGetErrorText)(hrdsv, szError, MAX_ERROR_TEXT_LEN) == 0)
32f65e50 1958 {
a3c1ce50 1959 return wxString::Format(wxT("DirectShow error \"%s\" \n")
c5191fbd 1960 wxT("(numeric %X)\n")
6a17b868 1961 wxT("occurred"),
c5191fbd 1962 szError, (int)hrdsv);
32f65e50
WS
1963 }
1964 else
1965 {
c5191fbd
VZ
1966 return wxString::Format(wxT("Unknown error \n")
1967 wxT("(numeric %X)\n")
6a17b868 1968 wxT("occurred"),
c5191fbd 1969 (int)hrdsv);
32f65e50 1970 }
1a680109 1971}
a3c1ce50 1972
c5191fbd
VZ
1973#define wxAMFAIL(x) wxFAIL_MSG(GetErrorString(x));
1974#define wxVERIFY(x) wxASSERT((x))
1975#define wxAMLOG(x) wxLogDebug(GetErrorString(x))
1976#else
c5191fbd
VZ
1977#define wxVERIFY(x) (x)
1978#define wxAMLOG(x)
1979#define wxAMFAIL(x)
1980#endif
1981
1982//---------------------------------------------------------------------------
1983// Standard macros for ease of use
1984//---------------------------------------------------------------------------
1985#define SAFE_RELEASE(x) { if (x) x->Release(); x = NULL; }
1986
1987//---------------------------------------------------------------------------
1988// wxAMLoadTimer
1989//
1990// Queries the control periodically to see if it has reached the point
1991// in its loading cycle where we can begin playing the media - if so
1992// then we finish up some things like getting the original size of the video
1993// and then sending the loaded event to our handler
1994//---------------------------------------------------------------------------
1995class wxAMLoadTimer : public wxTimer
1996{
1997public:
1998 wxAMLoadTimer(wxAMMediaBackend* parent) :
1999 m_parent(parent) {}
2000
2001 void Notify()
2002 {
c137ddc9 2003 if (m_parent->GetMP())
c5191fbd
VZ
2004 {
2005 MPReadyStateConstants nState;
9d7d3b1f 2006
c137ddc9
JS
2007#ifdef __WXWINCE__ //Cast to long needed for IWMP (??)
2008 m_parent->GetMP()->get_ReadyState((long*)&nState);
2009#else
2010 m_parent->GetMP()->get_ReadyState(&nState);
2011#endif
9d7d3b1f 2012
b1ec2381 2013 if (nState != mpReadyStateLoading)
c5191fbd
VZ
2014 {
2015 Stop();
2016 m_parent->FinishLoad();
2017 delete this;
2018 }
2019 }
2020 else
2021 {
2022 IActiveMovie2* pAM2 = NULL;
2023 ReadyStateConstants nState;
c137ddc9 2024 if (m_parent->GetAM()->QueryInterface(IID_IActiveMovie2, (void**)&pAM2) == 0
b1ec2381 2025 && pAM2->get_ReadyState(&nState) == 0)
c5191fbd
VZ
2026 {
2027 pAM2->Release();
b1ec2381 2028 if (nState != amvLoading)
c5191fbd
VZ
2029 {
2030 Stop();
2031 m_parent->FinishLoad();
2032 delete this;
2033 }
2034 }
2035 else
2036 {
b1ec2381 2037 if (pAM2)
c5191fbd
VZ
2038 pAM2->Release();
2039
2040 Stop();
2041 m_parent->FinishLoad();
2042 delete this;
2043 }
2044 }
c5191fbd
VZ
2045 }
2046
2047protected:
9d7d3b1f 2048 wxAMMediaBackend* m_parent; // Backend pointer
c5191fbd
VZ
2049};
2050
2051//---------------------------------------------------------------------------
2052// wxAMPlayTimer
2053//
2054// Sets m_hNotifyWnd to NULL to signify that we haven't loaded anything yet
2055// Queries the control periodically to see if it has stopped -
2056// if it has it sends the stop event
2057//---------------------------------------------------------------------------
2058class wxAMPlayTimer : public wxTimer
2059{
2060public:
2061 wxAMPlayTimer(wxAMMediaBackend* parent) :
2062 m_parent(parent) {}
2063
2064 void Notify()
2065 {
09e28f7f
DS
2066 // NB: Stop events could get triggered by the interface
2067 // if ShowPlayerControls is enabled, so the "GetPosition == GetDuration"
2068 // hack is needed here to make an attempt at it not getting sent
2069 // - but its far from ideal - they can still get sent in some cases
b1ec2381
DS
2070 if (m_parent->GetState() == wxMEDIASTATE_STOPPED &&
2071 m_parent->GetPosition() == m_parent->GetDuration())
c5191fbd 2072 {
7e41b689 2073 if ( m_parent->SendStopEvent() )
c5191fbd 2074 {
b1ec2381 2075 // seek to beginning of movie
c5191fbd
VZ
2076 m_parent->wxAMMediaBackend::SetPosition(0);
2077 Stop();
2078
b1ec2381 2079 // send the event to our child
7e41b689 2080 m_parent->QueueFinishEvent();
c5191fbd
VZ
2081 }
2082 }
2083 }
2084
2085protected:
2086 wxAMMediaBackend* m_parent; //Backend pointer
2087};
2088
2089
b1ec2381 2090#if 0
c5191fbd
VZ
2091// The following is an alternative way - but it doesn't seem
2092// to work with the IActiveMovie control - it probably processes
2093// its own events
2094//---------------------------------------------------------------------------
2095// wxAMPlayTimer
2096//
2097// Query the IMediaEvent interface from the embedded WMP's
2098// filtergraph, then process the events from it - sending
2099// EC_COMPLETE events as stop events to the media control.
2100//---------------------------------------------------------------------------
2101class wxAMPlayTimer : public wxTimer
2102{
2103public:
2104 wxAMPlayTimer(wxAMMediaBackend* pBE) : m_pBE(pBE), m_pME(NULL)
2105 {
2106 HRESULT hr;
2107 IUnknown* pGB;
c137ddc9 2108 hr = m_pBE->GetAM()->get_FilterGraph(&pGB);
c5191fbd
VZ
2109 wxASSERT(SUCCEEDED(hr));
2110 hr = pGB->QueryInterface(IID_IMediaEvent, (void**)&m_pME);
2111 wxASSERT(SUCCEEDED(hr));
2112 pGB->Release();
2113 }
2114
d3c7fc99 2115 virtual ~wxAMPlayTimer()
c5191fbd
VZ
2116 {
2117 SAFE_RELEASE(m_pME);
2118 }
2119
2120 void Notify()
2121 {
2122 LONG evCode;
6591df24 2123 LONG_PTR evParam1, evParam2;
c5191fbd 2124
c5191fbd 2125 // DirectShow keeps a list of queued events, and we need
6591df24 2126 // to go through them one by one, stopping at (hopefully only one)
c5191fbd 2127 // EC_COMPLETE message
6591df24 2128 while ( m_pME->GetEvent(&evCode, &evParam1, &evParam2, 0) == 0 )
c5191fbd
VZ
2129 {
2130 // Cleanup memory that GetEvent allocated
6591df24 2131 HRESULT hr = m_pME->FreeEventParams(evCode, evParam1, evParam2);
b1ec2381 2132 if (hr != 0)
c5191fbd 2133 {
6591df24
DS
2134 // Even though this makes a messagebox, this is Windows,
2135 // where we can do GUI stuff in separate threads :)
c5191fbd
VZ
2136 wxFAIL_MSG(m_pBE->GetErrorString(hr));
2137 }
2138 // If this is the end of the clip, notify handler
b1ec2381 2139 else if (1 == evCode) // EC_COMPLETE
c5191fbd 2140 {
7e41b689 2141 if ( m_pBE->SendStopEvent() )
c5191fbd
VZ
2142 {
2143 Stop();
7e41b689 2144 m_pBE->QueueFinishEvent();
c5191fbd
VZ
2145 }
2146 }
2147 }
2148 }
1a680109 2149
c5191fbd 2150protected:
b1ec2381
DS
2151 wxAMMediaBackend* m_pBE; // Backend pointer
2152 IMediaEvent* m_pME; // To determine when to send stop event
c5191fbd 2153};
b1ec2381 2154#endif
1a680109 2155
ff4aedc5
RN
2156//---------------------------------------------------------------------------
2157// wxAMMediaBackend Constructor
226ec5a7 2158//---------------------------------------------------------------------------
32f65e50 2159wxAMMediaBackend::wxAMMediaBackend()
c5191fbd 2160 :m_pAX(NULL),
c137ddc9
JS
2161#ifdef __WXWINCE__
2162 m_pWMP(NULL),
2163#else
c5191fbd
VZ
2164 m_pAM(NULL),
2165 m_pMP(NULL),
c137ddc9 2166#endif
c5191fbd 2167 m_pTimer(NULL)
1a680109 2168{
1a680109
RN
2169}
2170
ff4aedc5
RN
2171//---------------------------------------------------------------------------
2172// wxAMMediaBackend Destructor
226ec5a7 2173//---------------------------------------------------------------------------
ff4aedc5 2174wxAMMediaBackend::~wxAMMediaBackend()
1a680109 2175{
6591df24
DS
2176 // Free memory from Load()
2177 Clear();
c5191fbd 2178
b1ec2381 2179 if (m_pAX)
c5191fbd 2180 {
9d7d3b1f 2181 m_pAX->DissociateHandle();
c5191fbd 2182 delete m_pAX;
9d7d3b1f 2183
c137ddc9 2184#ifndef __WXWINCE__
c5191fbd 2185 m_pAM->Release();
c137ddc9 2186#endif
c5191fbd 2187
c137ddc9
JS
2188 if (GetMP())
2189 GetMP()->Release();
c5191fbd 2190 }
1a680109
RN
2191}
2192
1a680109 2193//---------------------------------------------------------------------------
c5191fbd 2194// wxAMMediaBackend::Clear
1a680109 2195//
c5191fbd
VZ
2196// Free up interfaces and memory allocated by LoadXXX
2197//---------------------------------------------------------------------------
2198void wxAMMediaBackend::Clear()
2199{
b1ec2381 2200 if (m_pTimer)
f3ebbc0a 2201 {
c5191fbd 2202 delete m_pTimer;
f3ebbc0a
RD
2203 m_pTimer = NULL;
2204 }
c5191fbd
VZ
2205}
2206
2207//---------------------------------------------------------------------------
2208// wxAMMediaBackend::CreateControl
226ec5a7
WS
2209//---------------------------------------------------------------------------
2210bool wxAMMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent,
ff4aedc5 2211 wxWindowID id,
226ec5a7 2212 const wxPoint& pos,
ff4aedc5 2213 const wxSize& size,
226ec5a7 2214 long style,
ff4aedc5
RN
2215 const wxValidator& validator,
2216 const wxString& name)
226ec5a7 2217{
9d7d3b1f
DS
2218 // First get the AMGetErrorText procedure in
2219 // debug mode for more meaningful messages
920a7c15 2220#ifdef __WXDEBUG__
aa200e97 2221 if ( m_dllQuartz.Load(_T("quartz.dll"), wxDL_VERBATIM) )
920a7c15 2222 {
aa200e97
VZ
2223 m_lpAMGetErrorText = (LPAMGETERRORTEXT)
2224 m_dllQuartz.GetSymbolAorW(wxT("AMGetErrorText"));
920a7c15 2225 }
b1ec2381 2226#endif
aa200e97 2227
be96ed8c
JS
2228#ifdef __WXWINCE__
2229 CLSID clsid;
be96ed8c 2230
9d7d3b1f
DS
2231 // Try progids first - *.WMP is PocketPC and Mediaplayer.1 is CE.NET
2232 // later versions support straight creation from CLSID
c137ddc9
JS
2233 if (CLSIDFromProgID(L"WPCEOCX.WMP", &clsid) != S_OK &&
2234 CLSIDFromProgID(L"MediaPlayer.MediaPlayer.1", &clsid) != S_OK)
2235 {
2236 clsid = CLSID_MediaPlayer;
2237 }
2238
9d7d3b1f
DS
2239 // While the CLSID is the same as CLSID_MediaPlayer
2240 // CE only supports the IWMP interface
be96ed8c
JS
2241 if ( ::CoCreateInstance(clsid, NULL,
2242 CLSCTX_INPROC_SERVER,
c137ddc9 2243 IID_IWMP, (void**)&m_pWMP) != 0 )
be96ed8c
JS
2244 {
2245 return false;
2246 }
c137ddc9 2247
be96ed8c
JS
2248#else
2249 // determine which (if any) media player interface
2250 // is available - IMediaPlayer or IActiveMovie
2251 if ( ::CoCreateInstance(CLSID_MediaPlayer, NULL,
2252 CLSCTX_INPROC_SERVER,
2253 IID_IMediaPlayer, (void**)&m_pMP) != 0 )
2254 {
2255 if ( ::CoCreateInstance(CLSID_ActiveMovie, NULL,
2256 CLSCTX_INPROC_SERVER,
2257 IID_IActiveMovie, (void**)&m_pAM) != 0 )
2258 {
2259 return false;
2260 }
2261
2262 m_pAM->QueryInterface(IID_IMediaPlayer, (void**)&m_pMP);
2263 }
2264 else
2265 {
2266 m_pMP->QueryInterface(IID_IActiveMovie, (void**)&m_pAM);
2267 }
2268#endif
b1ec2381 2269
ff4aedc5
RN
2270 // Create window
2271 // By default wxWindow(s) is created with a border -
c5191fbd
VZ
2272 // so we need to get rid of those
2273 //
2274 // Since we don't have a child window like most other
2275 // backends, we don't need wxCLIP_CHILDREN
ff4aedc5 2276 if ( !ctrl->wxControl::Create(parent, id, pos, size,
c5191fbd 2277 (style & ~wxBORDER_MASK) | wxBORDER_NONE,
ff4aedc5 2278 validator, name) )
6591df24 2279 {
ff4aedc5 2280 return false;
6591df24 2281 }
1a680109 2282
6591df24 2283 // Create the ActiveX container along with the media player
c5191fbd 2284 // interface and query them
bf354396
VZ
2285 m_ctrl = wxStaticCast(ctrl, wxMediaCtrl);
2286 m_pAX = new wxActiveXContainer(ctrl,
c137ddc9
JS
2287#ifdef __WXWINCE__
2288 IID_IWMP, m_pWMP
2289#else
2290 m_pMP ? IID_IMediaPlayer : IID_IActiveMovie, m_pAM
2291#endif
2292 );
ff4aedc5 2293
6591df24
DS
2294 // Set up wx-specific stuff for the default
2295 // settings wxMediaCtrl says it will conform to (???)
c137ddc9 2296 if (GetMP())
1a680109 2297 {
c137ddc9 2298 GetMP()->put_DisplaySize(mpFitToSize);
b1ec2381 2299
09e28f7f 2300#ifndef __WXWINCE__ // Not in CE's IWMP
c5191fbd 2301 // TODO: Unsure what actual effect this has
c137ddc9
JS
2302 GetMP()->put_WindowlessVideo(VARIANT_TRUE);
2303#endif
1a680109 2304 }
09e28f7f 2305#ifndef __WXWINCE__ // Not in CE's IWMP
920a7c15 2306 else
c137ddc9
JS
2307 GetAM()->put_MovieWindowSize(amvDoubleOriginalSize);
2308#endif
c5191fbd 2309
b1ec2381 2310 // by default true
c137ddc9 2311 GetAM()->put_AutoStart(VARIANT_FALSE);
b1ec2381
DS
2312
2313 // by default enabled
c5191fbd 2314 wxAMMediaBackend::ShowPlayerControls(wxMEDIACTRLPLAYERCONTROLS_NONE);
b1ec2381
DS
2315
2316 // by default with AM only 0.5
c5191fbd
VZ
2317 wxAMMediaBackend::SetVolume(1.0);
2318
b1ec2381
DS
2319 // don't erase the background of our control window
2320 // so that resizing is a bit smoother
6ab9bf57 2321 m_ctrl->SetBackgroundStyle(wxBG_STYLE_CUSTOM);
ff4aedc5 2322
c5191fbd 2323 // success
32f65e50 2324 return true;
920a7c15 2325}
1a680109 2326
920a7c15
JS
2327//---------------------------------------------------------------------------
2328// wxAMMediaBackend::Load (file version)
920a7c15
JS
2329//---------------------------------------------------------------------------
2330bool wxAMMediaBackend::Load(const wxString& fileName)
2331{
c5191fbd
VZ
2332 return DoLoad(fileName);
2333}
920a7c15 2334
c5191fbd
VZ
2335//---------------------------------------------------------------------------
2336// wxAMMediaBackend::Load (URL Version)
2337//---------------------------------------------------------------------------
2338bool wxAMMediaBackend::Load(const wxURI& location)
2339{
6591df24 2340 // Turn off loading from a proxy, as user may have set it previously
c5191fbd 2341 INSPlay* pPlay = NULL;
c137ddc9 2342 GetAM()->QueryInterface(IID_INSPlay, (void**) &pPlay);
b1ec2381 2343 if (pPlay)
c5191fbd
VZ
2344 {
2345 pPlay->put_UseHTTPProxy(VARIANT_FALSE);
2346 pPlay->Release();
2347 }
920a7c15 2348
c5191fbd
VZ
2349 return DoLoad(location.BuildURI());
2350}
920a7c15 2351
c5191fbd
VZ
2352//---------------------------------------------------------------------------
2353// wxAMMediaBackend::Load (URL Version with Proxy)
2354//---------------------------------------------------------------------------
2355bool wxAMMediaBackend::Load(const wxURI& location, const wxURI& proxy)
2356{
2357 // Set the proxy of the NETSHOW interface
2358 INSPlay* pPlay = NULL;
c137ddc9 2359 GetAM()->QueryInterface(IID_INSPlay, (void**) &pPlay);
a3c1ce50 2360
b1ec2381 2361 if (pPlay)
920a7c15 2362 {
c5191fbd
VZ
2363 pPlay->put_UseHTTPProxy(VARIANT_TRUE);
2364 pPlay->put_HTTPProxyHost(wxBasicString(proxy.GetServer()).Get());
2365 pPlay->put_HTTPProxyPort(wxAtoi(proxy.GetPort()));
2366 pPlay->Release();
ff4aedc5 2367 }
226ec5a7 2368
c5191fbd
VZ
2369 return DoLoad(location.BuildURI());
2370}
1a680109 2371
c5191fbd
VZ
2372//---------------------------------------------------------------------------
2373// wxAMMediaBackend::DoLoad
2374//
2375// Called by all functions - this actually renders
2376// the file and sets up the filter graph
2377//---------------------------------------------------------------------------
2378bool wxAMMediaBackend::DoLoad(const wxString& location)
2379{
6591df24
DS
2380 //Clear up previously allocated memory
2381 Clear();
a3c1ce50 2382
c5191fbd
VZ
2383 HRESULT hr;
2384
6591df24
DS
2385 // Play the movie the normal way through the embedded WMP.
2386 // Supposedly, Open is better in theory because
c5191fbd 2387 // the docs say its async and put_FileName is not -
6591df24 2388 // but in practice they both appear to be async anyway
c137ddc9
JS
2389 if (GetMP())
2390 hr = GetMP()->Open( wxBasicString(location).Get() );
c5191fbd 2391 else
c137ddc9 2392 hr = GetAM()->put_FileName( wxBasicString(location).Get() );
a3c1ce50 2393
b1ec2381 2394 if (FAILED(hr))
a3c1ce50
JS
2395 {
2396 wxAMLOG(hr);
2397 return false;
2398 }
2399
c5191fbd
VZ
2400 // In AM playing will FAIL if
2401 // the user plays before the media is loaded
2402 m_pTimer = new wxAMLoadTimer(this);
2403 m_pTimer->Start(20);
b1ec2381 2404
c5191fbd
VZ
2405 return true;
2406}
2407
2408//---------------------------------------------------------------------------
2409// wxAMMediaBackend::FinishLoad
2410//
2411// Called by our wxAMLoadTimer when the
2412// embedded WMP tells its the media is ready to play.
2413//
2414// Here we get the original size of the video and
2415// send the loaded event to our watcher :).
2416//---------------------------------------------------------------------------
2417void wxAMMediaBackend::FinishLoad()
2418{
09e28f7f 2419 // Get the original video size
c137ddc9
JS
2420 GetAM()->get_ImageSourceWidth((long*)&m_bestSize.x);
2421 GetAM()->get_ImageSourceHeight((long*)&m_bestSize.y);
1a680109 2422
6591df24
DS
2423 // Start the play timer to catch stop events
2424 // Previous load timer cleans up itself
c5191fbd 2425 m_pTimer = new wxAMPlayTimer(this);
96339a78 2426
7e41b689 2427 NotifyMovieLoaded();
1a680109
RN
2428}
2429
a3c1ce50 2430//---------------------------------------------------------------------------
c5191fbd 2431// wxAMMediaBackend::ShowPlayerControls
a3c1ce50 2432//---------------------------------------------------------------------------
c5191fbd 2433bool wxAMMediaBackend::ShowPlayerControls(wxMediaCtrlPlayerControls flags)
a3c1ce50 2434{
c5191fbd
VZ
2435 // Note that IMediaPlayer doesn't have a statusbar by
2436 // default but IActiveMovie does - so lets try to keep
2437 // the interface consistant
b1ec2381 2438 if (!flags)
c5191fbd 2439 {
c137ddc9
JS
2440 GetAM()->put_Enabled(VARIANT_FALSE);
2441 GetAM()->put_ShowControls(VARIANT_FALSE);
2442 if (GetMP())
2443 GetMP()->put_ShowStatusBar(VARIANT_FALSE);
c5191fbd
VZ
2444 }
2445 else
a3c1ce50 2446 {
c137ddc9
JS
2447 GetAM()->put_Enabled(VARIANT_TRUE);
2448 GetAM()->put_ShowControls(VARIANT_TRUE);
c5191fbd 2449
c137ddc9 2450 GetAM()->put_ShowPositionControls(
c5191fbd
VZ
2451 (flags & wxMEDIACTRLPLAYERCONTROLS_STEP) ?
2452 VARIANT_TRUE : VARIANT_FALSE);
2453
c137ddc9 2454 if (GetMP())
c5191fbd 2455 {
c137ddc9
JS
2456 GetMP()->put_ShowStatusBar(VARIANT_TRUE);
2457 GetMP()->put_ShowAudioControls(
c5191fbd
VZ
2458 (flags & wxMEDIACTRLPLAYERCONTROLS_VOLUME) ?
2459 VARIANT_TRUE : VARIANT_FALSE);
2460 }
a3c1ce50
JS
2461 }
2462
c5191fbd 2463 return true;
a3c1ce50
JS
2464}
2465
ff4aedc5
RN
2466//---------------------------------------------------------------------------
2467// wxAMMediaBackend::Play
2468//
920a7c15
JS
2469// Plays the stream. If it is non-seekable, it will restart it (implicit).
2470//
2471// Note that we use SUCCEEDED here because run/pause/stop tend to be overly
2472// picky and return warnings on pretty much every call
226ec5a7 2473//---------------------------------------------------------------------------
ff4aedc5 2474bool wxAMMediaBackend::Play()
1a680109 2475{
f3ebbc0a 2476 // Actually try to play the movie, even though it may not be loaded yet.
c137ddc9
JS
2477#ifdef __WXWINCE__
2478 HRESULT hr = m_pWMP->Play();
2479#else
2480 HRESULT hr = GetAM()->Run();
2481#endif
b1ec2381 2482 if (SUCCEEDED(hr))
920a7c15 2483 {
c5191fbd 2484 m_pTimer->Start(20);
920a7c15
JS
2485 return true;
2486 }
b1ec2381 2487
c5191fbd 2488 wxAMLOG(hr);
b1ec2381 2489
920a7c15 2490 return false;
1a680109
RN
2491}
2492
ff4aedc5
RN
2493//---------------------------------------------------------------------------
2494// wxAMMediaBackend::Pause
2495//
2496// Pauses the stream.
226ec5a7 2497//---------------------------------------------------------------------------
ff4aedc5 2498bool wxAMMediaBackend::Pause()
1a680109 2499{
c137ddc9 2500 HRESULT hr = GetAM()->Pause();
b1ec2381 2501 if (SUCCEEDED(hr))
920a7c15 2502 return true;
b1ec2381 2503
c5191fbd 2504 wxAMLOG(hr);
b1ec2381 2505
920a7c15 2506 return false;
1a680109
RN
2507}
2508
ff4aedc5
RN
2509//---------------------------------------------------------------------------
2510// wxAMMediaBackend::Stop
2511//
2512// Stops the stream.
226ec5a7 2513//---------------------------------------------------------------------------
ff4aedc5 2514bool wxAMMediaBackend::Stop()
1a680109 2515{
c137ddc9 2516 HRESULT hr = GetAM()->Stop();
b1ec2381 2517 if (SUCCEEDED(hr))
920a7c15 2518 {
b1ec2381 2519 // Seek to beginning
920a7c15 2520 wxAMMediaBackend::SetPosition(0);
b1ec2381
DS
2521
2522 // Stop stop event timer
c5191fbd 2523 m_pTimer->Stop();
920a7c15
JS
2524 return true;
2525 }
b1ec2381 2526
c5191fbd 2527 wxAMLOG(hr);
b1ec2381 2528
920a7c15 2529 return false;
1a680109
RN
2530}
2531
ff4aedc5
RN
2532//---------------------------------------------------------------------------
2533// wxAMMediaBackend::SetPosition
2534//
226ec5a7 2535// 1) Translates the current position's time to directshow time,
a2a444e3 2536// which is in a scale of 1 second (in a double)
ff4aedc5
RN
2537// 2) Sets the play position of the IMediaSeeking interface -
2538// passing NULL as the stop position means to keep the old
2539// stop position
226ec5a7 2540//---------------------------------------------------------------------------
ff4aedc5 2541bool wxAMMediaBackend::SetPosition(wxLongLong where)
1a680109 2542{
c137ddc9 2543 HRESULT hr = GetAM()->put_CurrentPosition(
09e28f7f 2544 ((LONGLONG)where.GetValue()) / 1000.0 );
b1ec2381 2545 if (FAILED(hr))
a3c1ce50
JS
2546 {
2547 wxAMLOG(hr);
2548 return false;
2549 }
2550
2551 return true;
1a680109
RN
2552}
2553
ff4aedc5
RN
2554//---------------------------------------------------------------------------
2555// wxAMMediaBackend::GetPosition
2556//
2557// 1) Obtains the current play and stop positions from IMediaSeeking
2558// 2) Returns the play position translated to our time base
226ec5a7 2559//---------------------------------------------------------------------------
ff4aedc5 2560wxLongLong wxAMMediaBackend::GetPosition()
1a680109 2561{
a2a444e3 2562 double outCur;
c137ddc9 2563 HRESULT hr = GetAM()->get_CurrentPosition(&outCur);
b1ec2381 2564 if (FAILED(hr))
a3c1ce50
JS
2565 {
2566 wxAMLOG(hr);
2567 return 0;
2568 }
1a680109 2569
b1ec2381 2570 // h,m,s,milli - outdur is in 1 second (double)
600ffb32
WS
2571 outCur *= 1000;
2572 wxLongLong ll;
2573 ll.Assign(outCur);
2574
2575 return ll;
1a680109
RN
2576}
2577
6f8c67e7 2578//---------------------------------------------------------------------------
a3c1ce50 2579// wxAMMediaBackend::GetVolume
6f8c67e7 2580//
a3c1ce50 2581// Gets the volume through the IBasicAudio interface -
6f8c67e7
JS
2582// value ranges from 0 (MAX volume) to -10000 (minimum volume).
2583// -100 per decibel.
2584//---------------------------------------------------------------------------
a3c1ce50 2585double wxAMMediaBackend::GetVolume()
b11eba7e 2586{
b1ec2381 2587 long lVolume;
c137ddc9 2588 HRESULT hr = GetAM()->get_Volume(&lVolume);
b1ec2381
DS
2589 if (FAILED(hr))
2590 {
2591 wxAMLOG(hr);
2592 return 0.0;
a3c1ce50 2593 }
b1ec2381
DS
2594
2595 return pow(10.0, lVolume / 2000.0);
b11eba7e 2596}
6f8c67e7
JS
2597
2598//---------------------------------------------------------------------------
a3c1ce50 2599// wxAMMediaBackend::SetVolume
6f8c67e7 2600//
a3c1ce50 2601// Sets the volume through the IBasicAudio interface -
6f8c67e7
JS
2602// value ranges from 0 (MAX volume) to -10000 (minimum volume).
2603// -100 per decibel.
2604//---------------------------------------------------------------------------
a3c1ce50 2605bool wxAMMediaBackend::SetVolume(double dVolume)
6f8c67e7 2606{
b1ec2381
DS
2607 // pow(10.0, -80.0) to correct 0 == -INF
2608 long lVolume = (long)(2000.0 * log10( pow( 10.0, -80.0) + dVolume ) );
c137ddc9 2609 HRESULT hr = GetAM()->put_Volume( lVolume );
b1ec2381
DS
2610 if (FAILED(hr))
2611 {
2612 wxAMLOG(hr);
2613 return false;
2614 }
2615
2616 return true;
6f8c67e7 2617}
b11eba7e 2618
ff4aedc5
RN
2619//---------------------------------------------------------------------------
2620// wxAMMediaBackend::GetDuration
2621//
920a7c15 2622// 1) Obtains the duration of the media from IAMMultiMediaStream
ff4aedc5 2623// 2) Converts that value to our time base, and returns it
920a7c15 2624//
32f65e50 2625// NB: With VBR MP3 files the default DirectShow MP3 render does not
920a7c15
JS
2626// read the Xing header correctly, resulting in skewed values for duration
2627// and seeking
226ec5a7 2628//---------------------------------------------------------------------------
ff4aedc5 2629wxLongLong wxAMMediaBackend::GetDuration()
1a680109 2630{
a2a444e3 2631 double outDuration;
c137ddc9 2632 HRESULT hr = GetAM()->get_Duration(&outDuration);
b1ec2381 2633 if (FAILED(hr))
a3c1ce50
JS
2634 {
2635 wxAMLOG(hr);
2636 return 0;
2637 }
1a680109 2638
b1ec2381 2639 // h,m,s,milli - outdur is in 1 second (double)
600ffb32
WS
2640 outDuration *= 1000;
2641 wxLongLong ll;
2642 ll.Assign(outDuration);
2643
2644 return ll;
1a680109
RN
2645}
2646
ff4aedc5
RN
2647//---------------------------------------------------------------------------
2648// wxAMMediaBackend::GetState
2649//
920a7c15 2650// Returns the cached state
226ec5a7 2651//---------------------------------------------------------------------------
ff4aedc5 2652wxMediaState wxAMMediaBackend::GetState()
1a680109 2653{
c5191fbd 2654 StateConstants nState;
c137ddc9
JS
2655#ifdef __WXWINCE__
2656 HRESULT hr = m_pWMP->get_PlayState((long*)&nState);
2657#else
2658 HRESULT hr = GetAM()->get_CurrentState(&nState);
2659#endif
b1ec2381 2660 if (FAILED(hr))
c5191fbd
VZ
2661 {
2662 wxAMLOG(hr);
2663 return wxMEDIASTATE_STOPPED;
2664 }
2665
2666 return (wxMediaState)nState;
1a680109
RN
2667}
2668
ff4aedc5
RN
2669//---------------------------------------------------------------------------
2670// wxAMMediaBackend::GetPlaybackRate
2671//
2672// Pretty simple way of obtaining the playback rate from
2673// the IMediaSeeking interface
226ec5a7 2674//---------------------------------------------------------------------------
ff4aedc5 2675double wxAMMediaBackend::GetPlaybackRate()
1a680109
RN
2676{
2677 double dRate;
c137ddc9 2678 HRESULT hr = GetAM()->get_Rate(&dRate);
b1ec2381 2679 if (FAILED(hr))
a3c1ce50
JS
2680 {
2681 wxAMLOG(hr);
2682 return 0.0;
2683 }
b1ec2381 2684
1a680109
RN
2685 return dRate;
2686}
2687
ff4aedc5
RN
2688//---------------------------------------------------------------------------
2689// wxAMMediaBackend::SetPlaybackRate
2690//
2691// Sets the playback rate of the media - DirectShow is pretty good
2692// about this, actually
226ec5a7 2693//---------------------------------------------------------------------------
ff4aedc5 2694bool wxAMMediaBackend::SetPlaybackRate(double dRate)
c5191fbd 2695{
c137ddc9 2696 HRESULT hr = GetAM()->put_Rate(dRate);
b1ec2381 2697 if (FAILED(hr))
c5191fbd
VZ
2698 {
2699 wxAMLOG(hr);
2700 return false;
920a7c15 2701 }
c5191fbd
VZ
2702
2703 return true;
920a7c15
JS
2704}
2705
920a7c15 2706//---------------------------------------------------------------------------
c5191fbd 2707// wxAMMediaBackend::GetDownloadXXX
920a7c15 2708//
c5191fbd
VZ
2709// Queries for and gets the total size of the file and the current
2710// progress in downloading that file from the IAMOpenProgress
2711// interface from the media player interface's filter graph
920a7c15 2712//---------------------------------------------------------------------------
c5191fbd
VZ
2713void wxAMMediaBackend::DoGetDownloadProgress(wxLongLong* pLoadProgress,
2714 wxLongLong* pLoadTotal)
1a680109 2715{
c137ddc9 2716#ifndef __WXWINCE__
c5191fbd
VZ
2717 LONGLONG loadTotal = 0, loadProgress = 0;
2718 IUnknown* pFG;
2719 IAMOpenProgress* pOP;
2720 HRESULT hr;
c137ddc9 2721 hr = GetAM()->get_FilterGraph(&pFG);
b1ec2381
DS
2722 if (SUCCEEDED(hr))
2723 {
c5191fbd 2724 hr = pFG->QueryInterface(IID_IAMOpenProgress, (void**)&pOP);
b1ec2381 2725 if (SUCCEEDED(hr))
c5191fbd
VZ
2726 {
2727 hr = pOP->QueryProgress(&loadTotal, &loadProgress);
2728 pOP->Release();
2729 }
b1ec2381 2730
c5191fbd
VZ
2731 pFG->Release();
2732 }
2733
b1ec2381
DS
2734 if (SUCCEEDED(hr))
2735 {
c5191fbd
VZ
2736 *pLoadProgress = loadProgress;
2737 *pLoadTotal = loadTotal;
b1ec2381 2738 }
c5191fbd 2739 else
c137ddc9 2740#endif
b1ec2381
DS
2741 {
2742 // When not loading from a URL QueryProgress will return
2743 // E_NOINTERFACE or whatever
2744 // wxAMFAIL(hr);
c5191fbd
VZ
2745 *pLoadProgress = 0;
2746 *pLoadTotal = 0;
920a7c15 2747 }
920a7c15
JS
2748}
2749
920a7c15 2750//---------------------------------------------------------------------------
c5191fbd 2751// wxAMMediaBackend::GetVideoSize
920a7c15 2752//
c5191fbd 2753// Obtains the cached original video size
920a7c15 2754//---------------------------------------------------------------------------
c5191fbd 2755wxSize wxAMMediaBackend::GetVideoSize() const
920a7c15 2756{
c5191fbd
VZ
2757 return m_bestSize;
2758}
b81383bb 2759
c5191fbd
VZ
2760//---------------------------------------------------------------------------
2761// wxAMMediaBackend::Move
2762//
2763// We take care of this in our redrawing
2764//---------------------------------------------------------------------------
2765void wxAMMediaBackend::Move(int WXUNUSED(x), int WXUNUSED(y),
2766 int WXUNUSED(w), int WXUNUSED(h))
2767{
1a680109
RN
2768}
2769
ff4aedc5
RN
2770//---------------------------------------------------------------------------
2771// End of wxAMMediaBackend
2772//---------------------------------------------------------------------------
1a680109 2773
9d7d3b1f 2774//---------------------------------------------------------------------------
ff4aedc5 2775// wxMCIMediaBackend
9d7d3b1f 2776//---------------------------------------------------------------------------
ff4aedc5 2777
a45d2855 2778#ifndef __WXWINCE__
412e0d47 2779IMPLEMENT_DYNAMIC_CLASS(wxMCIMediaBackend, wxMediaBackend)
ff4aedc5
RN
2780
2781//---------------------------------------------------------------------------
2782// Usual debugging macros for MCI returns
1a680109
RN
2783//---------------------------------------------------------------------------
2784
ff4aedc5
RN
2785#ifdef __WXDEBUG__
2786#define wxMCIVERIFY(arg) \
2787{ \
2788 DWORD nRet; \
2789 if ( (nRet = (arg)) != 0) \
2790 { \
2791 TCHAR sz[5000]; \
2792 mciGetErrorString(nRet, sz, 5000); \
2793 wxFAIL_MSG(wxString::Format(_T("MCI Error:%s"), sz)); \
2794 } \
2795}
2796#else
2797#define wxMCIVERIFY(arg) (arg);
2798#endif
2799
2800//---------------------------------------------------------------------------
2801// Simulation for <digitalv.h>
33d8e2fc 2802//
ff4aedc5 2803// Mingw and possibly other compilers don't have the digitalv.h header
226ec5a7 2804// that is needed to have some essential features of mci work with
ff4aedc5
RN
2805// windows - so we provide the declarations for the types we use here
2806//---------------------------------------------------------------------------
33d8e2fc 2807
b1ec2381
DS
2808typedef struct
2809{
33d8e2fc
RN
2810 DWORD_PTR dwCallback;
2811#ifdef MCI_USE_OFFEXT
2812 POINT ptOffset;
2813 POINT ptExtent;
226ec5a7 2814#else
33d8e2fc
RN
2815 RECT rc;
2816#endif
b1ec2381
DS
2817}
2818MCI_DGV_RECT_PARMS;
33d8e2fc 2819
b1ec2381
DS
2820typedef struct
2821{
33d8e2fc
RN
2822 DWORD_PTR dwCallback;
2823 HWND hWnd;
2824#ifndef _WIN32
2825 WORD wReserved1;
2826#endif
2827 UINT nCmdShow;
2828#ifndef _WIN32
2829 WORD wReserved2;
2830#endif
ff4aedc5 2831 wxChar* lpstrText;
b1ec2381
DS
2832}
2833MCI_DGV_WINDOW_PARMS;
33d8e2fc 2834
b1ec2381
DS
2835typedef struct
2836{
226ec5a7
WS
2837 DWORD_PTR dwCallback;
2838 DWORD dwTimeFormat;
2839 DWORD dwAudio;
2840 DWORD dwFileFormat;
2841 DWORD dwSpeed;
b1ec2381
DS
2842}
2843MCI_DGV_SET_PARMS;
33d8e2fc 2844
b1ec2381
DS
2845typedef struct
2846{
6f8c67e7
JS
2847 DWORD_PTR dwCallback;
2848 DWORD dwItem;
2849 DWORD dwValue;
2850 DWORD dwOver;
2851 wxChar* lpstrAlgorithm;
2852 wxChar* lpstrQuality;
b1ec2381
DS
2853}
2854MCI_DGV_SETAUDIO_PARMS;
6f8c67e7 2855
ff4aedc5
RN
2856//---------------------------------------------------------------------------
2857// wxMCIMediaBackend Constructor
2858//
2859// Here we don't need to do much except say we don't have any video :)
2860//---------------------------------------------------------------------------
2861wxMCIMediaBackend::wxMCIMediaBackend() : m_hNotifyWnd(NULL), m_bVideo(false)
2862{
3f9a3bf9
RN
2863}
2864
ff4aedc5
RN
2865//---------------------------------------------------------------------------
2866// wxMCIMediaBackend Destructor
2867//
9d7d3b1f 2868// We close the MCI device - note that there may not be an MCI device here,
ff4aedc5
RN
2869// or it may fail - but we don't really care, since we're destructing
2870//---------------------------------------------------------------------------
2871wxMCIMediaBackend::~wxMCIMediaBackend()
3f9a3bf9 2872{
b1ec2381 2873 if (m_hNotifyWnd)
ff4aedc5
RN
2874 {
2875 mciSendCommand(m_hDev, MCI_CLOSE, 0, 0);
2876 DestroyWindow(m_hNotifyWnd);
2877 m_hNotifyWnd = NULL;
2878 }
3f9a3bf9
RN
2879}
2880
ff4aedc5
RN
2881//---------------------------------------------------------------------------
2882// wxMCIMediaBackend::Create
2883//
9d7d3b1f 2884// Here we just tell wxMediaCtrl that MCI does exist (which it does, on all
ff4aedc5
RN
2885// msw systems, at least in some form dating back to win16 days)
2886//---------------------------------------------------------------------------
226ec5a7 2887bool wxMCIMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent,
ff4aedc5 2888 wxWindowID id,
226ec5a7 2889 const wxPoint& pos,
ff4aedc5 2890 const wxSize& size,
226ec5a7 2891 long style,
ff4aedc5
RN
2892 const wxValidator& validator,
2893 const wxString& name)
72259e00 2894{
ff4aedc5
RN
2895 // Create window
2896 // By default wxWindow(s) is created with a border -
2897 // so we need to get rid of those, and create with
2898 // wxCLIP_CHILDREN, so that if the driver/backend
2899 // is a child window, it refereshes properly
ff4aedc5 2900 if ( !ctrl->wxControl::Create(parent, id, pos, size,
11085e4b 2901 (style & ~wxBORDER_MASK) | wxBORDER_NONE | wxCLIP_CHILDREN,
ff4aedc5
RN
2902 validator, name) )
2903 return false;
2904
bf354396 2905 m_ctrl = wxStaticCast(ctrl, wxMediaCtrl);
b1ec2381 2906
3f9a3bf9
RN
2907 return true;
2908}
2909
ff4aedc5
RN
2910//---------------------------------------------------------------------------
2911// wxMCIMediaBackend::Load (file version)
2912//
2913// Here we have MCI load a file and device, set the time format to our
2914// default (milliseconds), and set the video (if any) to play in the control
2915//---------------------------------------------------------------------------
2916bool wxMCIMediaBackend::Load(const wxString& fileName)
3f9a3bf9 2917{
b1ec2381
DS
2918 // if the user already called load close the previous MCI device
2919 if (m_hNotifyWnd)
ff4aedc5 2920 {
3f9a3bf9 2921 mciSendCommand(m_hDev, MCI_CLOSE, 0, 0);
ff4aedc5
RN
2922 DestroyWindow(m_hNotifyWnd);
2923 m_hNotifyWnd = NULL;
2924 }
3f9a3bf9 2925
b1ec2381
DS
2926 // Opens a file and has MCI select a device. Normally you'd put
2927 // MCI_OPEN_TYPE in addition to MCI_OPEN_ELEMENT - however if you
2928 // omit this it tells MCI to select the device instead. This is good
2929 // because we have no reliable way of "enumerating" the devices in MCI
3f9a3bf9 2930 MCI_OPEN_PARMS openParms;
07594601 2931 openParms.lpstrElementName = fileName.wx_str();
3f9a3bf9 2932
9d7d3b1f 2933 if (mciSendCommand(0, MCI_OPEN, MCI_OPEN_ELEMENT,
ff4aedc5 2934 (DWORD)(LPVOID)&openParms) != 0)
a7d5151d 2935 {
ff4aedc5 2936 return false;
a7d5151d 2937 }
3f9a3bf9
RN
2938
2939 m_hDev = openParms.wDeviceID;
2940
b1ec2381 2941 // set the time format for the device to milliseconds
ff4aedc5 2942 MCI_SET_PARMS setParms;
3f9a3bf9
RN
2943 setParms.dwCallback = 0;
2944 setParms.dwTimeFormat = MCI_FORMAT_MILLISECONDS;
2945
2946 if (mciSendCommand(m_hDev, MCI_SET, MCI_SET_TIME_FORMAT,
2947 (DWORD)(LPVOID)&setParms) != 0)
b1ec2381 2948 {
3f9a3bf9 2949 return false;
a7d5151d 2950 }
3f9a3bf9 2951
b1ec2381 2952 // tell the MCI device to display the video in our wxMediaCtrl
3f9a3bf9 2953 MCI_DGV_WINDOW_PARMS windowParms;
5987f174 2954 windowParms.hWnd = (HWND)m_ctrl->GetHandle();
3f9a3bf9 2955
226ec5a7 2956 m_bVideo = (mciSendCommand(m_hDev, MCI_WINDOW,
b1ec2381 2957 0x00010000L, // MCI_DGV_WINDOW_HWND
ff4aedc5
RN
2958 (DWORD)(LPVOID)&windowParms) == 0);
2959
b1ec2381 2960 // Create a hidden window and register to handle MCI events
226ec5a7 2961 // Note that wxCanvasClassName is already registered
ff4aedc5 2962 // and used by all wxWindows and normal wxControls
b1ec2381 2963 m_hNotifyWnd = ::CreateWindow(
ff4aedc5
RN
2964 wxCanvasClassName,
2965 NULL,
2966 0, 0, 0, 0,
2967 0,
2968 (HWND) NULL,
2969 (HMENU)NULL,
2970 wxGetInstance(),
b1ec2381 2971 (LPVOID)NULL );
ff4aedc5 2972
b1ec2381 2973 if (!m_hNotifyWnd)
ff4aedc5
RN
2974 {
2975 wxLogSysError( wxT("Could not create hidden needed for ")
c5191fbd 2976 wxT("registering for MCI events!") );
ff4aedc5
RN
2977
2978 return false;
2979 }
226ec5a7 2980
1146983c 2981 wxSetWindowProc(m_hNotifyWnd, wxMCIMediaBackend::NotifyWndProc);
c5191fbd 2982 wxSetWindowUserData(m_hNotifyWnd, this);
ff4aedc5 2983
7e41b689 2984 NotifyMovieLoaded();
c5191fbd 2985
3f9a3bf9
RN
2986 return true;
2987}
2988
ff4aedc5
RN
2989//---------------------------------------------------------------------------
2990// wxMCIMediaBackend::Load (URL version)
2991//
2992// MCI doesn't support URLs directly (?)
2993//
9d7d3b1f 2994// TODO: Use wxURL/wxFileSystem and mmioInstallProc
ff4aedc5
RN
2995//---------------------------------------------------------------------------
2996bool wxMCIMediaBackend::Load(const wxURI& WXUNUSED(location))
3f9a3bf9
RN
2997{
2998 return false;
2999}
3000
ff4aedc5
RN
3001//---------------------------------------------------------------------------
3002// wxMCIMediaBackend::Play
3003//
3004// Plays/Resumes the MCI device... a couple notes:
3005// 1) Certain drivers will crash and burn if we don't pass them an
3006// MCI_PLAY_PARMS, despite the documentation that says otherwise...
3007// 2) There is a MCI_RESUME command, but MCI_PLAY does the same thing
226ec5a7 3008// and will resume from a stopped state also, so there's no need to
ff4aedc5
RN
3009// call both, for example
3010//---------------------------------------------------------------------------
3011bool wxMCIMediaBackend::Play()
5987f174 3012{
5987f174 3013 MCI_PLAY_PARMS playParms;
ff4aedc5
RN
3014 playParms.dwCallback = (DWORD)m_hNotifyWnd;
3015
9d7d3b1f
DS
3016 bool bOK = (mciSendCommand(m_hDev, MCI_PLAY, MCI_NOTIFY,
3017 (DWORD)(LPVOID)&playParms) == 0);
11219c9e 3018
b1ec2381 3019 if (bOK)
11219c9e
RN
3020 m_ctrl->Show(m_bVideo);
3021
3022 return bOK;
5987f174
RN
3023}
3024
ff4aedc5
RN
3025//---------------------------------------------------------------------------
3026// wxMCIMediaBackend::Pause
3027//
3028// Pauses the MCI device - nothing special
226ec5a7 3029//---------------------------------------------------------------------------
ff4aedc5 3030bool wxMCIMediaBackend::Pause()
5987f174
RN
3031{
3032 return (mciSendCommand(m_hDev, MCI_PAUSE, MCI_WAIT, 0) == 0);
3033}
3034
ff4aedc5
RN
3035//---------------------------------------------------------------------------
3036// wxMCIMediaBackend::Stop
3037//
3038// Stops the MCI device & seeks to the beginning as wxMediaCtrl docs outline
226ec5a7 3039//---------------------------------------------------------------------------
ff4aedc5 3040bool wxMCIMediaBackend::Stop()
5987f174
RN
3041{
3042 return (mciSendCommand(m_hDev, MCI_STOP, MCI_WAIT, 0) == 0) &&
3043 (mciSendCommand(m_hDev, MCI_SEEK, MCI_SEEK_TO_START, 0) == 0);
3044}
3045
ff4aedc5
RN
3046//---------------------------------------------------------------------------
3047// wxMCIMediaBackend::GetState
3048//
3049// Here we get the state and convert it to a wxMediaState -
3050// since we use direct comparisons with MCI_MODE_PLAY and
3051// MCI_MODE_PAUSE, we don't care if the MCI_STATUS call
3052// fails or not
226ec5a7 3053//---------------------------------------------------------------------------
ff4aedc5 3054wxMediaState wxMCIMediaBackend::GetState()
3f9a3bf9
RN
3055{
3056 MCI_STATUS_PARMS statusParms;
3057 statusParms.dwItem = MCI_STATUS_MODE;
ff4aedc5 3058
3f9a3bf9
RN
3059 mciSendCommand(m_hDev, MCI_STATUS, MCI_STATUS_ITEM,
3060 (DWORD)(LPVOID)&statusParms);
3061
b1ec2381 3062 if (statusParms.dwReturn == MCI_MODE_PAUSE)
3f9a3bf9 3063 return wxMEDIASTATE_PAUSED;
b1ec2381 3064 else if (statusParms.dwReturn == MCI_MODE_PLAY)
3f9a3bf9
RN
3065 return wxMEDIASTATE_PLAYING;
3066 else
3067 return wxMEDIASTATE_STOPPED;
3068}
3069
ff4aedc5
RN
3070//---------------------------------------------------------------------------
3071// wxMCIMediaBackend::SetPosition
3072//
3073// Here we set the position of the device in the stream.
226ec5a7 3074// Note that MCI actually stops the device after you seek it if the
ff4aedc5 3075// device is playing/paused, so we need to play the file after
226ec5a7
WS
3076// MCI seeks like normal APIs would
3077//---------------------------------------------------------------------------
ff4aedc5 3078bool wxMCIMediaBackend::SetPosition(wxLongLong where)
3f9a3bf9
RN
3079{
3080 MCI_SEEK_PARMS seekParms;
3081 seekParms.dwCallback = 0;
b1ec2381 3082
e70fda0e 3083#if wxUSE_LONGLONG_NATIVE && !wxUSE_LONGLONG_WX
226ec5a7 3084 seekParms.dwTo = (DWORD)where.GetValue();
b1ec2381
DS
3085#else // wxUSE_LONGLONG_WX
3086 // no way to return it in one piece
3087 wxASSERT( where.GetHi() == 0 );
e70fda0e 3088 seekParms.dwTo = (DWORD)where.GetLo();
b1ec2381 3089#endif
3f9a3bf9 3090
b1ec2381 3091 // device was playing?
3f9a3bf9
RN
3092 bool bReplay = GetState() == wxMEDIASTATE_PLAYING;
3093
b1ec2381 3094 if ( mciSendCommand(m_hDev, MCI_SEEK, MCI_TO,
ff4aedc5 3095 (DWORD)(LPVOID)&seekParms) != 0)
b1ec2381 3096 {
3f9a3bf9 3097 return false;
b1ec2381 3098 }
3f9a3bf9 3099
b1ec2381 3100 // If the device was playing, resume it
3f9a3bf9
RN
3101 if (bReplay)
3102 return Play();
3103 else
3104 return true;
3105}
3106
ff4aedc5
RN
3107//---------------------------------------------------------------------------
3108// wxMCIMediaBackend::GetPosition
3109//
3110// Gets the position of the device in the stream using the current
3111// time format... nothing special here...
226ec5a7 3112//---------------------------------------------------------------------------
ff4aedc5 3113wxLongLong wxMCIMediaBackend::GetPosition()
3f9a3bf9
RN
3114{
3115 MCI_STATUS_PARMS statusParms;
72259e00 3116 statusParms.dwItem = MCI_STATUS_POSITION;
ff4aedc5 3117
72259e00 3118 if (mciSendCommand(m_hDev, MCI_STATUS, MCI_STATUS_ITEM,
ff4aedc5 3119 (DWORD)(LPSTR)&statusParms) != 0)
a7d5151d 3120 {
3f9a3bf9 3121 return 0;
a7d5151d 3122 }
3f9a3bf9
RN
3123
3124 return statusParms.dwReturn;
3125}
3126
6f8c67e7
JS
3127//---------------------------------------------------------------------------
3128// wxMCIMediaBackend::GetVolume
3129//
3130// Gets the volume of the current media via the MCI_DGV_STATUS_VOLUME
3131// message. Value ranges from 0 (minimum) to 1000 (maximum volume).
3132//---------------------------------------------------------------------------
3133double wxMCIMediaBackend::GetVolume()
3134{
3135 MCI_STATUS_PARMS statusParms;
600ffb32 3136 statusParms.dwCallback = 0;
b1ec2381 3137 statusParms.dwItem = 0x4019; // MCI_DGV_STATUS_VOLUME
6f8c67e7
JS
3138
3139 if (mciSendCommand(m_hDev, MCI_STATUS, MCI_STATUS_ITEM,
3140 (DWORD)(LPSTR)&statusParms) != 0)
a7d5151d 3141 {
6f8c67e7 3142 return 0;
a7d5151d 3143 }
6f8c67e7
JS
3144
3145 return ((double)statusParms.dwReturn) / 1000.0;
3146}
3147
3148//---------------------------------------------------------------------------
3149// wxMCIMediaBackend::SetVolume
3150//
3151// Sets the volume of the current media via the MCI_DGV_SETAUDIO_VOLUME
3152// message. Value ranges from 0 (minimum) to 1000 (maximum volume).
3153//---------------------------------------------------------------------------
3154bool wxMCIMediaBackend::SetVolume(double dVolume)
3155{
3156 MCI_DGV_SETAUDIO_PARMS audioParms;
600ffb32 3157 audioParms.dwCallback = 0;
b1ec2381 3158 audioParms.dwItem = 0x4002; // MCI_DGV_SETAUDIO_VOLUME
6f8c67e7
JS
3159 audioParms.dwValue = (DWORD) (dVolume * 1000.0);
3160 audioParms.dwOver = 0;
3161 audioParms.lpstrAlgorithm = NULL;
3162 audioParms.lpstrQuality = NULL;
3163
b1ec2381
DS
3164 if (mciSendCommand(m_hDev, 0x0873, // MCI_SETAUDIO
3165 // MCI_DGV_SETAUDIO + (_ITEM | _VALUE)
c5191fbd 3166 0x00800000L | 0x01000000L,
6f8c67e7 3167 (DWORD)(LPSTR)&audioParms) != 0)
a7d5151d 3168 {
6f8c67e7 3169 return false;
a7d5151d 3170 }
b1ec2381 3171
6f8c67e7
JS
3172 return true;
3173}
3174
ff4aedc5
RN
3175//---------------------------------------------------------------------------
3176// wxMCIMediaBackend::GetDuration
3177//
3178// Gets the duration of the stream... nothing special
226ec5a7 3179//---------------------------------------------------------------------------
ff4aedc5 3180wxLongLong wxMCIMediaBackend::GetDuration()
3f9a3bf9
RN
3181{
3182 MCI_STATUS_PARMS statusParms;
72259e00 3183 statusParms.dwItem = MCI_STATUS_LENGTH;
ff4aedc5 3184
72259e00 3185 if (mciSendCommand(m_hDev, MCI_STATUS, MCI_STATUS_ITEM,
ff4aedc5 3186 (DWORD)(LPSTR)&statusParms) != 0)
a7d5151d 3187 {
3f9a3bf9 3188 return 0;
a7d5151d 3189 }
3f9a3bf9
RN
3190
3191 return statusParms.dwReturn;
3192}
3193
ff4aedc5
RN
3194//---------------------------------------------------------------------------
3195// wxMCIMediaBackend::Move
3196//
3197// Moves the window to a location
226ec5a7 3198//---------------------------------------------------------------------------
b1ec2381 3199void wxMCIMediaBackend::Move(int WXUNUSED(x), int WXUNUSED(y), int w, int h)
3f9a3bf9 3200{
ff4aedc5
RN
3201 if (m_hNotifyWnd && m_bVideo)
3202 {
b1ec2381 3203 MCI_DGV_RECT_PARMS putParms; // ifdefed MCI_DGV_PUT_PARMS
b11eba7e 3204 memset(&putParms, 0, sizeof(MCI_DGV_RECT_PARMS));
ff4aedc5 3205 putParms.rc.bottom = h;
b11eba7e 3206 putParms.rc.right = w;
7c4a4505 3207
b1ec2381
DS
3208 // wxStackWalker will crash and burn here on assert
3209 // and MCI doesn't like 0 and 0 for some reason (out of range)
3210 // so just don't it in that case
3211 if (w || h)
b11eba7e 3212 {
7c4a4505 3213 wxMCIVERIFY( mciSendCommand(m_hDev, MCI_PUT,
b1ec2381 3214 0x00040000L, // MCI_DGV_PUT_DESTINATION
ff4aedc5 3215 (DWORD)(LPSTR)&putParms) );
7c4a4505 3216 }
ff4aedc5 3217 }
3f9a3bf9
RN
3218}
3219
ff4aedc5
RN
3220//---------------------------------------------------------------------------
3221// wxMCIMediaBackend::GetVideoSize
3222//
3223// Gets the original size of the movie for sizers
226ec5a7 3224//---------------------------------------------------------------------------
ff4aedc5 3225wxSize wxMCIMediaBackend::GetVideoSize() const
3f9a3bf9 3226{
b1ec2381 3227 if (m_bVideo)
3f9a3bf9 3228 {
b1ec2381 3229 MCI_DGV_RECT_PARMS whereParms; // ifdefed MCI_DGV_WHERE_PARMS
3f9a3bf9 3230
226ec5a7 3231 wxMCIVERIFY( mciSendCommand(m_hDev, MCI_WHERE,
b1ec2381 3232 0x00020000L, // MCI_DGV_WHERE_SOURCE
ff4aedc5 3233 (DWORD)(LPSTR)&whereParms) );
226ec5a7 3234
ff4aedc5 3235 return wxSize(whereParms.rc.right, whereParms.rc.bottom);
3f9a3bf9 3236 }
9d7d3b1f 3237
b1ec2381 3238 return wxSize(0, 0);
3f9a3bf9
RN
3239}
3240
ff4aedc5
RN
3241//---------------------------------------------------------------------------
3242// wxMCIMediaBackend::GetPlaybackRate
3243//
3244// TODO
226ec5a7 3245//---------------------------------------------------------------------------
ff4aedc5 3246double wxMCIMediaBackend::GetPlaybackRate()
3f9a3bf9
RN
3247{
3248 return 1.0;
3249}
3250
ff4aedc5
RN
3251//---------------------------------------------------------------------------
3252// wxMCIMediaBackend::SetPlaybackRate
3253//
3254// TODO
226ec5a7 3255//---------------------------------------------------------------------------
ff4aedc5 3256bool wxMCIMediaBackend::SetPlaybackRate(double WXUNUSED(dRate))
3f9a3bf9 3257{
b1ec2381 3258#if 0
ff4aedc5
RN
3259 MCI_WAVE_SET_SAMPLESPERSEC
3260 MCI_DGV_SET_PARMS setParms;
3261 setParms.dwSpeed = (DWORD) (dRate * 1000.0);
3262
226ec5a7 3263 return (mciSendCommand(m_hDev, MCI_SET,
b1ec2381 3264 0x00020000L, // MCI_DGV_SET_SPEED
ff4aedc5 3265 (DWORD)(LPSTR)&setParms) == 0);
b1ec2381
DS
3266#endif
3267
3f9a3bf9
RN
3268 return false;
3269}
3270
ff4aedc5
RN
3271//---------------------------------------------------------------------------
3272// [static] wxMCIMediaBackend::MSWWindowProc
3273//
226ec5a7 3274// Here we process a message when MCI reaches the stopping point
ff4aedc5 3275// in the stream
226ec5a7
WS
3276//---------------------------------------------------------------------------
3277LRESULT CALLBACK wxMCIMediaBackend::NotifyWndProc(HWND hWnd, UINT nMsg,
3278 WPARAM wParam,
ff4aedc5
RN
3279 LPARAM lParam)
3280{
c5191fbd
VZ
3281 wxMCIMediaBackend* backend =
3282 (wxMCIMediaBackend*)wxGetWindowUserData(hWnd);
ff4aedc5
RN
3283
3284 return backend->OnNotifyWndProc(hWnd, nMsg, wParam, lParam);
3285}
3286
226ec5a7
WS
3287LRESULT CALLBACK wxMCIMediaBackend::OnNotifyWndProc(HWND hWnd, UINT nMsg,
3288 WPARAM wParam,
ff4aedc5 3289 LPARAM lParam)
3f9a3bf9 3290{
b1ec2381 3291 if (nMsg == MM_MCINOTIFY)
5987f174 3292 {
ff4aedc5 3293 wxASSERT(lParam == (LPARAM) m_hDev);
b1ec2381 3294 if (wParam == MCI_NOTIFY_SUCCESSFUL && lParam == (LPARAM)m_hDev)
5987f174 3295 {
7e41b689 3296 if ( SendStopEvent() )
ff4aedc5 3297 {
b1ec2381 3298 wxMCIVERIFY( mciSendCommand(m_hDev, MCI_SEEK, MCI_SEEK_TO_START, 0) );
7e41b689 3299 QueueFinishEvent();
ff4aedc5 3300 }
5987f174 3301 }
5987f174 3302 }
ff4aedc5 3303 return DefWindowProc(hWnd, nMsg, wParam, lParam);
3f9a3bf9 3304}
b1ec2381
DS
3305#endif // __WXWINCE__
3306
9d7d3b1f 3307//---------------------------------------------------------------------------
ff4aedc5 3308// wxQTMediaBackend
226ec5a7 3309//
b1ec2381 3310// TODO: Use a less kludgy way to pause/get state/set state
c5191fbd 3311// FIXME: Greg Hazel reports that sometimes files that cannot be played
b1ec2381 3312// with this backend are treated as playable anyway - not verified though.
9d7d3b1f 3313//---------------------------------------------------------------------------
ff4aedc5 3314
412e0d47 3315IMPLEMENT_DYNAMIC_CLASS(wxQTMediaBackend, wxMediaBackend)
ff4aedc5 3316
b1ec2381
DS
3317// Time between timer calls - this is the Apple recommendation to the TCL
3318// team I believe
c5191fbd 3319#define MOVIE_DELAY 20
ff4aedc5 3320
c5191fbd 3321//---------------------------------------------------------------------------
9d7d3b1f 3322// wxQTLoadTimer
c5191fbd
VZ
3323//
3324// QT, esp. QT for Windows is very picky about how you go about
3325// async loading. If you were to go through a Windows message loop
3326// or a MoviesTask or both and then check the movie load state
3327// it would still return 1000 (loading)... even (pre)prerolling doesn't
3328// help. However, making a load timer like this works
3329//---------------------------------------------------------------------------
3330class wxQTLoadTimer : public wxTimer
ff4aedc5
RN
3331{
3332public:
c5191fbd
VZ
3333 wxQTLoadTimer(Movie movie, wxQTMediaBackend* parent, wxQuickTimeLibrary* pLib) :
3334 m_movie(movie), m_parent(parent), m_pLib(pLib) {}
ff4aedc5 3335
c5191fbd 3336 void Notify()
ff4aedc5 3337 {
c5191fbd 3338 m_pLib->MoviesTask(m_movie, 0);
9d7d3b1f 3339 // kMovieLoadStatePlayable
b1ec2381
DS
3340 if (m_pLib->GetMovieLoadState(m_movie) >= 10000)
3341 {
c5191fbd
VZ
3342 m_parent->FinishLoad();
3343 delete this;
b1ec2381 3344 }
ff4aedc5
RN
3345 }
3346
c5191fbd
VZ
3347protected:
3348 Movie m_movie; //Our movie instance
3349 wxQTMediaBackend* m_parent; //Backend pointer
3350 wxQuickTimeLibrary* m_pLib; //Interfaces
3351};
3352
3353
3354// --------------------------------------------------------------------------
9d7d3b1f 3355// wxQTPlayTimer - Handle Asyncronous Playing
c5191fbd
VZ
3356//
3357// 1) Checks to see if the movie is done, and if not continues
3358// streaming the movie
3359// 2) Sends the wxEVT_MEDIA_STOP event if we have reached the end of
3360// the movie.
3361// --------------------------------------------------------------------------
3362class wxQTPlayTimer : public wxTimer
3363{
3364public:
3365 wxQTPlayTimer(Movie movie, wxQTMediaBackend* parent,
3366 wxQuickTimeLibrary* pLib) :
3367 m_movie(movie), m_parent(parent), m_pLib(pLib) {}
ff4aedc5 3368
ff4aedc5
RN
3369 void Notify()
3370 {
c5191fbd
VZ
3371 //
3372 // OK, a little explaining - basically originally
3373 // we only called MoviesTask if the movie was actually
3374 // playing (not paused or stopped)... this was before
3375 // we realized MoviesTask actually handles repainting
3376 // of the current frame - so if you were to resize
3377 // or something it would previously not redraw that
3378 // portion of the movie.
3379 //
3380 // So now we call MoviesTask always so that it repaints
3381 // correctly.
3382 //
3383 m_pLib->MoviesTask(m_movie, 0);
3384
3385 //
b1ec2381
DS
3386 // Handle the stop event - if the movie has reached
3387 // the end, notify our handler
c5191fbd
VZ
3388 //
3389 // m_bPlaying == !(Stopped | Paused)
3390 //
3391 if (m_parent->m_bPlaying)
ff4aedc5 3392 {
b1ec2381 3393 if (m_pLib->IsMovieDone(m_movie))
ff4aedc5 3394 {
7e41b689 3395 if ( m_parent->SendStopEvent() )
ff4aedc5 3396 {
ff4aedc5 3397 m_parent->Stop();
d7a9c895 3398 wxASSERT(m_pLib->GetMoviesError() == noErr);
ff4aedc5 3399
7e41b689 3400 m_parent->QueueFinishEvent();
ff4aedc5
RN
3401 }
3402 }
3403 }
3404 }
3405
3406protected:
b1ec2381 3407 Movie m_movie; // Our movie instance
ff4aedc5 3408 wxQTMediaBackend* m_parent; //Backend pointer
d7a9c895 3409 wxQuickTimeLibrary* m_pLib; //Interfaces
ff4aedc5
RN
3410};
3411
c5191fbd
VZ
3412
3413//---------------------------------------------------------------------------
3414// wxQTMediaBackend::QTWndProc
3415//
3416// Forwards events to the Movie Controller so that it can
3417// redraw itself/process messages etc..
3418//---------------------------------------------------------------------------
3419LRESULT CALLBACK wxQTMediaBackend::QTWndProc(HWND hWnd, UINT nMsg,
3420 WPARAM wParam, LPARAM lParam)
3421{
3422 wxQTMediaBackend* pThis = (wxQTMediaBackend*)wxGetWindowUserData(hWnd);
3423
3424 MSG msg;
3425 msg.hwnd = hWnd;
3426 msg.message = nMsg;
3427 msg.wParam = wParam;
3428 msg.lParam = lParam;
3429 msg.time = 0;
3430 msg.pt.x = 0;
3431 msg.pt.y = 0;
3432 EventRecord theEvent;
3433 pThis->m_lib.NativeEventToMacEvent(&msg, &theEvent);
3434 pThis->m_lib.MCIsPlayerEvent(pThis->m_pMC, &theEvent);
b1ec2381 3435
c5191fbd
VZ
3436 return pThis->m_ctrl->MSWWindowProc(nMsg, wParam, lParam);
3437}
3438
ff4aedc5
RN
3439//---------------------------------------------------------------------------
3440// wxQTMediaBackend Destructor
3441//
3442// Sets m_timer to NULL signifying we havn't loaded anything yet
3443//---------------------------------------------------------------------------
c5191fbd
VZ
3444wxQTMediaBackend::wxQTMediaBackend()
3445: m_movie(NULL), m_bPlaying(false), m_timer(NULL), m_pMC(NULL)
ff4aedc5
RN
3446{
3447}
3448
3449//---------------------------------------------------------------------------
3450// wxQTMediaBackend Destructor
3451//
3452// 1) Cleans up the QuickTime movie instance
3453// 2) Decrements the QuickTime reference counter - if this reaches
3454// 0, QuickTime shuts down
3455// 3) Decrements the QuickTime Windows Media Layer reference counter -
3456// if this reaches 0, QuickTime shuts down the Windows Media Layer
3457//---------------------------------------------------------------------------
3458wxQTMediaBackend::~wxQTMediaBackend()
3459{
b1ec2381 3460 if (m_movie)
ff4aedc5
RN
3461 Cleanup();
3462
b1ec2381 3463 if (m_lib.IsOk())
d7a9c895 3464 {
b1ec2381 3465 if (m_pMC)
c5191fbd
VZ
3466 {
3467 m_lib.DisposeMovieController(m_pMC);
b1ec2381 3468 // m_pMC = NULL;
c5191fbd
VZ
3469 }
3470
6ab9bf57
VZ
3471 // destroy wxQTMediaEvtHandler we pushed on it
3472 m_ctrl->PopEventHandler(true);
3473
c5191fbd
VZ
3474 m_lib.DestroyPortAssociation(
3475 (CGrafPtr)m_lib.GetNativeWindowPort(m_ctrl->GetHWND()));
3476
3103e8a9 3477 //Note that ExitMovies() is not necessary, but
d7a9c895
RN
3478 //the docs are fuzzy on whether or not TerminateQTML is
3479 m_lib.ExitMovies();
3480 m_lib.TerminateQTML();
3481 }
ff4aedc5
RN
3482}
3483
3484//---------------------------------------------------------------------------
3485// wxQTMediaBackend::CreateControl
3486//
3487// 1) Intializes QuickTime
3488// 2) Creates the control window
3489//---------------------------------------------------------------------------
226ec5a7 3490bool wxQTMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent,
ff4aedc5 3491 wxWindowID id,
226ec5a7 3492 const wxPoint& pos,
ff4aedc5 3493 const wxSize& size,
226ec5a7 3494 long style,
ff4aedc5
RN
3495 const wxValidator& validator,
3496 const wxString& name)
3497{
b1ec2381 3498 if (!m_lib.Initialize())
d7a9c895 3499 return false;
b11eba7e 3500
600ffb32
WS
3501 int nError = m_lib.InitializeQTML(0);
3502 if (nError != noErr) //-2093 no dll
ff4aedc5 3503 {
b1ec2381 3504 wxFAIL_MSG(wxString::Format(wxT("Couldn't Initialize Quicktime-%i"), nError));
ff4aedc5
RN
3505 return false;
3506 }
b1ec2381 3507
d7a9c895 3508 m_lib.EnterMovies();
ff4aedc5 3509
ff4aedc5
RN
3510 // Create window
3511 // By default wxWindow(s) is created with a border -
3512 // so we need to get rid of those
3513 //
3514 // Since we don't have a child window like most other
3515 // backends, we don't need wxCLIP_CHILDREN
ff4aedc5 3516 if ( !ctrl->wxControl::Create(parent, id, pos, size,
11085e4b 3517 (style & ~wxBORDER_MASK) | wxBORDER_NONE,
ff4aedc5 3518 validator, name) )
b1ec2381 3519 {
ff4aedc5 3520 return false;
b1ec2381 3521 }
c5191fbd 3522
bf354396 3523 m_ctrl = wxStaticCast(ctrl, wxMediaCtrl);
c5191fbd
VZ
3524
3525 // Create a port association for our window so we
3526 // can use it as a WindowRef
3527 m_lib.CreatePortAssociation(m_ctrl->GetHWND(), NULL, 0L);
3528
b1ec2381
DS
3529 // Part of a suggestion from Greg Hazel
3530 // to repaint movie when idle
7e41b689 3531 m_ctrl->PushEventHandler(new wxQTMediaEvtHandler(this, m_ctrl->GetHWND()));
c5191fbd
VZ
3532
3533 // done
ff4aedc5
RN
3534 return true;
3535}
3536
3537//---------------------------------------------------------------------------
3538// wxQTMediaBackend::Load (file version)
3539//
3540// 1) Get an FSSpec from the Windows path name
3541// 2) Open the movie
3542// 3) Obtain the movie instance from the movie resource
c5191fbd
VZ
3543// 4) Close the movie resource
3544// 5) Finish loading
ff4aedc5
RN
3545//---------------------------------------------------------------------------
3546bool wxQTMediaBackend::Load(const wxString& fileName)
3547{
b1ec2381 3548 if (m_movie)
ff4aedc5 3549 Cleanup();
9d7d3b1f 3550
a7d5151d
DS
3551 bool result = true;
3552 OSErr err = noErr;
920a7c15 3553 short movieResFile = 0; //= 0 because of annoying VC6 warning
ff4aedc5
RN
3554 FSSpec sfFile;
3555
a7d5151d 3556 err = m_lib.NativePathNameToFSSpec(
b1ec2381 3557 (char*) (const char*) fileName.mb_str(),
a7d5151d
DS
3558 &sfFile, 0);
3559 result = (err == noErr);
3560
3561 if (result)
b1ec2381 3562 {
a7d5151d
DS
3563 err = m_lib.OpenMovieFile(&sfFile, &movieResFile, fsRdPerm);
3564 result = (err == noErr);
b1ec2381 3565 }
226ec5a7 3566
a7d5151d
DS
3567 if (result)
3568 {
3569 short movieResID = 0;
3570 Str255 movieName;
ff4aedc5 3571
a7d5151d 3572 err = m_lib.NewMovieFromFile(
600ffb32
WS
3573 &m_movie,
3574 movieResFile,
3575 &movieResID,
3576 movieName,
3577 newMovieActive,
a7d5151d
DS
3578 NULL ); // wasChanged
3579 result = (err == noErr && m_lib.GetMoviesStickyError() == noErr);
3580
3581 // check m_lib.GetMoviesStickyError() because it may not find the
3582 // proper codec and play black video and other strange effects,
3583 // not to mention mess up the dynamic backend loading scheme
3584 // of wxMediaCtrl - so it just does what the QuickTime player does
3585 if (result)
3586 {
3587 m_lib.CloseMovieFile(movieResFile);
3588 FinishLoad();
3589 }
c5191fbd 3590 }
a7d5151d
DS
3591
3592 return result;
c5191fbd 3593}
ff4aedc5 3594
c5191fbd
VZ
3595//---------------------------------------------------------------------------
3596// wxQTMediaBackend::PPRMProc (static)
3597//
3598// Called when done PrePrerolling the movie.
3599// Note that in 99% of the cases this does nothing...
3600// Anyway we set up the loading timer here to tell us when the movie is done
3601//---------------------------------------------------------------------------
3832f946
WS
3602void wxQTMediaBackend::PPRMProc (Movie theMovie,
3603 OSErr WXUNUSED_UNLESS_DEBUG(theErr),
3604 void* theRefCon)
c5191fbd
VZ
3605{
3606 wxASSERT( theMovie );
3607 wxASSERT( theRefCon );
3608 wxASSERT( theErr == noErr );
3609
3610 wxQTMediaBackend* pBE = (wxQTMediaBackend*) theRefCon;
3611
3612 long lTime = pBE->m_lib.GetMovieTime(theMovie,NULL);
3613 Fixed rate = pBE->m_lib.GetMoviePreferredRate(theMovie);
a7d5151d 3614 pBE->m_lib.PrerollMovie(theMovie, lTime, rate);
c5191fbd
VZ
3615 pBE->m_timer = new wxQTLoadTimer(pBE->m_movie, pBE, &pBE->m_lib);
3616 pBE->m_timer->Start(MOVIE_DELAY);
ff4aedc5
RN
3617}
3618
3619//---------------------------------------------------------------------------
c5191fbd 3620// wxQTMediaBackend::Load (URL Version)
ff4aedc5 3621//
c5191fbd
VZ
3622// 1) Build an escaped URI from location
3623// 2) Create a handle to store the URI string
3624// 3) Put the URI string inside the handle
3625// 4) Make a QuickTime URL data ref from the handle with the URI in it
3626// 5) Clean up the URI string handle
3627// 6) Do some prerolling
3628// 7) Finish Loading
ff4aedc5
RN
3629//---------------------------------------------------------------------------
3630bool wxQTMediaBackend::Load(const wxURI& location)
3631{
b1ec2381 3632 if (m_movie)
ff4aedc5
RN
3633 Cleanup();
3634
3635 wxString theURI = location.BuildURI();
3636
d7a9c895 3637 Handle theHandle = m_lib.NewHandleClear(theURI.length() + 1);
ff4aedc5
RN
3638 wxASSERT(theHandle);
3639
d7a9c895 3640 m_lib.BlockMove(theURI.mb_str(), *theHandle, theURI.length() + 1);
ff4aedc5 3641
b1ec2381 3642 // create the movie from the handle that refers to the URI
c5191fbd
VZ
3643 OSErr err = m_lib.NewMovieFromDataRef(&m_movie, newMovieActive |
3644 newMovieAsyncOK
9d7d3b1f 3645 /* | newMovieIdleImportOK */,
226ec5a7 3646 NULL, theHandle,
19b6f122 3647 URLDataHandlerSubType);
ff4aedc5 3648
d7a9c895 3649 m_lib.DisposeHandle(theHandle);
ff4aedc5 3650
c5191fbd
VZ
3651 if (err == noErr)
3652 {
3653 long timeNow;
b1ec2381 3654 Fixed playRate;
ff4aedc5 3655
c5191fbd
VZ
3656 timeNow = m_lib.GetMovieTime(m_movie, NULL);
3657 wxASSERT(m_lib.GetMoviesError() == noErr);
ff4aedc5 3658
c5191fbd
VZ
3659 playRate = m_lib.GetMoviePreferredRate(m_movie);
3660 wxASSERT(m_lib.GetMoviesError() == noErr);
3661
a7d5151d
DS
3662 // Note that the callback here is optional,
3663 // but without it PrePrerollMovie can be buggy
3664 // (see Apple ml). Also, some may wonder
3665 // why we need this at all - this is because
3666 // Apple docs say QuickTime streamed movies
3667 // require it if you don't use a Movie Controller,
3668 // which we don't by default.
c5191fbd
VZ
3669 //
3670 m_lib.PrePrerollMovie(m_movie, timeNow, playRate,
3671 (WXFARPROC)wxQTMediaBackend::PPRMProc,
3672 (void*)this);
a7d5151d 3673
c5191fbd
VZ
3674 return true;
3675 }
3676 else
3677 return false;
ff4aedc5
RN
3678}
3679
3680//---------------------------------------------------------------------------
c5191fbd 3681// wxQTMediaBackend::FinishLoad
ff4aedc5 3682//
c5191fbd
VZ
3683// 1) Create the movie timer
3684// 2) Get real size of movie for GetBestSize/sizers
3685// 3) Set the movie time scale to something usable so that seeking
3686// etc. will work correctly
3687// 4) Set our Movie Controller to display the movie if it exists,
3688// otherwise set the bounds of the Movie
3689// 5) Refresh parent window
ff4aedc5
RN
3690//---------------------------------------------------------------------------
3691void wxQTMediaBackend::FinishLoad()
3692{
c5191fbd
VZ
3693 // Create the playing/streaming timer
3694 m_timer = new wxQTPlayTimer(m_movie, (wxQTMediaBackend*) this, &m_lib);
ff4aedc5 3695 wxASSERT(m_timer);
a7d5151d 3696
c5191fbd 3697 m_timer->Start(MOVIE_DELAY, wxTIMER_CONTINUOUS);
ff4aedc5 3698
b1ec2381 3699 // get the real size of the movie
ff4aedc5 3700 Rect outRect;
a7d5151d 3701 memset(&outRect, 0, sizeof(Rect)); // suppress annoying VC6 warning
d7a9c895
RN
3702 m_lib.GetMovieNaturalBoundsRect (m_movie, &outRect);
3703 wxASSERT(m_lib.GetMoviesError() == noErr);
ff4aedc5
RN
3704
3705 m_bestSize.x = outRect.right - outRect.left;
3706 m_bestSize.y = outRect.bottom - outRect.top;
226ec5a7 3707
c5191fbd 3708 // Handle the movie GWorld
b1ec2381 3709 if (m_pMC)
c5191fbd
VZ
3710 {
3711 Point thePoint;
3712 thePoint.h = thePoint.v = 0;
3713 m_lib.MCSetMovie(m_pMC, m_movie,
3714 m_lib.GetNativeWindowPort(m_ctrl->GetHandle()),
3715 thePoint);
3716 m_lib.MCSetVisible(m_pMC, true);
3717 m_bestSize.y += 16;
3718 }
3719 else
ff4aedc5 3720 {
d7a9c895
RN
3721 m_lib.SetMovieGWorld(m_movie,
3722 (CGrafPtr) m_lib.GetNativeWindowPort(m_ctrl->GetHWND()),
3723 NULL);
ff4aedc5
RN
3724 }
3725
c5191fbd 3726 // Set the movie to millisecond precision
d7a9c895
RN
3727 m_lib.SetMovieTimeScale(m_movie, 1000);
3728 wxASSERT(m_lib.GetMoviesError() == noErr);
ff4aedc5 3729
7e41b689 3730 NotifyMovieLoaded();
ff4aedc5
RN
3731}
3732
3733//---------------------------------------------------------------------------
c5191fbd 3734// wxQTMediaBackend::Play
ff4aedc5 3735//
c5191fbd
VZ
3736// 1) Start the QT movie
3737// 2) Start the movie loading timer
3738//
3739// NOTE: This will still return success even when
3740// the movie is still loading, and as mentioned in wxQTLoadTimer
3741// I don't know of a way to force this to be sync - so if its
3742// still loading the function will return true but the movie will
3743// still be in the stopped state
ff4aedc5
RN
3744//---------------------------------------------------------------------------
3745bool wxQTMediaBackend::Play()
3746{
d7a9c895 3747 m_lib.StartMovie(m_movie);
c5191fbd 3748 m_bPlaying = true;
b1ec2381 3749
d7a9c895 3750 return m_lib.GetMoviesError() == noErr;
ff4aedc5
RN
3751}
3752
3753//---------------------------------------------------------------------------
c5191fbd 3754// wxQTMediaBackend::Pause
ff4aedc5 3755//
c5191fbd
VZ
3756// 1) Stop the movie
3757// 2) Stop the movie timer
ff4aedc5
RN
3758//---------------------------------------------------------------------------
3759bool wxQTMediaBackend::Pause()
3760{
c5191fbd 3761 m_bPlaying = false;
d7a9c895 3762 m_lib.StopMovie(m_movie);
b1ec2381 3763
d7a9c895 3764 return m_lib.GetMoviesError() == noErr;
ff4aedc5
RN
3765}
3766
3767//---------------------------------------------------------------------------
c5191fbd 3768// wxQTMediaBackend::Stop
ff4aedc5 3769//
c5191fbd
VZ
3770// 1) Stop the movie
3771// 2) Stop the movie timer
3772// 3) Seek to the beginning of the movie
ff4aedc5
RN
3773//---------------------------------------------------------------------------
3774bool wxQTMediaBackend::Stop()
3775{
c5191fbd 3776 m_bPlaying = false;
ff4aedc5 3777
d7a9c895 3778 m_lib.StopMovie(m_movie);
b1ec2381
DS
3779 if (m_lib.GetMoviesError() == noErr)
3780 m_lib.GoToBeginningOfMovie(m_movie);
226ec5a7 3781
d7a9c895 3782 return m_lib.GetMoviesError() == noErr;
ff4aedc5
RN
3783}
3784
3785//---------------------------------------------------------------------------
c5191fbd 3786// wxQTMediaBackend::GetPlaybackRate
ff4aedc5 3787//
a7d5151d 3788// Get the movie playback rate from ::GetMovieRate
ff4aedc5
RN
3789//---------------------------------------------------------------------------
3790double wxQTMediaBackend::GetPlaybackRate()
3791{
d7a9c895 3792 return ( ((double)m_lib.GetMovieRate(m_movie)) / 0x10000);
ff4aedc5
RN
3793}
3794
3795//---------------------------------------------------------------------------
c5191fbd 3796// wxQTMediaBackend::SetPlaybackRate
ff4aedc5 3797//
a7d5151d 3798// Convert dRate to Fixed and Set the movie rate through SetMovieRate
ff4aedc5
RN
3799//---------------------------------------------------------------------------
3800bool wxQTMediaBackend::SetPlaybackRate(double dRate)
3801{
d7a9c895 3802 m_lib.SetMovieRate(m_movie, (Fixed) (dRate * 0x10000));
b1ec2381 3803
d7a9c895 3804 return m_lib.GetMoviesError() == noErr;
ff4aedc5
RN
3805}
3806
3807//---------------------------------------------------------------------------
c5191fbd 3808// wxQTMediaBackend::SetPosition
ff4aedc5 3809//
c5191fbd
VZ
3810// 1) Create a time record struct (TimeRecord) with appropriate values
3811// 2) Pass struct to SetMovieTime
ff4aedc5
RN
3812//---------------------------------------------------------------------------
3813bool wxQTMediaBackend::SetPosition(wxLongLong where)
3814{
a7d5151d
DS
3815 // NB: For some reason SetMovieTime does not work
3816 // correctly with the Quicktime Windows SDK (6)
3817 // From Muskelkatermann at the wxForum
3818 // http://www.solidsteel.nl/users/wxwidgets/viewtopic.php?t=2957
3819 // RN - note that I have not verified this but there
3820 // is no harm in calling SetMovieTimeValue instead
c5191fbd 3821#if 0
ff4aedc5
RN
3822 TimeRecord theTimeRecord;
3823 memset(&theTimeRecord, 0, sizeof(TimeRecord));
600ffb32 3824 theTimeRecord.value.lo = where.GetLo();
d7a9c895
RN
3825 theTimeRecord.scale = m_lib.GetMovieTimeScale(m_movie);
3826 theTimeRecord.base = m_lib.GetMovieTimeBase(m_movie);
3827 m_lib.SetMovieTime(m_movie, &theTimeRecord);
c5191fbd
VZ
3828#else
3829 m_lib.SetMovieTimeValue(m_movie, where.GetLo());
3830#endif
ff4aedc5 3831
b1ec2381 3832 return (m_lib.GetMoviesError() == noErr);
ff4aedc5
RN
3833}
3834
3835//---------------------------------------------------------------------------
e163773d 3836// wxQTMediaBackend::GetPosition
ff4aedc5 3837//
e163773d 3838// 1) Calls GetMovieTime to get the position we are in in the movie
8b5d5223 3839// in milliseconds (we called
ff4aedc5
RN
3840//---------------------------------------------------------------------------
3841wxLongLong wxQTMediaBackend::GetPosition()
3842{
d7a9c895 3843 return m_lib.GetMovieTime(m_movie, NULL);
ff4aedc5
RN
3844}
3845
6f8c67e7
JS
3846//---------------------------------------------------------------------------
3847// wxQTMediaBackend::GetVolume
3848//
3849// Gets the volume through GetMovieVolume - which returns a 16 bit short -
3850//
3851// +--------+--------+
3852// + (1) + (2) +
3853// +--------+--------+
3854//
3855// (1) first 8 bits are value before decimal
3856// (2) second 8 bits are value after decimal
3857//
3858// Volume ranges from -1.0 (gain but no sound), 0 (no sound and no gain) to
3859// 1 (full gain and sound)
3860//---------------------------------------------------------------------------
3861double wxQTMediaBackend::GetVolume()
3862{
3863 short sVolume = m_lib.GetMovieVolume(m_movie);
c5191fbd 3864 wxASSERT(m_lib.GetMoviesError() == noErr);
b11eba7e 3865
b1ec2381 3866 if (sVolume & (128 << 8)) //negative - no sound
6f8c67e7
JS
3867 return 0.0;
3868
b1ec2381 3869 return sVolume / 256.0;
6f8c67e7
JS
3870}
3871
3872//---------------------------------------------------------------------------
3873// wxQTMediaBackend::SetVolume
3874//
3875// Sets the volume through SetMovieVolume - which takes a 16 bit short -
3876//
3877// +--------+--------+
3878// + (1) + (2) +
3879// +--------+--------+
3880//
3881// (1) first 8 bits are value before decimal
3882// (2) second 8 bits are value after decimal
3883//
3884// Volume ranges from -1.0 (gain but no sound), 0 (no sound and no gain) to
3885// 1 (full gain and sound)
3886//---------------------------------------------------------------------------
3887bool wxQTMediaBackend::SetVolume(double dVolume)
3888{
c5191fbd
VZ
3889 m_lib.SetMovieVolume(m_movie, (short) (dVolume * 256));
3890 return m_lib.GetMoviesError() == noErr;
6f8c67e7
JS
3891}
3892
ff4aedc5 3893//---------------------------------------------------------------------------
c5191fbd 3894// wxQTMediaBackend::GetDuration
ff4aedc5 3895//
c5191fbd 3896// Calls GetMovieDuration
ff4aedc5
RN
3897//---------------------------------------------------------------------------
3898wxLongLong wxQTMediaBackend::GetDuration()
3899{
d7a9c895 3900 return m_lib.GetMovieDuration(m_movie);
ff4aedc5
RN
3901}
3902
3903//---------------------------------------------------------------------------
c5191fbd 3904// wxQTMediaBackend::GetState
ff4aedc5 3905//
a7d5151d
DS
3906// Determines the current state:
3907// if we are at the beginning, then we are stopped
ff4aedc5
RN
3908//---------------------------------------------------------------------------
3909wxMediaState wxQTMediaBackend::GetState()
3910{
b1ec2381 3911 if (m_bPlaying)
ff4aedc5 3912 return wxMEDIASTATE_PLAYING;
b1ec2381 3913 else if ( !m_movie || wxQTMediaBackend::GetPosition() == 0 )
c5191fbd 3914 return wxMEDIASTATE_STOPPED;
ff4aedc5
RN
3915 else
3916 return wxMEDIASTATE_PAUSED;
3917}
3918
3919//---------------------------------------------------------------------------
c5191fbd 3920// wxQTMediaBackend::Cleanup
ff4aedc5 3921//
c5191fbd
VZ
3922// Diposes of the movie timer, Disassociates the Movie Controller with
3923// movie and hides it if it exists, and stops and disposes
3924// of the QT movie
ff4aedc5
RN
3925//---------------------------------------------------------------------------
3926void wxQTMediaBackend::Cleanup()
3927{
c5191fbd
VZ
3928 m_bPlaying = false;
3929
b1ec2381 3930 if (m_timer)
c5191fbd 3931 {
b1ec2381
DS
3932 delete m_timer;
3933 m_timer = NULL;
c5191fbd 3934 }
ff4aedc5 3935
d7a9c895 3936 m_lib.StopMovie(m_movie);
c5191fbd 3937
b1ec2381 3938 if (m_pMC)
c5191fbd
VZ
3939 {
3940 Point thePoint;
3941 thePoint.h = thePoint.v = 0;
3942 m_lib.MCSetVisible(m_pMC, false);
3943 m_lib.MCSetMovie(m_pMC, NULL, NULL, thePoint);
3944 }
3945
d7a9c895 3946 m_lib.DisposeMovie(m_movie);
c5191fbd 3947 m_movie = NULL;
ff4aedc5
RN
3948}
3949
3950//---------------------------------------------------------------------------
c5191fbd 3951// wxQTMediaBackend::ShowPlayerControls
ff4aedc5 3952//
c5191fbd
VZ
3953// Creates a movie controller for the Movie if the user wants it
3954//---------------------------------------------------------------------------
3955bool wxQTMediaBackend::ShowPlayerControls(wxMediaCtrlPlayerControls flags)
3956{
b1ec2381 3957 if (m_pMC)
c5191fbd 3958 {
a7d5151d 3959 // restore old wndproc
c5191fbd
VZ
3960 wxSetWindowProc((HWND)m_ctrl->GetHWND(), wxWndProc);
3961 m_lib.DisposeMovieController(m_pMC);
3962 m_pMC = NULL;
a7d5151d
DS
3963
3964 // movie controller height
3965 m_bestSize.y -= 16;
c5191fbd
VZ
3966 }
3967
b1ec2381 3968 if (flags && m_movie)
c5191fbd
VZ
3969 {
3970 Rect rect;
3971 wxRect wxrect = m_ctrl->GetClientRect();
3972
a7d5151d 3973 // make room for controller
b1ec2381 3974 if (wxrect.width < 320)
c5191fbd
VZ
3975 wxrect.width = 320;
3976
3832f946
WS
3977 rect.top = (short)wxrect.y;
3978 rect.left = (short)wxrect.x;
3979 rect.right = (short)(rect.left + wxrect.width);
3980 rect.bottom = (short)(rect.top + wxrect.height);
c5191fbd 3981
b1ec2381 3982 if (!m_pMC)
c5191fbd
VZ
3983 {
3984 m_pMC = m_lib.NewMovieController(m_movie, &rect, mcTopLeftMovie |
3985 // mcScaleMovieToFit |
3986 // mcWithBadge |
3987 mcWithFrame);
09e28f7f 3988 m_lib.MCDoAction(m_pMC, 32, (void*)true); // mcActionSetKeysEnabled
c5191fbd
VZ
3989 m_lib.MCSetActionFilterWithRefCon(m_pMC,
3990 (WXFARPROC)wxQTMediaBackend::MCFilterProc, (void*)this);
a7d5151d
DS
3991 m_bestSize.y += 16; // movie controller height
3992
3993 // By default the movie controller uses its own colour palette
3994 // for the movie which can be bad on some files, so turn it off.
09e28f7f 3995 // Also turn off its frame / border for the movie
a7d5151d 3996 // Also take care of a couple of the interface flags here
c5191fbd
VZ
3997 long mcFlags = 0;
3998 m_lib.MCDoAction(m_pMC, 39/*mcActionGetFlags*/, (void*)&mcFlags);
a7d5151d 3999
9d7d3b1f 4000 mcFlags |=
a7d5151d
DS
4001 // (1<< 0) /*mcFlagSuppressMovieFrame*/ |
4002 (1<< 3) /*mcFlagsUseWindowPalette*/
4003 | ((flags & wxMEDIACTRLPLAYERCONTROLS_STEP)
b1ec2381 4004 ? 0 : (1<< 1) /*mcFlagSuppressStepButtons*/)
a7d5151d 4005 | ((flags & wxMEDIACTRLPLAYERCONTROLS_VOLUME)
b1ec2381 4006 ? 0 : (1<< 2) /*mcFlagSuppressSpeakerButton*/)
a7d5151d
DS
4007// | (1<< 4) /*mcFlagDontInvalidate*/ // if we take care of repainting ourselves
4008 ;
4009
c5191fbd
VZ
4010 m_lib.MCDoAction(m_pMC, 38/*mcActionSetFlags*/, (void*)mcFlags);
4011
a7d5151d
DS
4012 // intercept the wndproc of our control window
4013 wxSetWindowProc((HWND)m_ctrl->GetHWND(), wxQTMediaBackend::QTWndProc);
c5191fbd 4014
a7d5151d 4015 // set the user data of our window
c5191fbd
VZ
4016 wxSetWindowUserData((HWND)m_ctrl->GetHWND(), this);
4017 }
4018 }
4019
7e41b689 4020 NotifyMovieSizeChanged();
c5191fbd
VZ
4021
4022 return m_lib.GetMoviesError() == noErr;
4023}
4024
4025//---------------------------------------------------------------------------
4026// wxQTMediaBackend::MCFilterProc (static)
4027//
4028// Callback for when the movie controller recieves a message
4029//---------------------------------------------------------------------------
a7d5151d 4030Boolean wxQTMediaBackend::MCFilterProc(MovieController WXUNUSED(theController),
c5191fbd
VZ
4031 short action,
4032 void * WXUNUSED(params),
4033 LONG_PTR refCon)
4034{
09e28f7f
DS
4035// NB: potential optimisation
4036// if (action == 1)
4037// return 0;
4038
a7d5151d 4039 wxQTMediaBackend* pThis = (wxQTMediaBackend*)refCon;
c5191fbd 4040
a7d5151d
DS
4041 switch (action)
4042 {
09e28f7f
DS
4043 case 1:
4044 // don't process idle events
4045 break;
4046
a7d5151d
DS
4047 case 8:
4048 // play button triggered - MC will set movie to opposite state
4049 // of current - playing ? paused : playing
4050 if (pThis)
c5191fbd
VZ
4051 pThis->m_bPlaying = !(pThis->m_bPlaying);
4052
a7d5151d
DS
4053 // NB: Sometimes it doesn't redraw properly -
4054 // if you click on the button but don't move the mouse
4055 // the button will not change its state until you move
4056 // mcActionDraw and Refresh/Update combo do nothing
4057 // to help this unfortunately
4058 break;
b1ec2381 4059
a7d5151d
DS
4060 default:
4061 break;
c5191fbd 4062 }
a7d5151d 4063
c5191fbd
VZ
4064 return 0;
4065}
4066
4067//---------------------------------------------------------------------------
4068// wxQTMediaBackend::GetVideoSize
4069//
4070// Returns the actual size of the QT movie
ff4aedc5
RN
4071//---------------------------------------------------------------------------
4072wxSize wxQTMediaBackend::GetVideoSize() const
4073{
4074 return m_bestSize;
4075}
4076
4077//---------------------------------------------------------------------------
4078// wxQTMediaBackend::Move
4079//
c5191fbd 4080// Sets the bounds of either the Movie or Movie Controller
ff4aedc5 4081//---------------------------------------------------------------------------
d7a9c895 4082void wxQTMediaBackend::Move(int WXUNUSED(x), int WXUNUSED(y), int w, int h)
ff4aedc5 4083{
b1ec2381 4084 if (m_movie)
ff4aedc5 4085 {
a7d5151d 4086 // make room for controller
b1ec2381 4087 if (m_pMC)
c5191fbd 4088 {
b1ec2381 4089 if (w < 320)
c5191fbd 4090 w = 320;
ff4aedc5 4091
c5191fbd
VZ
4092 Rect theRect = {0, 0, (short)h, (short)w};
4093 m_lib.MCSetControllerBoundsRect(m_pMC, &theRect);
4094 }
4095 else
4096 {
4097 Rect theRect = {0, 0, (short)h, (short)w};
b1ec2381 4098 m_lib.SetMovieBox(m_movie, &theRect);
c5191fbd
VZ
4099 }
4100
d7a9c895 4101 wxASSERT(m_lib.GetMoviesError() == noErr);
ff4aedc5
RN
4102 }
4103}
4104
c5191fbd
VZ
4105//---------------------------------------------------------------------------
4106// wxQTMediaBackend::OnEraseBackground
4107//
4108// Suggestion from Greg Hazel to repaint the movie when idle
4109// (on pause also)
4110//
a7d5151d
DS
4111// TODO: We may be repainting too much here - under what exact circumstances
4112// do we need this? I think Move also repaints correctly for the Movie
c5191fbd
VZ
4113// Controller, so in that instance we don't need this either
4114//---------------------------------------------------------------------------
4115void wxQTMediaEvtHandler::OnEraseBackground(wxEraseEvent& evt)
4116{
6ab9bf57 4117 wxQuickTimeLibrary& m_pLib = m_qtb->m_lib;
c5191fbd 4118
6ab9bf57 4119 if ( m_qtb->m_pMC )
c5191fbd 4120 {
f10747d8 4121 // repaint movie controller
6ab9bf57 4122 m_pLib.MCDoAction(m_qtb->m_pMC, 2 /*mcActionDraw*/,
7e41b689 4123 m_pLib.GetNativeWindowPort(m_hwnd));
c5191fbd 4124 }
a7d5151d 4125 else if ( m_qtb->m_movie )
c5191fbd 4126 {
a7d5151d
DS
4127 // no movie controller
4128 CGrafPtr port = (CGrafPtr)m_pLib.GetNativeWindowPort(m_hwnd);
c5191fbd 4129
a7d5151d
DS
4130 m_pLib.BeginUpdate(port);
4131 m_pLib.UpdateMovie(m_qtb->m_movie);
4132 wxASSERT(m_pLib.GetMoviesError() == noErr);
4133 m_pLib.EndUpdate(port);
4134 }
4135 else
4136 {
4137 // no movie
4138 // let the system repaint the window
4139 evt.Skip();
c5191fbd 4140 }
c5191fbd
VZ
4141}
4142
ff4aedc5 4143//---------------------------------------------------------------------------
1146983c 4144// End QT Backend
ff4aedc5 4145//---------------------------------------------------------------------------
ff4aedc5
RN
4146
4147//in source file that contains stuff you don't directly use
7ec69821 4148#include "wx/html/forcelnk.h"
412e0d47 4149FORCE_LINK_ME(basewxmediabackends)
ff4aedc5 4150
72259e00 4151#endif //wxUSE_MEDIACTRL