1 ////////////////////////////////////////////////////////////////////////////////
4 // Author: Guilhem Lavaux
5 // Created: February 1998
7 // Copyright: (C) 1998, Guilhem Lavaux
8 // License: wxWindows license
9 ////////////////////////////////////////////////////////////////////////////////
12 #pragma implementation "vidwin.h"
16 #include "wx/wxprec.h"
21 #define WXMMEDIA_INTERNAL
33 wxVideoWindows::wxVideoWindows(void)
37 wxVideoWindows::wxVideoWindows(wxInputStream
& str
, bool seekable
)
38 : wxVideoBaseDriver(str
, seekable
)
40 OpenFile(GetCurrentFile());
43 wxVideoWindows::wxVideoWindows(const char *fname
)
44 : wxVideoBaseDriver(fname
)
49 wxVideoWindows::~wxVideoWindows(void)
51 mciSendCommand(internal
->dev_id
, MCI_CLOSE
, 0, 0);
57 void wxVideoWindows::OpenFile(const char *fname
)
59 MCI_DGV_OPEN_PARMS open_struct
;
62 internal
= new VIDW_Internal
;
64 open_struct
.lpstrDeviceType
= "avivideo";
65 open_struct
.lpstrElementName
= (LPSTR
)fname
;
66 open_struct
.hWndParent
= 0;
68 ret
= mciSendCommand(0, MCI_OPEN
,
69 MCI_OPEN_ELEMENT
|MCI_DGV_OPEN_PARENT
|MCI_OPEN_TYPE
|MCI_DGV_OPEN_32BIT
,
70 (DWORD
)(LPVOID
)&open_struct
);
71 internal
->dev_id
= open_struct
.wDeviceID
;
74 bool wxVideoWindows::Pause(void)
76 return (mciSendCommand(internal
->dev_id
, MCI_PAUSE
, 0, 0) == 0);
79 bool wxVideoWindows::Resume(void)
81 return (mciSendCommand(internal
->dev_id
, MCI_PAUSE
, 0, 0) == 0);
84 bool wxVideoWindows::SetVolume(wxUint8 vol
)
89 bool wxVideoWindows::Resize(wxUint16 w
, wxUint16 h
)
94 bool wxVideoWindows::IsCapable(wxVideoType v_type
)
96 return (v_type
== wxVIDEO_MSAVI
);
99 bool wxVideoWindows::AttachOutput(wxVideoOutput
& output
)
101 MCI_DGV_WINDOW_PARMS win_struct
;
103 if (!wxVideoBaseDriver::AttachOutput(output
))
106 win_struct
.hWnd
= (HWND
)output
.GetHWND();
107 mciSendCommand(internal
->dev_id
, MCI_WINDOW
,
108 MCI_DGV_WINDOW_HWND
, (DWORD
)(LPVOID
)&win_struct
);
112 void wxVideoWindows::DetachOutput(void)
114 MCI_DGV_WINDOW_PARMS win_struct
;
116 wxVideoBaseDriver::DetachOutput();
119 mciSendCommand(internal
->dev_id
, MCI_WINDOW
,
120 MCI_DGV_WINDOW_HWND
, (DWORD
)(LPVOID
)&win_struct
);
123 bool wxVideoWindows::StartPlay(void)
125 return (mciSendCommand(internal
->dev_id
, MCI_PLAY
, 0, NULL
) == 0);
128 void wxVideoWindows::StopPlay(void)
130 mciSendCommand(internal
->dev_id
, MCI_STOP
, 0, NULL
);