ReactOS  0.4.13-dev-551-gf37fb1f
mciavi.c File Reference
#include <string.h>
#include "private_mciavi.h"
#include "wine/debug.h"
#include "wine/unicode.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 337 of file mciavi.c.

338 {
339  LARGE_INTEGER lc, lf;
342  return (lc.QuadPart * 1000000) / lf.QuadPart;
343 }
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:112

Referenced by MCIAVI_player().

◆ DllMain()

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

Definition at line 58 of file mciavi.c.

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

◆ MCIAVI_CleanUp()

static void MCIAVI_CleanUp ( WINE_MCIAVI wma)
static

Definition at line 169 of file mciavi.c.

170 {
171  /* to prevent handling in WindowProc */
173  if (wma->hFile) {
174  mmioClose(wma->hFile, 0);
175  wma->hFile = 0;
176 
177  HeapFree(GetProcessHeap(), 0, wma->lpFileName);
178  wma->lpFileName = NULL;
179 
181  wma->lpVideoIndex = NULL;
183  wma->lpAudioIndex = NULL;
184  if (wma->hic) ICClose(wma->hic);
185  wma->hic = 0;
186  HeapFree(GetProcessHeap(), 0, wma->inbih);
187  wma->inbih = NULL;
188  HeapFree(GetProcessHeap(), 0, wma->outbih);
189  wma->outbih = NULL;
190  HeapFree(GetProcessHeap(), 0, wma->indata);
191  wma->indata = NULL;
192  HeapFree(GetProcessHeap(), 0, wma->outdata);
193  wma->outdata = NULL;
194  if (wma->hbmFrame) DeleteObject(wma->hbmFrame);
195  wma->hbmFrame = 0;
196  if (wma->hWnd) DestroyWindow(wma->hWnd);
197  wma->hWnd = 0;
198 
200  wma->lpWaveFormat = 0;
201 
202  memset(&wma->mah, 0, sizeof(wma->mah));
203  memset(&wma->ash_video, 0, sizeof(wma->ash_video));
204  memset(&wma->ash_audio, 0, sizeof(wma->ash_audio));
205  wma->dwCurrVideoFrame = wma->dwCurrAudioBlock = 0;
206  wma->dwCachedFrame = -1;
207  }
208 }
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:395
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:394

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 992 of file mciavi.c.

