ReactOS  0.4.15-dev-1018-g0695ecb
mciavi.c File Reference
#include <string.h>
#include "private_mciavi.h"
#include "wine/debug.h"
Include dependency graph for mciavi.c:

Go to the source code of this file.

Classes

struct  MCIAVI_play_data
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (mciavi)
 
static DWORD MCIAVI_mciStop (UINT, DWORD, LPMCI_GENERIC_PARMS)
 
BOOL WINAPI DllMain (HINSTANCE hInstDLL, DWORD fdwReason, LPVOID fImpLoad)
 
static DWORD MCIAVI_drvOpen (LPCWSTR str, LPMCI_OPEN_DRIVER_PARMSW modp)
 
static DWORD MCIAVI_drvClose (DWORD dwDevID)
 
static DWORD MCIAVI_drvConfigure (DWORD dwDevID)
 
WINE_MCIAVIMCIAVI_mciGetOpenDev (UINT wDevID)
 
static void MCIAVI_CleanUp (WINE_MCIAVI *wma)
 
static DWORD MCIAVI_mciOpen (UINT wDevID, DWORD dwFlags, LPMCI_DGV_OPEN_PARMSW lpOpenParms)
 
DWORD MCIAVI_mciClose (UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
 
static double currenttime_us (void)
 
static DWORD MCIAVI_player (WINE_MCIAVI *wma, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms)
 
static DWORD WINAPI MCIAVI_mciPlay_thread (LPVOID arg)
 
static DWORD MCIAVI_mciPlay_async (WINE_MCIAVI *wma, DWORD dwFlags, LPMCI_PLAY_PARMS lpParams)
 
static DWORD MCIAVI_mciPlay (UINT wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms)
 
static DWORD MCIAVI_mciPause (UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
 
static DWORD MCIAVI_mciResume (UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
 
static DWORD MCIAVI_mciSeek (UINT wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpParms)
 
static DWORD MCIAVI_mciLoad (UINT wDevID, DWORD dwFlags, LPMCI_DGV_LOAD_PARMSW lpParms)
 
static DWORD MCIAVI_mciRealize (UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
 
static DWORD MCIAVI_mciUpdate (UINT wDevID, DWORD dwFlags, LPMCI_DGV_UPDATE_PARMS lpParms)
 
static DWORD MCIAVI_mciStep (UINT wDevID, DWORD dwFlags, LPMCI_DGV_STEP_PARMS lpParms)
 
static DWORD MCIAVI_mciCue (UINT wDevID, DWORD dwFlags, LPMCI_DGV_CUE_PARMS lpParms)
 
static DWORD MCIAVI_mciBreak (UINT wDevID, DWORD dwFlags, LPMCI_BREAK_PARMS lpParms)
 
static DWORD MCIAVI_mciSetAudio (UINT wDevID, DWORD dwFlags, LPMCI_DGV_SETAUDIO_PARMSW lpParms)
 
static DWORD MCIAVI_mciSignal (UINT wDevID, DWORD dwFlags, LPMCI_DGV_SIGNAL_PARMS lpParms)
 
static DWORD MCIAVI_mciSetVideo (UINT wDevID, DWORD dwFlags, LPMCI_DGV_SETVIDEO_PARMSW lpParms)
 
static DWORD MCIAVI_mciConfigure (UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
 
LRESULT CALLBACK MCIAVI_DriverProc (DWORD_PTR dwDevID, HDRVR hDriv, UINT wMsg, LPARAM dwParam1, LPARAM dwParam2)
 

Variables

HINSTANCE MCIAVI_hInstance = 0
 

Function Documentation

◆ currenttime_us()

static double currenttime_us ( void  )
static

Definition at line 336 of file mciavi.c.

337 {
338  LARGE_INTEGER lc, lf;
341  return (lc.QuadPart * 1000000) / lf.QuadPart;
342 }
BOOL WINAPI QueryPerformanceFrequency(OUT PLARGE_INTEGER lpFrequency)
Definition: perfcnt.c:45
BOOL WINAPI QueryPerformanceCounter(OUT PLARGE_INTEGER lpPerformanceCount)
Definition: perfcnt.c:23
LONGLONG QuadPart
Definition: typedefs.h:114

Referenced by MCIAVI_player().

◆ DllMain()

BOOL WINAPI DllMain ( HINSTANCE  hInstDLL,
DWORD  fdwReason,
LPVOID  fImpLoad 
)

Definition at line 57 of file mciavi.c.

58 {
59  switch (fdwReason) {
60  case DLL_PROCESS_ATTACH:
61  DisableThreadLibraryCalls(hInstDLL);
62  MCIAVI_hInstance = hInstDLL;
63  break;
64  }
65  return TRUE;
66 }
#define TRUE
Definition: types.h:120
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
HINSTANCE MCIAVI_hInstance
Definition: mciavi.c:52

◆ MCIAVI_CleanUp()

static void MCIAVI_CleanUp ( WINE_MCIAVI wma)
static

Definition at line 168 of file mciavi.c.

169 {
170  /* to prevent handling in WindowProc */
172  if (wma->hFile) {
173  mmioClose(wma->hFile, 0);
174  wma->hFile = 0;
175 
176  HeapFree(GetProcessHeap(), 0, wma->lpFileName);
177  wma->lpFileName = NULL;
178 
180  wma->lpVideoIndex = NULL;
182  wma->lpAudioIndex = NULL;
183  if (wma->hic) ICClose(wma->hic);
184  wma->hic = 0;
185  HeapFree(GetProcessHeap(), 0, wma->inbih);
186  wma->inbih = NULL;
187  HeapFree(GetProcessHeap(), 0, wma->outbih);
188  wma->outbih = NULL;
189  HeapFree(GetProcessHeap(), 0, wma->indata);
190  wma->indata = NULL;
191  HeapFree(GetProcessHeap(), 0, wma->outdata);
192  wma->outdata = NULL;
193  if (wma->hbmFrame) DeleteObject(wma->hbmFrame);
194  wma->hbmFrame = 0;
195  if (wma->hWnd) DestroyWindow(wma->hWnd);
196  wma->hWnd = 0;
197 
199  wma->lpWaveFormat = 0;
200 
201  memset(&wma->mah, 0, sizeof(wma->mah));
202  memset(&wma->ash_video, 0, sizeof(wma->ash_video));
203  memset(&wma->ash_audio, 0, sizeof(wma->ash_audio));
204  wma->dwCurrVideoFrame = wma->dwCurrAudioBlock = 0;
205  wma->dwCachedFrame = -1;
206  }
207 }
LPWAVEFORMATEX lpWaveFormat
AVIStreamHeader ash_audio
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
MMRESULT WINAPI mmioClose(HMMIO hmmio, UINT uFlags)
Definition: mmio.c:701
BOOL WINAPI DestroyWindow(_In_ HWND)
LRESULT WINAPI ICClose(HIC hic)
AVIStreamHeader ash_video
DWORD dwCachedFrame
smooth NULL
Definition: ftsmooth.c:416
HBITMAP hbmFrame
#define GetProcessHeap()
Definition: compat.h:484
LPVOID outdata
DWORD dwCurrVideoFrame
LPBITMAPINFOHEADER outbih
DWORD dwCurrAudioBlock
MainAVIHeader mah
struct MMIOPos * lpVideoIndex
LPBITMAPINFOHEADER inbih
#define MCI_MODE_NOT_READY
Definition: mmsystem.h:694
struct MMIOPos * lpAudioIndex
LPWSTR lpFileName
#define memset(x, y, z)
Definition: compat.h:39
#define HeapFree(x, y, z)
Definition: compat.h:483

Referenced by MCIAVI_mciClose(), and MCIAVI_mciOpen().

◆ MCIAVI_DriverProc()

LRESULT CALLBACK MCIAVI_DriverProc ( DWORD_PTR  dwDevID,
HDRVR  hDriv,
UINT  wMsg,
LPARAM  dwParam1,
LPARAM  dwParam2 
)

Definition at line 1002 of file mciavi.c.

1004 {
1005  TRACE("(%08lX, %p, %08X, %08lX, %08lX)\n",
1006  dwDevID, hDriv, wMsg, dwParam1, dwParam2);
1007 
1008  switch (wMsg) {
1009  case DRV_LOAD: return 1;
1010  case DRV_FREE: return 1;
1011  case DRV_OPEN: return MCIAVI_drvOpen((LPCWSTR)dwParam1, (LPMCI_OPEN_DRIVER_PARMSW)dwParam2);
1012  case DRV_CLOSE: return MCIAVI_drvClose(dwDevID);
1013  case DRV_ENABLE: return 1;
1014  case DRV_DISABLE: return 1;
1015  case DRV_QUERYCONFIGURE: return 1;
1016  case DRV_CONFIGURE: return MCIAVI_drvConfigure(dwDevID);
1017  case DRV_INSTALL: return DRVCNF_RESTART;
1018  case DRV_REMOVE: return DRVCNF_RESTART;
1019  }
1020 
1021  /* session instance */
1022  if (dwDevID == 0xFFFFFFFF) return 1;
1023 
1024  switch (wMsg) {
1025  case MCI_OPEN_DRIVER: return MCIAVI_mciOpen (dwDevID, dwParam1, (LPMCI_DGV_OPEN_PARMSW) dwParam2);
1026  case MCI_CLOSE_DRIVER: return MCIAVI_mciClose (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
1027  case MCI_PLAY: return MCIAVI_mciPlay (dwDevID, dwParam1, (LPMCI_PLAY_PARMS) dwParam2);
1028  case MCI_STOP: return MCIAVI_mciStop (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
1029  case MCI_SET: return MCIAVI_mciSet (dwDevID, dwParam1, (LPMCI_DGV_SET_PARMS) dwParam2);
1030  case MCI_PAUSE: return MCIAVI_mciPause (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
1031  case MCI_RESUME: return MCIAVI_mciResume (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
1032  case MCI_STATUS: return MCIAVI_mciStatus (dwDevID, dwParam1, (LPMCI_DGV_STATUS_PARMSW) dwParam2);
1033  case MCI_GETDEVCAPS: return MCIAVI_mciGetDevCaps(dwDevID, dwParam1, (LPMCI_GETDEVCAPS_PARMS) dwParam2);
1034  case MCI_INFO: return MCIAVI_mciInfo (dwDevID, dwParam1, (LPMCI_DGV_INFO_PARMSW) dwParam2);
1035  case MCI_SEEK: return MCIAVI_mciSeek (dwDevID, dwParam1, (LPMCI_SEEK_PARMS) dwParam2);
1036  case MCI_PUT: return MCIAVI_mciPut (dwDevID, dwParam1, (LPMCI_DGV_PUT_PARMS) dwParam2);
1037  case MCI_WINDOW: return MCIAVI_mciWindow (dwDevID, dwParam1, (LPMCI_DGV_WINDOW_PARMSW) dwParam2);
1038  case MCI_LOAD: return MCIAVI_mciLoad (dwDevID, dwParam1, (LPMCI_DGV_LOAD_PARMSW) dwParam2);
1039  case MCI_REALIZE: return MCIAVI_mciRealize (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
1040  case MCI_UPDATE: return MCIAVI_mciUpdate (dwDevID, dwParam1, (LPMCI_DGV_UPDATE_PARMS) dwParam2);
1041  case MCI_WHERE: return MCIAVI_mciWhere (dwDevID, dwParam1, (LPMCI_DGV_RECT_PARMS) dwParam2);
1042  case MCI_STEP: return MCIAVI_mciStep (dwDevID, dwParam1, (LPMCI_DGV_STEP_PARMS) dwParam2);
1043  case MCI_CUE: return MCIAVI_mciCue (dwDevID, dwParam1, (LPMCI_DGV_CUE_PARMS) dwParam2);
1044  case MCI_BREAK: return MCIAVI_mciBreak (dwDevID, dwParam1, (LPMCI_BREAK_PARMS) dwParam2);
1045  /* Digital Video specific */
1046  case MCI_SETAUDIO: return MCIAVI_mciSetAudio (dwDevID, dwParam1, (LPMCI_DGV_SETAUDIO_PARMSW) dwParam2);
1047  case MCI_SIGNAL: return MCIAVI_mciSignal (dwDevID, dwParam1, (LPMCI_DGV_SIGNAL_PARMS) dwParam2);
1048  case MCI_SETVIDEO: return MCIAVI_mciSetVideo (dwDevID, dwParam1, (LPMCI_DGV_SETVIDEO_PARMSW) dwParam2);
1049  case MCI_CONFIGURE: return MCIAVI_mciConfigure (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
1050 
1051  /* no editing, recording, saving, locking without inputs */
1052  case MCI_CAPTURE:
1053  case MCI_COPY:
1054  case MCI_CUT:
1055  case MCI_DELETE:
1056  case MCI_FREEZE:
1057  case MCI_LIST:
1058  case MCI_MONITOR:
1059  case MCI_PASTE:
1060  case MCI_QUALITY:
1061  case MCI_RECORD:
1062  case MCI_RESERVE:
1063  case MCI_RESTORE:
1064  case MCI_SAVE:
1065  case MCI_UNDO:
1066  case MCI_UNFREEZE:
1067  TRACE("Unsupported function [0x%x] flags=%08x\n", wMsg, (DWORD)dwParam1);
1069  case MCI_SPIN:
1070  case MCI_ESCAPE:
1071  WARN("Unsupported command [0x%x] %08x\n", wMsg, (DWORD)dwParam1);
1072  break;
1073  case MCI_OPEN:
1074  case MCI_CLOSE:
1075  FIXME("Shouldn't receive a MCI_OPEN or CLOSE message\n");
1076  break;
1077  default:
1078  TRACE("Sending msg [%u] to default driver proc\n", wMsg);
1079  return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
1080  }
1082 }
static DWORD MCIAVI_mciUpdate(UINT wDevID, DWORD dwFlags, LPMCI_DGV_UPDATE_PARMS lpParms)
Definition: mciavi.c:824
#define DRV_DISABLE
Definition: mmsystem.h:123
#define MCI_UNFREEZE
Definition: mmsystem.h:669
#define MCI_SETAUDIO
Definition: digitalv.h:39
#define MCI_ESCAPE
Definition: mmsystem.h:648
static DWORD MCIAVI_drvConfigure(DWORD dwDevID)
Definition: mciavi.c:137
#define MCI_COPY
Definition: mmsystem.h:672
#define MCI_RESTORE
Definition: digitalv.h:46
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
DWORD MCIAVI_mciWindow(UINT wDevID, DWORD dwFlags, LPMCI_DGV_WINDOW_PARMSW lpParms) DECLSPEC_HIDDEN
Definition: wnd.c:277
#define MCI_CAPTURE
Definition: digitalv.h:36
static DWORD MCIAVI_mciOpen(UINT wDevID, DWORD dwFlags, LPMCI_DGV_OPEN_PARMSW lpOpenParms)
Definition: mciavi.c:212
#define MCIERR_UNSUPPORTED_FUNCTION
Definition: mmsystem.h:584
#define WARN(fmt,...)
Definition: debug.h:112
#define MCI_STEP
Definition: mmsystem.h:657
#define MCI_PASTE
Definition: mmsystem.h:673
#define MCI_RESERVE
Definition: digitalv.h:38
#define MCI_PLAY
Definition: mmsystem.h:649
#define DRV_CLOSE
Definition: mmsystem.h:122
#define MCI_RESUME
Definition: mmsystem.h:675
#define MCI_BREAK
Definition: mmsystem.h:660
#define MCI_FREEZE
Definition: mmsystem.h:668
DWORD MCIAVI_mciPut(UINT wDevID, DWORD dwFlags, LPMCI_DGV_PUT_PARMS lpParms) DECLSPEC_HIDDEN
Definition: wnd.c:153
#define MCI_CUE
Definition: mmsystem.h:663
#define MCI_SAVE
Definition: mmsystem.h:661
#define MCI_QUALITY
Definition: digitalv.h:42
DWORD MCIAVI_mciWhere(UINT wDevID, DWORD dwFlags, LPMCI_DGV_RECT_PARMS lpParms) DECLSPEC_HIDDEN
Definition: wnd.c:209
#define DRV_QUERYCONFIGURE
Definition: mmsystem.h:126
#define DRV_OPEN
Definition: mmsystem.h:121
#define MCI_STOP
Definition: mmsystem.h:651
#define MCI_WINDOW
Definition: mmsystem.h:665
#define MCI_SET
Definition: mmsystem.h:656
static DWORD MCIAVI_mciPause(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
Definition: mciavi.c:690
DWORD MCIAVI_mciSet(UINT wDevID, DWORD dwFlags, LPMCI_DGV_SET_PARMS lpParms)
Definition: info.c:227
#define MCI_RECORD
Definition: mmsystem.h:658
DWORD MCIAVI_mciGetDevCaps(UINT wDevID, DWORD dwFlags, LPMCI_GETDEVCAPS_PARMS lpParms)
Definition: info.c:73
#define MCI_SIGNAL
Definition: digitalv.h:40
#define FIXME(fmt,...)
Definition: debug.h:111
#define MCI_WHERE
Definition: mmsystem.h:667
#define DRV_LOAD(x)
#define MCI_OPEN
Definition: mmsystem.h:646
DWORD MCIAVI_mciStatus(UINT wDevID, DWORD dwFlags, LPMCI_DGV_STATUS_PARMSW lpParms)
Definition: info.c:363
#define DRVCNF_RESTART
Definition: mmsystem.h:135
#define DRV_REMOVE
Definition: mmsystem.h:128
#define MCI_INFO
Definition: mmsystem.h:653
static DWORD MCIAVI_mciResume(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
Definition: mciavi.c:717
#define MCI_CONFIGURE
Definition: digitalv.h:45
#define MCI_OPEN_DRIVER
Definition: mmddk.h:338
#define MCI_STATUS
Definition: mmsystem.h:662
static DWORD MCIAVI_drvOpen(LPCWSTR str, LPMCI_OPEN_DRIVER_PARMSW modp)
Definition: mciavi.c:71
#define TRACE(s)
Definition: solgame.cpp:4
#define DRV_CONFIGURE
Definition: mmsystem.h:125
static DWORD MCIAVI_mciSetVideo(UINT wDevID, DWORD dwFlags, LPMCI_DGV_SETVIDEO_PARMSW lpParms)
Definition: mciavi.c:963
static DWORD MCIAVI_mciPlay(UINT wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms)
Definition: mciavi.c:543
static DWORD MCIAVI_drvClose(DWORD dwDevID)
Definition: mciavi.c:103
#define MCI_REALIZE
Definition: mmsystem.h:664
unsigned long DWORD
Definition: ntddk_ex.h:95
#define DRV_FREE
Definition: mmsystem.h:124
DWORD MCIAVI_mciInfo(UINT wDevID, DWORD dwFlags, LPMCI_DGV_INFO_PARMSW lpParms)
Definition: info.c:188
#define MCI_SETVIDEO
Definition: digitalv.h:41
static DWORD MCIAVI_mciRealize(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
Definition: mciavi.c:806
static DWORD MCIAVI_mciConfigure(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
Definition: mciavi.c:980
#define MCI_LOAD
Definition: mmsystem.h:670
#define MCI_CUT
Definition: mmsystem.h:671
static DWORD MCIAVI_mciStop(UINT, DWORD, LPMCI_GENERIC_PARMS)
Definition: mciavi.c:636
#define MCI_CLOSE_DRIVER
Definition: mmddk.h:339
static DWORD MCIAVI_mciCue(UINT wDevID, DWORD dwFlags, LPMCI_DGV_CUE_PARMS lpParms)
Definition: mciavi.c:886
#define DRV_ENABLE
Definition: mmsystem.h:120
static DWORD MCIAVI_mciSeek(UINT wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpParms)
Definition: mciavi.c:744
DWORD MCIAVI_mciClose(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
Definition: mciavi.c:305
#define MCI_PUT
Definition: mmsystem.h:666
#define MCI_CLOSE
Definition: mmsystem.h:647
#define MCI_GETDEVCAPS
Definition: mmsystem.h:654
#define MCIERR_UNRECOGNIZED_COMMAND
Definition: mmsystem.h:571
static DWORD MCIAVI_mciBreak(UINT wDevID, DWORD dwFlags, LPMCI_BREAK_PARMS lpParms)
Definition: mciavi.c:905
static DWORD MCIAVI_mciSignal(UINT wDevID, DWORD dwFlags, LPMCI_DGV_SIGNAL_PARMS lpParms)
Definition: mciavi.c:946
#define MCI_PAUSE
Definition: mmsystem.h:652
#define DRV_INSTALL
Definition: mmsystem.h:127
LRESULT WINAPI DefDriverProc(DWORD_PTR dwDriverIdentifier, HDRVR hDrv, UINT Msg, LPARAM lParam1, LPARAM lParam2)
Definition: driver.c:554
static DWORD MCIAVI_mciSetAudio(UINT wDevID, DWORD dwFlags, LPMCI_DGV_SETAUDIO_PARMSW lpParms)
Definition: mciavi.c:929
#define MCI_UNDO
Definition: digitalv.h:44
static DWORD MCIAVI_mciLoad(UINT wDevID, DWORD dwFlags, LPMCI_DGV_LOAD_PARMSW lpParms)
Definition: mciavi.c:789
#define MCI_MONITOR
Definition: digitalv.h:37
#define MCI_SPIN
Definition: mmsystem.h:655
static DWORD MCIAVI_mciStep(UINT wDevID, DWORD dwFlags, LPMCI_DGV_STEP_PARMS lpParms)
Definition: mciavi.c:849
#define MCI_UPDATE
Definition: mmsystem.h:674
#define MCI_SEEK
Definition: mmsystem.h:650
#define MCI_DELETE
Definition: mmsystem.h:676
#define MCI_LIST
Definition: digitalv.h:43

◆ MCIAVI_drvClose()

static DWORD MCIAVI_drvClose ( DWORD  dwDevID)
static

Definition at line 103 of file mciavi.c.

104 {
105  WINE_MCIAVI *wma;
106 
107  TRACE("%04x\n", dwDevID);
108 
109  /* finish all outstanding things */
110  MCIAVI_mciClose(dwDevID, MCI_WAIT, NULL);
111 
112  wma = (WINE_MCIAVI*)mciGetDriverData(dwDevID);
113 
114  if (wma) {
116 
117  EnterCriticalSection(&wma->cs);
118 
119  mciSetDriverData(dwDevID, 0);
121 
122  CloseHandle(wma->hStopEvent);
123 
124  LeaveCriticalSection(&wma->cs);
125  wma->cs.DebugInfo->Spare[0] = 0;
126  DeleteCriticalSection(&wma->cs);
127 
128  HeapFree(GetProcessHeap(), 0, wma);
129  return 1;
130  }
131  return (dwDevID == 0xFFFFFFFF) ? 1 : 0;
132 }
BOOL WINAPI mciSetDriverData(UINT uDeviceID, DWORD dwData)
DWORD WINAPI mciGetDriverData(UINT uDeviceID)
Definition: mci.c:2066
#define CloseHandle
Definition: compat.h:487
BOOL MCIAVI_UnregisterClass(void) DECLSPEC_HIDDEN
Definition: wnd.c:88
#define MCI_WAIT
Definition: mmsystem.h:730
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
smooth NULL
Definition: ftsmooth.c:416
HANDLE hStopEvent
#define TRACE(s)
Definition: solgame.cpp:4
WORD wCommandTable
#define GetProcessHeap()
Definition: compat.h:484
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
BOOL WINAPI mciFreeCommandResource(UINT uTable)
Definition: mci.c:1500
PCRITICAL_SECTION_DEBUG DebugInfo
Definition: winbase.h:872
DWORD MCIAVI_mciClose(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
Definition: mciavi.c:305
CRITICAL_SECTION cs
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define HeapFree(x, y, z)
Definition: compat.h:483
DWORD_PTR Spare[8/sizeof(DWORD_PTR)]
Definition: winbase.h:865

Referenced by MCIAVI_DriverProc().

◆ MCIAVI_drvConfigure()

static DWORD MCIAVI_drvConfigure ( DWORD  dwDevID)
static

Definition at line 137 of file mciavi.c.

138 {
139  WINE_MCIAVI *wma;
140 
141  TRACE("%04x\n", dwDevID);
142 
143  MCIAVI_mciStop(dwDevID, MCI_WAIT, NULL);
144 
145  wma = (WINE_MCIAVI*)mciGetDriverData(dwDevID);
146 
147  if (wma) {
148  MessageBoxA(0, "Sample AVI Wine Driver !", "MM-Wine Driver", MB_OK);
149  return 1;
150  }
151  return 0;
152 }
DWORD WINAPI mciGetDriverData(UINT uDeviceID)
Definition: mci.c:2066
#define MCI_WAIT
Definition: mmsystem.h:730
int WINAPI MessageBoxA(_In_opt_ HWND, _In_opt_ LPCSTR, _In_opt_ LPCSTR, _In_ UINT)
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
static DWORD MCIAVI_mciStop(UINT, DWORD, LPMCI_GENERIC_PARMS)
Definition: mciavi.c:636
#define MB_OK
Definition: winuser.h:784

Referenced by MCIAVI_DriverProc().

◆ MCIAVI_drvOpen()

static DWORD MCIAVI_drvOpen ( LPCWSTR  str,
LPMCI_OPEN_DRIVER_PARMSW  modp 
)
static

Definition at line 71 of file mciavi.c.

72 {
73  WINE_MCIAVI* wma;
74  static const WCHAR mciAviWStr[] = {'M','C','I','A','V','I',0};
75 
76  TRACE("%s, %p\n", debugstr_w(str), modp);
77 
78  /* session instance */
79  if (!modp) return 0xFFFFFFFF;
80 
81  if (!MCIAVI_RegisterClass()) return 0;
82 
84  if (!wma)
85  return 0;
86 
88  wma->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": WINE_MCIAVI.cs");
90  wma->wDevID = modp->wDeviceID;
95  mciSetDriverData(wma->wDevID, (DWORD_PTR)wma);
96 
97  return modp->wDeviceID;
98 }
BOOL WINAPI mciSetDriverData(UINT uDeviceID, DWORD dwData)
#define DWORD_PTR
Definition: treelist.c:76
#define MCI_DEVTYPE_DIGITAL_VIDEO
Definition: mmsystem.h:687
UINT WINAPI mciLoadCommandResource(HINSTANCE hInstance, LPCWSTR lpResName, UINT uType)
Definition: mci.c:1460
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:651
#define FALSE
Definition: types.h:117
UINT wCustomCommandTable
Definition: mmddk.h:438
#define debugstr_w
Definition: kernel32.h:32
const WCHAR * str
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:751
smooth NULL
Definition: ftsmooth.c:416
HANDLE hStopEvent
#define TRACE(s)
Definition: solgame.cpp:4
WORD wCommandTable
#define GetProcessHeap()
Definition: compat.h:484
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
PCRITICAL_SECTION_DEBUG DebugInfo
Definition: winbase.h:872
uint32_t DWORD_PTR
Definition: typedefs.h:65
MCIDEVICEID wDevID
#define MCI_MODE_NOT_READY
Definition: mmsystem.h:694
HINSTANCE MCIAVI_hInstance
Definition: mciavi.c:52
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
CRITICAL_SECTION cs
DWORD_PTR Spare[8/sizeof(DWORD_PTR)]
Definition: winbase.h:865
BOOL MCIAVI_RegisterClass(void) DECLSPEC_HIDDEN
Definition: wnd.c:93

Referenced by MCIAVI_DriverProc().

◆ MCIAVI_mciBreak()

static DWORD MCIAVI_mciBreak ( UINT  wDevID,
DWORD  dwFlags,
LPMCI_BREAK_PARMS  lpParms 
)
static

Definition at line 905 of file mciavi.c.

906 {
907  WINE_MCIAVI *wma;
908 
909  TRACE("(%04x, %08x, %p)\n", wDevID, dwFlags, lpParms);
910 
911  if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
912 
913  wma = MCIAVI_mciGetOpenDev(wDevID);
914  if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
915 
916  EnterCriticalSection(&wma->cs);
917 
918  wma->mci_break.flags = dwFlags;
919  wma->mci_break.parms = *lpParms;
920 
921  LeaveCriticalSection(&wma->cs);
922 
923  return 0;
924 }
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
struct WINE_MCIAVI::@460 mci_break
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
WINE_MCIAVI * MCIAVI_mciGetOpenDev(UINT wDevID)
Definition: mciavi.c:157
CRITICAL_SECTION cs
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define MCIERR_INVALID_DEVICE_ID
Definition: mmsystem.h:569
#define MCIERR_NULL_PARAMETER_BLOCK
Definition: mmsystem.h:605

Referenced by MCIAVI_DriverProc().

◆ MCIAVI_mciClose()

DWORD MCIAVI_mciClose ( UINT  wDevID,
DWORD  dwFlags,
LPMCI_GENERIC_PARMS  lpParms 
)

Definition at line 305 of file mciavi.c.

306 {
307  WINE_MCIAVI *wma;
308  DWORD dwRet = 0;
309 
310  TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);
311 
312  wma = MCIAVI_mciGetOpenDev(wDevID);
313  if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
314 
315  MCIAVI_mciStop(wDevID, MCI_WAIT, NULL);
316 
317  EnterCriticalSection(&wma->cs);
318 
319  if (wma->nUseCount == 1) {
320  MCIAVI_CleanUp(wma);
321 
322  if ((dwFlags & MCI_NOTIFY) && lpParms) {
324  wDevID,
326  }
327  LeaveCriticalSection(&wma->cs);
328  return dwRet;
329  }
330  wma->nUseCount--;
331 
332  LeaveCriticalSection(&wma->cs);
333  return dwRet;
334 }
static void MCIAVI_CleanUp(WINE_MCIAVI *wma)
Definition: mciavi.c:168
#define MCI_WAIT
Definition: mmsystem.h:730
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
BOOL WINAPI mciDriverNotify(HWND hwndCallback, UINT uDeviceID, UINT uStatus)
Definition: mci.c:2056
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
#define MCI_NOTIFY_SUCCESSFUL
Definition: mmsystem.h:725
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
static DWORD MCIAVI_mciStop(UINT, DWORD, LPMCI_GENERIC_PARMS)
Definition: mciavi.c:636
WINE_MCIAVI * MCIAVI_mciGetOpenDev(UINT wDevID)
Definition: mciavi.c:157
#define HWND_32(h16)
Definition: wownt32.h:29
DWORD_PTR dwCallback
Definition: mmsystem.h:1517
CRITICAL_SECTION cs
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define MCIERR_INVALID_DEVICE_ID
Definition: mmsystem.h:569
#define MCI_NOTIFY
Definition: mmsystem.h:729
#define LOWORD(l)
Definition: pedump.c:82

Referenced by MCIAVI_DriverProc(), MCIAVI_drvClose(), and MCIAVI_WindowProc().

◆ MCIAVI_mciConfigure()

static DWORD MCIAVI_mciConfigure ( UINT  wDevID,
DWORD  dwFlags,
LPMCI_GENERIC_PARMS  lpParms 
)
static

Definition at line 980 of file mciavi.c.

981 {
982  WINE_MCIAVI *wma;
983 
984  FIXME("(%04x, %08x, %p) : stub\n", wDevID, dwFlags, lpParms);
985 
986  if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
987 
988  wma = MCIAVI_mciGetOpenDev(wDevID);
989  if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
990  if (dwFlags & MCI_TEST) return 0;
991 
992  return 0;
993 }
#define FIXME(fmt,...)
Definition: debug.h:111
smooth NULL
Definition: ftsmooth.c:416
#define MCI_TEST
Definition: digitalv.h:32
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
WINE_MCIAVI * MCIAVI_mciGetOpenDev(UINT wDevID)
Definition: mciavi.c:157
#define MCIERR_INVALID_DEVICE_ID
Definition: mmsystem.h:569
#define MCIERR_NULL_PARAMETER_BLOCK
Definition: mmsystem.h:605

Referenced by MCIAVI_DriverProc().

◆ MCIAVI_mciCue()

static DWORD MCIAVI_mciCue ( UINT  wDevID,
DWORD  dwFlags,
LPMCI_DGV_CUE_PARMS  lpParms 
)
static

Definition at line 886 of file mciavi.c.

887 {
888  WINE_MCIAVI *wma;
889 
890  FIXME("(%04x, %08x, %p) : stub\n", wDevID, dwFlags, lpParms);
891 
892  if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
893 
894  wma = MCIAVI_mciGetOpenDev(wDevID);
895  if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
897  if (dwFlags & MCI_TEST) return 0;
898 
899  return 0;
900 }
#define MCIERR_UNSUPPORTED_FUNCTION
Definition: mmsystem.h:584
#define FIXME(fmt,...)
Definition: debug.h:111
smooth NULL
Definition: ftsmooth.c:416
#define MCI_TEST
Definition: digitalv.h:32
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
WINE_MCIAVI * MCIAVI_mciGetOpenDev(UINT wDevID)
Definition: mciavi.c:157
#define MCI_DGV_CUE_INPUT
Definition: digitalv.h:141
#define MCIERR_INVALID_DEVICE_ID
Definition: mmsystem.h:569
#define MCIERR_NULL_PARAMETER_BLOCK
Definition: mmsystem.h:605

Referenced by MCIAVI_DriverProc().

◆ MCIAVI_mciGetOpenDev()

WINE_MCIAVI* MCIAVI_mciGetOpenDev ( UINT  wDevID)

Definition at line 157 of file mciavi.c.

158 {
159  WINE_MCIAVI* wma = (WINE_MCIAVI*)mciGetDriverData(wDevID);
160 
161  if (wma == NULL || wma->nUseCount == 0) {
162  WARN("Invalid wDevID=%u\n", wDevID);
163  return 0;
164  }
165  return wma;
166 }
DWORD WINAPI mciGetDriverData(UINT uDeviceID)
Definition: mci.c:2066
#define WARN(fmt,...)
Definition: debug.h:112
smooth NULL
Definition: ftsmooth.c:416

Referenced by MCIAVI_mciBreak(), MCIAVI_mciClose(), MCIAVI_mciConfigure(), MCIAVI_mciCue(), MCIAVI_mciGetDevCaps(), MCIAVI_mciInfo(), MCIAVI_mciLoad(), MCIAVI_mciPause(), MCIAVI_mciPlay(), MCIAVI_mciPut(), MCIAVI_mciRealize(), MCIAVI_mciResume(), MCIAVI_mciSeek(), MCIAVI_mciSet(), MCIAVI_mciSetAudio(), MCIAVI_mciSetVideo(), MCIAVI_mciSignal(), MCIAVI_mciStatus(), MCIAVI_mciStep(), MCIAVI_mciStop(), MCIAVI_mciUpdate(), MCIAVI_mciWhere(), MCIAVI_mciWindow(), and MCIAVI_waveCallback().

◆ MCIAVI_mciLoad()

static DWORD MCIAVI_mciLoad ( UINT  wDevID,
DWORD  dwFlags,
LPMCI_DGV_LOAD_PARMSW  lpParms 
)
static

Definition at line 789 of file mciavi.c.

790 {
791  WINE_MCIAVI *wma;
792 
793  FIXME("(%04x, %08x, %p) : stub\n", wDevID, dwFlags, lpParms);
794 
795  if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
796 
797  wma = MCIAVI_mciGetOpenDev(wDevID);
798  if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
799 
800  return MCIERR_UNSUPPORTED_FUNCTION; /* like w2k */
801 }
#define MCIERR_UNSUPPORTED_FUNCTION
Definition: mmsystem.h:584
#define FIXME(fmt,...)
Definition: debug.h:111
smooth NULL
Definition: ftsmooth.c:416
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
WINE_MCIAVI * MCIAVI_mciGetOpenDev(UINT wDevID)
Definition: mciavi.c:157
#define MCIERR_INVALID_DEVICE_ID
Definition: mmsystem.h:569
#define MCIERR_NULL_PARAMETER_BLOCK
Definition: mmsystem.h:605

Referenced by MCIAVI_DriverProc().

◆ MCIAVI_mciOpen()

static DWORD MCIAVI_mciOpen ( UINT  wDevID,
DWORD  dwFlags,
LPMCI_DGV_OPEN_PARMSW  lpOpenParms 
)
static

Definition at line 212 of file mciavi.c.

214 {
215  WINE_MCIAVI *wma;
216  LRESULT dwRet = 0;
217 
218  TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpOpenParms);
219 
220  if (lpOpenParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
221 
222  wma = (WINE_MCIAVI *)mciGetDriverData(wDevID);
223  if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
224 
225  EnterCriticalSection(&wma->cs);
226 
227  if (wma->nUseCount > 0) {
228  /* The driver is already open on this channel */
229  /* If the driver was opened shareable before and this open specifies */
230  /* shareable then increment the use count */
231  if (wma->fShareable && (dwFlags & MCI_OPEN_SHAREABLE))
232  ++wma->nUseCount;
233  else
234  {
235  LeaveCriticalSection(&wma->cs);
237  }
238  } else {
239  wma->nUseCount = 1;
241  }
242 
244 
245  if (dwFlags & MCI_OPEN_ELEMENT) {
247  /* could it be that (DWORD)lpOpenParms->lpstrElementName
248  * contains the hFile value ?
249  */
251  } else if (lpOpenParms->lpstrElementName && lpOpenParms->lpstrElementName[0]) {
252  /* FIXME : what should be done id wma->hFile is already != 0, or the driver is playin' */
253  TRACE("MCI_OPEN_ELEMENT %s!\n", debugstr_w(lpOpenParms->lpstrElementName));
254 
255  wma->lpFileName = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(lpOpenParms->lpstrElementName) + 1) * sizeof(WCHAR));
256  lstrcpyW(wma->lpFileName, lpOpenParms->lpstrElementName);
257 
258  if (lpOpenParms->lpstrElementName[0] == '@') {
259  /* The file name @11223344 encodes an AVIFile handle in decimal notation
260  * in Win3.1 and w2k/NT, but this feature is absent in win95 (KB140750).
261  * wma->hFile = LongToHandle(wcstol(lpOpenParms->lpstrElementName+1, NULL, 10)); */
262  FIXME("Using AVIFile/Stream %s NIY\n", debugstr_w(lpOpenParms->lpstrElementName));
263  }
264  wma->hFile = mmioOpenW(lpOpenParms->lpstrElementName, NULL,
266 
267  if (wma->hFile == 0) {
268  WARN("can't find file=%s!\n", debugstr_w(lpOpenParms->lpstrElementName));
269  dwRet = MCIERR_FILE_NOT_FOUND;
270  } else {
271  if (!MCIAVI_GetInfo(wma))
272  dwRet = MCIERR_INVALID_FILE;
273  else if (!MCIAVI_OpenVideo(wma))
275  else if (!MCIAVI_CreateWindow(wma, dwFlags, lpOpenParms))
276  dwRet = MCIERR_CREATEWINDOW;
277  }
278  } else {
279  FIXME("Don't record yet\n");
281  }
282  }
283 
284  if (dwRet == 0) {
285  TRACE("lpOpenParms->wDeviceID = %04x\n", lpOpenParms->wDeviceID);
286 
287  wma->dwStatus = MCI_MODE_STOP;
289  } else {
290  MCIAVI_CleanUp(wma);
291  }
292 
293  LeaveCriticalSection(&wma->cs);
294 
295  if (!dwRet && (dwFlags & MCI_NOTIFY)) {
296  mciDriverNotify(HWND_32(LOWORD(lpOpenParms->dwCallback)),
297  wDevID, MCI_NOTIFY_SUCCESSFUL);
298  }
299  return dwRet;
300 }
#define MMIO_ALLOCBUF
Definition: mmsystem.h:532
static void MCIAVI_CleanUp(WINE_MCIAVI *wma)
Definition: mciavi.c:168
#define MCI_MODE_STOP
Definition: mmsystem.h:695
#define MCIERR_INVALID_FILE
Definition: mmsystem.h:604
DWORD WINAPI mciGetDriverData(UINT uDeviceID)
Definition: mci.c:2066
#define MCIERR_CANNOT_LOAD_DRIVER
Definition: mmsystem.h:576
#define MCIERR_UNSUPPORTED_FUNCTION
Definition: mmsystem.h:584
#define WARN(fmt,...)
Definition: debug.h:112
HMMIO WINAPI mmioOpenW(LPWSTR szFileName, MMIOINFO *lpmmioinfo, DWORD dwOpenFlags)
Definition: mmio.c:669
#define MMIO_DENYWRITE
Definition: mmsystem.h:540
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define lstrlenW
Definition: compat.h:498
BOOL WINAPI mciDriverNotify(HWND hwndCallback, UINT uDeviceID, UINT uStatus)
Definition: mci.c:2056
DWORD_PTR dwCallback
Definition: digitalv.h:604
#define MCI_FORMAT_FRAMES
Definition: mmsystem.h:704
#define MCI_OPEN_ELEMENT_ID
Definition: mmsystem.h:737
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111
smooth NULL
Definition: ftsmooth.c:416
BOOL MCIAVI_GetInfo(WINE_MCIAVI *wma)
Definition: mmoutput.c:255
#define MMIO_READ
Definition: mmsystem.h:535
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:484
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LPWSTR lpstrElementName
Definition: digitalv.h:607
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MCI_OPEN_SHAREABLE
Definition: mmsystem.h:734
#define MCIERR_CREATEWINDOW
Definition: mmsystem.h:640
#define MCI_NOTIFY_SUCCESSFUL
Definition: mmsystem.h:725
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define HWND_32(h16)
Definition: wownt32.h:29
#define MCIERR_FILE_NOT_FOUND
Definition: mmsystem.h:585
BOOL MCIAVI_OpenVideo(WINE_MCIAVI *wma)
Definition: mmoutput.c:426
#define lstrcpyW
Definition: compat.h:497
#define MCI_MODE_NOT_READY
Definition: mmsystem.h:694
#define MCI_OPEN_ELEMENT
Definition: mmsystem.h:735
CRITICAL_SECTION cs
#define MCIERR_UNRECOGNIZED_COMMAND
Definition: mmsystem.h:571
DWORD dwMciTimeFormat
LPWSTR lpFileName
#define MCIERR_MUST_USE_SHAREABLE
Definition: mmsystem.h:599
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define MCIERR_INVALID_DEVICE_ID
Definition: mmsystem.h:569
LONG_PTR LRESULT
Definition: windef.h:209
#define MCI_NOTIFY
Definition: mmsystem.h:729
BOOL MCIAVI_CreateWindow(WINE_MCIAVI *wma, DWORD dwFlags, LPMCI_DGV_OPEN_PARMSW lpOpenParms) DECLSPEC_HIDDEN
Definition: wnd.c:112
#define MCIERR_NULL_PARAMETER_BLOCK
Definition: mmsystem.h:605
#define LOWORD(l)
Definition: pedump.c:82

Referenced by MCIAVI_DriverProc().

◆ MCIAVI_mciPause()

static DWORD MCIAVI_mciPause ( UINT  wDevID,
DWORD  dwFlags,
LPMCI_GENERIC_PARMS  lpParms 
)
static

Definition at line 690 of file mciavi.c.

691 {
692  WINE_MCIAVI *wma;
693 
694  TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);
695 
696  wma = MCIAVI_mciGetOpenDev(wDevID);
697  if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
698  if (dwFlags & MCI_TEST) return 0;
699 
700  EnterCriticalSection(&wma->cs);
701 
702  if (wma->dwStatus == MCI_MODE_PLAY)
703  wma->dwStatus = MCI_MODE_PAUSE;
704 
705  if (wma->lpWaveFormat) {
706  LeaveCriticalSection(&wma->cs);
707  return waveOutPause(wma->hWave);
708  }
709 
710  LeaveCriticalSection(&wma->cs);
711  return 0;
712 }
LPWAVEFORMATEX lpWaveFormat
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define MCI_MODE_PLAY
Definition: mmsystem.h:696
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
UINT WINAPI waveOutPause(HWAVEOUT hWaveOut)
Definition: winmm.c:2374
#define MCI_TEST
Definition: digitalv.h:32
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
WINE_MCIAVI * MCIAVI_mciGetOpenDev(UINT wDevID)
Definition: mciavi.c:157
CRITICAL_SECTION cs
#define MCI_MODE_PAUSE
Definition: mmsystem.h:699
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define MCIERR_INVALID_DEVICE_ID
Definition: mmsystem.h:569

Referenced by MCIAVI_DriverProc().

◆ MCIAVI_mciPlay()

static DWORD MCIAVI_mciPlay ( UINT  wDevID,
DWORD  dwFlags,
LPMCI_PLAY_PARMS  lpParms 
)
static

Definition at line 543 of file mciavi.c.

544 {
545  WINE_MCIAVI *wma;
546  DWORD dwRet;
547  DWORD dwFromFrame, dwToFrame;
548 
549  TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);
550 
551  if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
552 
553  wma = MCIAVI_mciGetOpenDev(wDevID);
554  if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
556  if (dwFlags & MCI_TEST) return 0;
557 
559  FIXME("Unsupported flag %08x\n", dwFlags);
560 
561  EnterCriticalSection(&wma->cs);
562 
563  if (!wma->hFile)
564  {
565  LeaveCriticalSection(&wma->cs);
566  return MCIERR_FILE_NOT_FOUND;
567  }
568  if (!wma->hWndPaint)
569  {
570  LeaveCriticalSection(&wma->cs);
571  return MCIERR_NO_WINDOW;
572  }
573 
574  dwFromFrame = wma->dwCurrVideoFrame;
575  dwToFrame = wma->dwPlayableVideoFrames - 1;
576 
577  if (dwFlags & MCI_FROM) {
578  dwFromFrame = MCIAVI_ConvertTimeFormatToFrame(wma, lpParms->dwFrom);
579  }
580  if (dwFlags & MCI_TO) {
581  dwToFrame = MCIAVI_ConvertTimeFormatToFrame(wma, lpParms->dwTo);
582  }
583  if (dwToFrame >= wma->dwPlayableVideoFrames)
584  dwToFrame = wma->dwPlayableVideoFrames - 1;
585 
586  TRACE("Playing from frame=%u to frame=%u\n", dwFromFrame, dwToFrame);
587 
588  wma->dwCurrVideoFrame = dwFromFrame;
589  wma->dwToVideoFrame = dwToFrame;
590 
591  LeaveCriticalSection(&wma->cs);
592 
594  {
595  HMONITOR mon = MonitorFromWindow(wma->hWndPaint, MONITOR_DEFAULTTONEAREST);
596  MONITORINFO mi;
597  mi.cbSize = sizeof(mi);
598  GetMonitorInfoA(mon, &mi);
601  NULL, NULL, NULL, 0);
602  }
603  /* if not fullscreen ensure the window is visible */
604  else if (!(GetWindowLongW(wma->hWndPaint, GWL_STYLE) & WS_VISIBLE))
606 
607  EnterCriticalSection(&wma->cs);
608 
609  /* if already playing exit */
610  if (wma->dwStatus == MCI_MODE_PLAY)
611  {
612  LeaveCriticalSection(&wma->cs);
613  return 0;
614  }
615 
616  wma->dwStatus = MCI_MODE_PLAY;
617 
618  LeaveCriticalSection(&wma->cs);
619 
620  if (dwFlags & MCI_WAIT)
621  return MCIAVI_player(wma, dwFlags, lpParms);
622 
623  dwRet = MCIAVI_mciPlay_async(wma, dwFlags, lpParms);
624 
625  if (dwRet) {
626  EnterCriticalSection(&wma->cs);
627  wma->dwStatus = MCI_MODE_STOP;
628  LeaveCriticalSection(&wma->cs);
629  }
630  return dwRet;
631 }
#define MCI_MODE_STOP
Definition: mmsystem.h:695
#define MCI_MCIAVI_PLAY_WINDOW
Definition: mciavi.h:4
static DWORD MCIAVI_player(WINE_MCIAVI *wma, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms)
Definition: mciavi.c:347
#define MCI_WAIT
Definition: mmsystem.h:730
#define MCI_DGV_PLAY_REVERSE
Definition: digitalv.h:228
#define MCIERR_UNSUPPORTED_FUNCTION
Definition: mmsystem.h:584
LONG top
Definition: windef.h:307
static MONITORINFO mi
Definition: win.c:7339
LONG left
Definition: windef.h:306
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
LONG right
Definition: windef.h:308
RECT rcMonitor
Definition: winuser.h:3760
#define MCI_MCIAVI_PLAY_FULLBY2
Definition: mciavi.h:6
DWORD MCIAVI_ConvertTimeFormatToFrame(WINE_MCIAVI *wma, DWORD val)
Definition: info.c:52
#define MCI_MODE_PLAY
Definition: mmsystem.h:696
#define FIXME(fmt,...)
Definition: debug.h:111
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4290
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
smooth NULL
Definition: ftsmooth.c:416
DWORD dwToVideoFrame
#define TRACE(s)
Definition: solgame.cpp:4
#define MCI_TEST
Definition: digitalv.h:32
DWORD dwCurrVideoFrame
unsigned long DWORD
Definition: ntddk_ex.h:95
static DWORD MCIAVI_mciPlay_async(WINE_MCIAVI *wma, DWORD dwFlags, LPMCI_PLAY_PARMS lpParams)
Definition: mciavi.c:518
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define MCI_MCIAVI_PLAY_FULLSCREEN
Definition: mciavi.h:5
#define SW_SHOWNA
Definition: winuser.h:772
WINE_MCIAVI * MCIAVI_mciGetOpenDev(UINT wDevID)
Definition: mciavi.c:157
#define GWL_STYLE
Definition: winuser.h:846
BOOL WINAPI GetMonitorInfoA(_In_ HMONITOR, _Inout_ LPMONITORINFO)
#define MCIERR_FILE_NOT_FOUND
Definition: mmsystem.h:585
DWORD cbSize
Definition: winuser.h:3759
HMONITOR WINAPI MonitorFromWindow(HWND, DWORD)
#define WS_POPUP
Definition: pedump.c:616
CRITICAL_SECTION cs
DWORD dwPlayableVideoFrames
#define MCI_FROM
Definition: mmsystem.h:731
LONG bottom
Definition: windef.h:309
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define MCIERR_INVALID_DEVICE_ID
Definition: mmsystem.h:569
#define MCIERR_NO_WINDOW
Definition: mmsystem.h:639
#define WS_VISIBLE
Definition: pedump.c:620
#define MCIERR_NULL_PARAMETER_BLOCK
Definition: mmsystem.h:605
#define MCI_TO
Definition: mmsystem.h:732

Referenced by MCIAVI_DriverProc().

◆ MCIAVI_mciPlay_async()

static DWORD MCIAVI_mciPlay_async ( WINE_MCIAVI wma,
DWORD  dwFlags,
LPMCI_PLAY_PARMS  lpParams 
)
static

Definition at line 518 of file mciavi.c.

519 {
520  HANDLE handle;
521  struct MCIAVI_play_data *data = HeapAlloc(GetProcessHeap(), 0, sizeof(struct MCIAVI_play_data));
522 
523  if (!data) return MCIERR_OUT_OF_MEMORY;
524 
525  data->wma = wma;
526  data->flags = dwFlags;
527  if (dwFlags & MCI_NOTIFY)
528  data->params.dwCallback = lpParams->dwCallback;
529 
531  {
532  WARN("Couldn't create thread for async play, playing synchronously\n");
533  return MCIAVI_mciPlay_thread(data);
534  }
537  return 0;
538 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#define CloseHandle
Definition: compat.h:487
#define WARN(fmt,...)
Definition: debug.h:112
DWORD_PTR dwCallback
Definition: mmsystem.h:1537
WINE_MCIAVI * wma
Definition: mciavi.c:491
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:136
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI SetThreadPriority(IN HANDLE hThread, IN int nPriority)
Definition: thread.c:699
#define MCIERR_OUT_OF_MEMORY
Definition: mmsystem.h:574
#define GetProcessHeap()
Definition: compat.h:484
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define THREAD_PRIORITY_TIME_CRITICAL
Definition: winbase.h:278
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
static DWORD WINAPI MCIAVI_mciPlay_thread(LPVOID arg)
Definition: mciavi.c:502
#define MCI_NOTIFY
Definition: mmsystem.h:729

Referenced by MCIAVI_mciPlay().

◆ MCIAVI_mciPlay_thread()

static DWORD WINAPI MCIAVI_mciPlay_thread ( LPVOID  arg)
static

Definition at line 502 of file mciavi.c.

503 {
504  struct MCIAVI_play_data *data = (struct MCIAVI_play_data *)arg;
505  DWORD ret;
506 
507  TRACE("In thread before async play command (id %u, flags %08x)\n", data->wma->wDevID, data->flags);
508  ret = MCIAVI_player(data->wma, data->flags, &data->params);
509  TRACE("In thread after async play command (id %u, flags %08x)\n", data->wma->wDevID, data->flags);
510 
512  return ret;
513 }
static DWORD MCIAVI_player(WINE_MCIAVI *wma, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms)
Definition: mciavi.c:347
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:484
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
int ret
#define HeapFree(x, y, z)
Definition: compat.h:483

Referenced by MCIAVI_mciPlay_async().

◆ MCIAVI_mciRealize()

static DWORD MCIAVI_mciRealize ( UINT  wDevID,
DWORD  dwFlags,
LPMCI_GENERIC_PARMS  lpParms 
)
static

Definition at line 806 of file mciavi.c.

807 {
808  WINE_MCIAVI *wma;
809 
810  FIXME("(%04x, %08x, %p) : stub\n", wDevID, dwFlags, lpParms);
811 
812  if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
813 
814  wma = MCIAVI_mciGetOpenDev(wDevID);
815  if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
816  if (dwFlags & MCI_TEST) return 0;
817 
818  return 0;
819 }
WINE_MCIAVI * wma
Definition: mciavi.c:491
#define FIXME(fmt,...)
Definition: debug.h:111
smooth NULL
Definition: ftsmooth.c:416
#define MCI_TEST
Definition: digitalv.h:32
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
WINE_MCIAVI * MCIAVI_mciGetOpenDev(UINT wDevID)
Definition: mciavi.c:157
#define MCIERR_INVALID_DEVICE_ID
Definition: mmsystem.h:569
#define MCIERR_NULL_PARAMETER_BLOCK
Definition: mmsystem.h:605

Referenced by MCIAVI_DriverProc().

◆ MCIAVI_mciResume()

static DWORD MCIAVI_mciResume ( UINT  wDevID,
DWORD  dwFlags,
LPMCI_GENERIC_PARMS  lpParms 
)
static

Definition at line 717 of file mciavi.c.

718 {
719  WINE_MCIAVI *wma;
720 
721  TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);
722 
723  wma = MCIAVI_mciGetOpenDev(wDevID);
724  if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
725  if (dwFlags & MCI_TEST) return 0;
726 
728 
729  if (wma->dwStatus == MCI_MODE_PAUSE)
731 
732  if (wma->lpWaveFormat) {
734  return waveOutRestart(wma->hWave);
735  }
736 
738  return 0;
739 }
LPWAVEFORMATEX lpWaveFormat
WINE_MCIAVI * wma
Definition: mciavi.c:491
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define MCI_MODE_PLAY
Definition: mmsystem.h:696
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define MCI_TEST
Definition: digitalv.h:32
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
WINE_MCIAVI * MCIAVI_mciGetOpenDev(UINT wDevID)
Definition: mciavi.c:157
UINT WINAPI waveOutRestart(HWAVEOUT hWaveOut)
Definition: winmm.c:2402
CRITICAL_SECTION cs
#define MCI_MODE_PAUSE
Definition: mmsystem.h:699
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define MCIERR_INVALID_DEVICE_ID
Definition: mmsystem.h:569

Referenced by MCIAVI_DriverProc().

◆ MCIAVI_mciSeek()

static DWORD MCIAVI_mciSeek ( UINT  wDevID,
DWORD  dwFlags,
LPMCI_SEEK_PARMS  lpParms 
)
static

Definition at line 744 of file mciavi.c.

745 {
746  WINE_MCIAVI *wma;
747  DWORD position;
748 
749  TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);
750 
751  if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
752 
753  wma = MCIAVI_mciGetOpenDev(wDevID);
754  if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
755 
757  if (!position) return MCIERR_MISSING_PARAMETER;
758  if (position&(position-1)) return MCIERR_FLAGS_NOT_COMPATIBLE;
759 
760  if (dwFlags & MCI_TO) {
761  position = MCIAVI_ConvertTimeFormatToFrame(wma, lpParms->dwTo);
762  if (position >= wma->dwPlayableVideoFrames)
763  return MCIERR_OUTOFRANGE;
764  } else if (dwFlags & MCI_SEEK_TO_START) {
765  position = 0;
766  } else {
767  position = wma->dwPlayableVideoFrames - 1;
768  }
769  if (dwFlags & MCI_TEST) return 0;
770 
771  MCIAVI_mciStop(wDevID, MCI_WAIT, NULL);
772 
774 
775  wma->dwCurrVideoFrame = position;
776  TRACE("Seeking to frame=%u\n", wma->dwCurrVideoFrame);
777 
778  if (dwFlags & MCI_NOTIFY) {
780  wDevID, MCI_NOTIFY_SUCCESSFUL);
781  }
783  return 0;
784 }
#define MCI_WAIT
Definition: mmsystem.h:730
WINE_MCIAVI * wma
Definition: mciavi.c:491
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
DWORD MCIAVI_ConvertTimeFormatToFrame(WINE_MCIAVI *wma, DWORD val)
Definition: info.c:52
BOOL WINAPI mciDriverNotify(HWND hwndCallback, UINT uDeviceID, UINT uStatus)
Definition: mci.c:2056
#define MCIERR_FLAGS_NOT_COMPATIBLE
Definition: mmsystem.h:593
smooth NULL
Definition: ftsmooth.c:416
#define MCIERR_MISSING_PARAMETER
Definition: mmsystem.h:583
#define TRACE(s)
Definition: solgame.cpp:4
#define MCI_TEST
Definition: digitalv.h:32
DWORD dwCurrVideoFrame
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD_PTR dwCallback
Definition: mmsystem.h:1543
#define MCI_NOTIFY_SUCCESSFUL
Definition: mmsystem.h:725
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define MCI_SEEK_TO_END
Definition: mmsystem.h:741
#define MCIERR_OUTOFRANGE
Definition: mmsystem.h:592
static DWORD MCIAVI_mciStop(UINT, DWORD, LPMCI_GENERIC_PARMS)
Definition: mciavi.c:636
#define MCI_SEEK_TO_START
Definition: mmsystem.h:740
WINE_MCIAVI * MCIAVI_mciGetOpenDev(UINT wDevID)
Definition: mciavi.c:157
#define HWND_32(h16)
Definition: wownt32.h:29
CRITICAL_SECTION cs
DWORD dwPlayableVideoFrames
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define MCIERR_INVALID_DEVICE_ID
Definition: mmsystem.h:569
#define MCI_NOTIFY
Definition: mmsystem.h:729
#define MCIERR_NULL_PARAMETER_BLOCK
Definition: mmsystem.h:605
#define LOWORD(l)
Definition: pedump.c:82
#define MCI_TO
Definition: mmsystem.h:732

Referenced by MCIAVI_DriverProc().

◆ MCIAVI_mciSetAudio()

static DWORD MCIAVI_mciSetAudio ( UINT  wDevID,
DWORD  dwFlags,
LPMCI_DGV_SETAUDIO_PARMSW  lpParms 
)
static

Definition at line 929 of file mciavi.c.

930 {
931  WINE_MCIAVI *wma;
932 
933  if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
934 
935  FIXME("(%04x, %08x, %p) Item %04x: stub\n", wDevID, dwFlags, lpParms, dwFlags & MCI_DGV_SETAUDIO_ITEM ? lpParms->dwItem : 0);
936 
937  wma = MCIAVI_mciGetOpenDev(wDevID);
938  if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
939 
940  return 0;
941 }
WINE_MCIAVI * wma
Definition: mciavi.c:491
#define MCI_DGV_SETAUDIO_ITEM
Definition: digitalv.h:296
#define FIXME(fmt,...)
Definition: debug.h:111
smooth NULL
Definition: ftsmooth.c:416
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
WINE_MCIAVI * MCIAVI_mciGetOpenDev(UINT wDevID)
Definition: mciavi.c:157
#define MCIERR_INVALID_DEVICE_ID
Definition: mmsystem.h:569
#define MCIERR_NULL_PARAMETER_BLOCK
Definition: mmsystem.h:605

Referenced by MCIAVI_DriverProc().

◆ MCIAVI_mciSetVideo()

static DWORD MCIAVI_mciSetVideo ( UINT  wDevID,
DWORD  dwFlags,
LPMCI_DGV_SETVIDEO_PARMSW  lpParms 
)
static

Definition at line 963 of file mciavi.c.

964 {
965  WINE_MCIAVI *wma;
966 
967  if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
968 
969  FIXME("(%04x, %08x, %p) Item %04x: stub\n", wDevID, dwFlags, lpParms, dwFlags & MCI_DGV_SETVIDEO_ITEM ? lpParms->dwItem : 0);
970 
971  wma = MCIAVI_mciGetOpenDev(wDevID);
972  if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
973 
974  return 0;
975 }
#define MCI_DGV_SETVIDEO_ITEM
Definition: digitalv.h:327
WINE_MCIAVI * wma
Definition: mciavi.c:491
#define FIXME(fmt,...)
Definition: debug.h:111
smooth NULL
Definition: ftsmooth.c:416
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
WINE_MCIAVI * MCIAVI_mciGetOpenDev(UINT wDevID)
Definition: mciavi.c:157
#define MCIERR_INVALID_DEVICE_ID
Definition: mmsystem.h:569
#define MCIERR_NULL_PARAMETER_BLOCK
Definition: mmsystem.h:605

Referenced by MCIAVI_DriverProc().

◆ MCIAVI_mciSignal()

static DWORD MCIAVI_mciSignal ( UINT  wDevID,
DWORD  dwFlags,
LPMCI_DGV_SIGNAL_PARMS  lpParms 
)
static

Definition at line 946 of file mciavi.c.

947 {
948  WINE_MCIAVI *wma;
949 
950  FIXME("(%04x, %08x, %p) : stub\n", wDevID, dwFlags, lpParms);
951 
952  if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
953 
954  wma = MCIAVI_mciGetOpenDev(wDevID);
955  if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
956 
957  return 0;
958 }
WINE_MCIAVI * wma
Definition: mciavi.c:491
#define FIXME(fmt,...)
Definition: debug.h:111
smooth NULL
Definition: ftsmooth.c:416
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
WINE_MCIAVI * MCIAVI_mciGetOpenDev(UINT wDevID)
Definition: mciavi.c:157
#define MCIERR_INVALID_DEVICE_ID
Definition: mmsystem.h:569
#define MCIERR_NULL_PARAMETER_BLOCK
Definition: mmsystem.h:605

Referenced by MCIAVI_DriverProc().

◆ MCIAVI_mciStep()

static DWORD MCIAVI_mciStep ( UINT  wDevID,
DWORD  dwFlags,
LPMCI_DGV_STEP_PARMS  lpParms 
)
static

Definition at line 849 of file mciavi.c.

850 {
851  WINE_MCIAVI *wma;
852  DWORD position;
853  int delta = 1;
854 
855  TRACE("(%04x, %08x, %p)\n", wDevID, dwFlags, lpParms);
856 
857  if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
858 
859  wma = MCIAVI_mciGetOpenDev(wDevID);
860  if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
861 
862  if (dwFlags & MCI_DGV_STEP_FRAMES) delta = lpParms->dwFrames;
863  if (dwFlags & MCI_DGV_STEP_REVERSE) delta = -delta;
864  position = wma->dwCurrVideoFrame + delta;
865  if (position >= wma->dwPlayableVideoFrames) return MCIERR_OUTOFRANGE;
866  if (dwFlags & MCI_TEST) return 0;
867 
868  MCIAVI_mciStop(wDevID, MCI_WAIT, NULL);
869 
871 
872  wma->dwCurrVideoFrame = position;
873  TRACE("Stepping to frame=%u\n", wma->dwCurrVideoFrame);
874 
875  if (dwFlags & MCI_NOTIFY) {
877  wDevID, MCI_NOTIFY_SUCCESSFUL);
878  }
880  return 0;
881 }
#define MCI_WAIT
Definition: mmsystem.h:730
WINE_MCIAVI * wma
Definition: mciavi.c:491
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
BOOL WINAPI mciDriverNotify(HWND hwndCallback, UINT uDeviceID, UINT uStatus)
Definition: mci.c:2056
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define MCI_TEST
Definition: digitalv.h:32
DWORD dwCurrVideoFrame
unsigned long DWORD
Definition: ntddk_ex.h:95
#define MCI_DGV_STEP_FRAMES
Definition: digitalv.h:431
#define MCI_NOTIFY_SUCCESSFUL
Definition: mmsystem.h:725
DWORD_PTR dwCallback
Definition: digitalv.h:822
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define MCIERR_OUTOFRANGE
Definition: mmsystem.h:592
static DWORD MCIAVI_mciStop(UINT, DWORD, LPMCI_GENERIC_PARMS)
Definition: mciavi.c:636
#define MCI_DGV_STEP_REVERSE
Definition: digitalv.h:430
WINE_MCIAVI * MCIAVI_mciGetOpenDev(UINT wDevID)
Definition: mciavi.c:157
#define HWND_32(h16)
Definition: wownt32.h:29
CRITICAL_SECTION cs
DWORD dwPlayableVideoFrames
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define MCIERR_INVALID_DEVICE_ID
Definition: mmsystem.h:569
#define MCI_NOTIFY
Definition: mmsystem.h:729
#define MCIERR_NULL_PARAMETER_BLOCK
Definition: mmsystem.h:605
#define LOWORD(l)
Definition: pedump.c:82

Referenced by MCIAVI_DriverProc().

◆ MCIAVI_mciStop()

static DWORD MCIAVI_mciStop ( UINT  wDevID,
DWORD  dwFlags,
LPMCI_GENERIC_PARMS  lpParms 
)
static

Definition at line 636 of file mciavi.c.

637 {
638  WINE_MCIAVI *wma;
639  DWORD dwRet = 0;
640 
641  TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);
642 
643  wma = MCIAVI_mciGetOpenDev(wDevID);
644  if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
645  if (dwFlags & MCI_TEST) return 0;
646 
648 
649  TRACE("current status %04x\n", wma->dwStatus);
650 
651  switch (wma->dwStatus) {
652  case MCI_MODE_PLAY:
653  case MCI_MODE_RECORD:
657  /* fall through */
658  case MCI_MODE_PAUSE:
659  /* Since our wave notification callback takes the lock,
660  * we must release it before resetting the device */
662  dwRet = waveOutReset(wma->hWave);
664  /* fall through */
665  default:
666  do /* one more chance for an async thread to finish */
667  {
669  Sleep(10);
671  } while (wma->dwStatus != MCI_MODE_STOP);
672 
673  break;
674 
675  case MCI_MODE_NOT_READY:
676  break;
677  }
678 
679  if ((dwFlags & MCI_NOTIFY) && lpParms) {
681  wDevID, MCI_NOTIFY_SUCCESSFUL);
682  }
684  return dwRet;
685 }
#define MCI_MODE_STOP
Definition: mmsystem.h:695
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
WINE_MCIAVI * wma
Definition: mciavi.c:491
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
BOOL WINAPI mciDriverNotify(HWND hwndCallback, UINT uDeviceID, UINT uStatus)
Definition: mci.c:2056
#define MCI_MODE_RECORD
Definition: mmsystem.h:697
#define MCI_MODE_PLAY
Definition: mmsystem.h:696
smooth NULL
Definition: ftsmooth.c:416
HANDLE hStopEvent
#define TRACE(s)
Definition: solgame.cpp:4
#define MCI_TEST
Definition: digitalv.h:32
unsigned long DWORD
Definition: ntddk_ex.h:95
#define MCI_NOTIFY_SUCCESSFUL
Definition: mmsystem.h:725
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
WINE_MCIAVI * MCIAVI_mciGetOpenDev(UINT wDevID)
Definition: mciavi.c:157
#define HWND_32(h16)
Definition: wownt32.h:29
#define MCI_MODE_NOT_READY
Definition: mmsystem.h:694
DWORD_PTR dwCallback
Definition: mmsystem.h:1517
CRITICAL_SECTION cs
#define MCI_MODE_PAUSE
Definition: mmsystem.h:699
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define MCIERR_INVALID_DEVICE_ID
Definition: mmsystem.h:569
#define MCI_NOTIFY
Definition: mmsystem.h:729
UINT WINAPI waveOutReset(HWAVEOUT hWaveOut)
Definition: winmm.c:2388
#define LOWORD(l)
Definition: pedump.c:82

Referenced by MCIAVI_DriverProc(), MCIAVI_drvConfigure(), MCIAVI_mciClose(), MCIAVI_mciSeek(), and MCIAVI_mciStep().

◆ MCIAVI_mciUpdate()

static DWORD MCIAVI_mciUpdate ( UINT  wDevID,
DWORD  dwFlags,
LPMCI_DGV_UPDATE_PARMS  lpParms 
)
static

Definition at line 824 of file mciavi.c.

825 {
826  WINE_MCIAVI *wma;
827 
828  TRACE("%04x, %08x, %p\n", wDevID, dwFlags, lpParms);
829 
830  if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
831 
832  wma = MCIAVI_mciGetOpenDev(wDevID);
833  if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
834  /* Ignore MCI_TEST flag. */
835 
837 
839  MCIAVI_PaintFrame(wma, lpParms->hDC);
840 
842 
843  return 0;
844 }
WINE_MCIAVI * wma
Definition: mciavi.c:491
#define MCI_DGV_UPDATE_HDC
Definition: digitalv.h:439
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
WINE_MCIAVI * MCIAVI_mciGetOpenDev(UINT wDevID)
Definition: mciavi.c:157
CRITICAL_SECTION cs
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define MCIERR_INVALID_DEVICE_ID
Definition: mmsystem.h:569
#define MCIERR_NULL_PARAMETER_BLOCK
Definition: mmsystem.h:605
double MCIAVI_PaintFrame(WINE_MCIAVI *wma, HDC hDC)
Definition: mmoutput.c:604

Referenced by MCIAVI_DriverProc().

◆ MCIAVI_player()

static DWORD MCIAVI_player ( WINE_MCIAVI wma,
DWORD  dwFlags,
LPMCI_PLAY_PARMS  lpParms 
)
static

Definition at line 347 of file mciavi.c.

348 {
349  DWORD dwRet;
350  LPWAVEHDR waveHdr = NULL;
351  unsigned i, nHdr = 0;
352  DWORD numEvents = 1;
353  HANDLE events[2];
354  double next_frame_us;
355  BOOL wait_audio = TRUE;
356 
358 
360  {
361  dwRet = 0;
362  goto mci_play_done;
363  }
364 
365  events[0] = wma->hStopEvent;
366  if (wma->lpWaveFormat) {
367  if (MCIAVI_OpenAudio(wma, &nHdr, &waveHdr) != 0)
368  {
369  /* can't play audio */
371  wma->lpWaveFormat = NULL;
372  }
373  else
374  {
375  /* fill the queue with as many wave headers as possible */
376  MCIAVI_PlayAudioBlocks(wma, nHdr, waveHdr);
377  events[1] = wma->hEvent;
378  numEvents = 2;
379  }
380  }
381 
382  next_frame_us = currenttime_us();
383  while (wma->dwStatus == MCI_MODE_PLAY)
384  {
385  HDC hDC;
386  double tc, delta;
387  DWORD ret;
388 
389  tc = currenttime_us();
390 
391  hDC = wma->hWndPaint ? GetDC(wma->hWndPaint) : 0;
392  if (hDC)
393  {
394  while(next_frame_us <= tc && wma->dwCurrVideoFrame < wma->dwToVideoFrame){
395  double dur;
396  dur = MCIAVI_PaintFrame(wma, hDC);
398  if(!dur)
399  break;
400  next_frame_us += dur;
401  TRACE("next_frame: %f\n", next_frame_us);
402  }
404  }
406  {
407  if (!(dwFlags & MCI_DGV_PLAY_REPEAT))
408  break;
409  TRACE("repeat media as requested\n");
411  }
412 
413  if (wma->lpWaveFormat)
414  MCIAVI_PlayAudioBlocks(wma, nHdr, waveHdr);
415 
416  tc = currenttime_us();
417  if (tc < next_frame_us)
418  delta = next_frame_us - tc;
419  else
420  delta = 0;
421 
422  /* check if the playback was cancelled */
423  if ((wma->mci_break.flags & MCI_BREAK_KEY) &&
424  (GetAsyncKeyState(wma->mci_break.parms.nVirtKey) & 0x8000))
425  {
426  if (!(wma->mci_break.flags & MCI_BREAK_HWND) ||
427  GetForegroundWindow() == wma->mci_break.parms.hwndBreak)
428  {
429  /* we queue audio blocks ahead so ignore them otherwise the audio
430  * will keep playing until the buffer is empty */
431  wait_audio = FALSE;
432 
433  TRACE("playback cancelled using break key\n");
434  break;
435  }
436  }
437 
439  ret = WaitForMultipleObjects(numEvents, events, FALSE, delta / 1000);
441  if (ret == WAIT_OBJECT_0 || wma->dwStatus != MCI_MODE_PLAY) break;
442  }
443 
444  if (wma->lpWaveFormat)
445  {
446  if (wait_audio)
447  while (wma->dwEventCount != nHdr - 1)
448  {
450  Sleep(100);
452  }
453 
454  /* just to get rid of some race conditions between play, stop and pause */
458 
459  for (i = 0; i < nHdr; i++)
460  waveOutUnprepareHeader(wma->hWave, &waveHdr[i], sizeof(WAVEHDR));
461  }
462 
463  dwRet = 0;
464 
465  if (wma->lpWaveFormat) {
466  HeapFree(GetProcessHeap(), 0, waveHdr);
467 
468  if (wma->hWave) {
472  wma->hWave = 0;
473  }
475  }
476 
477 mci_play_done:
479 
480  if (dwFlags & MCI_NOTIFY) {
481  TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
484  }
486  return dwRet;
487 }
#define MCI_MODE_STOP
Definition: mmsystem.h:695
#define CloseHandle
Definition: compat.h:487
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
HDC WINAPI GetDC(_In_opt_ HWND)
#define TRUE
Definition: types.h:120
LPWAVEFORMATEX lpWaveFormat
static HDC
Definition: imagelist.c:92
DWORD_PTR dwCallback
Definition: mmsystem.h:1537
WINE_MCIAVI * wma
Definition: mciavi.c:491
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
DWORD WINAPI WaitForMultipleObjects(IN DWORD nCount, IN CONST HANDLE *lpHandles, IN BOOL bWaitAll, IN DWORD dwMilliseconds)
Definition: synch.c:151
BOOL WINAPI mciDriverNotify(HWND hwndCallback, UINT uDeviceID, UINT uStatus)
Definition: mci.c:2056
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define MCI_MODE_PLAY
Definition: mmsystem.h:696
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
const GLfloat * tc
Definition: glext.h:8925
smooth NULL
Definition: ftsmooth.c:416
DWORD dwToVideoFrame
#define MCI_BREAK_HWND
Definition: mmsystem.h:783
HANDLE hStopEvent
#define MCI_DGV_PLAY_REPEAT
Definition: digitalv.h:227
#define TRACE(s)
Definition: solgame.cpp:4
#define WAIT_OBJECT_0
Definition: winbase.h:387
#define GetProcessHeap()
Definition: compat.h:484
DWORD dwCurrVideoFrame
unsigned long DWORD
Definition: ntddk_ex.h:95
struct WINE_MCIAVI::@460 mci_break
#define MCI_NOTIFY_SUCCESSFUL
Definition: mmsystem.h:725
int ret
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
SHORT WINAPI GetAsyncKeyState(_In_ int)
DWORD dwCurrAudioBlock
UINT WINAPI waveOutUnprepareHeader(HWAVEOUT hWaveOut, LPWAVEHDR lpWaveOutHdr, UINT uSize)
Definition: winmm.c:2310
#define MCI_BREAK_KEY
Definition: mmsystem.h:782
MCIDEVICEID wDevID
static HDC hDC
Definition: 3dtext.c:33
#define HWND_32(h16)
Definition: wownt32.h:29
static double currenttime_us(void)
Definition: mciavi.c:336
UINT WINAPI waveOutClose(HWAVEOUT hWaveOut)
Definition: winmm.c:2260
HWND WINAPI GetForegroundWindow(void)
Definition: ntwrapper.h:392
HANDLE events[2]
Definition: event.c:4
CRITICAL_SECTION cs
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define MCI_NOTIFY
Definition: mmsystem.h:729
UINT WINAPI waveOutReset(HWAVEOUT hWaveOut)
Definition: winmm.c:2388
#define LOWORD(l)
Definition: pedump.c:82
#define HeapFree(x, y, z)
Definition: compat.h:483
void MCIAVI_PlayAudioBlocks(WINE_MCIAVI *wma, unsigned nHdr, LPWAVEHDR waveHdr)
Definition: mmoutput.c:575
double MCIAVI_PaintFrame(WINE_MCIAVI *wma, HDC hDC)
Definition: mmoutput.c:604
DWORD MCIAVI_OpenAudio(WINE_MCIAVI *wma, unsigned *nHdr, LPWAVEHDR *pWaveHdr)
Definition: mmoutput.c:525

Referenced by MCIAVI_mciPlay(), and MCIAVI_mciPlay_thread().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( mciavi  )

Variable Documentation

◆ MCIAVI_hInstance

HINSTANCE MCIAVI_hInstance = 0