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