994 {
995  TRACE("(%08lX, %p, %08X, %08lX, %08lX)\n",
996  dwDevID, hDriv, wMsg, dwParam1, dwParam2);
997 
998  switch (wMsg) {
999  case DRV_LOAD: return 1;
1000  case DRV_FREE: return 1;
1001  case DRV_OPEN: return MCIAVI_drvOpen((LPCWSTR)dwParam1, (LPMCI_OPEN_DRIVER_PARMSW)dwParam2);
1002  case DRV_CLOSE: return MCIAVI_drvClose(dwDevID);
1003  case DRV_ENABLE: return 1;
1004  case DRV_DISABLE: return 1;
1005  case DRV_QUERYCONFIGURE: return 1;
1006  case DRV_CONFIGURE: return MCIAVI_drvConfigure(dwDevID);
1007  case DRV_INSTALL: return DRVCNF_RESTART;
1008  case DRV_REMOVE: return DRVCNF_RESTART;
1009  }
1010 
1011  /* session instance */
1012  if (dwDevID == 0xFFFFFFFF) return 1;
1013 
1014  switch (wMsg) {
1015  case MCI_OPEN_DRIVER: return MCIAVI_mciOpen (dwDevID, dwParam1, (LPMCI_DGV_OPEN_PARMSW) dwParam2);
1016  case MCI_CLOSE_DRIVER: return MCIAVI_mciClose (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
1017  case MCI_PLAY: return MCIAVI_mciPlay (dwDevID, dwParam1, (LPMCI_PLAY_PARMS) dwParam2);
1018  case MCI_STOP: return MCIAVI_mciStop (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
1019  case MCI_SET: return MCIAVI_mciSet (dwDevID, dwParam1, (LPMCI_DGV_SET_PARMS) dwParam2);
1020  case MCI_PAUSE: return MCIAVI_mciPause (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
1021  case MCI_RESUME: return MCIAVI_mciResume (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
1022  case MCI_STATUS: return MCIAVI_mciStatus (dwDevID, dwParam1, (LPMCI_DGV_STATUS_PARMSW) dwParam2);
1023  case MCI_GETDEVCAPS: return MCIAVI_mciGetDevCaps(dwDevID, dwParam1, (LPMCI_GETDEVCAPS_PARMS) dwParam2);
1024  case MCI_INFO: return MCIAVI_mciInfo (dwDevID, dwParam1, (LPMCI_DGV_INFO_PARMSW) dwParam2);
1025  case MCI_SEEK: return MCIAVI_mciSeek (dwDevID, dwParam1, (LPMCI_SEEK_PARMS) dwParam2);
1026  case MCI_PUT: return MCIAVI_mciPut (dwDevID, dwParam1, (LPMCI_DGV_PUT_PARMS) dwParam2);
1027  case MCI_WINDOW: return MCIAVI_mciWindow (dwDevID, dwParam1, (LPMCI_DGV_WINDOW_PARMSW) dwParam2);
1028  case MCI_LOAD: return MCIAVI_mciLoad (dwDevID, dwParam1, (LPMCI_DGV_LOAD_PARMSW) dwParam2);
1029  case MCI_REALIZE: return MCIAVI_mciRealize (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
1030  case MCI_UPDATE: return MCIAVI_mciUpdate (dwDevID, dwParam1, (LPMCI_DGV_UPDATE_PARMS) dwParam2);
1031  case MCI_WHERE: return MCIAVI_mciWhere (dwDevID, dwParam1, (LPMCI_DGV_RECT_PARMS) dwParam2);
1032  case MCI_STEP: return MCIAVI_mciStep (dwDevID, dwParam1, (LPMCI_DGV_STEP_PARMS) dwParam2);
1033  case MCI_CUE: return MCIAVI_mciCue (dwDevID, dwParam1, (LPMCI_DGV_CUE_PARMS) dwParam2);
1034  case MCI_BREAK: return MCIAVI_mciBreak (dwDevID, dwParam1, (LPMCI_BREAK_PARMS) dwParam2);
1035  /* Digital Video specific */
1036  case MCI_SETAUDIO: return MCIAVI_mciSetAudio (dwDevID, dwParam1, (LPMCI_DGV_SETAUDIO_PARMSW) dwParam2);
1037  case MCI_SIGNAL: return MCIAVI_mciSignal (dwDevID, dwParam1, (LPMCI_DGV_SIGNAL_PARMS) dwParam2);
1038  case MCI_SETVIDEO: return MCIAVI_mciSetVideo (dwDevID, dwParam1, (LPMCI_DGV_SETVIDEO_PARMSW) dwParam2);
1039  case MCI_CONFIGURE: return MCIAVI_mciConfigure (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
1040 
1041  /* no editing, recording, saving, locking without inputs */
1042  case MCI_CAPTURE:
1043  case MCI_COPY:
1044  case MCI_CUT:
1045  case MCI_DELETE:
1046  case MCI_FREEZE:
1047  case MCI_LIST:
1048  case MCI_MONITOR:
1049  case MCI_PASTE:
1050  case MCI_QUALITY:
1051  case MCI_RECORD:
1052  case MCI_RESERVE:
1053  case MCI_RESTORE:
1054  case MCI_SAVE:
1055  case MCI_UNDO:
1056  case MCI_UNFREEZE:
1057  TRACE("Unsupported function [0x%x] flags=%08x\n", wMsg, (DWORD)dwParam1);
1059  case MCI_SPIN:
1060  case MCI_ESCAPE:
1061  WARN("Unsupported command [0x%x] %08x\n", wMsg, (DWORD)dwParam1);
1062  break;
1063  case MCI_OPEN:
1064  case MCI_CLOSE:
1065  FIXME("Shouldn't receive a MCI_OPEN or CLOSE message\n");
1066  break;
1067  default:
1068  TRACE("Sending msg [%u] to default driver proc\n", wMsg);
1069  return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
1070  }
1072 }
static DWORD MCIAVI_mciUpdate(UINT wDevID, DWORD dwFlags, LPMCI_DGV_UPDATE_PARMS lpParms)
Definition: mciavi.c:814
#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:138
#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:213
#define MCIERR_UNSUPPORTED_FUNCTION
Definition: mmsystem.h:584
#define WARN(fmt,...)
Definition: debug.h:111
#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:680
DWORD MCIAVI_mciSet(UINT wDevID, DWORD dwFlags, LPMCI_DGV_SET_PARMS lpParms)
Definition: info.c:228
#define MCI_RECORD
Definition: mmsystem.h:658
DWORD MCIAVI_mciGetDevCaps(UINT wDevID, DWORD dwFlags, LPMCI_GETDEVCAPS_PARMS lpParms)
Definition: info.c:74
#define MCI_SIGNAL
Definition: digitalv.h:40
#define FIXME(fmt,...)
Definition: debug.h:110
#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:364
#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:707
#define MCI_CONFIGURE
Definition: digitalv.h:45
#define MCI_OPEN_DRIVER
Definition: mmddk.h:334
#define MCI_STATUS
Definition: mmsystem.h:662
static DWORD MCIAVI_drvOpen(LPCWSTR str, LPMCI_OPEN_DRIVER_PARMSW modp)
Definition: mciavi.c:72
#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:953
static DWORD MCIAVI_mciPlay(UINT wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms)
Definition: mciavi.c:544
static DWORD MCIAVI_drvClose(DWORD dwDevID)
Definition: mciavi.c:104
#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:189
#define MCI_SETVIDEO
Definition: digitalv.h:41
static DWORD MCIAVI_mciRealize(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
Definition: mciavi.c:796
static DWORD MCIAVI_mciConfigure(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
Definition: mciavi.c:970
#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:626
#define MCI_CLOSE_DRIVER
Definition: mmddk.h:335
static DWORD MCIAVI_mciCue(UINT wDevID, DWORD dwFlags, LPMCI_DGV_CUE_PARMS lpParms)
Definition: mciavi.c:876
#define DRV_ENABLE
Definition: mmsystem.h:120
static DWORD MCIAVI_mciSeek(UINT wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpParms)
Definition: mciavi.c:734
DWORD MCIAVI_mciClose(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
Definition: mciavi.c:306
#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:895
static DWORD MCIAVI_mciSignal(UINT wDevID, DWORD dwFlags, LPMCI_DGV_SIGNAL_PARMS lpParms)
Definition: mciavi.c:936
#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:919
#define MCI_UNDO
Definition: digitalv.h:44
static DWORD MCIAVI_mciLoad(UINT wDevID, DWORD dwFlags, LPMCI_DGV_LOAD_PARMSW lpParms)
Definition: mciavi.c:779
#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:839
#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 104 of file mciavi.c.

105 {
106  WINE_MCIAVI *wma;
107 
108  TRACE("%04x\n", dwDevID);
109 
110  /* finish all outstanding things */
111  MCIAVI_mciClose(dwDevID, MCI_WAIT, NULL);
112 
113  wma = (WINE_MCIAVI*)mciGetDriverData(dwDevID);
114 
115  if (wma) {
117 
118  EnterCriticalSection(&wma->cs);
119 
120  mciSetDriverData(dwDevID, 0);
122 
123  CloseHandle(wma->hStopEvent);
124 
125  LeaveCriticalSection(&wma->cs);
126  wma->cs.DebugInfo->Spare[0] = 0;
127  DeleteCriticalSection(&wma->cs);
128 
129  HeapFree(GetProcessHeap(), 0, wma);
130  return 1;
131  }
132  return (dwDevID == 0xFFFFFFFF) ? 1 : 0;
133 }
BOOL WINAPI mciSetDriverData(UINT uDeviceID, DWORD dwData)
DWORD WINAPI mciGetDriverData(UINT uDeviceID)
Definition: mci.c:2066
#define CloseHandle
Definition: compat.h:398
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:395
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
BOOL WINAPI mciFreeCommandResource(UINT uTable)
Definition: mci.c:1500
PCRITICAL_SECTION_DEBUG DebugInfo
Definition: winbase.h:859
DWORD MCIAVI_mciClose(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
Definition: mciavi.c:306
CRITICAL_SECTION cs
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
#define HeapFree(x, y, z)
Definition: compat.h:394
DWORD_PTR Spare[8/sizeof(DWORD_PTR)]
Definition: winbase.h:852

Referenced by MCIAVI_DriverProc().

◆ MCIAVI_drvConfigure()

static DWORD MCIAVI_drvConfigure ( DWORD  dwDevID)
static

Definition at line 138 of file mciavi.c.

139 {
140  WINE_MCIAVI *wma;
141 
142  TRACE("%04x\n", dwDevID);
143 
144  MCIAVI_mciStop(dwDevID, MCI_WAIT, NULL);
145 
146  wma = (WINE_MCIAVI*)mciGetDriverData(dwDevID);
147 
148  if (wma) {
149  MessageBoxA(0, "Sample AVI Wine Driver !", "MM-Wine Driver", MB_OK);
150  return 1;
151  }
152  return 0;
153 }
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:626
#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 72 of file mciavi.c.

73 {
74  WINE_MCIAVI* wma;
75  static const WCHAR mciAviWStr[] = {'M','C','I','A','V','I',0};
76 
77  TRACE("%s, %p\n", debugstr_w(str), modp);
78 
79  /* session instance */
80  if (!modp) return 0xFFFFFFFF;
81 
82  if (!MCIAVI_RegisterClass()) return 0;
83 
85  if (!wma)
86  return 0;
87 
89  wma->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": WINE_MCIAVI.cs");
91  wma->wDevID = modp->wDeviceID;
96  mciSetDriverData(wma->wDevID, (DWORD_PTR)wma);
97 
98  return modp->wDeviceID;
99 }
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:597
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:697
smooth NULL
Definition: ftsmooth.c:416
HANDLE hStopEvent
#define TRACE(s)
Definition: solgame.cpp:4
WORD wCommandTable
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
PCRITICAL_SECTION_DEBUG DebugInfo
Definition: winbase.h:859
uint32_t DWORD_PTR
Definition: typedefs.h:63
MCIDEVICEID wDevID
#define MCI_MODE_NOT_READY
Definition: mmsystem.h:694
HINSTANCE MCIAVI_hInstance
Definition: mciavi.c:53
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
CRITICAL_SECTION cs
DWORD_PTR Spare[8/sizeof(DWORD_PTR)]
Definition: winbase.h:852
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 895 of file mciavi.c.

896 {
897  WINE_MCIAVI *wma;
898 
899  TRACE("(%04x, %08x, %p)\n", wDevID, dwFlags, lpParms);
900 
901  if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
902 
903  wma = MCIAVI_mciGetOpenDev(wDevID);
904  if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
905 
906  EnterCriticalSection(&wma->cs);
907 
908  wma->mci_break.flags = dwFlags;
909  wma->mci_break.parms = *lpParms;
910 
911  LeaveCriticalSection(&wma->cs);
912 
913  return 0;
914 }
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
struct WINE_MCIAVI::@442 mci_break
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:158
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 306 of file mciavi.c.

307 {
308  WINE_MCIAVI *wma;
309  DWORD dwRet = 0;
310 
311  TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);
312 
313  wma = MCIAVI_mciGetOpenDev(wDevID);
314  if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
315 
316  MCIAVI_mciStop(wDevID, MCI_WAIT, NULL);
317 
318  EnterCriticalSection(&wma->cs);
319 
320  if (wma->nUseCount == 1) {
321  MCIAVI_CleanUp(wma);
322 
323  if ((dwFlags & MCI_NOTIFY) && lpParms) {
325  wDevID,
327  }
328  LeaveCriticalSection(&wma->cs);
329  return dwRet;
330  }
331  wma->nUseCount--;
332 
333  LeaveCriticalSection(&wma->cs);
334  return dwRet;
335 }
static void MCIAVI_CleanUp(WINE_MCIAVI *wma)
Definition: mciavi.c:169
#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:626
WINE_MCIAVI * MCIAVI_mciGetOpenDev(UINT wDevID)
Definition: mciavi.c:158
#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 970 of file mciavi.c.

971 {
972  WINE_MCIAVI *wma;
973 
974  FIXME("(%04x, %08x, %p) : stub\n", wDevID, dwFlags, lpParms);
975 
976  if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
977 
978  wma = MCIAVI_mciGetOpenDev(wDevID);
979  if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
980  if (dwFlags & MCI_TEST) return 0;
981 
982  return 0;
983 }
#define FIXME(fmt,...)
Definition: debug.h:110
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:158
#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 876 of file mciavi.c.

877 {
878  WINE_MCIAVI *wma;
879 
880  FIXME("(%04x, %08x, %p) : stub\n", wDevID, dwFlags, lpParms);
881 
882  if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
883 
884  wma = MCIAVI_mciGetOpenDev(wDevID);
885  if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
887  if (dwFlags & MCI_TEST) return 0;
888 
889  return 0;
890 }
#define MCIERR_UNSUPPORTED_FUNCTION
Definition: mmsystem.h:584
#define FIXME(fmt,...)
Definition: debug.h:110
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:158
#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 158 of file mciavi.c.

159 {
160  WINE_MCIAVI* wma = (WINE_MCIAVI*)mciGetDriverData(wDevID);
161 
162  if (wma == NULL || wma->nUseCount == 0) {
163  WARN("Invalid wDevID=%u\n", wDevID);
164  return 0;
165  }
166  return wma;
167 }
DWORD WINAPI mciGetDriverData(UINT uDeviceID)
Definition: mci.c:2066
#define WARN(fmt,...)
Definition: debug.h:111
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 779 of file mciavi.c.

780 {
781  WINE_MCIAVI *wma;
782 
783  FIXME("(%04x, %08x, %p) : stub\n", wDevID, dwFlags, lpParms);
784 
785  if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
786 
787  wma = MCIAVI_mciGetOpenDev(wDevID);
788  if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
789 
790  return MCIERR_UNSUPPORTED_FUNCTION; /* like w2k */
791 }
#define MCIERR_UNSUPPORTED_FUNCTION
Definition: mmsystem.h:584
#define FIXME(fmt,...)
Definition: debug.h:110
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:158
#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 213 of file mciavi.c.

215 {
216  WINE_MCIAVI *wma;
217  LRESULT dwRet = 0;
218 
219  TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpOpenParms);
220 
221  if (lpOpenParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
222 
223  wma = (WINE_MCIAVI *)mciGetDriverData(wDevID);
224  if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
225 
226  EnterCriticalSection(&wma->cs);
227 
228  if (wma->nUseCount > 0) {
229  /* The driver is already open on this channel */
230  /* If the driver was opened shareable before and this open specifies */
231  /* shareable then increment the use count */
232  if (wma->fShareable && (dwFlags & MCI_OPEN_SHAREABLE))
233  ++wma->nUseCount;
234  else
235  {
236  LeaveCriticalSection(&wma->cs);
238  }
239  } else {
240  wma->nUseCount = 1;
242  }
243 
245 
246  if (dwFlags & MCI_OPEN_ELEMENT) {
248  /* could it be that (DWORD)lpOpenParms->lpstrElementName
249  * contains the hFile value ?
250  */
252  } else if (lpOpenParms->lpstrElementName && lpOpenParms->lpstrElementName[0]) {
253  /* FIXME : what should be done id wma->hFile is already != 0, or the driver is playin' */
254  TRACE("MCI_OPEN_ELEMENT %s!\n", debugstr_w(lpOpenParms->lpstrElementName));
255 
256  wma->lpFileName = HeapAlloc(GetProcessHeap(), 0, (strlenW(lpOpenParms->lpstrElementName) + 1) * sizeof(WCHAR));
257  strcpyW(wma->lpFileName, lpOpenParms->lpstrElementName);
258 
259  if (lpOpenParms->lpstrElementName[0] == '@') {
260  /* The file name @11223344 encodes an AVIFile handle in decimal notation
261  * in Win3.1 and w2k/NT, but this feature is absent in win95 (KB140750).
262  * wma->hFile = LongToHandle(strtolW(lpOpenParms->lpstrElementName+1, NULL, 10)); */
263  FIXME("Using AVIFile/Stream %s NIY\n", debugstr_w(lpOpenParms->lpstrElementName));
264  }
265  wma->hFile = mmioOpenW(lpOpenParms->lpstrElementName, NULL,
267 
268  if (wma->hFile == 0) {
269  WARN("can't find file=%s!\n", debugstr_w(lpOpenParms->lpstrElementName));
270  dwRet = MCIERR_FILE_NOT_FOUND;
271  } else {
272  if (!MCIAVI_GetInfo(wma))
273  dwRet = MCIERR_INVALID_FILE;
274  else if (!MCIAVI_OpenVideo(wma))
276  else if (!MCIAVI_CreateWindow(wma, dwFlags, lpOpenParms))
277  dwRet = MCIERR_CREATEWINDOW;
278  }
279  } else {
280  FIXME("Don't record yet\n");
282  }
283  }
284 
285  if (dwRet == 0) {
286  TRACE("lpOpenParms->wDeviceID = %04x\n", lpOpenParms->wDeviceID);
287 
288  wma->dwStatus = MCI_MODE_STOP;
290  } else {
291  MCIAVI_CleanUp(wma);
292  }
293 
294  LeaveCriticalSection(&wma->cs);
295 
296  if (!dwRet && (dwFlags & MCI_NOTIFY)) {
297  mciDriverNotify(HWND_32(LOWORD(lpOpenParms->dwCallback)),
298  wDevID, MCI_NOTIFY_SUCCESSFUL);
299  }
300  return dwRet;
301 }
#define MMIO_ALLOCBUF
Definition: mmsystem.h:532
static void MCIAVI_CleanUp(WINE_MCIAVI *wma)
Definition: mciavi.c:169
#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
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define MCIERR_CANNOT_LOAD_DRIVER
Definition: mmsystem.h:576
#define MCIERR_UNSUPPORTED_FUNCTION
Definition: mmsystem.h:584
#define WARN(fmt,...)
Definition: debug.h:111
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)
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:110
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:395
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
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219
BOOL MCIAVI_OpenVideo(WINE_MCIAVI *wma)
Definition: mmoutput.c:426
#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 680 of file mciavi.c.

681 {
682  WINE_MCIAVI *wma;
683 
684  TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);
685 
686  wma = MCIAVI_mciGetOpenDev(wDevID);
687  if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
688  if (dwFlags & MCI_TEST) return 0;
689 
690  EnterCriticalSection(&wma->cs);
691 
692  if (wma->dwStatus == MCI_MODE_PLAY)
693  wma->dwStatus = MCI_MODE_PAUSE;
694 
695  if (wma->lpWaveFormat) {
696  LeaveCriticalSection(&wma->cs);
697  return waveOutPause(wma->hWave);
698  }
699 
700  LeaveCriticalSection(&wma->cs);
701  return 0;
702 }
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:158
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 544 of file mciavi.c.

545 {
546  WINE_MCIAVI *wma;
547  DWORD dwRet;
548  DWORD dwFromFrame, dwToFrame;
549 
550  TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);
551 
552  if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
553 
554  wma = MCIAVI_mciGetOpenDev(wDevID);
555  if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
557  if (dwFlags & MCI_TEST) return 0;
558 
560  FIXME("Unsupported flag %08x\n", dwFlags);
561 
562  EnterCriticalSection(&wma->cs);
563 
564  if (!wma->hFile)
565  {
566  LeaveCriticalSection(&wma->cs);
567  return MCIERR_FILE_NOT_FOUND;
568  }
569  if (!wma->hWndPaint)
570  {
571  LeaveCriticalSection(&wma->cs);
572  return MCIERR_NO_WINDOW;
573  }
574 
575  dwFromFrame = wma->dwCurrVideoFrame;
576  dwToFrame = wma->dwPlayableVideoFrames - 1;
577 
578  if (dwFlags & MCI_FROM) {
579  dwFromFrame = MCIAVI_ConvertTimeFormatToFrame(wma, lpParms->dwFrom);
580  }
581  if (dwFlags & MCI_TO) {
582  dwToFrame = MCIAVI_ConvertTimeFormatToFrame(wma, lpParms->dwTo);
583  }
584  if (dwToFrame >= wma->dwPlayableVideoFrames)
585  dwToFrame = wma->dwPlayableVideoFrames - 1;
586 
587  TRACE("Playing from frame=%u to frame=%u\n", dwFromFrame, dwToFrame);
588 
589  wma->dwCurrVideoFrame = dwFromFrame;
590  wma->dwToVideoFrame = dwToFrame;
591 
592  LeaveCriticalSection(&wma->cs);
593 
596 
597  EnterCriticalSection(&wma->cs);
598 
599  /* if already playing exit */
600  if (wma->dwStatus == MCI_MODE_PLAY)
601  {
602  LeaveCriticalSection(&wma->cs);
603  return 0;
604  }
605 
606  wma->dwStatus = MCI_MODE_PLAY;
607 
608  LeaveCriticalSection(&wma->cs);
609 
610  if (dwFlags & MCI_WAIT)
611  return MCIAVI_player(wma, dwFlags, lpParms);
612 
613  dwRet = MCIAVI_mciPlay_async(wma, dwFlags, lpParms);
614 
615  if (dwRet) {
616  EnterCriticalSection(&wma->cs);
617  wma->dwStatus = MCI_MODE_STOP;
618  LeaveCriticalSection(&wma->cs);
619  }
620  return dwRet;
621 }
#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:348
#define MCI_WAIT
Definition: mmsystem.h:730
#define MCI_DGV_PLAY_REVERSE
Definition: digitalv.h:228
#define MCIERR_UNSUPPORTED_FUNCTION
Definition: mmsystem.h:584
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define MCI_MCIAVI_PLAY_FULLBY2
Definition: mciavi.h:6
DWORD MCIAVI_ConvertTimeFormatToFrame(WINE_MCIAVI *wma, DWORD val)
Definition: info.c:53
#define MCI_MODE_PLAY
Definition: mmsystem.h:696
#define FIXME(fmt,...)
Definition: debug.h:110
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:519
_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:158
#define GWL_STYLE
Definition: winuser.h:846
#define MCIERR_FILE_NOT_FOUND
Definition: mmsystem.h:585
CRITICAL_SECTION cs
DWORD dwPlayableVideoFrames
#define MCI_FROM
Definition: mmsystem.h:731
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 519 of file mciavi.c.

520 {
521  HANDLE handle;
522  struct MCIAVI_play_data *data = HeapAlloc(GetProcessHeap(), 0, sizeof(struct MCIAVI_play_data));
523 
524  if (!data) return MCIERR_OUT_OF_MEMORY;
525 
526  data->wma = wma;
527  data->flags = dwFlags;
528  if (dwFlags & MCI_NOTIFY)
529  data->params.dwCallback = lpParams->dwCallback;
530 
532  {
533  WARN("Couldn't create thread for async play, playing synchronously\n");
534  return MCIAVI_mciPlay_thread(data);
535  }
538  return 0;
539 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#define CloseHandle
Definition: compat.h:398
#define WARN(fmt,...)
Definition: debug.h:111
DWORD_PTR dwCallback
Definition: mmsystem.h:1537
WINE_MCIAVI * wma
Definition: mciavi.c:492
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:111
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI SetThreadPriority(IN HANDLE hThread, IN int nPriority)
Definition: thread.c:661
#define MCIERR_OUT_OF_MEMORY
Definition: mmsystem.h:574
#define GetProcessHeap()
Definition: compat.h:395
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:503
#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 503 of file mciavi.c.

504 {
505  struct MCIAVI_play_data *data = (struct MCIAVI_play_data *)arg;
506  DWORD ret;
507 
508  TRACE("In thread before async play command (id %u, flags %08x)\n", data->wma->wDevID, data->flags);
509  ret = MCIAVI_player(data->wma, data->flags, &data->params);
510  TRACE("In thread after async play command (id %u, flags %08x)\n", data->wma->wDevID, data->flags);
511 
513  return ret;
514 }
static DWORD MCIAVI_player(WINE_MCIAVI *wma, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms)
Definition: mciavi.c:348
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
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:394

Referenced by MCIAVI_mciPlay_async().

◆ MCIAVI_mciRealize()

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

Definition at line 796 of file mciavi.c.

797 {
798  WINE_MCIAVI *wma;
799 
800  FIXME("(%04x, %08x, %p) : stub\n", wDevID, dwFlags, lpParms);
801 
802  if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
803 
804  wma = MCIAVI_mciGetOpenDev(wDevID);
805  if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
806  if (dwFlags & MCI_TEST) return 0;
807 
808  return 0;
809 }
WINE_MCIAVI * wma
Definition: mciavi.c:492
#define FIXME(fmt,...)
Definition: debug.h:110
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:158
#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 707 of file mciavi.c.

708 {
709  WINE_MCIAVI *wma;
710 
711  TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);
712 
713  wma = MCIAVI_mciGetOpenDev(wDevID);
714  if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
715  if (dwFlags & MCI_TEST) return 0;
716 
718 
719  if (wma->dwStatus == MCI_MODE_PAUSE)
721 
722  if (wma->lpWaveFormat) {
724  return waveOutRestart(wma->hWave);
725  }
726 
728  return 0;
729 }
LPWAVEFORMATEX lpWaveFormat
WINE_MCIAVI * wma
Definition: mciavi.c:492
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:158
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 734 of file mciavi.c.

735 {
736  WINE_MCIAVI *wma;
737  DWORD position;
738 
739  TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);
740 
741  if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
742 
743  wma = MCIAVI_mciGetOpenDev(wDevID);
744  if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
745 
747  if (!position) return MCIERR_MISSING_PARAMETER;
748  if (position&(position-1)) return MCIERR_FLAGS_NOT_COMPATIBLE;
749 
750  if (dwFlags & MCI_TO) {
751  position = MCIAVI_ConvertTimeFormatToFrame(wma, lpParms->dwTo);
752  if (position >= wma->dwPlayableVideoFrames)
753  return MCIERR_OUTOFRANGE;
754  } else if (dwFlags & MCI_SEEK_TO_START) {
755  position = 0;
756  } else {
757  position = wma->dwPlayableVideoFrames - 1;
758  }
759  if (dwFlags & MCI_TEST) return 0;
760 
761  MCIAVI_mciStop(wDevID, MCI_WAIT, NULL);
762 
764 
765  wma->dwCurrVideoFrame = position;
766  TRACE("Seeking to frame=%u\n", wma->dwCurrVideoFrame);
767 
768  if (dwFlags & MCI_NOTIFY) {
770  wDevID, MCI_NOTIFY_SUCCESSFUL);
771  }
773  return 0;
774 }
#define MCI_WAIT
Definition: mmsystem.h:730
WINE_MCIAVI * wma
Definition: mciavi.c:492
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
DWORD MCIAVI_ConvertTimeFormatToFrame(WINE_MCIAVI *wma, DWORD val)
Definition: info.c:53
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:626
#define MCI_SEEK_TO_START
Definition: mmsystem.h:740
WINE_MCIAVI * MCIAVI_mciGetOpenDev(UINT wDevID)
Definition: mciavi.c:158
#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 919 of file mciavi.c.

920 {
921  WINE_MCIAVI *wma;
922 
923  if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
924 
925  FIXME("(%04x, %08x, %p) Item %04x: stub\n", wDevID, dwFlags, lpParms, dwFlags & MCI_DGV_SETAUDIO_ITEM ? lpParms->dwItem : 0);
926 
927  wma = MCIAVI_mciGetOpenDev(wDevID);
928  if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
929 
930  return 0;
931 }
WINE_MCIAVI * wma
Definition: mciavi.c:492
#define MCI_DGV_SETAUDIO_ITEM
Definition: digitalv.h:296
#define FIXME(fmt,...)
Definition: debug.h:110
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:158
#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 953 of file mciavi.c.

954 {
955  WINE_MCIAVI *wma;
956 
957  if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
958 
959  FIXME("(%04x, %08x, %p) Item %04x: stub\n", wDevID, dwFlags, lpParms, dwFlags & MCI_DGV_SETVIDEO_ITEM ? lpParms->dwItem : 0);
960 
961  wma = MCIAVI_mciGetOpenDev(wDevID);
962  if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
963 
964  return 0;
965 }
#define MCI_DGV_SETVIDEO_ITEM
Definition: digitalv.h:327
WINE_MCIAVI * wma
Definition: mciavi.c:492
#define FIXME(fmt,...)
Definition: debug.h:110
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:158
#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 936 of file mciavi.c.

937 {
938  WINE_MCIAVI *wma;
939 
940  FIXME("(%04x, %08x, %p) : stub\n", wDevID, dwFlags, lpParms);
941 
942  if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
943 
944  wma = MCIAVI_mciGetOpenDev(wDevID);
945  if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
946 
947  return 0;
948 }
WINE_MCIAVI * wma
Definition: mciavi.c:492
#define FIXME(fmt,...)
Definition: debug.h:110
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:158
#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 839 of file mciavi.c.

840 {
841  WINE_MCIAVI *wma;
842  DWORD position;
843  int delta = 1;
844 
845  TRACE("(%04x, %08x, %p)\n", wDevID, dwFlags, lpParms);
846 
847  if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
848 
849  wma = MCIAVI_mciGetOpenDev(wDevID);
850  if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
851 
852  if (dwFlags & MCI_DGV_STEP_FRAMES) delta = lpParms->dwFrames;
853  if (dwFlags & MCI_DGV_STEP_REVERSE) delta = -delta;
854  position = wma->dwCurrVideoFrame + delta;
855  if (position >= wma->dwPlayableVideoFrames) return MCIERR_OUTOFRANGE;
856  if (dwFlags & MCI_TEST) return 0;
857 
858  MCIAVI_mciStop(wDevID, MCI_WAIT, NULL);
859 
861 
862  wma->dwCurrVideoFrame = position;
863  TRACE("Stepping to frame=%u\n", wma->dwCurrVideoFrame);
864 
865  if (dwFlags & MCI_NOTIFY) {
867  wDevID, MCI_NOTIFY_SUCCESSFUL);
868  }
870  return 0;
871 }
#define MCI_WAIT
Definition: mmsystem.h:730
WINE_MCIAVI * wma
Definition: mciavi.c:492
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:626
#define MCI_DGV_STEP_REVERSE
Definition: digitalv.h:430
WINE_MCIAVI * MCIAVI_mciGetOpenDev(UINT wDevID)
Definition: mciavi.c:158
#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 626 of file mciavi.c.

627 {
628  WINE_MCIAVI *wma;
629  DWORD dwRet = 0;
630 
631  TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);
632 
633  wma = MCIAVI_mciGetOpenDev(wDevID);
634  if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
635  if (dwFlags & MCI_TEST) return 0;
636 
638 
639  TRACE("current status %04x\n", wma->dwStatus);
640 
641  switch (wma->dwStatus) {
642  case MCI_MODE_PLAY:
643  case MCI_MODE_RECORD:
647  /* fall through */
648  case MCI_MODE_PAUSE:
649  /* Since our wave notification callback takes the lock,
650  * we must release it before resetting the device */
652  dwRet = waveOutReset(wma->hWave);
654  /* fall through */
655  default:
656  do /* one more chance for an async thread to finish */
657  {
659  Sleep(10);
661  } while (wma->dwStatus != MCI_MODE_STOP);
662 
663  break;
664 
665  case MCI_MODE_NOT_READY:
666  break;
667  }
668 
669  if ((dwFlags & MCI_NOTIFY) && lpParms) {
671  wDevID, MCI_NOTIFY_SUCCESSFUL);
672  }
674  return dwRet;
675 }
#define MCI_MODE_STOP
Definition: mmsystem.h:695
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:736
WINE_MCIAVI * wma
Definition: mciavi.c:492
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:679
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:158
#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 814 of file mciavi.c.

