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