]> git.saurik.com Git - wxWidgets.git/blame_incremental - utils/wxMMedia/vidwin.cpp
1. wxLoad/SaveFileSelector return "wxString" instead of "char *"
[wxWidgets.git] / utils / wxMMedia / vidwin.cpp
... / ...
CommitLineData
1////////////////////////////////////////////////////////////////////////////////
2// Name: vidwin.h
3// Purpose: wxMMedia
4// Author: Guilhem Lavaux
5// Created: February 1998
6// Updated:
7// Copyright: (C) 1998, Guilhem Lavaux
8// License: wxWindows license
9////////////////////////////////////////////////////////////////////////////////
10
11#ifdef __GNUG__
12#pragma implementation "vidwin.h"
13#endif
14
15#if 0
16#include "wx/wxprec.h"
17#else
18#include "wx/wx.h"
19#endif
20
21#define WXMMEDIA_INTERNAL
22#include <windows.h>
23#include <mmsystem.h>
24#include <digitalv.h>
25#include "mmtype.h"
26#include "mmfile.h"
27#include "vidwin.h"
28
29#ifdef __BORLANDC__
30#pragma hdrstop
31#endif
32
33wxVideoWindows::wxVideoWindows(void)
34{
35}
36
37wxVideoWindows::wxVideoWindows(wxInputStream& str, bool seekable)
38 : wxVideoBaseDriver(str, seekable)
39{
40 OpenFile(GetCurrentFile());
41}
42
43wxVideoWindows::wxVideoWindows(const char *fname)
44 : wxVideoBaseDriver(fname)
45{
46 OpenFile(fname);
47}
48
49wxVideoWindows::~wxVideoWindows(void)
50{
51 mciSendCommand(internal->dev_id, MCI_CLOSE, 0, 0);
52
53 if (internal)
54 delete internal;
55}
56
57void wxVideoWindows::OpenFile(const char *fname)
58{
59 MCI_DGV_OPEN_PARMS open_struct;
60 DWORD ret;
61
62 internal = new VIDW_Internal;
63
64 open_struct.lpstrDeviceType = "avivideo";
65 open_struct.lpstrElementName = (LPSTR)fname;
66 open_struct.hWndParent = 0;
67
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;
72}
73
74bool wxVideoWindows::Pause(void)
75{
76 return (mciSendCommand(internal->dev_id, MCI_PAUSE, 0, 0) == 0);
77}
78
79bool wxVideoWindows::Resume(void)
80{
81 return (mciSendCommand(internal->dev_id, MCI_PAUSE, 0, 0) == 0);
82}
83
84bool wxVideoWindows::SetVolume(wxUint8 vol)
85{
86 return TRUE;
87}
88
89bool wxVideoWindows::Resize(wxUint16 w, wxUint16 h)
90{
91 return TRUE;
92}
93
94bool wxVideoWindows::IsCapable(wxVideoType v_type)
95{
96 return (v_type == wxVIDEO_MSAVI);
97}
98
99bool wxVideoWindows::AttachOutput(wxVideoOutput& output)
100{
101 MCI_DGV_WINDOW_PARMS win_struct;
102
103 if (!wxVideoBaseDriver::AttachOutput(output))
104 return FALSE;
105
106 win_struct.hWnd = (HWND)output.GetHWND();
107 mciSendCommand(internal->dev_id, MCI_WINDOW,
108 MCI_DGV_WINDOW_HWND, (DWORD)(LPVOID)&win_struct);
109 return TRUE;
110}
111
112void wxVideoWindows::DetachOutput(void)
113{
114 MCI_DGV_WINDOW_PARMS win_struct;
115
116 wxVideoBaseDriver::DetachOutput();
117
118 win_struct.hWnd = 0;
119 mciSendCommand(internal->dev_id, MCI_WINDOW,
120 MCI_DGV_WINDOW_HWND, (DWORD)(LPVOID)&win_struct);
121}
122
123bool wxVideoWindows::StartPlay(void)
124{
125 return (mciSendCommand(internal->dev_id, MCI_PLAY, 0, NULL) == 0);
126}
127
128void wxVideoWindows::StopPlay(void)
129{
130 mciSendCommand(internal->dev_id, MCI_STOP, 0, NULL);
131}