815 {
816  WINE_MCIAVI *wma;
817 
818  TRACE("%04x, %08x, %p\n", wDevID, dwFlags, lpParms);
819 
820  if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
821 
822  wma = MCIAVI_mciGetOpenDev(wDevID);
823  if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
824  /* Ignore MCI_TEST flag. */
825 
827 
829  MCIAVI_PaintFrame(wma, lpParms->hDC);
830 
832 
833  return 0;
834 }
WINE_MCIAVI * wma
Definition: mciavi.c:492
#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:158
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 348 of file mciavi.c.

349 {
350  DWORD dwRet;
351  LPWAVEHDR waveHdr = NULL;
352  unsigned i, nHdr = 0;
353  DWORD numEvents = 1;
354  HANDLE events[2];
355  double next_frame_us;
356  BOOL wait_audio = TRUE;
357 
359 
361  {
362  dwRet = 0;
363  goto mci_play_done;
364  }
365 
366  events[0] = wma->hStopEvent;
367  if (wma->lpWaveFormat) {
368  if (MCIAVI_OpenAudio(wma, &nHdr, &waveHdr) != 0)
369  {
370  /* can't play audio */
372  wma->lpWaveFormat = NULL;
373  }
374  else
375  {
376  /* fill the queue with as many wave headers as possible */
377  MCIAVI_PlayAudioBlocks(wma, nHdr, waveHdr);
378  events[1] = wma->hEvent;
379  numEvents = 2;
380  }
381  }
382 
383  next_frame_us = currenttime_us();
384  while (wma->dwStatus == MCI_MODE_PLAY)
385  {
386  HDC hDC;
387  double tc, delta;
388  DWORD ret;
389 
390  tc = currenttime_us();
391 
392  hDC = wma->hWndPaint ? GetDC(wma->hWndPaint) : 0;
393  if (hDC)
394  {
395  while(next_frame_us <= tc && wma->dwCurrVideoFrame < wma->dwToVideoFrame){
396  double dur;
397  dur = MCIAVI_PaintFrame(wma, hDC);
399  if(!dur)
400  break;
401  next_frame_us += dur;
402  TRACE("next_frame: %f\n", next_frame_us);
403  }
405  }
407  {
408  if (!(dwFlags & MCI_DGV_PLAY_REPEAT))
409  break;
410  TRACE("repeat media as requested\n");
412  }
413 
414  if (wma->lpWaveFormat)
415  MCIAVI_PlayAudioBlocks(wma, nHdr, waveHdr);
416 
417  tc = currenttime_us();
418  if (tc < next_frame_us)
419  delta = next_frame_us - tc;
420  else
421  delta = 0;
422 
423  /* check if the playback was cancelled */
424  if ((wma->mci_break.flags & MCI_BREAK_KEY) &&
425  (GetAsyncKeyState(wma->mci_break.parms.nVirtKey) & 0x8000))
426  {
427  if (!(wma->mci_break.flags & MCI_BREAK_HWND) ||
428  GetForegroundWindow() == wma->mci_break.parms.hwndBreak)
429  {
430  /* we queue audio blocks ahead so ignore them otherwise the audio
431  * will keep playing until the buffer is empty */
432  wait_audio = FALSE;
433 
434  TRACE("playback cancelled using break key\n");
435  break;
436  }
437  }
438 
440  ret = WaitForMultipleObjects(numEvents, events, FALSE, delta / 1000);
442  if (ret == WAIT_OBJECT_0 || wma->dwStatus != MCI_MODE_PLAY) break;
443  }
444 
445  if (wma->lpWaveFormat)
446  {
447  if (wait_audio)
448  while (wma->dwEventCount != nHdr - 1)
449  {
451  Sleep(100);
453  }
454 
455  /* just to get rid of some race conditions between play, stop and pause */
459 
460  for (i = 0; i < nHdr; i++)
461  waveOutUnprepareHeader(wma->hWave, &waveHdr[i], sizeof(WAVEHDR));
462  }
463 
464  dwRet = 0;
465 
466  if (wma->lpWaveFormat) {
467  HeapFree(GetProcessHeap(), 0, waveHdr);
468 
469  if (wma->hWave) {
473  wma->hWave = 0;
474  }
476  }
477 
478 mci_play_done:
480 
481  if (dwFlags & MCI_NOTIFY) {
482  TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
485  }
487  return dwRet;
488 }
#define MCI_MODE_STOP
Definition: mmsystem.h:695
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:736
HDC WINAPI GetDC(_In_opt_ HWND)
LPWAVEFORMATEX lpWaveFormat
static HDC
Definition: imagelist.c:92
DWORD_PTR dwCallback
Definition: mmsystem.h:1537
WINE_MCIAVI * wma
Definition: mciavi.c:492
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
struct WINE_MCIAVI::@442 mci_break
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
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:395
DWORD dwCurrVideoFrame
unsigned long DWORD
Definition: ntddk_ex.h:95
#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:337
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:394
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