diff --git a/PInvoke/Multimedia/CorrelationReport.md b/PInvoke/Multimedia/CorrelationReport.md index 43450062..b03164d8 100644 --- a/PInvoke/Multimedia/CorrelationReport.md +++ b/PInvoke/Multimedia/CorrelationReport.md @@ -1,9 +1,9 @@ ## Vanara.PInvoke.Multimedia -PInvoke API (methods, structures and constants) imported from Windows Multimedia (winmm.dll, msacm32.dll, avifil32.dll). +PInvoke API (methods, structures and constants) imported from Windows Multimedia (avicap32.dll, avifil32.dll, msacm32.dll, msvfw32.dll, winmm.dll). -- Includes methods from winmm.dll, msacm32.dll, avifil32.dll +- Includes methods from avicap32.dll, avifil32.dll, msacm32.dll, msvfw32.dll, winmm.dll - Current NuGet release: [![Nuget](https://img.shields.io/nuget/v/Vanara.PInvoke.Multimedia?logo=nuget&style=flat-square)![Nuget](https://img.shields.io/nuget/dt/Vanara.PInvoke.Multimedia?label=%20&style=flat-square)](https://www.nuget.org/packages/Vanara.PInvoke.Multimedia) -### Methods - 57% API coverage (154 of 270 functions) +### Methods - 60% API coverage (164 of 272 functions) Native Method | Native DLL | Header | Managed Method --- | --- | --- | --- [acmDriverAdd](https://www.google.com/search?num=5&q=acmDriverAddA+site%3Adocs.microsoft.com) | msacm32.dll | msacm.h | [Vanara.PInvoke.MsAcm32.acmDriverAdd](https://github.com/dahall/Vanara/search?l=C%23&q=acmDriverAdd) @@ -84,6 +84,8 @@ Native Method | Native DLL | Header | Managed Method [AVIStreamTimeToSample](https://www.google.com/search?num=5&q=AVIStreamTimeToSample+site%3Adocs.microsoft.com) | avifil32.dll | vfw.h | [Vanara.PInvoke.AviFil32.AVIStreamTimeToSample](https://github.com/dahall/Vanara/search?l=C%23&q=AVIStreamTimeToSample) [AVIStreamWrite](https://www.google.com/search?num=5&q=AVIStreamWrite+site%3Adocs.microsoft.com) | avifil32.dll | vfw.h | [Vanara.PInvoke.AviFil32.AVIStreamWrite](https://github.com/dahall/Vanara/search?l=C%23&q=AVIStreamWrite) [AVIStreamWriteData](https://www.google.com/search?num=5&q=AVIStreamWriteData+site%3Adocs.microsoft.com) | avifil32.dll | vfw.h | [Vanara.PInvoke.AviFil32.AVIStreamWriteData](https://github.com/dahall/Vanara/search?l=C%23&q=AVIStreamWriteData) +[capCreateCaptureWindow](https://www.google.com/search?num=5&q=capCreateCaptureWindowA+site%3Adocs.microsoft.com) | avicap32.dll | vfw.h | [Vanara.PInvoke.Vfw32.capCreateCaptureWindow](https://github.com/dahall/Vanara/search?l=C%23&q=capCreateCaptureWindow) +[capGetDriverDescription](https://www.google.com/search?num=5&q=capGetDriverDescriptionA+site%3Adocs.microsoft.com) | avicap32.dll | vfw.h | [Vanara.PInvoke.Vfw32.capGetDriverDescription](https://github.com/dahall/Vanara/search?l=C%23&q=capGetDriverDescription) [CloseDriver](https://www.google.com/search?num=5&q=CloseDriver+site%3Adocs.microsoft.com) | winmm.dll | | [CreateEditableStream](https://www.google.com/search?num=5&q=CreateEditableStream+site%3Adocs.microsoft.com) | avifil32.dll | vfw.h | [Vanara.PInvoke.AviFil32.CreateEditableStream](https://github.com/dahall/Vanara/search?l=C%23&q=CreateEditableStream) [DefDriverProc](https://www.google.com/search?num=5&q=DefDriverProc+site%3Adocs.microsoft.com) | winmm.dll | | @@ -110,10 +112,8 @@ Native Method | Native DLL | Header | Managed Method [EditStreamSetInfo](https://www.google.com/search?num=5&q=EditStreamSetInfo+site%3Adocs.microsoft.com) | avifil32.dll | vfw.h | [Vanara.PInvoke.AviFil32.EditStreamSetInfo](https://github.com/dahall/Vanara/search?l=C%23&q=EditStreamSetInfo) [EditStreamSetName](https://www.google.com/search?num=5&q=EditStreamSetName+site%3Adocs.microsoft.com) | avifil32.dll | vfw.h | [Vanara.PInvoke.AviFil32.EditStreamSetName](https://github.com/dahall/Vanara/search?l=C%23&q=EditStreamSetName) [GetDriverModuleHandle](https://www.google.com/search?num=5&q=GetDriverModuleHandle+site%3Adocs.microsoft.com) | winmm.dll | | -[GetOpenFileNamePreviewA](https://www.google.com/search?num=5&q=GetOpenFileNamePreviewA+site%3Adocs.microsoft.com) | msvfw32.dll | vfw.h | [Vanara.PInvoke.Msvfw32.GetOpenFileNamePreview](https://github.com/dahall/Vanara/search?l=C%23&q=GetOpenFileNamePreview) -[GetOpenFileNamePreviewW](https://www.google.com/search?num=5&q=GetOpenFileNamePreviewW+site%3Adocs.microsoft.com) | msvfw32.dll | vfw.h | [Vanara.PInvoke.Msvfw32.GetOpenFileNamePreview](https://github.com/dahall/Vanara/search?l=C%23&q=GetOpenFileNamePreview) -[GetSaveFileNamePreviewA](https://www.google.com/search?num=5&q=GetSaveFileNamePreviewA+site%3Adocs.microsoft.com) | msvfw32.dll | vfw.h | [Vanara.PInvoke.Msvfw32.GetSaveFileNamePreview](https://github.com/dahall/Vanara/search?l=C%23&q=GetSaveFileNamePreview) -[GetSaveFileNamePreviewW](https://www.google.com/search?num=5&q=GetSaveFileNamePreviewW+site%3Adocs.microsoft.com) | msvfw32.dll | vfw.h | [Vanara.PInvoke.Msvfw32.GetSaveFileNamePreview](https://github.com/dahall/Vanara/search?l=C%23&q=GetSaveFileNamePreview) +[GetOpenFileNamePreview](https://www.google.com/search?num=5&q=GetOpenFileNamePreview+site%3Adocs.microsoft.com) | msvfw32.dll | vfw.h | [Vanara.PInvoke.Msvfw32.GetOpenFileNamePreview](https://github.com/dahall/Vanara/search?l=C%23&q=GetOpenFileNamePreview) +[GetSaveFileNamePreview](https://www.google.com/search?num=5&q=GetSaveFileNamePreviewA+site%3Adocs.microsoft.com) | msvfw32.dll | vfw.h | [Vanara.PInvoke.Msvfw32.GetSaveFileNamePreview](https://github.com/dahall/Vanara/search?l=C%23&q=GetSaveFileNamePreview) [ICClose](https://www.google.com/search?num=5&q=ICClose+site%3Adocs.microsoft.com) | msvfw32.dll | vfw.h | [Vanara.PInvoke.Msvfw32.ICClose](https://github.com/dahall/Vanara/search?l=C%23&q=ICClose) [ICCompress](https://www.google.com/search?num=5&q=ICCompress+site%3Adocs.microsoft.com) | msvfw32.dll | vfw.h | [Vanara.PInvoke.Msvfw32.ICCompress](https://github.com/dahall/Vanara/search?l=C%23&q=ICCompress) [ICCompressorChoose](https://www.google.com/search?num=5&q=ICCompressorChoose+site%3Adocs.microsoft.com) | msvfw32.dll | vfw.h | [Vanara.PInvoke.Msvfw32.ICCompressorChoose](https://github.com/dahall/Vanara/search?l=C%23&q=ICCompressorChoose) @@ -123,10 +123,18 @@ Native Method | Native DLL | Header | Managed Method [ICDrawBegin](https://www.google.com/search?num=5&q=ICDrawBegin+site%3Adocs.microsoft.com) | msvfw32.dll | vfw.h | [Vanara.PInvoke.Msvfw32.ICDrawBegin](https://github.com/dahall/Vanara/search?l=C%23&q=ICDrawBegin) [ICGetDisplayFormat](https://www.google.com/search?num=5&q=ICGetDisplayFormat+site%3Adocs.microsoft.com) | msvfw32.dll | vfw.h | [Vanara.PInvoke.Msvfw32.ICGetDisplayFormat](https://github.com/dahall/Vanara/search?l=C%23&q=ICGetDisplayFormat) [ICGetInfo](https://www.google.com/search?num=5&q=ICGetInfo+site%3Adocs.microsoft.com) | msvfw32.dll | vfw.h | [Vanara.PInvoke.Msvfw32.ICGetInfo](https://github.com/dahall/Vanara/search?l=C%23&q=ICGetInfo) +[ICImageCompress](https://www.google.com/search?num=5&q=ICImageCompress+site%3Adocs.microsoft.com) | msvfw32.dll | vfw.h | [Vanara.PInvoke.Msvfw32.ICImageCompress](https://github.com/dahall/Vanara/search?l=C%23&q=ICImageCompress) +[ICImageDecompress](https://www.google.com/search?num=5&q=ICImageDecompress+site%3Adocs.microsoft.com) | msvfw32.dll | vfw.h | [Vanara.PInvoke.Msvfw32.ICImageDecompress](https://github.com/dahall/Vanara/search?l=C%23&q=ICImageDecompress) [ICInfo](https://www.google.com/search?num=5&q=ICInfo+site%3Adocs.microsoft.com) | msvfw32.dll | vfw.h | [Vanara.PInvoke.Msvfw32.ICInfo](https://github.com/dahall/Vanara/search?l=C%23&q=ICInfo) +[ICInstall](https://www.google.com/search?num=5&q=ICInstall+site%3Adocs.microsoft.com) | msvfw32.dll | vfw.h | [Vanara.PInvoke.Msvfw32.ICInstall](https://github.com/dahall/Vanara/search?l=C%23&q=ICInstall) [ICLocate](https://www.google.com/search?num=5&q=ICLocate+site%3Adocs.microsoft.com) | msvfw32.dll | vfw.h | [Vanara.PInvoke.Msvfw32.ICLocate](https://github.com/dahall/Vanara/search?l=C%23&q=ICLocate) [ICOpen](https://www.google.com/search?num=5&q=ICOpen+site%3Adocs.microsoft.com) | msvfw32.dll | vfw.h | [Vanara.PInvoke.Msvfw32.ICOpen](https://github.com/dahall/Vanara/search?l=C%23&q=ICOpen) +[ICOpenFunction](https://www.google.com/search?num=5&q=ICOpenFunction+site%3Adocs.microsoft.com) | msvfw32.dll | vfw.h | [Vanara.PInvoke.Msvfw32.ICOpenFunction](https://github.com/dahall/Vanara/search?l=C%23&q=ICOpenFunction) +[ICRemove](https://www.google.com/search?num=5&q=ICRemove+site%3Adocs.microsoft.com) | msvfw32.dll | vfw.h | [Vanara.PInvoke.Msvfw32.ICRemove](https://github.com/dahall/Vanara/search?l=C%23&q=ICRemove) [ICSendMessage](https://www.google.com/search?num=5&q=ICSendMessage+site%3Adocs.microsoft.com) | msvfw32.dll | vfw.h | [Vanara.PInvoke.Msvfw32.ICSendMessage](https://github.com/dahall/Vanara/search?l=C%23&q=ICSendMessage) +[ICSeqCompressFrame](https://www.google.com/search?num=5&q=ICSeqCompressFrame+site%3Adocs.microsoft.com) | msvfw32.dll | vfw.h | [Vanara.PInvoke.Msvfw32.ICSeqCompressFrame](https://github.com/dahall/Vanara/search?l=C%23&q=ICSeqCompressFrame) +[ICSeqCompressFrameEnd](https://www.google.com/search?num=5&q=ICSeqCompressFrameEnd+site%3Adocs.microsoft.com) | msvfw32.dll | vfw.h | [Vanara.PInvoke.Msvfw32.ICSeqCompressFrameEnd](https://github.com/dahall/Vanara/search?l=C%23&q=ICSeqCompressFrameEnd) +[ICSeqCompressFrameStart](https://www.google.com/search?num=5&q=ICSeqCompressFrameStart+site%3Adocs.microsoft.com) | msvfw32.dll | vfw.h | [Vanara.PInvoke.Msvfw32.ICSeqCompressFrameStart](https://github.com/dahall/Vanara/search?l=C%23&q=ICSeqCompressFrameStart) [IID_IAVIEditStream](https://www.google.com/search?num=5&q=IID_IAVIEditStream+site%3Adocs.microsoft.com) | avifil32.dll | | [IID_IAVIFile](https://www.google.com/search?num=5&q=IID_IAVIFile+site%3Adocs.microsoft.com) | avifil32.dll | | [IID_IAVIStream](https://www.google.com/search?num=5&q=IID_IAVIStream+site%3Adocs.microsoft.com) | avifil32.dll | | @@ -140,21 +148,17 @@ Native Method | Native DLL | Header | Managed Method [joyReleaseCapture](https://www.google.com/search?num=5&q=joyReleaseCapture+site%3Adocs.microsoft.com) | winmm.dll | | [joySetCapture](https://www.google.com/search?num=5&q=joySetCapture+site%3Adocs.microsoft.com) | winmm.dll | | [joySetThreshold](https://www.google.com/search?num=5&q=joySetThreshold+site%3Adocs.microsoft.com) | winmm.dll | | -[mciDriverNotify](https://www.google.com/search?num=5&q=mciDriverNotify+site%3Adocs.microsoft.com) | winmm.dll | | -[mciDriverYield](https://www.google.com/search?num=5&q=mciDriverYield+site%3Adocs.microsoft.com) | winmm.dll | | [mciExecute](https://www.google.com/search?num=5&q=mciExecute+site%3Adocs.microsoft.com) | winmm.dll | | -[mciFreeCommandResource](https://www.google.com/search?num=5&q=mciFreeCommandResource+site%3Adocs.microsoft.com) | winmm.dll | | [mciGetCreatorTask](https://www.google.com/search?num=5&q=mciGetCreatorTask+site%3Adocs.microsoft.com) | winmm.dll | | [mciGetDeviceID](https://www.google.com/search?num=5&q=mciGetDeviceIDA+site%3Adocs.microsoft.com) | winmm.dll | | [mciGetDeviceIDFromElementID](https://www.google.com/search?num=5&q=mciGetDeviceIDFromElementIDA+site%3Adocs.microsoft.com) | winmm.dll | | -[mciGetDriverData](https://www.google.com/search?num=5&q=mciGetDriverData+site%3Adocs.microsoft.com) | winmm.dll | | [mciGetErrorString](https://www.google.com/search?num=5&q=mciGetErrorStringA+site%3Adocs.microsoft.com) | winmm.dll | | [mciGetYieldProc](https://www.google.com/search?num=5&q=mciGetYieldProc+site%3Adocs.microsoft.com) | winmm.dll | | -[mciLoadCommandResource](https://www.google.com/search?num=5&q=mciLoadCommandResource+site%3Adocs.microsoft.com) | winmm.dll | | [mciSendCommand](https://www.google.com/search?num=5&q=mciSendCommandA+site%3Adocs.microsoft.com) | winmm.dll | | [mciSendString](https://www.google.com/search?num=5&q=mciSendStringA+site%3Adocs.microsoft.com) | winmm.dll | | -[mciSetDriverData](https://www.google.com/search?num=5&q=mciSetDriverData+site%3Adocs.microsoft.com) | winmm.dll | | [mciSetYieldProc](https://www.google.com/search?num=5&q=mciSetYieldProc+site%3Adocs.microsoft.com) | winmm.dll | | +[MCIWndCreate](https://www.google.com/search?num=5&q=MCIWndCreate+site%3Adocs.microsoft.com) | msvfw32.dll | vfw.h | [Vanara.PInvoke.Vfw32.MCIWndCreate](https://github.com/dahall/Vanara/search?l=C%23&q=MCIWndCreate) +[MCIWndRegisterClass](https://www.google.com/search?num=5&q=MCIWndRegisterClass+site%3Adocs.microsoft.com) | msvfw32.dll | vfw.h | [Vanara.PInvoke.Vfw32.MCIWndRegisterClass](https://github.com/dahall/Vanara/search?l=C%23&q=MCIWndRegisterClass) [midiConnect](https://www.google.com/search?num=5&q=midiConnect+site%3Adocs.microsoft.com) | winmm.dll | | [midiDisconnect](https://www.google.com/search?num=5&q=midiDisconnect+site%3Adocs.microsoft.com) | winmm.dll | | [midiInAddBuffer](https://www.google.com/search?num=5&q=midiInAddBuffer+site%3Adocs.microsoft.com) | winmm.dll | | @@ -204,7 +208,6 @@ Native Method | Native DLL | Header | Managed Method [mixerMessage](https://www.google.com/search?num=5&q=mixerMessage+site%3Adocs.microsoft.com) | winmm.dll | | [mixerOpen](https://www.google.com/search?num=5&q=mixerOpen+site%3Adocs.microsoft.com) | winmm.dll | | [mixerSetControlDetails](https://www.google.com/search?num=5&q=mixerSetControlDetails+site%3Adocs.microsoft.com) | winmm.dll | | -[mmDrvInstall](https://www.google.com/search?num=5&q=mmDrvInstall+site%3Adocs.microsoft.com) | winmm.dll | | [mmGetCurrentTask](https://www.google.com/search?num=5&q=mmGetCurrentTask+site%3Adocs.microsoft.com) | winmm.dll | | [mmioAdvance](https://www.google.com/search?num=5&q=mmioAdvance+site%3Adocs.microsoft.com) | winmm.dll | | [mmioAscend](https://www.google.com/search?num=5&q=mmioAscend+site%3Adocs.microsoft.com) | winmm.dll | | @@ -275,7 +278,6 @@ Native Method | Native DLL | Header | Managed Method [waveOutSetVolume](https://www.google.com/search?num=5&q=waveOutSetVolume+site%3Adocs.microsoft.com) | winmm.dll | mmeapi.h | [Vanara.PInvoke.WinMm.waveOutSetVolume](https://github.com/dahall/Vanara/search?l=C%23&q=waveOutSetVolume) [waveOutUnprepareHeader](https://www.google.com/search?num=5&q=waveOutUnprepareHeader+site%3Adocs.microsoft.com) | winmm.dll | mmeapi.h | [Vanara.PInvoke.WinMm.waveOutUnprepareHeader](https://github.com/dahall/Vanara/search?l=C%23&q=waveOutUnprepareHeader) [waveOutWrite](https://www.google.com/search?num=5&q=waveOutWrite+site%3Adocs.microsoft.com) | winmm.dll | mmeapi.h | [Vanara.PInvoke.WinMm.waveOutWrite](https://github.com/dahall/Vanara/search?l=C%23&q=waveOutWrite) -[WOWAppExit](https://www.google.com/search?num=5&q=WOWAppExit+site%3Adocs.microsoft.com) | winmm.dll | | ### Structures Native Structure | Header | Managed Structure --- | --- | --- @@ -292,9 +294,13 @@ Native Structure | Header | Managed Structure [AVIFILEINFO](https://www.google.com/search?num=5&q=AVIFILEINFO+site%3Adocs.microsoft.com) | vfw.h | [Vanara.PInvoke.AviFil32.AVIFILEINFO](https://github.com/dahall/Vanara/search?l=C%23&q=AVIFILEINFO) [AVISTREAMINFO](https://www.google.com/search?num=5&q=AVISTREAMINFO+site%3Adocs.microsoft.com) | vfw.h | [Vanara.PInvoke.AviFil32.AVISTREAMINFO](https://github.com/dahall/Vanara/search?l=C%23&q=AVISTREAMINFO) [CAPDRIVERCAPS](https://www.google.com/search?num=5&q=CAPDRIVERCAPS+site%3Adocs.microsoft.com) | vfw.h | [Vanara.PInvoke.AviFil32.CAPDRIVERCAPS](https://github.com/dahall/Vanara/search?l=C%23&q=CAPDRIVERCAPS) +[CAPDRIVERCAPS](https://www.google.com/search?num=5&q=CAPDRIVERCAPS+site%3Adocs.microsoft.com) | vfw.h | [Vanara.PInvoke.Vfw32.CAPDRIVERCAPS](https://github.com/dahall/Vanara/search?l=C%23&q=CAPDRIVERCAPS) [CAPINFOCHUNK](https://www.google.com/search?num=5&q=CAPINFOCHUNK+site%3Adocs.microsoft.com) | vfw.h | [Vanara.PInvoke.AviFil32.CAPINFOCHUNK](https://github.com/dahall/Vanara/search?l=C%23&q=CAPINFOCHUNK) +[CAPINFOCHUNK](https://www.google.com/search?num=5&q=CAPINFOCHUNK+site%3Adocs.microsoft.com) | vfw.h | [Vanara.PInvoke.Vfw32.CAPINFOCHUNK](https://github.com/dahall/Vanara/search?l=C%23&q=CAPINFOCHUNK) [CAPSTATUS](https://www.google.com/search?num=5&q=CAPSTATUS+site%3Adocs.microsoft.com) | vfw.h | [Vanara.PInvoke.AviFil32.CAPSTATUS](https://github.com/dahall/Vanara/search?l=C%23&q=CAPSTATUS) +[CAPSTATUS](https://www.google.com/search?num=5&q=CAPSTATUS+site%3Adocs.microsoft.com) | vfw.h | [Vanara.PInvoke.Vfw32.CAPSTATUS](https://github.com/dahall/Vanara/search?l=C%23&q=CAPSTATUS) [CAPTUREPARMS](https://www.google.com/search?num=5&q=CAPTUREPARMS+site%3Adocs.microsoft.com) | vfw.h | [Vanara.PInvoke.AviFil32.CAPTUREPARMS](https://github.com/dahall/Vanara/search?l=C%23&q=CAPTUREPARMS) +[CAPTUREPARMS](https://www.google.com/search?num=5&q=CAPTUREPARMS+site%3Adocs.microsoft.com) | vfw.h | [Vanara.PInvoke.Vfw32.CAPTUREPARMS](https://github.com/dahall/Vanara/search?l=C%23&q=CAPTUREPARMS) [COMPVARS](https://www.google.com/search?num=5&q=COMPVARS+site%3Adocs.microsoft.com) | vfw.h | [Vanara.PInvoke.Msvfw32.COMPVARS](https://github.com/dahall/Vanara/search?l=C%23&q=COMPVARS) [DRAWDIBTIME](https://www.google.com/search?num=5&q=DRAWDIBTIME+site%3Adocs.microsoft.com) | vfw.h | [Vanara.PInvoke.AviFil32.DRAWDIBTIME](https://github.com/dahall/Vanara/search?l=C%23&q=DRAWDIBTIME) [DRAWDIBTIME](https://www.google.com/search?num=5&q=DRAWDIBTIME+site%3Adocs.microsoft.com) | vfw.h | [Vanara.PInvoke.Msvfw32.DRAWDIBTIME](https://github.com/dahall/Vanara/search?l=C%23&q=DRAWDIBTIME) @@ -320,6 +326,7 @@ Native Structure | Header | Managed Structure [PCMWAVEFORMAT](https://www.google.com/search?num=5&q=PCMWAVEFORMAT+site%3Adocs.microsoft.com) | mmreg.h | [Vanara.PInvoke.WinMm.PCMWAVEFORMAT](https://github.com/dahall/Vanara/search?l=C%23&q=PCMWAVEFORMAT) [SAMPLES](https://www.google.com/search?num=5&q=SAMPLES+site%3Adocs.microsoft.com) | | [Vanara.PInvoke.WinMm.WAVEFORMATEXTENSIBLE.SAMPLES](https://github.com/dahall/Vanara/search?l=C%23&q=SAMPLES) [VIDEOHDR](https://www.google.com/search?num=5&q=VIDEOHDR+site%3Adocs.microsoft.com) | vfw.h | [Vanara.PInvoke.AviFil32.VIDEOHDR](https://github.com/dahall/Vanara/search?l=C%23&q=VIDEOHDR) +[VIDEOHDR](https://www.google.com/search?num=5&q=VIDEOHDR+site%3Adocs.microsoft.com) | vfw.h | [Vanara.PInvoke.Vfw32.VIDEOHDR](https://github.com/dahall/Vanara/search?l=C%23&q=VIDEOHDR) [WAVEFILTER](https://www.google.com/search?num=5&q=WAVEFILTER+site%3Adocs.microsoft.com) | mmreg.h | [Vanara.PInvoke.WinMm.WAVEFILTER](https://github.com/dahall/Vanara/search?l=C%23&q=WAVEFILTER) [WAVEFORMAT](https://www.google.com/search?num=5&q=WAVEFORMAT+site%3Adocs.microsoft.com) | mmreg.h | [Vanara.PInvoke.WinMm.WAVEFORMAT](https://github.com/dahall/Vanara/search?l=C%23&q=WAVEFORMAT) [WAVEFORMATEX](https://www.google.com/search?num=5&q=WAVEFORMATEX+site%3Adocs.microsoft.com) | mmeapi.h | [Vanara.PInvoke.WinMm.WAVEFORMATEX](https://github.com/dahall/Vanara/search?l=C%23&q=WAVEFORMATEX) @@ -338,7 +345,6 @@ Native Interface | Header | Managed Interface ### Classes Native Class | Header | Managed Class --- | --- | --- -[Msvfw32](https://www.google.com/search?num=5&q=Msvfw32+site%3Adocs.microsoft.com) | | [Vanara.PInvoke.Msvfw32](https://github.com/dahall/Vanara/search?l=C%23&q=Msvfw32) [SafeHACMDRIVER](https://www.google.com/search?num=5&q=SafeHACMDRIVER+site%3Adocs.microsoft.com) | | [Vanara.PInvoke.MsAcm32.SafeHACMDRIVER](https://github.com/dahall/Vanara/search?l=C%23&q=SafeHACMDRIVER) [SafeHACMSTREAM](https://www.google.com/search?num=5&q=SafeHACMSTREAM+site%3Adocs.microsoft.com) | | [Vanara.PInvoke.MsAcm32.SafeHACMSTREAM](https://github.com/dahall/Vanara/search?l=C%23&q=SafeHACMSTREAM) [SafeHDRAWDIB](https://www.google.com/search?num=5&q=SafeHDRAWDIB+site%3Adocs.microsoft.com) | | [Vanara.PInvoke.Msvfw32.SafeHDRAWDIB](https://github.com/dahall/Vanara/search?l=C%23&q=SafeHDRAWDIB) diff --git a/PInvoke/Multimedia/Vanara.PInvoke.Multimedia.csproj b/PInvoke/Multimedia/Vanara.PInvoke.Multimedia.csproj index ede91b43..4b98fd00 100644 --- a/PInvoke/Multimedia/Vanara.PInvoke.Multimedia.csproj +++ b/PInvoke/Multimedia/Vanara.PInvoke.Multimedia.csproj @@ -1,10 +1,10 @@  - winmm.dll;msacm32.dll;avifil32.dll + avicap32.dll;avifil32.dll;msacm32.dll;msvfw32.dll;winmm.dll - PInvoke API (methods, structures and constants) imported from Windows Multimedia (winmm.dll, msacm32.dll, avifil32.dll). + PInvoke API (methods, structures and constants) imported from Windows Multimedia (avicap32.dll, avifil32.dll, msacm32.dll, msvfw32.dll, winmm.dll). $(AssemblyName) net20;net35;net40;net45;net5.0-windows;netstandard2.0;netcoreapp2.0;netcoreapp2.1;netcoreapp3.0;netcoreapp3.1 Vanara.PInvoke.Multimedia @@ -14,10 +14,10 @@ Currently implements: Functions -acmDriverAdd acmDriverClose acmDriverDetails acmDriverEnum acmDriverID acmDriverMessage acmDriverOpen acmDriverPriority acmDriverRemove acmFilterChoose acmFilterDetails acmFilterEnum acmFilterTagDetails acmFilterTagEnum acmFormatChoose acmFormatDetails acmFormatEnum acmFormatSuggest acmFormatTagDetails acmFormatTagEnum acmGetVersion acmMetrics acmStreamClose acmStreamConvert acmStreamMessage acmStreamOpen acmStreamPrepareHeader acmStreamReset acmStreamSize acmStreamUnprepareHeader auxGetDevCaps auxGetNumDevs auxGetVolume auxOutMessage auxSetVolume AVIBuildFilter AVIClearClipboard AVIFileAddRef AVIFileCreateStream AVIFileEndRecord AVIFileExit AVIFileGetStream AVIFileInfo AVIFileInit AVIFileOpen AVIFileReadData AVIFileRelease AVIFileWriteData AVIGetFromClipboard AVIMakeCompressedStream AVIMakeFileFromStreams AVIMakeStreamFromClipboard AVIPutFileOnClipboard AVISave AVISaveOptions AVISaveOptionsFree AVISaveV AVIStreamAddRef AVIStreamBeginStreaming AVIStreamCreate AVIStreamEndStreaming AVIStreamFindSample AVIStreamGetFrame AVIStreamGetFrameClose AVIStreamGetFrameOpen AVIStreamInfo AVIStreamLength AVIStreamOpenFromFile AVIStreamRead AVIStreamReadData AVIStreamReadFormat AVIStreamRelease AVIStreamSampleToTime AVIStreamSetFormat AVIStreamStart AVIStreamTimeToSample AVIStreamWrite AVIStreamWriteData CloseDriver CreateEditableStream DefDriverProc DrawDibBegin DrawDibChangePalette DrawDibClose DrawDibDraw DrawDibEnd DrawDibGetBuffer DrawDibGetPalette DrawDibOpen DrawDibProfileDisplay DrawDibRealize DrawDibSetPalette DrawDibStart DrawDibStop DrawDibTime DriverCallback DrvGetModuleHandle EditStreamClone EditStreamCopy EditStreamCut EditStreamPaste EditStreamSetInfo EditStreamSetName GetDriverModuleHandle GetOpenFileNamePreviewA GetOpenFileNamePreviewW GetSaveFileNamePreviewA GetSaveFileNamePreviewW ICClose ICCompress ICCompressorChoose ICCompressorFree ICDecompress ICDraw ICDrawBegin ICGetDisplayFormat ICGetInfo ICInfo ICLocate ICOpen ICSendMessage IID_IAVIEditStream IID_IAVIFile IID_IAVIStream IID_IGetFrame joyConfigChanged joyGetDevCaps joyGetNumDevs joyGetPos joyGetPosEx joyGetThreshold joyReleaseCapture joySetCapture joySetThreshold mciDriverNotify mciDriverYield mciExecute mciFreeCommandResource mciGetCreatorTask mciGetDeviceID mciGetDeviceIDFromElementID mciGetDriverData mciGetErrorString mciGetYieldProc mciLoadCommandResource mciSendCommand mciSendString mciSetDriverData mciSetYieldProc midiConnect midiDisconnect midiInAddBuffer midiInClose midiInGetDevCaps midiInGetErrorText midiInGetID midiInGetNumDevs midiInMessage midiInOpen midiInPrepareHeader midiInReset midiInStart midiInStop midiInUnprepareHeader midiOutCacheDrumPatches midiOutCachePatches midiOutClose midiOutGetDevCaps midiOutGetErrorText midiOutGetID midiOutGetNumDevs midiOutGetVolume midiOutLongMsg midiOutMessage midiOutOpen midiOutPrepareHeader midiOutReset midiOutSetVolume midiOutShortMsg midiOutUnprepareHeader midiStreamClose midiStreamOpen midiStreamOut midiStreamPause midiStreamPosition midiStreamProperty midiStreamRestart midiStreamStop mixerClose mixerGetControlDetails mixerGetDevCaps mixerGetID mixerGetLineControls mixerGetLineInfo mixerGetNumDevs mixerMessage mixerOpen mixerSetControlDetails mmDrvInstall mmGetCurrentTask mmioAdvance mmioAscend mmioClose mmioCreateChunk mmioDescend mmioFlush mmioGetInfo mmioInstallIOProc mmioOpen mmioRead mmioRename mmioSeek mmioSendMessage mmioSetBuffer mmioSetInfo mmioStringToFOURCC mmioWrite mmsystemGetVersion mmTaskBlock mmTaskCreate mmTaskSignal mmTaskYield OpenDriver PlaySound SendDriverMessage sndPlaySound StretchDIB timeBeginPeriod timeEndPeriod timeGetDevCaps timeGetSystemTime timeGetTime timeKillEvent timeSetEvent waveInAddBuffer waveInClose waveInGetDevCaps waveInGetErrorText waveInGetID waveInGetNumDevs waveInGetPosition waveInMessage waveInOpen waveInPrepareHeader waveInReset waveInStart waveInStop waveInUnprepareHeader waveOutBreakLoop waveOutClose waveOutGetDevCaps waveOutGetErrorText waveOutGetID waveOutGetNumDevs waveOutGetPitch waveOutGetPlaybackRate waveOutGetPosition waveOutGetVolume waveOutMessage waveOutOpen waveOutPause waveOutPrepareHeader waveOutReset waveOutRestart waveOutSetPitch waveOutSetPlaybackRate waveOutSetVolume waveOutUnprepareHeader waveOutWrite WOWAppExit +acmDriverAdd acmDriverClose acmDriverDetails acmDriverEnum acmDriverID acmDriverMessage acmDriverOpen acmDriverPriority acmDriverRemove acmFilterChoose acmFilterDetails acmFilterEnum acmFilterTagDetails acmFilterTagEnum acmFormatChoose acmFormatDetails acmFormatEnum acmFormatSuggest acmFormatTagDetails acmFormatTagEnum acmGetVersion acmMetrics acmStreamClose acmStreamConvert acmStreamMessage acmStreamOpen acmStreamPrepareHeader acmStreamReset acmStreamSize acmStreamUnprepareHeader auxGetDevCaps auxGetNumDevs auxGetVolume auxOutMessage auxSetVolume AVIBuildFilter AVIClearClipboard AVIFileAddRef AVIFileCreateStream AVIFileEndRecord AVIFileExit AVIFileGetStream AVIFileInfo AVIFileInit AVIFileOpen AVIFileReadData AVIFileRelease AVIFileWriteData AVIGetFromClipboard AVIMakeCompressedStream AVIMakeFileFromStreams AVIMakeStreamFromClipboard AVIPutFileOnClipboard AVISave AVISaveOptions AVISaveOptionsFree AVISaveV AVIStreamAddRef AVIStreamBeginStreaming AVIStreamCreate AVIStreamEndStreaming AVIStreamFindSample AVIStreamGetFrame AVIStreamGetFrameClose AVIStreamGetFrameOpen AVIStreamInfo AVIStreamLength AVIStreamOpenFromFile AVIStreamRead AVIStreamReadData AVIStreamReadFormat AVIStreamRelease AVIStreamSampleToTime AVIStreamSetFormat AVIStreamStart AVIStreamTimeToSample AVIStreamWrite AVIStreamWriteData capCreateCaptureWindow capGetDriverDescription CloseDriver CreateEditableStream DefDriverProc DrawDibBegin DrawDibChangePalette DrawDibClose DrawDibDraw DrawDibEnd DrawDibGetBuffer DrawDibGetPalette DrawDibOpen DrawDibProfileDisplay DrawDibRealize DrawDibSetPalette DrawDibStart DrawDibStop DrawDibTime DriverCallback DrvGetModuleHandle EditStreamClone EditStreamCopy EditStreamCut EditStreamPaste EditStreamSetInfo EditStreamSetName GetDriverModuleHandle GetOpenFileNamePreview GetSaveFileNamePreview ICClose ICCompress ICCompressorChoose ICCompressorFree ICDecompress ICDraw ICDrawBegin ICGetDisplayFormat ICGetInfo ICImageCompress ICImageDecompress ICInfo ICInstall ICLocate ICOpen ICOpenFunction ICRemove ICSendMessage ICSeqCompressFrame ICSeqCompressFrameEnd ICSeqCompressFrameStart IID_IAVIEditStream IID_IAVIFile IID_IAVIStream IID_IGetFrame joyConfigChanged joyGetDevCaps joyGetNumDevs joyGetPos joyGetPosEx joyGetThreshold joyReleaseCapture joySetCapture joySetThreshold mciExecute mciGetCreatorTask mciGetDeviceID mciGetDeviceIDFromElementID mciGetErrorString mciGetYieldProc mciSendCommand mciSendString mciSetYieldProc MCIWndCreate MCIWndRegisterClass midiConnect midiDisconnect midiInAddBuffer midiInClose midiInGetDevCaps midiInGetErrorText midiInGetID midiInGetNumDevs midiInMessage midiInOpen midiInPrepareHeader midiInReset midiInStart midiInStop midiInUnprepareHeader midiOutCacheDrumPatches midiOutCachePatches midiOutClose midiOutGetDevCaps midiOutGetErrorText midiOutGetID midiOutGetNumDevs midiOutGetVolume midiOutLongMsg midiOutMessage midiOutOpen midiOutPrepareHeader midiOutReset midiOutSetVolume midiOutShortMsg midiOutUnprepareHeader midiStreamClose midiStreamOpen midiStreamOut midiStreamPause midiStreamPosition midiStreamProperty midiStreamRestart midiStreamStop mixerClose mixerGetControlDetails mixerGetDevCaps mixerGetID mixerGetLineControls mixerGetLineInfo mixerGetNumDevs mixerMessage mixerOpen mixerSetControlDetails mmGetCurrentTask mmioAdvance mmioAscend mmioClose mmioCreateChunk mmioDescend mmioFlush mmioGetInfo mmioInstallIOProc mmioOpen mmioRead mmioRename mmioSeek mmioSendMessage mmioSetBuffer mmioSetInfo mmioStringToFOURCC mmioWrite mmsystemGetVersion mmTaskBlock mmTaskCreate mmTaskSignal mmTaskYield OpenDriver PlaySound SendDriverMessage sndPlaySound StretchDIB timeBeginPeriod timeEndPeriod timeGetDevCaps timeGetSystemTime timeGetTime timeKillEvent timeSetEvent waveInAddBuffer waveInClose waveInGetDevCaps waveInGetErrorText waveInGetID waveInGetNumDevs waveInGetPosition waveInMessage waveInOpen waveInPrepareHeader waveInReset waveInStart waveInStop waveInUnprepareHeader waveOutBreakLoop waveOutClose waveOutGetDevCaps waveOutGetErrorText waveOutGetID waveOutGetNumDevs waveOutGetPitch waveOutGetPlaybackRate waveOutGetPosition waveOutGetVolume waveOutMessage waveOutOpen waveOutPause waveOutPrepareHeader waveOutReset waveOutRestart waveOutSetPitch waveOutSetPlaybackRate waveOutSetVolume waveOutUnprepareHeader waveOutWrite Structures -ACMDRIVERDETAILS ACMFILTERCHOOSE ACMFILTERDETAILS ACMFILTERTAGDETAILS ACMFORMATCHOOSE ACMFORMATDETAILS ACMFORMATTAGDETAILS ACMSTREAMHEADER AUXCAPS AVICOMPRESSOPTIONS AVIFILEINFO AVISTREAMINFO CAPDRIVERCAPS CAPINFOCHUNK CAPSTATUS CAPTUREPARMS COMPVARS DRAWDIBTIME DRAWDIBTIME HACMDRIVER HACMDRIVERID HACMOBJ HACMSTREAM HDRAWDIB HIC HWAVEIN HWAVEOUT ICCOMPRESS ICCOMPRESSFRAMES ICDECOMPRESS ICDECOMPRESSEX ICDRAW ICDRAWBEGIN ICDRAWSUGGEST ICINFO ICOPEN ICSETSTATUSPROC MMTIME PCMWAVEFORMAT SAMPLES VIDEOHDR WAVEFILTER WAVEFORMAT WAVEFORMATEX WAVEFORMATEXTENSIBLE WAVEHDR WAVEINCAPS WAVEOUTCAPS +ACMDRIVERDETAILS ACMFILTERCHOOSE ACMFILTERDETAILS ACMFILTERTAGDETAILS ACMFORMATCHOOSE ACMFORMATDETAILS ACMFORMATTAGDETAILS ACMSTREAMHEADER AUXCAPS AVICOMPRESSOPTIONS AVIFILEINFO AVISTREAMINFO CAPDRIVERCAPS CAPDRIVERCAPS CAPINFOCHUNK CAPINFOCHUNK CAPSTATUS CAPSTATUS CAPTUREPARMS CAPTUREPARMS COMPVARS DRAWDIBTIME DRAWDIBTIME HACMDRIVER HACMDRIVERID HACMOBJ HACMSTREAM HDRAWDIB HIC HWAVEIN HWAVEOUT ICCOMPRESS ICCOMPRESSFRAMES ICDECOMPRESS ICDECOMPRESSEX ICDRAW ICDRAWBEGIN ICDRAWSUGGEST ICINFO ICOPEN ICSETSTATUSPROC MMTIME PCMWAVEFORMAT SAMPLES VIDEOHDR VIDEOHDR WAVEFILTER WAVEFORMAT WAVEFORMATEX WAVEFORMATEXTENSIBLE WAVEHDR WAVEINCAPS WAVEOUTCAPS Interfaces IAVIEditStream IAVIFile IAVIStream IAVIStreaming IGetFrame diff --git a/PInvoke/Multimedia/Vfw.IC.cs b/PInvoke/Multimedia/Vfw.IC.cs index f87e2fb5..59f00a87 100644 --- a/PInvoke/Multimedia/Vfw.IC.cs +++ b/PInvoke/Multimedia/Vfw.IC.cs @@ -208,6 +208,29 @@ namespace Vanara.PInvoke #pragma warning restore CS1591 // Missing XML comment for publicly visible type or member } + /// Flags defining the contents of lParam in . + [Flags] + public enum ICINSTALL : uint + { + /// + ICINSTALL_UNICODE = 0x8000, + + /// + /// The lParam parameter contains the address of a compressor function. This function should be structured like the DriverProc + /// entry point function used by compressors. + /// + ICINSTALL_FUNCTION = 0x0001, + + /// The lParam parameter contains the address of a null-terminated string that names the compressor to install. + ICINSTALL_DRIVER = 0x0002, + + /// lParam is a HDRVR (driver handle) + ICINSTALL_HDRV = 0x0004, + + /// lParam is a unicode driver name + ICINSTALL_DRIVERW = 0x8002, + } + /// Message codes for . [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICSendMessage")] public enum ICM_Message : uint @@ -398,6 +421,30 @@ namespace Vanara.PInvoke ICM_SET_STATUS_PROC = ICM_USER + 72, } + /// Applicable flags. + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICCompressorChoose")] + [Flags] + public enum ICMF_CHOOSE : uint + { + /// Displays a check box and edit box to enter the frequency of key frames. + ICMF_CHOOSE_KEYFRAME = 0x0001, + + /// Displays a check box and edit box to enter the data rate for the movie. + ICMF_CHOOSE_DATARATE = 0x0002, + + /// + /// Displays a button to expand the dialog box to include a preview window. The preview window shows how frames of your movie + /// will appear when compressed with the current settings. + /// + ICMF_CHOOSE_PREVIEW = 0x0004, + + /// + /// All compressors should appear in the selection list. If this flag is not specified, only the compressors that can handle the + /// input format appear in the selection list. + /// + ICMF_CHOOSE_ALLCOMPRESSORS = 0x0008, + } + /// Applicable flags. [PInvokeData("vfw.h", MSDNShortId = "NS:vfw.__unnamed_struct_11")] public enum ICMF_COMPVARS @@ -1381,27 +1428,6 @@ namespace Vanara.PInvoke public static extern bool ICCompressorChoose([In, Optional] HWND hwnd, ICMF_CHOOSE uiFlags, [In, Optional] IntPtr pvIn, [In, Optional] IntPtr lpData, ref COMPVARS pc, [Optional, MarshalAs(UnmanagedType.LPStr)] string lpszTitle); - /// Applicable flags. - [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICCompressorChoose")] - [Flags] - public enum ICMF_CHOOSE : uint - { - /// Displays a check box and edit box to enter the frequency of key frames. - ICMF_CHOOSE_KEYFRAME = 0x0001, - /// Displays a check box and edit box to enter the data rate for the movie. - ICMF_CHOOSE_DATARATE = 0x0002, - /// - /// Displays a button to expand the dialog box to include a preview window. The preview window shows how frames of your movie will - /// appear when compressed with the current settings. - /// - ICMF_CHOOSE_PREVIEW = 0x0004, - /// - /// All compressors should appear in the selection list. If this flag is not specified, only the compressors that can handle the - /// input format appear in the selection list. - /// - ICMF_CHOOSE_ALLCOMPRESSORS = 0x0008, - } - /// The ICCompressorFree function frees the resources in the COMPVARS structure used by other VCM functions. /// Pointer to the COMPVARS structure containing the resources to be freed. /// This function does not return a value. @@ -1818,6 +1844,135 @@ namespace Vanara.PInvoke return ICSendMessage(hic, ICM_Message.ICM_DECOMPRESS_GET_FORMAT, pIn).ToInt32(); } + /// + /// The ICDecompressGetPalette macro requests that the video decompression driver supply the color table of the output + /// BITMAPINFOHEADER structure. You can use this macro or explicitly call the ICM_DECOMPRESS_GET_PALETTE message. + /// + /// Handle to a decompressor. + /// Pointer to a BITMAPINFOHEADER structure containing the input format. + /// + /// Pointer to a BITMAPINFOHEADER structure to contain the color table. The space reserved for the color table is always at least + /// 256 colors. You can specify zero for this parameter to return only the size of the color table. + /// + /// None + /// + /// + /// If lpbiOutput is nonzero, the driver sets the biClrUsed member of BITMAPINFOHEADER to the number of colors in the color + /// table. The driver fills the bmiColors members of BITMAPINFO with the actual colors. + /// + /// The driver should support this message only if it uses a palette other than the one specified in the input format. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icdecompressgetpalette void ICDecompressGetPalette( hic, lpbiInput, + // lpbiOutput ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICDecompressGetPalette")] + public static ICERR ICDecompressGetPalette([In] HIC hic, in BITMAPINFOHEADER lpbiInput, in BITMAPINFOHEADER lpbiOutput) => + (ICERR)ICSendMessage(hic, ICM_Message.ICM_DECOMPRESS_GET_PALETTE, lpbiInput, lpbiOutput).ToInt32(); + + /// The ICDecompressOpen macro opens a decompressor that is compatible with the specified formats. + /// + /// Four-character code indicating the type of compressor to open. For video streams, the value of this parameter is "VIDC" or ICTYPE_VIDEO. + /// + /// + /// Four-character code indicating the preferred stream handler to use. Typically, this information is stored in the stream header + /// in an AVI file. + /// + /// + /// Pointer to a structure defining the input format. A decompressor handle is not returned unless it can decompress this format. + /// For bitmaps, this parameter refers to a BITMAPINFOHEADER structure. + /// + /// + /// + /// Pointer to a structure defining an optional decompression format. You can also specify zero to use the default output format + /// associated with the input format. + /// + /// + /// If this parameter is nonzero, a compressor handle is not returned unless it can create this output format. For bitmaps, this + /// parameter refers to a BITMAPINFOHEADER structure. + /// + /// + /// None + /// + /// The ICDecompressOpen macro is defined as follows: + /// + /// #define ICDecompressOpen(fccType, fccHandler, lpbiIn, lpbiOut) \ ICLocate(fccType, fccHandler, lpbiIn, lpbiOut, ICMODE_DECOMPRESS); + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icdecompressopen void ICDecompressOpen( fccType, fccHandler, + // lpbiIn, lpbiOut ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICDecompressOpen")] + public static SafeHIC ICDecompressOpen(uint fccType, [Optional] uint fccHandler, in BITMAPINFOHEADER lpbiIn, in BITMAPINFOHEADER lpbiOut) => + ICLocate(fccType, fccHandler, lpbiIn, lpbiOut, ICMODE.ICMODE_DECOMPRESS); + + /// The ICDecompressOpen macro opens a decompressor that is compatible with the specified formats. + /// + /// Four-character code indicating the type of compressor to open. For video streams, the value of this parameter is "VIDC" or ICTYPE_VIDEO. + /// + /// + /// Four-character code indicating the preferred stream handler to use. Typically, this information is stored in the stream header + /// in an AVI file. + /// + /// + /// Pointer to a structure defining the input format. A decompressor handle is not returned unless it can decompress this format. + /// For bitmaps, this parameter refers to a BITMAPINFOHEADER structure. + /// + /// None + /// + /// The ICDecompressOpen macro is defined as follows: + /// + /// #define ICDecompressOpen(fccType, fccHandler, lpbiIn, lpbiOut) \ ICLocate(fccType, fccHandler, lpbiIn, lpbiOut, ICMODE_DECOMPRESS); + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icdecompressopen void ICDecompressOpen( fccType, fccHandler, + // lpbiIn, lpbiOut ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICDecompressOpen")] + public static SafeHIC ICDecompressOpen(uint fccType, [Optional] uint fccHandler, in BITMAPINFOHEADER lpbiIn) => + ICLocate(fccType, fccHandler, lpbiIn, IntPtr.Zero, ICMODE.ICMODE_DECOMPRESS); + + /// + /// The ICDecompressQuery macro queries a video decompression driver to determine if it supports a specific input format or + /// if it can decompress a specific input format to a specific output format. You can use this macro or explicitly call the + /// ICM_DECOMPRESS_QUERY message. + /// + /// Handle to a decompressor. + /// Pointer to a BITMAPINFO structure containing the input format. + /// + /// Pointer to a BITMAPINFO structure containing the output format. You can specify zero for this parameter to indicate any output + /// format is acceptable. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icdecompressquery void ICDecompressQuery( hic, lpbiInput, + // lpbiOutput ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICDecompressQuery")] + public static ICERR ICDecompressQuery([In] HIC hic, in BITMAPINFO lpbiInput, in BITMAPINFO lpbiOutput) => + (ICERR)ICSendMessage(hic, ICM_Message.ICM_DECOMPRESS_QUERY, lpbiInput, lpbiOutput).ToInt32(); + + /// + /// The ICDecompressSetPalette macro specifies a palette for a video decompression driver to use if it is decompressing to a + /// format that uses a palette. You can use this macro or explicitly call the ICM_DECOMPRESS_SET_PALETTE message. + /// + /// Handle to a decompressor. + /// + /// Pointer to a BITMAPINFOHEADER structure whose color table contains the colors that should be used if possible. You can specify + /// zero to use the default set of output colors. + /// + /// None + /// + /// + /// This macro should not affect decompression already in progress; rather, colors passed using this message should be returned in + /// response to future ICDecompressGetFormat and ICDecompressGetPalette macros. Colors are sent back to the decompression driver in + /// a future ICDecompressBegin macro. + /// + /// + /// This macro is used primarily when a driver decompresses images to the screen and another application that uses a palette is in + /// the foreground, forcing the decompression driver to adapt to a foreign set of colors. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icdecompresssetpalette void ICDecompressSetPalette( hic, + // lpbiPalette ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICDecompressSetPalette")] + public static ICERR ICDecompressSetPalette([In] HIC hic, [In, Optional] SafeBITMAPINFO lpbiPalette) => + (ICERR)ICSendMessage(hic, ICM_Message.ICM_DECOMPRESS_SET_PALETTE, lpbiPalette).ToInt32(); + /// The ICDraw function decompresses an image for drawing. /// Handle to an decompressor. /// @@ -1956,6 +2111,859 @@ namespace Vanara.PInvoke [In, Optional] HDC hdc, int xDst, int yDst, int dxDst, int dyDst, in BITMAPINFOHEADER lpbi, int xSrc, int ySrc, int dxSrc, int dySrc, uint dwRate, uint dwScale); + /// + /// The ICDrawChangePalette macro notifies a rendering driver that the movie palette is changing. You can use this macro or + /// explicitly call the ICM_DRAW_CHANGEPALETTE message. + /// + /// Handle to a rendering driver. + /// Pointer to a BITMAPINFO structure containing the new format and optional color table. + /// None + /// + /// This message should be supported by installable rendering handlers that draw DIBs with an internal structure that includes a palette. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icdrawchangepalette void ICDrawChangePalette( hic, lpbiInput ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICDrawChangePalette")] + public static ICERR ICDrawChangePalette([In] HIC hic, in BITMAPINFO lpbiInput) => + (ICERR)ICSendMessage(hic, ICM_Message.ICM_DRAW_CHANGEPALETTE, lpbiInput).ToInt32(); + + /// + /// The ICDrawEnd macro notifies a rendering driver to decompress the current image to the screen and to release resources + /// allocated for decompression and drawing. You can use this macro or explicitly call the ICM_DRAW_END message. + /// + /// Handle to a driver. + /// None + /// + /// The ICM_DRAW_BEGIN and ICM_DRAW_END messages do not nest. If your driver receives ICM_DRAW_BEGIN before decompression is + /// stopped with ICM_DRAW_END, it should restart decompression with new parameters. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icdrawend void ICDrawEnd( hic ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICDrawEnd")] + public static ICERR ICDrawEnd([In] HIC hic) => (ICERR)ICSendMessage(hic, ICM_Message.ICM_DRAW_END).ToInt32(); + + /// + /// The ICDrawFlush macro notifies a rendering driver to render the contents of any image buffers that are waiting to be + /// drawn. You can use this macro or explicitly call the ICM_DRAW_FLUSH message. + /// + /// Handle to a driver. + /// None + /// This message is used only by hardware that performs its own asynchronous decompression, timing, and drawing. + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icdrawflush void ICDrawFlush( hic ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICDrawFlush")] + public static ICERR ICDrawFlush([In] HIC hic) => (ICERR)ICSendMessage(hic, ICM_Message.ICM_DRAW_FLUSH).ToInt32(); + + /// + /// The ICDrawGetTime macro requests a rendering driver that controls the timing of drawing frames to return the current + /// value of its internal clock. You can use this macro or explicitly call the ICM_DRAW_GETTIME message. + /// + /// Handle to a driver. + /// Address to contain the current time. The return value should be specified in samples. + /// None + /// + /// This message is generally supported by hardware that performs its own asynchronous decompression, timing, and drawing. The + /// message can also be sent if the hardware is being used as the synchronization master. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icdrawgettime void ICDrawGetTime( hic, lplTime ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICDrawGetTime")] + public static ICERR ICDrawGetTime([In] HIC hic, out int lplTime) + { + unsafe + { + int val = 0; + var ret = (ICERR)ICSendMessage(hic, ICM_Message.ICM_DRAW_GETTIME, (IntPtr)(void*)&val).ToInt32(); + lplTime = val; + return ret; + } + } + + /// The ICDrawOpen macro opens a driver that can draw images with the specified format. + /// + /// Four-character code indicating the type of driver to open. For video streams, the value of this parameter is "VIDC" or ICTYPE_VIDEO. + /// + /// + /// Four-character code indicating the preferred stream handler to use. Typically, this information is stored in the stream header + /// in an AVI file. + /// + /// + /// Pointer to the structure defining the input format. A driver handle will not be returned unless it can decompress this format. + /// For images, this parameter refers to a BITMAPINFOHEADER structure. + /// + /// None + /// + /// The ICDrawOpen macro is defined as follows: + /// + /// #define ICDrawOpen(fccType, fccHandler, lpbiIn) \ ICLocate(fccType, fccHandler, lpbiIn, NULL, ICMODE_DRAW); + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icdrawopen void ICDrawOpen( fccType, fccHandler, lpbiIn ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICDrawOpen")] + public static SafeHIC ICDrawOpen(uint fccType, [Optional] uint fccHandler, in BITMAPINFOHEADER lpbiIn) => ICLocate(fccType, fccHandler, lpbiIn, IntPtr.Zero, ICMODE.ICMODE_DRAW); + + /// + /// The ICDrawQuery macro queries a rendering driver to determine if it can render data in a specific format. You can use + /// this macro or explicitly call the ICM_DRAW_QUERY message. + /// + /// Handle to a driver. + /// Pointer to a BITMAPINFO structure containing the input format. + /// None + /// + /// This macro differs from the ICDrawBegin macro in that it queries the driver in a general sense. ICDrawBegin determines if + /// the driver can draw the data using the specified format under specific conditions, such as stretching the image. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icdrawquery void ICDrawQuery( hic, lpbiInput ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICDrawQuery")] + public static ICERR ICDrawQuery([In] HIC hic, [In, Optional] SafeBITMAPINFO lpbiInput) => + (ICERR)ICSendMessage(hic, ICM_Message.ICM_DRAW_QUERY, lpbiInput).ToInt32(); + + /// + /// The ICDrawRealize macro notifies a rendering driver to realize its drawing palette while drawing. You can use this macro + /// or explicitly call the ICM_DRAW_REALIZE message. + /// + /// Handle to a driver. + /// Handle of the DC used to realize the palette. + /// + /// Background flag. Specify TRUE to realize the palette as a background task or FALSE to realize the palette in the foreground. + /// + /// None + /// Drivers need to respond to this message only if the drawing palette is different from the decompressed palette. + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icdrawrealize void ICDrawRealize( hic, hdc, fBackground ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICDrawRealize")] + public static ICERR ICDrawRealize([In] HIC hic, HDC hdc, bool fBackground) => + (ICERR)ICSendMessage(hic, ICM_Message.ICM_DRAW_REALIZE, (IntPtr)hdc, new IntPtr(fBackground ? 1 : 0)).ToInt32(); + + /// + /// The ICDrawRenderBuffer macro notifies a rendering driver to draw the frames that have been passed to it. You can use this + /// macro or explicitly call the ICM_DRAW_RENDERBUFFER message. + /// + /// Handle to a driver. + /// None + /// + /// Use this message with hardware that performs its own asynchronous decompression, timing, and drawing. + /// + /// This message is typically used to perform a seek operation when the driver must be specifically instructed to display each video + /// frame passed to it rather than playing a sequence of video frames. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icdrawrenderbuffer void ICDrawRenderBuffer( hic ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICDrawRenderBuffer")] + public static ICERR ICDrawRenderBuffer([In] HIC hic) => (ICERR)ICSendMessage(hic, ICM_Message.ICM_DRAW_RENDERBUFFER).ToInt32(); + + /// + /// The ICDrawSetTime macro provides synchronization information to a rendering driver that handles the timing of drawing + /// frames. The synchronization information is the sample number of the frame to draw. You can use this macro or explicitly call the + /// ICM_DRAW_SETTIME message. + /// + /// Handle to a driver. + /// Sample number of the frame to render. + /// None + /// + /// + /// Typically, the driver compares the specified value with the frame number associated with the time of its internal clock and + /// attempts to synchronize the two if the difference is significant. + /// + /// + /// Use this message when the hardware performs its own asynchronous decompression, timing, and drawing, and the hardware relies on + /// an external synchronization signal (the hardware is not being used as the synchronization master). + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icdrawsettime void ICDrawSetTime( hic, lTime ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICDrawSetTime")] + public static ICERR ICDrawSetTime([In] HIC hic, int lTime) => (ICERR)ICSendMessage(hic, ICM_Message.ICM_DRAW_SETTIME, (IntPtr)lTime).ToInt32(); + + /// + /// The ICDrawStart macro notifies a rendering driver to start its internal clock for the timing of drawing frames. You can + /// use this macro or explicitly call the ICM_DRAW_START message. + /// + /// Handle to a driver. + /// None + /// + /// This message is used by hardware that performs its own asynchronous decompression, timing, and drawing. + /// When the driver receives this message, it should start rendering data at the rate specified with the ICM_DRAW_BEGIN message. + /// + /// The ICDrawStart and ICDrawStop macros do not nest. If your driver receives ICDrawStart before rendering is stopped + /// with ICDrawStop, it should restart rendering with new parameters. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icdrawstart void ICDrawStart( hic ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICDrawStart")] + public static ICERR ICDrawStart([In] HIC hic) => (ICERR)ICSendMessage(hic, ICM_Message.ICM_DRAW_START).ToInt32(); + + /// + /// The ICDrawStartPlay macro provides the start and end times of a play operation to a rendering driver. You can use this + /// macro or explicitly call the ICM_DRAW_START_PLAY message. + /// + /// Handle to a driver. + /// Start time. + /// End time. + /// None + /// + /// This message precedes any frame data sent to the rendering driver. + /// + /// Units for lFrom and lTo are specified with the ICM_DRAW_BEGIN message. For video data this is normally a frame number. For more + /// information about the playback rate, see the dwRate and dwScale members of the ICDRAWBEGIN structure. + /// + /// If the end time is less than the start time, the playback direction is reversed. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icdrawstartplay void ICDrawStartPlay( hic, lFrom, lTo ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICDrawStartPlay")] + public static ICERR ICDrawStartPlay([In] HIC hic, int lFrom, int lTo) => + (ICERR)ICSendMessage(hic, ICM_Message.ICM_DRAW_START_PLAY, (IntPtr)lFrom, (IntPtr)lTo).ToInt32(); + + /// + /// The ICDrawStop macro notifies a rendering driver to stop its internal clock for the timing of drawing frames. You can use + /// this macro or explicitly call the ICM_DRAW_STOP message. + /// + /// Handle to a driver. + /// None + /// This macro is used by hardware that performs its own asynchronous decompression, timing, and drawing. + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icdrawstop void ICDrawStop( hic ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICDrawStop")] + public static ICERR ICDrawStop([In] HIC hic) => (ICERR)ICSendMessage(hic, ICM_Message.ICM_DRAW_STOP).ToInt32(); + + /// + /// The ICDrawStopPlay macro notifies a rendering driver when a play operation is complete. You can use this macro or + /// explicitly call the ICM_DRAW_STOP_PLAY message. + /// + /// Handle to a driver. + /// None + /// Use this message when the play operation is complete. Use the ICDrawStop macro to end timing. + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icdrawstopplay void ICDrawStopPlay( hic ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICDrawStopPlay")] + public static ICERR ICDrawStopPlay([In] HIC hic) => (ICERR)ICSendMessage(hic, ICM_Message.ICM_DRAW_STOP_PLAY).ToInt32(); + + /// The ICDrawSuggestFormat function notifies the drawing handler to suggest the input data format. + /// Handle to the driver to use. + /// + /// Pointer to a structure containing the format of the compressed data. For bitmaps, this is a BITMAPINFOHEADER structure. + /// + /// + /// Pointer to a structure to return the suggested format. The drawing handler can receive and draw data from this format. For + /// bitmaps, this is a BITMAPINFOHEADER structure. + /// + /// Width of the source rectangle. + /// Height of the source rectangle. + /// Width of the destination rectangle. + /// Height of the destination rectangle. + /// Decompressor that can use the format of data in lpbiIn. + /// Returns ICERR_OK if successful or an error otherwise. + /// + /// + /// Applications can use this function to determine alternative input formats that a drawing handler can decompress and if the + /// drawing handler can stretch data. If the drawing handler cannot stretch data as requested, the application might have to stretch + /// the data. + /// + /// + /// If the drawing handler cannot decompress a format provided by an application, use the ICDecompress, ICDecompressEx, j, + /// ICDecompressExQuery, and ICDecompressOpen functions to obtain alternate formats. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icdrawsuggestformat LRESULT VFWAPI_INLINE ICDrawSuggestFormat( HIC + // hic, LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut, int dxSrc, int dySrc, int dxDst, int dyDst, HIC hicDecomp ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICDrawSuggestFormat")] + public static IntPtr ICDrawSuggestFormat([In] HIC hic, [In] IntPtr lpbiIn, [Out] IntPtr lpbiOut, int dxSrc, int dySrc, int dxDst, int dyDst, [In] HIC hicDecomp) => + ICSendMessage(hic, ICM_Message.ICM_DRAW_SUGGESTFORMAT, new ICDRAWSUGGEST() + { + lpbiIn = lpbiIn, + lpbiSuggest = lpbiOut, + dxSrc = dxSrc, + dySrc = dySrc, + dxDst = dxDst, + dyDst = dyDst, + hicDecompressor = hicDecomp + }); + + /// + /// The ICDrawWindow macro notifies a rendering driver that the window specified for the ICM_DRAW_BEGIN message needs to be + /// redrawn. The window has moved or become temporarily obscured. You can use this macro or explicitly call the ICM_DRAW_WINDOW message. + /// + /// Handle to a driver. + /// + /// Pointer to the destination rectangle in screen coordinates. If this parameter points to an empty rectangle, drawing should be + /// turned off. + /// + /// None + /// + /// This message is supported by hardware that performs its own asynchronous decompression, timing, and drawing. + /// + /// Video-overlay drivers use this message to draw when the window is obscured or moved. When a window specified for ICM_DRAW_BEGIN + /// is completely hidden by other windows, the destination rectangle is empty. Drivers should turn off video-overlay hardware when + /// this condition occurs. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icdrawwindow void ICDrawWindow( hic, prc ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICDrawWindow")] + public static ICERR ICDrawWindow([In] HIC hic, in RECT prc) => (ICERR)ICSendMessage(hic, ICM_Message.ICM_DRAW_STOP_PLAY, prc).ToInt32(); + + /// + /// The ICGetBuffersWanted macro queries a driver for the number of buffers to allocate. You can use this macro or explicitly + /// call the ICM_GETBUFFERSWANTED message. + /// + /// Handle to a driver. + /// Address to contain the number of samples the driver needs to efficiently render the data. + /// None + /// + /// This message is used by drivers that use hardware to render data and want to ensure a minimal time lag caused by waiting for + /// buffers to arrive. For example, if a driver controls a video decompression board that can hold 10 frames of video, it could + /// return 10 for this message. This instructs applications to try to stay 10 frames ahead of the frame it currently needs. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icgetbufferswanted void ICGetBuffersWanted( hic, lpdwBuffers ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICGetBuffersWanted")] + public static ICERR ICGetBuffersWanted([In] HIC hic, out uint lpdwBuffers) => ICSendGetMessage(hic, ICM_Message.ICM_GETBUFFERSWANTED, out lpdwBuffers); + + /// + /// The ICGetDefaultKeyFrameRate macro queries a video compression driver for its default (or preferred) key-frame spacing. + /// You can use this macro or explicitly call the ICM_GETDEFAULTKEYFRAMERATE message. + /// + /// Handle to a compressor. + /// Address to contain the preferred key-frame spacing. + /// None + /// The ICGetDefaultKeyFrameRate macro returns the default key frame rate. + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icgetdefaultkeyframerate void ICGetDefaultKeyFrameRate( hic ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICGetDefaultKeyFrameRate")] + public static ICERR ICGetDefaultKeyFrameRate([In] HIC hic, out uint dwICValue) => ICSendGetMessage(hic, ICM_Message.ICM_GETDEFAULTKEYFRAMERATE, out dwICValue); + + /// + /// The ICGetDefaultQuality macro queries a video compression driver to provide its default quality setting. You can use this + /// macro or explicitly call the ICM_GETDEFAULTQUALITY message. + /// + /// Handle to a compressor. + /// Address to contain the default quality value. Quality values range from 0 to 10,000. + /// None + /// The ICGetDefaultQuality macro returns the default quality value. + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icgetdefaultquality void ICGetDefaultQuality( hic ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICGetDefaultQuality")] + public static ICERR ICGetDefaultQuality([In] HIC hic, out uint dwICValue) => ICSendGetMessage(hic, ICM_Message.ICM_GETDEFAULTKEYFRAMERATE, out dwICValue); + + /// + /// The ICGetDisplayFormat function determines the best format available for displaying a compressed image. The function also + /// opens a compressor if a handle of an open compressor is not specified. + /// + /// Handle to the compressor to use. Specify NULL to have VCM select and open an appropriate compressor. + /// Pointer to BITMAPINFOHEADER structure containing the compressed format. + /// + /// Pointer to a buffer to return the decompressed format. The buffer should be large enough for a BITMAPINFOHEADER structure and + /// 256 color entries. + /// + /// Preferred bit depth, if nonzero. + /// Width multiplier to stretch the image. If this parameter is zero, that dimension is not stretched. + /// Height multiplier to stretch the image. If this parameter is zero, that dimension is not stretched. + /// Returns a handle to a decompressor if successful or zero otherwise. + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icgetdisplayformat HIC VFWAPI ICGetDisplayFormat( HIC hic, + // LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut, int BitDepth, int dx, int dy ); + [DllImport(Lib_Msvfw32, SetLastError = false, ExactSpelling = true)] + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICGetDisplayFormat")] + public static extern SafeHIC ICGetDisplayFormat(HIC hic, in BITMAPINFOHEADER lpbiIn, IntPtr lpbiOut, [Optional] int BitDepth, [Optional] int dx, [Optional] int dy); + + /// The ICGetInfo function obtains information about a compressor. + /// Handle to a compressor. + /// Pointer to the ICINFO structure to return information about the compressor. + /// Size, in bytes, of the structure pointed to by lpicinfo. + /// Returns the number of bytes copied into the structure or zero if an error occurs. + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icgetinfo LRESULT VFWAPI ICGetInfo( HIC hic, ICINFO *picinfo, DWORD + // cb ); + [DllImport(Lib_Msvfw32, SetLastError = false, ExactSpelling = true)] + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICGetInfo")] + public static extern IntPtr ICGetInfo(HIC hic, ref ICINFO picinfo, uint cb); + + /// + /// The ICGetState macro queries a video compression driver to return its current configuration in a block of memory. You can + /// use this macro or explicitly call the ICM_GETSTATE message. + /// + /// Handle of the compressor. + /// + /// Pointer to a block of memory to contain the current configuration information. You can specify NULL for this parameter to + /// determine the amount of memory required for the configuration information, as in ICGetStateSize. + /// + /// Size, in bytes, of the block of memory. + /// None + /// + /// The ICGetStateSize macro returns the number of bytes used by the state data. + /// The structure used to represent configuration information is driver specific and is defined by the driver. + /// Use ICGetStateSize before calling the ICGetState macro to determine the size of buffer to allocate for the call. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icgetstate void ICGetState( hic, pv, cb ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICGetState")] + public static ICERR ICGetState([In] HIC hic, IntPtr pv, uint cb) => (ICERR)ICSendMessage(hic, ICM_Message.ICM_GETSTATE, pv, new IntPtr((int)cb)).ToInt32(); + + /// + /// The ICGetStateSize macro queries a video compression driver to determine the amount of memory required to retrieve the + /// configuration information. You can use this macro or explicitly call the ICM_GETSTATE message. + /// + /// Handle of the compressor. + /// The size, in bytes, of the buffer needed to hold state. + /// None + /// + /// The structure used to represent configuration information is driver specific and is defined by the driver. + /// Use ICGetStateSize before calling the ICGetState macro to determine the size of buffer to allocate for the call. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icgetstatesize void ICGetStateSize( hic ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICGetStateSize")] + public static ICERR ICGetStateSize([In] HIC hic, out uint size) + { + unsafe + { + uint dw = default; + var ret = (ICERR)ICSendMessage(hic, ICM_Message.ICM_GETSTATE, IntPtr.Zero, (IntPtr)(void*)&dw).ToInt32(); + size = dw; + return ret; + } + } + + /// + /// The ICImageCompress function compresses an image to a given size. This function does not require initialization functions. + /// + /// + /// Handle to a compressor opened with the ICOpen function. Specify NULL to have VCM select an appropriate compressor for the + /// compression format. An application can have the user select the compressor by using the ICCompressorChoose function, which opens + /// the selected compressor and returns a handle of the compressor in this parameter. + /// + /// Reserved; must be zero. + /// Pointer to the BITMAPINFO structure containing the input data format. + /// Pointer to input data bits to compress. The data bits exclude header and format information. + /// + /// Pointer to the BITMAPINFO structure containing the compressed output format. Specify NULL to have the compressor use an + /// appropriate format. + /// + /// Quality value used by the compressor. Values range from 0 to 10,000. + /// + /// Maximum size desired for the compressed image. The compressor might not be able to compress the data to fit within this size. + /// When the function returns, this parameter points to the size of the compressed image. Image sizes are specified in bytes. + /// + /// Returns a handle to a compressed DIB. The image data follows the format header. + /// + /// To obtain the format information from the BITMAPINFOHEADER structure, use the GlobalLock function to lock the data. Use the + /// GlobalFree function to free the DIB when you are finished. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icimagecompress HANDLE VFWAPI ICImageCompress( HIC hic, UINT + // uiFlags, LPBITMAPINFO lpbiIn, LPVOID lpBits, LPBITMAPINFO lpbiOut, LONG lQuality, LONG *plSize ); + [DllImport(Lib_Msvfw32, SetLastError = false, ExactSpelling = true)] + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICImageCompress")] + public static extern SafeHGlobalHandle ICImageCompress([In] HIC hic, [Optional] uint uiFlags, in BITMAPINFO lpbiIn, [In] IntPtr lpBits, [In, Optional] IntPtr lpbiOut, int lQuality, ref int plSize); + + /// + /// The ICImageCompress function compresses an image to a given size. This function does not require initialization functions. + /// + /// + /// Handle to a compressor opened with the ICOpen function. Specify NULL to have VCM select an appropriate compressor for the + /// compression format. An application can have the user select the compressor by using the ICCompressorChoose function, which opens + /// the selected compressor and returns a handle of the compressor in this parameter. + /// + /// Reserved; must be zero. + /// Pointer to the BITMAPINFO structure containing the input data format. + /// Pointer to input data bits to compress. The data bits exclude header and format information. + /// + /// Pointer to the BITMAPINFO structure containing the compressed output format. Specify NULL to have the compressor use an + /// appropriate format. + /// + /// Quality value used by the compressor. Values range from 0 to 10,000. + /// + /// Maximum size desired for the compressed image. The compressor might not be able to compress the data to fit within this size. + /// When the function returns, this parameter points to the size of the compressed image. Image sizes are specified in bytes. + /// + /// Returns a handle to a compressed DIB. The image data follows the format header. + /// + /// To obtain the format information from the BITMAPINFOHEADER structure, use the GlobalLock function to lock the data. Use the + /// GlobalFree function to free the DIB when you are finished. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icimagecompress HANDLE VFWAPI ICImageCompress( HIC hic, UINT + // uiFlags, LPBITMAPINFO lpbiIn, LPVOID lpBits, LPBITMAPINFO lpbiOut, LONG lQuality, LONG *plSize ); + [DllImport(Lib_Msvfw32, SetLastError = false, ExactSpelling = true)] + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICImageCompress")] + public static extern SafeHGlobalHandle ICImageCompress([In] HIC hic, [Optional] uint uiFlags, [In] IntPtr lpbiIn, [In] IntPtr lpBits, [In, Optional] IntPtr lpbiOut, int lQuality, ref int plSize); + + /// The ICImageDecompress function decompresses an image without using initialization functions. + /// + /// Handle to a decompressor opened with the ICOpen function. Specify NULL to have VCM select an appropriate decompressor for + /// the compressed image. + /// + /// Reserved; must be zero. + /// Compressed input data format. + /// Pointer to input data bits to compress. The data bits exclude header and format information. + /// Decompressed output format. Specify NULL to let decompressor use an appropriate format. + /// + /// Returns a handle to an uncompressed DIB in the CF_DIB format if successful or NULL otherwise. Image data follows the + /// format header. + /// + /// + /// To obtain the format information from the LPBITMAPINFOHEADER structure, use the GlobalLock function to lock the + /// data. Use the GlobalFree function to free the DIB when you are finished. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icimagedecompress HANDLE VFWAPI ICImageDecompress( HIC hic, UINT + // uiFlags, LPBITMAPINFO lpbiIn, LPVOID lpBits, LPBITMAPINFO lpbiOut ); + [DllImport(Lib_Msvfw32, SetLastError = false, ExactSpelling = true)] + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICImageDecompress")] + public static extern SafeHGlobalHandle ICImageDecompress([In] HIC hic, [Optional] uint uiFlags, in BITMAPINFO lpbiIn, [In] IntPtr lpBits, [In, Optional] IntPtr lpbiOut); + + /// The ICImageDecompress function decompresses an image without using initialization functions. + /// + /// Handle to a decompressor opened with the ICOpen function. Specify NULL to have VCM select an appropriate decompressor for + /// the compressed image. + /// + /// Reserved; must be zero. + /// Compressed input data format. + /// Pointer to input data bits to compress. The data bits exclude header and format information. + /// Decompressed output format. Specify NULL to let decompressor use an appropriate format. + /// + /// Returns a handle to an uncompressed DIB in the CF_DIB format if successful or NULL otherwise. Image data follows the + /// format header. + /// + /// + /// To obtain the format information from the LPBITMAPINFOHEADER structure, use the GlobalLock function to lock the + /// data. Use the GlobalFree function to free the DIB when you are finished. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icimagedecompress HANDLE VFWAPI ICImageDecompress( HIC hic, UINT + // uiFlags, LPBITMAPINFO lpbiIn, LPVOID lpBits, LPBITMAPINFO lpbiOut ); + [DllImport(Lib_Msvfw32, SetLastError = false, ExactSpelling = true)] + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICImageDecompress")] + public static extern SafeHGlobalHandle ICImageDecompress([In] HIC hic, [Optional] uint uiFlags, [In] IntPtr lpbiIn, [In] IntPtr lpBits, [In, Optional] IntPtr lpbiOut); + + /// + /// The ICInfo function retrieves information about specific installed compressors or enumerates the installed compressors. + /// + /// Four-character code indicating the type of compressor. Specify zero to match all compressor types. + /// + /// Four-character code identifying a specific compressor or a number between zero and the number of installed compressors of the + /// type specified by fccType. + /// + /// Pointer to a ICINFO structure to return information about the compressor. + /// Returns TRUE if successful or an error otherwise. + /// + /// To enumerate the compressors or decompressors, specify an integer for fccHandler. This function returns information for integers + /// between zero and the number of installed compressors or decompressors of the type specified for fccType. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icinfo BOOL VFWAPI ICInfo( DWORD fccType, DWORD fccHandler, ICINFO + // *lpicinfo ); + [DllImport(Lib_Msvfw32, SetLastError = false, ExactSpelling = true)] + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICInfo")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool ICInfo(uint fccType, uint fccHandler, out ICINFO lpicinfo); + + /// The ICInstall function installs a new compressor or decompressor. + /// + /// Four-character code indicating the type of data used by the compressor or decompressor. Specify "VIDC" for a video compressor or decompressor. + /// + /// Four-character code identifying a specific compressor or decompressor. + /// + /// Pointer to a null-terminated string containing the name of the compressor or decompressor, or the address of a function used for + /// compression or decompression. The contents of this parameter are defined by the flags set for wFlags. + /// + /// Reserved; do not use. + /// + /// Flags defining the contents of lParam. The following values are defined. + /// + /// + /// Value + /// Meaning + /// + /// + /// ICINSTALL_DRIVER + /// The lParam parameter contains the address of a null-terminated string that names the compressor to install. + /// + /// + /// ICINSTALL_FUNCTION + /// + /// The lParam parameter contains the address of a compressor function. This function should be structured like the DriverProc entry + /// point function used by compressors. + /// + /// + /// + /// + /// Returns ICERR_OK if successful or an error otherwise. + /// + /// Applications must open an installed compressor or decompressor before using it. + /// + /// If your application installs a function as a compressor or decompressor, it should remove the function with the ICRemove + /// function before it terminates. This prevents other applications from trying to access the function when it is not available. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icinstall BOOL VFWAPI ICInstall( DWORD fccType, DWORD fccHandler, + // LPARAM lParam, LPSTR szDesc, UINT wFlags ); + [DllImport(Lib_Msvfw32, SetLastError = false, ExactSpelling = true)] + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICInstall")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool ICInstall(uint fccType, uint fccHandler, [In] IntPtr lParam, [Optional, MarshalAs(UnmanagedType.LPStr)] string szDesc, ICINSTALL wFlags); + + /// + /// The ICLocate function finds a compressor or decompressor that can handle images with the specified formats, or finds a + /// driver that can decompress an image with a specified format directly to hardware. + /// + /// + /// Four-character code indicating the type of compressor or decompressor to open. For video streams, the value of this parameter is 'VIDC'. + /// + /// + /// Preferred handler of the specified type. Typically, the handler type is stored in the stream header in an AVI file. Specify + /// NULL if your application can use any handler type or it does not know the handler type to use. + /// + /// + /// Pointer to a BITMAPINFOHEADER structure defining the input format. A compressor handle is not returned unless it supports this format. + /// + /// + /// + /// Pointer to a BITMAPINFOHEADER structure defining an optional decompressed format. You can also specify zero to use the default + /// output format associated with the input format. + /// + /// If this parameter is nonzero, a compressor handle is not returned unless it can create this output format. + /// + /// + /// Flags that describe the search criteria for a compressor or decompressor. The following values are defined: + /// + /// + /// Value + /// Meaning + /// + /// + /// ICMODE_COMPRESS + /// Finds a compressor that can compress an image with a format defined by lpbiIn to the format defined by lpbiOut. + /// + /// + /// ICMODE_DECOMPRESS + /// Finds a decompressor that can decompress an image with a format defined by lpbiIn to the format defined by lpbiOut. + /// + /// + /// ICMODE_DRAW + /// Finds a decompressor that can decompress an image with a format defined by lpbiIn and draw it directly to hardware. + /// + /// + /// ICMODE_FASTCOMPRESS + /// + /// Has the same meaning as ICMODE_COMPRESS except the compressor is used for a real-time operation and emphasizes speed over quality. + /// + /// + /// + /// ICMODE_FASTDECOMPRESS + /// + /// Has the same meaning as ICMODE_DECOMPRESS except the decompressor is used for a real-time operation and emphasizes speed over quality. + /// + /// + /// + /// + /// Returns a handle to a compressor or decompressor if successful or zero otherwise. + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-iclocate HIC VFWAPI ICLocate( DWORD fccType, DWORD fccHandler, + // LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut, WORD wFlags ); + [DllImport(Lib_Msvfw32, SetLastError = false, ExactSpelling = true)] + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICLocate")] + public static extern SafeHIC ICLocate(uint fccType, [Optional] uint fccHandler, in BITMAPINFOHEADER lpbiIn, in BITMAPINFOHEADER lpbiOut, ICMODE wFlags); + + /// + /// The ICLocate function finds a compressor or decompressor that can handle images with the specified formats, or finds a + /// driver that can decompress an image with a specified format directly to hardware. + /// + /// + /// Four-character code indicating the type of compressor or decompressor to open. For video streams, the value of this parameter is 'VIDC'. + /// + /// + /// Preferred handler of the specified type. Typically, the handler type is stored in the stream header in an AVI file. Specify + /// NULL if your application can use any handler type or it does not know the handler type to use. + /// + /// + /// Pointer to a BITMAPINFOHEADER structure defining the input format. A compressor handle is not returned unless it supports this format. + /// + /// + /// + /// Pointer to a BITMAPINFOHEADER structure defining an optional decompressed format. You can also specify zero to use the default + /// output format associated with the input format. + /// + /// If this parameter is nonzero, a compressor handle is not returned unless it can create this output format. + /// + /// + /// Flags that describe the search criteria for a compressor or decompressor. The following values are defined: + /// + /// + /// Value + /// Meaning + /// + /// + /// ICMODE_COMPRESS + /// Finds a compressor that can compress an image with a format defined by lpbiIn to the format defined by lpbiOut. + /// + /// + /// ICMODE_DECOMPRESS + /// Finds a decompressor that can decompress an image with a format defined by lpbiIn to the format defined by lpbiOut. + /// + /// + /// ICMODE_DRAW + /// Finds a decompressor that can decompress an image with a format defined by lpbiIn and draw it directly to hardware. + /// + /// + /// ICMODE_FASTCOMPRESS + /// + /// Has the same meaning as ICMODE_COMPRESS except the compressor is used for a real-time operation and emphasizes speed over quality. + /// + /// + /// + /// ICMODE_FASTDECOMPRESS + /// + /// Has the same meaning as ICMODE_DECOMPRESS except the decompressor is used for a real-time operation and emphasizes speed over quality. + /// + /// + /// + /// + /// Returns a handle to a compressor or decompressor if successful or zero otherwise. + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-iclocate HIC VFWAPI ICLocate( DWORD fccType, DWORD fccHandler, + // LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut, WORD wFlags ); + [DllImport(Lib_Msvfw32, SetLastError = false, ExactSpelling = true)] + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICLocate")] + public static extern SafeHIC ICLocate(uint fccType, [Optional] uint fccHandler, in BITMAPINFOHEADER lpbiIn, [In, Optional] IntPtr lpbiOut, ICMODE wFlags); + + /// The ICOpen function opens a compressor or decompressor. + /// + /// Four-character code indicating the type of compressor or decompressor to open. For video streams, the value of this parameter is "VIDC". + /// + /// + /// Preferred handler of the specified type. Typically, the handler type is stored in the stream header in an AVI file. + /// + /// + /// Flag defining the use of the compressor or decompressor. The following values are defined. + /// + /// + /// Value + /// Meaning + /// + /// + /// ICMODE_COMPRESS + /// Compressor will perform normal compression. + /// + /// + /// ICMODE_DECOMPRESS + /// Decompressor will perform normal decompression. + /// + /// + /// ICMODE_DRAW + /// Decompressor will decompress and draw the data directly to hardware. + /// + /// + /// ICMODE_FASTCOMPRESS + /// Compressor will perform fast (real-time) compression. + /// + /// + /// ICMODE_FASTDECOMPRESS + /// Decompressor will perform fast (real-time) decompression. + /// + /// + /// ICMODE_QUERY + /// Queries the compressor or decompressor for information. + /// + /// + /// + /// Returns a handle to a compressor or decompressor if successful or zero otherwise. + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icopen HIC VFWAPI ICOpen( DWORD fccType, DWORD fccHandler, UINT + // wMode ); + [DllImport(Lib_Msvfw32, SetLastError = false, ExactSpelling = true)] + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICOpen")] + public static extern SafeHIC ICOpen(uint fccType, uint fccHandler, ICMODE wMode); + + /// The ICOpenFunction function opens a compressor or decompressor defined as a function. + /// Type of compressor to open. For video, the value of this parameter is ICTYPE_VIDEO. + /// Preferred handler of the specified type. Typically, this comes from the stream header in an AVI file. + /// + /// Flag to define the use of the compressor or decompressor. The following values are defined. + /// + /// + /// Value + /// Meaning + /// + /// + /// ICMODE_COMPRESS + /// Compressor will perform normal compression. + /// + /// + /// ICMODE_DECOMPRESS + /// Decompressor will perform normal decompression. + /// + /// + /// ICMODE_DRAW + /// Decompressor will decompress and draw the data directly to hardware. + /// + /// + /// ICMODE_FASTCOMPRESS + /// Compressor will perform fast (real-time) compression. + /// + /// + /// ICMODE_FASTDECOMPRESS + /// Decompressor will perform fast (real-time) decompression. + /// + /// + /// ICMODE_QUERY + /// Queries the compressor or decompressor for information. + /// + /// + /// + /// Pointer to the function used as the compressor or decompressor. + /// Returns a handle to a compressor or decompressor if successful or zero otherwise. + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icopenfunction HIC VFWAPI ICOpenFunction( DWORD fccType, DWORD + // fccHandler, UINT wMode, FARPROC lpfnHandler ); + [DllImport(Lib_Msvfw32, SetLastError = false, ExactSpelling = true)] + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICOpenFunction")] + public static extern SafeHIC ICOpenFunction(uint fccType, uint fccHandler, ICMODE wMode, [In] IntPtr lpfnHandler); + + /// + /// The ICQueryAbout macro queries a video compression driver to determine if it has an About dialog box. You can use this + /// macro or explicitly call the ICM_ABOUT message. + /// + /// Handle of the compressor. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icqueryabout void ICQueryAbout( hic ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICQueryAbout")] + public static ICERR ICQueryAbout([In] HIC hic) => (ICERR)ICSendMessage(hic, ICM_Message.ICM_ABOUT, new IntPtr(-1), (IntPtr)1).ToInt32(); + + /// + /// The ICQueryAbout macro queries a video compression driver to determine if it has an About dialog box. You can use this + /// macro or explicitly call the ICM_ABOUT message. + /// + /// Handle of the compressor. + /// Handle to the parent window of the displayed dialog box. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icqueryabout void ICQueryAbout( hic ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICQueryAbout")] + public static ICERR ICQueryAbout([In] HIC hic, [In] HWND hwnd) => (ICERR)ICSendMessage(hic, ICM_Message.ICM_ABOUT, (IntPtr)hwnd, IntPtr.Zero).ToInt32(); + + /// + /// The ICQueryConfigure macro queries a video compression driver to determine if it has a configuration dialog box. You can + /// use this macro or explicitly send the ICM_CONFIGURE message. + /// + /// Handle of the compressor. + /// None + /// + /// This message is different from the DRV_CONFIGURE message used for hardware configuration. The dialog box for this message should + /// let the user set and edit the internal state referenced by the ICM_GETSTATE and ICM_SETSTATE messages. For example, this dialog + /// box can let the user change parameters affecting the quality level and other similar compression options. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icqueryconfigure void ICQueryConfigure( hic ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICQueryConfigure")] + public static ICERR ICQueryConfigure([In] HIC hic) => (ICERR)ICSendMessage(hic, ICM_Message.ICM_CONFIGURE, new IntPtr(-1), (IntPtr)1).ToInt32(); + + /// + /// The ICQueryConfigure macro queries a video compression driver to determine if it has a configuration dialog box. You can + /// use this macro or explicitly send the ICM_CONFIGURE message. + /// + /// Handle of the compressor. + /// Handle to the parent window of the displayed dialog box. + /// None + /// + /// This message is different from the DRV_CONFIGURE message used for hardware configuration. The dialog box for this message should + /// let the user set and edit the internal state referenced by the ICM_GETSTATE and ICM_SETSTATE messages. For example, this dialog + /// box can let the user change parameters affecting the quality level and other similar compression options. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icqueryconfigure void ICQueryConfigure( hic ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICQueryConfigure")] + public static ICERR ICQueryConfigure([In] HIC hic, [In] HWND hwnd) => (ICERR)ICSendMessage(hic, ICM_Message.ICM_CONFIGURE, (IntPtr)hwnd, (IntPtr)1).ToInt32(); + + /// The ICRemove function removes an installed compressor. + /// + /// Four-character code indicating the type of data used by the compressor or decompressor. Specify "VIDC" for a video compressor or decompressor. + /// + /// + /// Four-character code identifying a specific compressor or a number between zero and the number of installed compressors of the + /// type specified by fccType. + /// + /// Reserved; do not use. + /// Returns TRUE if successful or FALSE otherwise. + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icremove BOOL VFWAPI ICRemove( DWORD fccType, DWORD fccHandler, + // UINT wFlags ); + [DllImport(Lib_Msvfw32, SetLastError = false, ExactSpelling = true)] + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICRemove")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool ICRemove(uint fccType, uint fccHandler, uint wFlags = 0); + /// The ICSendMessage function sends a message to a compressor. /// Handle to the compressor to receive the message. /// Message to send. @@ -1999,14 +3007,160 @@ namespace Vanara.PInvoke } /// The ICSendMessage function sends a message to a compressor. + /// The type of the structure to pass into . /// Handle to the compressor to receive the message. /// Message to send. /// Additional message-specific information. - /// Additional message-specific information. /// Returns a message-specific result. [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICSendMessage")] - internal static IntPtr ICSendMessage(HIC hic, ICM_Message msg, [In] SafeBITMAPINFO lpbiInput, [In, Optional] SafeBITMAPINFO lpbiOutput) => - ICSendMessage(hic, msg, lpbiInput ?? SafeBITMAPINFO.Null, lpbiOutput ?? SafeBITMAPINFO.Null); + public static IntPtr ICSendMessage(HIC hic, ICM_Message msg, in T lpbiInput) where T : struct + { + using var mem = new SafeCoTaskMemStruct(lpbiInput); + return ICSendMessage(hic, msg, mem, (IntPtr)(int)mem.Size); + } + + /// The ICSeqCompressFrame function compresses one frame in a sequence of frames. + /// Pointer to a COMPVARS structure initialized with information about the compression. + /// Reserved; must be zero. + /// Pointer to the data bits to compress. (The data bits exclude header or format information.) + /// Returns whether or not the frame was compressed into a key frame. + /// + /// Maximum size desired for the compressed image. The compressor might not be able to compress the data to fit within this size. + /// When the function returns, the parameter points to the size of the compressed image. Images sizes are specified in bytes. + /// + /// Returns the address of the compressed bits if successful or NULL otherwise. + /// + /// + /// This function uses a COMPVARS structure to provide settings for the specified compressor and intersperses key frames at the rate + /// specified by the ICSeqCompressorFrameStart function. You can specify values for the data rate for the sequence and the key-frame + /// frequency by using the appropriate members of COMPVARS. + /// + /// Use this function instead of the ICCompress function to compress a video sequence. + /// + /// You can allow the user to specify a compressor and initialize a COMPVARS structure by using the ICCompressorChoose function. Or, + /// you can initialize a COMPVARS structure manually. + /// + /// + /// Use the ICSeqCompressFrameStart, ICSeqCompressFrame, and ICSeqCompressFrameEnd functions to compress a sequence of frames + /// to a specified data rate and number of key frames. Use ICSeqCompressFrame once for each frame to be compressed. + /// + /// When finished with compression, use the ICCompressorFree function to release the resources specified by COMPVARS. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icseqcompressframe LPVOID VFWAPI ICSeqCompressFrame( PCOMPVARS pc, + // UINT uiFlags, LPVOID lpBits, BOOL *pfKey, LONG *plSize ); + [DllImport(Lib_Msvfw32, SetLastError = false, ExactSpelling = true)] + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICSeqCompressFrame")] + public static extern IntPtr ICSeqCompressFrame(in COMPVARS pc, [Optional] uint uiFlags, [In] IntPtr lpBits, [MarshalAs(UnmanagedType.Bool)] out bool pfKey, ref int plSize); + + /// + /// The ICSeqCompressFrameEnd function ends sequence compression that was initiated by using the ICSeqCompressFrameStart and + /// ICSeqCompressFrame functions. + /// + /// Pointer to a COMPVARS structure used during sequence compression. + /// This function does not return a value. + /// When finished with compression, use the ICCompressorFree function to release the resources specified by COMPVARS. + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icseqcompressframeend void VFWAPI ICSeqCompressFrameEnd( PCOMPVARS + // pc ); + [DllImport(Lib_Msvfw32, SetLastError = false, ExactSpelling = true)] + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICSeqCompressFrameEnd")] + public static extern void ICSeqCompressFrameEnd(in COMPVARS pc); + + /// + /// The ICSeqCompressFrameStart function initializes resources for compressing a sequence of frames using the + /// ICSeqCompressFrame function. + /// + /// Pointer to a COMPVARS structure initialized with information for compression. + /// Format of the data to be compressed. + /// Returns TRUE if successful or FALSE otherwise. + /// + /// + /// This function uses a COMPVARS structure to provide settings for the specified compressor and intersperses key frames at the rate + /// specified by the lKey member of COMPVARS. You can specify values for the data rate for the sequence and the + /// key-frame frequency by using the appropriate members of COMPVARS. + /// + /// + /// Use the ICSeqCompressFrameStart, ICSeqCompressFrame, and ICSeqCompressFrameEnd functions to compress a sequence of frames + /// to a specified data rate and number of key frames. + /// + /// When finished with compression, use the ICCompressorFree function to release the resources specified in COMPVARS. + /// + /// COMPVARS needs to be initialized before you use this function. You can initialize the structure manually or you can allow the + /// user to specify a compressor and initialize a COMPVARS structure by using the ICCompressorChoose function. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icseqcompressframestart BOOL VFWAPI ICSeqCompressFrameStart( + // PCOMPVARS pc, LPBITMAPINFO lpbiIn ); + [DllImport(Lib_Msvfw32, SetLastError = false, ExactSpelling = true)] + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICSeqCompressFrameStart")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool ICSeqCompressFrameStart(in COMPVARS pc, [In] IntPtr lpbiIn); + + /// + /// The ICSeqCompressFrameStart function initializes resources for compressing a sequence of frames using the + /// ICSeqCompressFrame function. + /// + /// Pointer to a COMPVARS structure initialized with information for compression. + /// Format of the data to be compressed. + /// Returns TRUE if successful or FALSE otherwise. + /// + /// + /// This function uses a COMPVARS structure to provide settings for the specified compressor and intersperses key frames at the rate + /// specified by the lKey member of COMPVARS. You can specify values for the data rate for the sequence and the + /// key-frame frequency by using the appropriate members of COMPVARS. + /// + /// + /// Use the ICSeqCompressFrameStart, ICSeqCompressFrame, and ICSeqCompressFrameEnd functions to compress a sequence of frames + /// to a specified data rate and number of key frames. + /// + /// When finished with compression, use the ICCompressorFree function to release the resources specified in COMPVARS. + /// + /// COMPVARS needs to be initialized before you use this function. You can initialize the structure manually or you can allow the + /// user to specify a compressor and initialize a COMPVARS structure by using the ICCompressorChoose function. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icseqcompressframestart BOOL VFWAPI ICSeqCompressFrameStart( + // PCOMPVARS pc, LPBITMAPINFO lpbiIn ); + [DllImport(Lib_Msvfw32, SetLastError = false, ExactSpelling = true)] + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICSeqCompressFrameStart")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool ICSeqCompressFrameStart(in COMPVARS pc, in BITMAPINFO lpbiIn); + + /// + /// The ICSetState macro notifies a video compression driver to set the state of the compressor. You can use this macro or + /// explicitly call the ICM_SETSTATE message. + /// + /// Handle of the compressor. + /// + /// Pointer to a block of memory containing configuration data. You can specify NULL for this parameter to reset the + /// compressor to its default state. + /// + /// Size, in bytes, of the block of memory. + /// None + /// + /// The information used by this message is private and specific to a given compressor. Client applications should use this message + /// only to restore information previously obtained with the ICGetState and ICConfigure macros and should use the ICConfigure + /// macro to adjust the configuration of a video compression driver. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icsetstate void ICSetState( hic, pv, cb ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICSetState")] + public static ICERR ICSetState([In] HIC hic, [In] IntPtr pv, uint cb) => (ICERR)ICSendMessage(hic, ICM_Message.ICM_SETSTATE, pv, new IntPtr((int)cb)).ToInt32(); + + /// + /// The ICSetStatusProc function sends the address of a status callback function to a compressor. The compressor calls this + /// function during lengthy operations. + /// + /// Handle to the compressor. + /// Applicable flags. Set to zero. + /// Constant specified with the status callback address. + /// + /// Pointer to the status callback function. Specify NULL to indicate no status callbacks should be sent. + /// + /// Returns ICERR_OK if successful or FALSE otherwise. + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icsetstatusproc LRESULT VFWAPI_INLINE ICSetStatusProc( HIC hic, + // DWORD dwFlags, LRESULT lParam, LONG(* )(LPARAM,UINT,LONG) fpfnStatus ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICSetStatusProc")] + public static IntPtr ICSetStatusProc([In] HIC hic, [Optional] uint dwFlags, [In] IntPtr lParam, [Optional] Func fpfnStatus) => + ICSendMessage(hic, ICM_Message.ICM_SET_STATUS_PROC, new ICSETSTATUSPROC() { dwFlags = dwFlags, lParam = lParam, Status = fpfnStatus }); /// /// The StretchDIB function copies a device independent bitmap from one memory location to another and resizes the image to @@ -2051,7 +3205,27 @@ namespace Vanara.PInvoke [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.StretchDIB")] public static extern void StretchDIB(in BITMAPINFOHEADER biDst, [Out] IntPtr lpDst, int DstX, int DstY, int DstXE, int DstYE, in BITMAPINFOHEADER biSrc, [In] IntPtr lpSrc, int SrcX, int SrcY, int SrcXE, int SrcYE); -#region // Structs + internal static ICERR ICSendGetMessage(HIC hic, ICM_Message msg, out T val) where T : unmanaged + { + unsafe + { + T dw = default; + var ret = (ICERR)ICSendMessage(hic, msg, (IntPtr)(void*)&dw).ToInt32(); + val = dw; + return ret; + } + } + + /// The ICSendMessage function sends a message to a compressor. + /// Handle to the compressor to receive the message. + /// Message to send. + /// Additional message-specific information. + /// Additional message-specific information. + /// Returns a message-specific result. + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICSendMessage")] + internal static IntPtr ICSendMessage(HIC hic, ICM_Message msg, [In] SafeBITMAPINFO lpbiInput, [In, Optional] SafeBITMAPINFO lpbiOutput) => + ICSendMessage(hic, msg, lpbiInput ?? SafeBITMAPINFO.Null, lpbiOutput ?? SafeBITMAPINFO.Null); + /// /// The COMPVARS structure describes compressor settings for functions such as ICCompressorChoose, ICSeqCompressFrame, and ICCompressorFree. /// @@ -2937,6 +4111,10 @@ namespace Vanara.PInvoke /// Parameter that contains a constant to pass to the status procedure. public IntPtr lParam; + + /// + [MarshalAs(UnmanagedType.FunctionPtr)] + public Func Status; } /// Provides a for that is disposed using . @@ -2960,151 +4138,15 @@ namespace Vanara.PInvoke /// protected override bool InternalReleaseHandle() => DrawDibClose(handle); } - #endregion - - /// The ICDecompressGetPalette macro requests that the video decompression driver supply the color table of the output BITMAPINFOHEADER structure. You can use this macro or explicitly call the ICM_DECOMPRESS_GET_PALETTE message. - /// Handle to a decompressor. - /// Pointer to a BITMAPINFOHEADER structure containing the input format. - /// Pointer to a BITMAPINFOHEADER structure to contain the color table. The space reserved for the color table is always at least 256 colors. You can specify zero for this parameter to return only the size of the color table. - /// None - /// - /// If lpbiOutput is nonzero, the driver sets the biClrUsed member of BITMAPINFOHEADER to the number of colors in the color table. The driver fills the bmiColors members of BITMAPINFO with the actual colors. - /// The driver should support this message only if it uses a palette other than the one specified in the input format. - /// - // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icdecompressgetpalette - // void ICDecompressGetPalette( hic, lpbiInput, lpbiOutput ); - [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICDecompressGetPalette")] - public static ICERR ICDecompressGetPalette([In] HIC hic, in BITMAPINFOHEADER lpbiInput, in BITMAPINFOHEADER lpbiOutput) => - (ICERR)ICSendMessage(hic, ICM_Message.ICM_DECOMPRESS_GET_PALETTE, lpbiInput, lpbiOutput).ToInt32(); - - /// The ICDecompressOpen macro opens a decompressor that is compatible with the specified formats. - /// Four-character code indicating the type of compressor to open. For video streams, the value of this parameter is "VIDC" or ICTYPE_VIDEO. - /// Four-character code indicating the preferred stream handler to use. Typically, this information is stored in the stream header in an AVI file. - /// Pointer to a structure defining the input format. A decompressor handle is not returned unless it can decompress this format. For bitmaps, this parameter refers to a BITMAPINFOHEADER structure. - /// - /// Pointer to a structure defining an optional decompression format. You can also specify zero to use the default output format associated with the input format. - /// If this parameter is nonzero, a compressor handle is not returned unless it can create this output format. For bitmaps, this parameter refers to a BITMAPINFOHEADER structure. - /// - /// None - /// - /// The ICDecompressOpen macro is defined as follows: - /// #define ICDecompressOpen(fccType, fccHandler, lpbiIn, lpbiOut) \ ICLocate(fccType, fccHandler, lpbiIn, lpbiOut, ICMODE_DECOMPRESS); - /// - // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icdecompressopen - // void ICDecompressOpen( fccType, fccHandler, lpbiIn, lpbiOut ); - [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICDecompressOpen")] - public static SafeHIC ICDecompressOpen(uint fccType, [Optional] uint fccHandler, in BITMAPINFOHEADER lpbiIn, in BITMAPINFOHEADER lpbiOut) => - ICLocate(fccType, fccHandler, lpbiIn, lpbiOut, ICMODE.ICMODE_DECOMPRESS); - - /// The ICDecompressOpen macro opens a decompressor that is compatible with the specified formats. - /// Four-character code indicating the type of compressor to open. For video streams, the value of this parameter is "VIDC" or ICTYPE_VIDEO. - /// Four-character code indicating the preferred stream handler to use. Typically, this information is stored in the stream header in an AVI file. - /// Pointer to a structure defining the input format. A decompressor handle is not returned unless it can decompress this format. For bitmaps, this parameter refers to a BITMAPINFOHEADER structure. - /// None - /// - /// The ICDecompressOpen macro is defined as follows: - /// #define ICDecompressOpen(fccType, fccHandler, lpbiIn, lpbiOut) \ ICLocate(fccType, fccHandler, lpbiIn, lpbiOut, ICMODE_DECOMPRESS); - /// - // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icdecompressopen - // void ICDecompressOpen( fccType, fccHandler, lpbiIn, lpbiOut ); - [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICDecompressOpen")] - public static SafeHIC ICDecompressOpen(uint fccType, [Optional] uint fccHandler, in BITMAPINFOHEADER lpbiIn) => - ICLocate(fccType, fccHandler, lpbiIn, IntPtr.Zero, ICMODE.ICMODE_DECOMPRESS); - - /// The ICLocate function finds a compressor or decompressor that can handle images with the specified formats, or finds a driver that can decompress an image with a specified format directly to hardware. - /// Four-character code indicating the type of compressor or decompressor to open. For video streams, the value of this parameter is 'VIDC'. - /// Preferred handler of the specified type. Typically, the handler type is stored in the stream header in an AVI file. Specify NULL if your application can use any handler type or it does not know the handler type to use. - /// Pointer to a BITMAPINFOHEADER structure defining the input format. A compressor handle is not returned unless it supports this format. - /// - /// Pointer to a BITMAPINFOHEADER structure defining an optional decompressed format. You can also specify zero to use the default output format associated with the input format. - /// If this parameter is nonzero, a compressor handle is not returned unless it can create this output format. - /// - /// - /// Flags that describe the search criteria for a compressor or decompressor. The following values are defined: - /// - /// - /// Value - /// Meaning - /// - /// - /// ICMODE_COMPRESS - /// Finds a compressor that can compress an image with a format defined by lpbiIn to the format defined by lpbiOut. - /// - /// - /// ICMODE_DECOMPRESS - /// Finds a decompressor that can decompress an image with a format defined by lpbiIn to the format defined by lpbiOut. - /// - /// - /// ICMODE_DRAW - /// Finds a decompressor that can decompress an image with a format defined by lpbiIn and draw it directly to hardware. - /// - /// - /// ICMODE_FASTCOMPRESS - /// Has the same meaning as ICMODE_COMPRESS except the compressor is used for a real-time operation and emphasizes speed over quality. - /// - /// - /// ICMODE_FASTDECOMPRESS - /// Has the same meaning as ICMODE_DECOMPRESS except the decompressor is used for a real-time operation and emphasizes speed over quality. - /// - /// - /// - /// Returns a handle to a compressor or decompressor if successful or zero otherwise. - // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-iclocate - // HIC VFWAPI ICLocate( DWORD fccType, DWORD fccHandler, LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut, WORD wFlags ); - [DllImport(Lib_Msvfw32, SetLastError = false, ExactSpelling = true)] - [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICLocate")] - public static extern SafeHIC ICLocate(uint fccType, [Optional] uint fccHandler, in BITMAPINFOHEADER lpbiIn, in BITMAPINFOHEADER lpbiOut, ICMODE wFlags); - - /// The ICLocate function finds a compressor or decompressor that can handle images with the specified formats, or finds a driver that can decompress an image with a specified format directly to hardware. - /// Four-character code indicating the type of compressor or decompressor to open. For video streams, the value of this parameter is 'VIDC'. - /// Preferred handler of the specified type. Typically, the handler type is stored in the stream header in an AVI file. Specify NULL if your application can use any handler type or it does not know the handler type to use. - /// Pointer to a BITMAPINFOHEADER structure defining the input format. A compressor handle is not returned unless it supports this format. - /// - /// Pointer to a BITMAPINFOHEADER structure defining an optional decompressed format. You can also specify zero to use the default output format associated with the input format. - /// If this parameter is nonzero, a compressor handle is not returned unless it can create this output format. - /// - /// - /// Flags that describe the search criteria for a compressor or decompressor. The following values are defined: - /// - /// - /// Value - /// Meaning - /// - /// - /// ICMODE_COMPRESS - /// Finds a compressor that can compress an image with a format defined by lpbiIn to the format defined by lpbiOut. - /// - /// - /// ICMODE_DECOMPRESS - /// Finds a decompressor that can decompress an image with a format defined by lpbiIn to the format defined by lpbiOut. - /// - /// - /// ICMODE_DRAW - /// Finds a decompressor that can decompress an image with a format defined by lpbiIn and draw it directly to hardware. - /// - /// - /// ICMODE_FASTCOMPRESS - /// Has the same meaning as ICMODE_COMPRESS except the compressor is used for a real-time operation and emphasizes speed over quality. - /// - /// - /// ICMODE_FASTDECOMPRESS - /// Has the same meaning as ICMODE_DECOMPRESS except the decompressor is used for a real-time operation and emphasizes speed over quality. - /// - /// - /// - /// Returns a handle to a compressor or decompressor if successful or zero otherwise. - // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-iclocate - // HIC VFWAPI ICLocate( DWORD fccType, DWORD fccHandler, LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut, WORD wFlags ); - [DllImport(Lib_Msvfw32, SetLastError = false, ExactSpelling = true)] - [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICLocate")] - public static extern SafeHIC ICLocate(uint fccType, [Optional] uint fccHandler, in BITMAPINFOHEADER lpbiIn, [In, Optional] IntPtr lpbiOut, ICMODE wFlags); /// Provides a for that is disposed using . public class SafeHIC : SafeHANDLE { /// Initializes a new instance of the class and assigns an existing handle. /// An object that represents the pre-existing handle to use. - /// to reliably release the handle during the finalization phase; otherwise, (not recommended). + /// + /// to reliably release the handle during the finalization phase; otherwise, (not recommended). + /// public SafeHIC(IntPtr preexistingHandle, bool ownsHandle = true) : base(preexistingHandle, ownsHandle) { } /// Initializes a new instance of the class. @@ -3118,203 +4160,5 @@ namespace Vanara.PInvoke /// protected override bool InternalReleaseHandle() => ICClose(handle) == IntPtr.Zero; } - - /// The ICOpen function opens a compressor or decompressor. - /// Four-character code indicating the type of compressor or decompressor to open. For video streams, the value of this parameter is "VIDC". - /// Preferred handler of the specified type. Typically, the handler type is stored in the stream header in an AVI file. - /// - /// Flag defining the use of the compressor or decompressor. The following values are defined. - /// - /// - /// Value - /// Meaning - /// - /// - /// ICMODE_COMPRESS - /// Compressor will perform normal compression. - /// - /// - /// ICMODE_DECOMPRESS - /// Decompressor will perform normal decompression. - /// - /// - /// ICMODE_DRAW - /// Decompressor will decompress and draw the data directly to hardware. - /// - /// - /// ICMODE_FASTCOMPRESS - /// Compressor will perform fast (real-time) compression. - /// - /// - /// ICMODE_FASTDECOMPRESS - /// Decompressor will perform fast (real-time) decompression. - /// - /// - /// ICMODE_QUERY - /// Queries the compressor or decompressor for information. - /// - /// - /// - /// Returns a handle to a compressor or decompressor if successful or zero otherwise. - // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icopen - // HIC VFWAPI ICOpen( DWORD fccType, DWORD fccHandler, UINT wMode ); - [DllImport(Lib_Msvfw32, SetLastError = false, ExactSpelling = true)] - [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICOpen")] - public static extern SafeHIC ICOpen(uint fccType, uint fccHandler, ICMODE wMode); - - /// The ICInfo function retrieves information about specific installed compressors or enumerates the installed compressors. - /// Four-character code indicating the type of compressor. Specify zero to match all compressor types. - /// Four-character code identifying a specific compressor or a number between zero and the number of installed compressors of the type specified by fccType. - /// Pointer to a ICINFO structure to return information about the compressor. - /// Returns TRUE if successful or an error otherwise. - /// To enumerate the compressors or decompressors, specify an integer for fccHandler. This function returns information for integers between zero and the number of installed compressors or decompressors of the type specified for fccType. - // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icinfo - // BOOL VFWAPI ICInfo( DWORD fccType, DWORD fccHandler, ICINFO *lpicinfo ); - [DllImport(Lib_Msvfw32, SetLastError = false, ExactSpelling = true)] - [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICInfo")] - [return: MarshalAs(UnmanagedType.Bool)] - public static extern bool ICInfo(uint fccType, uint fccHandler, out ICINFO lpicinfo); - - /// The ICGetDisplayFormat function determines the best format available for displaying a compressed image. The function also opens a compressor if a handle of an open compressor is not specified. - /// Handle to the compressor to use. Specify NULL to have VCM select and open an appropriate compressor. - /// Pointer to BITMAPINFOHEADER structure containing the compressed format. - /// Pointer to a buffer to return the decompressed format. The buffer should be large enough for a BITMAPINFOHEADER structure and 256 color entries. - /// Preferred bit depth, if nonzero. - /// Width multiplier to stretch the image. If this parameter is zero, that dimension is not stretched. - /// Height multiplier to stretch the image. If this parameter is zero, that dimension is not stretched. - /// Returns a handle to a decompressor if successful or zero otherwise. - // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icgetdisplayformat - // HIC VFWAPI ICGetDisplayFormat( HIC hic, LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut, int BitDepth, int dx, int dy ); - [DllImport(Lib_Msvfw32, SetLastError = false, ExactSpelling = true)] - [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICGetDisplayFormat")] - public static extern SafeHIC ICGetDisplayFormat(HIC hic, in BITMAPINFOHEADER lpbiIn, IntPtr lpbiOut, [Optional] int BitDepth, [Optional] int dx, [Optional] int dy); - - /// The ICGetInfo function obtains information about a compressor. - /// Handle to a compressor. - /// Pointer to the ICINFO structure to return information about the compressor. - /// Size, in bytes, of the structure pointed to by lpicinfo. - /// Returns the number of bytes copied into the structure or zero if an error occurs. - // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icgetinfo - // LRESULT VFWAPI ICGetInfo( HIC hic, ICINFO *picinfo, DWORD cb ); - [DllImport(Lib_Msvfw32, SetLastError = false, ExactSpelling = true)] - [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICGetInfo")] - public static extern IntPtr ICGetInfo(HIC hic, ref ICINFO picinfo, uint cb); - - /// The ICDecompressQuery macro queries a video decompression driver to determine if it supports a specific input format or if it can decompress a specific input format to a specific output format. You can use this macro or explicitly call the ICM_DECOMPRESS_QUERY message. - /// Handle to a decompressor. - /// Pointer to a BITMAPINFO structure containing the input format. - /// Pointer to a BITMAPINFO structure containing the output format. You can specify zero for this parameter to indicate any output format is acceptable. - /// None - // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icdecompressquery - // void ICDecompressQuery( hic, lpbiInput, lpbiOutput ); - [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICDecompressQuery")] - public static ICERR ICDecompressQuery([In] HIC hic, in BITMAPINFO lpbiInput, in BITMAPINFO lpbiOutput) => - (ICERR)ICSendMessage(hic, ICM_Message.ICM_DECOMPRESS_QUERY, lpbiInput, lpbiOutput).ToInt32(); - - /// The ICDecompressSetPalette macro specifies a palette for a video decompression driver to use if it is decompressing to a format that uses a palette. You can use this macro or explicitly call the ICM_DECOMPRESS_SET_PALETTE message. - /// Handle to a decompressor. - /// Pointer to a BITMAPINFOHEADER structure whose color table contains the colors that should be used if possible. You can specify zero to use the default set of output colors. - /// None - /// - /// This macro should not affect decompression already in progress; rather, colors passed using this message should be returned in response to future ICDecompressGetFormat and ICDecompressGetPalette macros. Colors are sent back to the decompression driver in a future ICDecompressBegin macro. - /// This macro is used primarily when a driver decompresses images to the screen and another application that uses a palette is in the foreground, forcing the decompression driver to adapt to a foreign set of colors. - /// - // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icdecompresssetpalette - // void ICDecompressSetPalette( hic, lpbiPalette ); - [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICDecompressSetPalette")] - public static ICERR ICDecompressSetPalette([In] HIC hic, [In, Optional] SafeBITMAPINFO lpbiPalette) => - (ICERR)ICSendMessage(hic, ICM_Message.ICM_DECOMPRESS_SET_PALETTE, lpbiPalette).ToInt32(); - - /// The ICDrawChangePalette macro notifies a rendering driver that the movie palette is changing. You can use this macro or explicitly call the ICM_DRAW_CHANGEPALETTE message. - /// Handle to a rendering driver. - /// Pointer to a BITMAPINFO structure containing the new format and optional color table. - /// None - /// This message should be supported by installable rendering handlers that draw DIBs with an internal structure that includes a palette. - // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icdrawchangepalette - // void ICDrawChangePalette( hic, lpbiInput ); - [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICDrawChangePalette")] - public static ICERR ICDrawChangePalette([In] HIC hic, in BITMAPINFO lpbiInput) => - (ICERR)ICSendMessage(hic, ICM_Message.ICM_DRAW_CHANGEPALETTE, lpbiInput).ToInt32(); - - /// The ICDrawEnd macro notifies a rendering driver to decompress the current image to the screen and to release resources allocated for decompression and drawing. You can use this macro or explicitly call the ICM_DRAW_END message. - /// Handle to a driver. - /// None - /// The ICM_DRAW_BEGIN and ICM_DRAW_END messages do not nest. If your driver receives ICM_DRAW_BEGIN before decompression is stopped with ICM_DRAW_END, it should restart decompression with new parameters. - // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icdrawend - // void ICDrawEnd( hic ); - [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICDrawEnd")] - public static ICERR ICDrawEnd([In] HIC hic) => (ICERR)ICSendMessage(hic, ICM_Message.ICM_DRAW_END).ToInt32(); - - /// The ICDrawFlush macro notifies a rendering driver to render the contents of any image buffers that are waiting to be drawn. You can use this macro or explicitly call the ICM_DRAW_FLUSH message. - /// Handle to a driver. - /// None - /// This message is used only by hardware that performs its own asynchronous decompression, timing, and drawing. - // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icdrawflush - // void ICDrawFlush( hic ); - [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICDrawFlush")] - public static ICERR ICDrawFlush([In] HIC hic) => (ICERR)ICSendMessage(hic, ICM_Message.ICM_DRAW_FLUSH).ToInt32(); - - /// The ICDrawGetTime macro requests a rendering driver that controls the timing of drawing frames to return the current value of its internal clock. You can use this macro or explicitly call the ICM_DRAW_GETTIME message. - /// Handle to a driver. - /// Address to contain the current time. The return value should be specified in samples. - /// None - /// This message is generally supported by hardware that performs its own asynchronous decompression, timing, and drawing. The message can also be sent if the hardware is being used as the synchronization master. - // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icdrawgettime - // void ICDrawGetTime( hic, lplTime ); - [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICDrawGetTime")] - public static ICERR ICDrawGetTime([In] HIC hic, out int lplTime) - { - unsafe - { - int val = 0; - var ret = (ICERR)ICSendMessage(hic, ICM_Message.ICM_DRAW_GETTIME, (IntPtr)(void*)&val).ToInt32(); - lplTime = val; - return ret; - } - } - - /// The ICDrawOpen macro opens a driver that can draw images with the specified format. - /// Four-character code indicating the type of driver to open. For video streams, the value of this parameter is "VIDC" or ICTYPE_VIDEO. - /// Four-character code indicating the preferred stream handler to use. Typically, this information is stored in the stream header in an AVI file. - /// Pointer to the structure defining the input format. A driver handle will not be returned unless it can decompress this format. For images, this parameter refers to a BITMAPINFOHEADER structure. - /// None - /// - /// The ICDrawOpen macro is defined as follows: - /// #define ICDrawOpen(fccType, fccHandler, lpbiIn) \ ICLocate(fccType, fccHandler, lpbiIn, NULL, ICMODE_DRAW); - /// - // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-icdrawopen - // void ICDrawOpen( fccType, fccHandler, lpbiIn ); - [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.ICDrawOpen")] - public static SafeHIC ICDrawOpen(uint fccType, [Optional] uint fccHandler, in BITMAPINFOHEADER lpbiIn) => ICLocate(fccType, fccHandler, lpbiIn, IntPtr.Zero, ICMODE.ICMODE_DRAW); - - /* - function ICDrawQuery - function ICDrawRealize - function ICDrawRenderBuffer - function ICDrawSetTime - function ICDrawStart - function ICDrawStartPlay - function ICDrawStop - function ICDrawStopPlay - function ICDrawSuggestFormat - function ICDrawWindow - function ICGetBuffersWanted - function ICGetDefaultKeyFrameRate - function ICGetDefaultQuality - function ICGetState - function ICGetStateSize - function ICImageCompress - function ICImageDecompress - function ICInstall - function ICOpenFunction - function ICQueryAbout - function ICQueryConfigure - function ICRemove - function ICSeqCompressFrame - function ICSeqCompressFrameEnd - function ICSeqCompressFrameStart - function ICSetState - function ICSetStatusProc - */ } } \ No newline at end of file diff --git a/PInvoke/Multimedia/Vfw.MCI.cs b/PInvoke/Multimedia/Vfw.MCI.cs index 8f3a3153..c7007375 100644 --- a/PInvoke/Multimedia/Vfw.MCI.cs +++ b/PInvoke/Multimedia/Vfw.MCI.cs @@ -2,330 +2,1661 @@ using System; using System.Runtime.InteropServices; -using static Vanara.PInvoke.WinMm; +using System.Text; +using static Vanara.PInvoke.User32; namespace Vanara.PInvoke { /// Items from the Vfw32.dll public static partial class Vfw32 { - /* - CAPCONTROLCALLBACK - CAPERRORCALLBACKA - CAPERRORCALLBACKW - CAPSTATUSCALLBACKA - CAPSTATUSCALLBACKW - CAPVIDEOCALLBACK - CAPWAVECALLBACK - CAPYIELDCALLBACK + /// Seek from the end. + public const int MCIWND_END = -2; - IAVIEditStream - IAVIFile - IAVIStream - IAVIStreaming - IGetFrame + /// Seek from the start. + public const int MCIWND_START = -1; - AVIBuildFilterA - AVIBuildFilterW - AVIClearClipboard - AVIFileAddRef - AVIFileCreateStream - AVIFileCreateStreamA - AVIFileCreateStreamW - AVIFileEndRecord - AVIFileExit - AVIFileGetStream - AVIFileInfo - AVIFileInfoA - AVIFileInfoW - AVIFileInit - AVIFileOpen - AVIFileOpenA - AVIFileOpenW - AVIFileReadData - AVIFileRelease - AVIFileWriteData - AVIGetFromClipboard - AVIMakeCompressedStream - AVIMakeFileFromStreams - AVIMakeStreamFromClipboard - AVIPutFileOnClipboard - AVISaveA - AVISaveOptions - AVISaveOptionsFree - AVISaveVA - AVISaveVW - AVISaveW - AVIStreamAddRef - AVIStreamBeginStreaming - AVIStreamCreate - AVIStreamDataSize - AVIStreamEnd - AVIStreamEndStreaming - AVIStreamEndTime - AVIStreamFindSample - AVIStreamFormatSize - AVIStreamGetFrame - AVIStreamGetFrameClose - AVIStreamGetFrameOpen - AVIStreamInfoA - AVIStreamInfoW - AVIStreamIsKeyFrame - AVIStreamLength - AVIStreamLengthTime - AVIStreamNearestKeyFrame - AVIStreamNearestKeyFrameTime - AVIStreamNearestSample - AVIStreamNearestSampleTime - AVIStreamNextKeyFrame - AVIStreamNextKeyFrameTime - AVIStreamNextSample - AVIStreamNextSampleTime - AVIStreamOpenFromFileA - AVIStreamOpenFromFileW - AVIStreamPrevKeyFrame - AVIStreamPrevKeyFrameTime - AVIStreamPrevSample - AVIStreamPrevSampleTime - AVIStreamRead - AVIStreamReadData - AVIStreamReadFormat - AVIStreamRelease - AVIStreamSampleSize - AVIStreamSampleToSample - AVIStreamSampleToTime - AVIStreamSetFormat - AVIStreamStart - AVIStreamStartTime - AVIStreamTimeToSample - AVIStreamWrite - AVIStreamWriteData - capCaptureAbort - capCaptureGetSetup - capCaptureSequence - capCaptureSequenceNoFile - capCaptureSetSetup - capCaptureSingleFrame - capCaptureSingleFrameClose - capCaptureSingleFrameOpen - capCaptureStop - capCreateCaptureWindowA - capCreateCaptureWindowW - capDlgVideoCompression - capDlgVideoDisplay - capDlgVideoFormat - capDlgVideoSource - capDriverConnect - capDriverDisconnect - capDriverGetCaps - capDriverGetName - capDriverGetVersion - capEditCopy - capFileAlloc - capFileGetCaptureFile - capFileSaveAs - capFileSaveDIB - capFileSetCaptureFile - capFileSetInfoChunk - capGetAudioFormat - capGetAudioFormatSize - capGetDriverDescriptionA - capGetDriverDescriptionW - capGetMCIDeviceName - capGetStatus - capGetUserData - capGetVideoFormat - capGetVideoFormatSize - capGrabFrame - capGrabFrameNoStop - capOverlay - capPaletteAuto - capPaletteManual - capPaletteOpen - capPalettePaste - capPaletteSave - capPreview - capPreviewRate - capPreviewScale - capSetAudioFormat - capSetCallbackOnCapControl - capSetCallbackOnError - capSetCallbackOnFrame - capSetCallbackOnStatus - capSetCallbackOnVideoStream - capSetCallbackOnWaveStream - capSetCallbackOnYield - capSetMCIDeviceName - capSetScrollPos - capSetUserData - capSetVideoFormat - CreateEditableStream - DrawDibBegin - DrawDibChangePalette - DrawDibClose - DrawDibDraw - DrawDibEnd - DrawDibGetBuffer - DrawDibGetPalette - DrawDibOpen - DrawDibProfileDisplay - DrawDibRealize - DrawDibSetPalette - DrawDibStart - DrawDibStop - DrawDibTime - DrawDibUpdate - EditStreamClone - EditStreamCopy - EditStreamCut - EditStreamPaste - EditStreamSetInfoA - EditStreamSetInfoW - EditStreamSetNameA - EditStreamSetNameW - GetOpenFileNamePreviewA - GetOpenFileNamePreviewW - GetSaveFileNamePreviewA - GetSaveFileNamePreviewW - ICAbout - ICClose - ICCompress - ICCompressBegin - ICCompressEnd - ICCompressGetFormat - ICCompressGetFormatSize - ICCompressGetSize - ICCompressorChoose - ICCompressorFree - ICCompressQuery - ICConfigure - ICDecompress - ICDecompressBegin - ICDecompressEnd - ICDecompressEx - ICDecompressExBegin - ICDecompressExEnd - ICDecompressExQuery - ICDecompressGetFormat - ICDecompressGetFormatSize - ICDecompressGetPalette - ICDecompressOpen - ICDecompressQuery - ICDecompressSetPalette - ICDraw - ICDrawBegin - ICDrawChangePalette - ICDrawEnd - ICDrawFlush - ICDrawGetTime - ICDrawOpen - ICDrawQuery - ICDrawRealize - ICDrawRenderBuffer - ICDrawSetTime - ICDrawStart - ICDrawStartPlay - ICDrawStop - ICDrawStopPlay - ICDrawSuggestFormat - ICDrawWindow - ICGetBuffersWanted - ICGetDefaultKeyFrameRate - ICGetDefaultQuality - ICGetDisplayFormat - ICGetInfo - ICGetState - ICGetStateSize - ICImageCompress - ICImageDecompress - ICInfo - ICInstall - ICLocate - ICOpen - ICOpenFunction - ICQueryAbout - ICQueryConfigure - ICRemove - ICSendMessage - ICSeqCompressFrame - ICSeqCompressFrameEnd - ICSeqCompressFrameStart - ICSetState - ICSetStatusProc - MCIWndCanConfig - MCIWndCanEject - MCIWndCanPlay - MCIWndCanRecord - MCIWndCanSave - MCIWndCanWindow - MCIWndChangeStyles - MCIWndClose - MCIWndCreateA - MCIWndCreateW - MCIWndDestroy - MCIWndEject - MCIWndEnd - MCIWndGetActiveTimer - MCIWndGetAlias - MCIWndGetDest - MCIWndGetDevice - MCIWndGetDeviceID - MCIWndGetEnd - MCIWndGetError - MCIWndGetFileName - MCIWndGetInactiveTimer - MCIWndGetLength - MCIWndGetMode - MCIWndGetPalette - MCIWndGetPosition - MCIWndGetPositionString - MCIWndGetRepeat - MCIWndGetSource - MCIWndGetSpeed - MCIWndGetStart - MCIWndGetStyles - MCIWndGetTimeFormat - MCIWndGetVolume - MCIWndGetZoom - MCIWndHome - MCIWndNew - MCIWndOpen - MCIWndOpenDialog - MCIWndOpenInterface - MCIWndPause - MCIWndPlay - MCIWndPlayFrom - MCIWndPlayFromTo - MCIWndPlayReverse - MCIWndPlayTo - MCIWndPutDest - MCIWndPutSource - MCIWndRealize - MCIWndRecord - MCIWndRegisterClass - MCIWndResume - MCIWndReturnString - MCIWndSave - MCIWndSaveDialog - MCIWndSeek - MCIWndSendString - MCIWndSetActiveTimer - MCIWndSetInactiveTimer - MCIWndSetOwner - MCIWndSetPalette - MCIWndSetRepeat - MCIWndSetSpeed - MCIWndSetTimeFormat - MCIWndSetTimers - MCIWndSetVolume - MCIWndSetZoom - MCIWndStep - MCIWndStop - MCIWndUseFrames - MCIWndUseTime - MCIWndValidateMedia - mmioFOURCC - StretchDIB - */ + private const string Lib_Msvfw32 = "msvfw32.dll"; + + /// Window messages for MCI functions. + [PInvokeData("mciapi.h")] + public enum MCI : uint + { + /// + /// The MCI_OPEN command initializes a device or file. All devices recognize this command. + /// To send this command, call the mciSendCommand function with the following parameters. + /// + /// MCIERROR mciSendCommand( MCIDEVICEID wDeviceID, MCI_OPEN, DWORD dwFlags, (DWORD) (LPMCI_OPEN_PARMS) lpOpen ); + /// + /// + /// + /// wDeviceID + /// Device identifier of the MCI device that is to receive the command message. + /// + /// + /// dwFlags + /// MCI_NOTIFY or MCI_WAIT. For information about these flags, see The Wait, Notify, and Test Flags. + /// + /// + /// lpOpen + /// Pointer to an MCI_OPEN_PARMS structure. (Devices with extended command sets might replace this structure + /// with a device-specific structure.) + /// + /// + /// Return Value + /// Returns zero if successful or an error otherwise. + /// + /// + /// + /// + /// The following additional flags apply to all devices supporting MCI_OPEN: + /// MCI_OPEN_ALIAS + /// An alias is included in the lpstrAlias member of the structure identified by lpOpen. + /// MCI_OPEN_SHAREABLE + /// The device or file should be opened as sharable. + /// MCI_OPEN_TYPE + /// A device type name or constant is included in the lpstrDeviceType member of the structure identified by lpOpen. + /// MCI_OPEN_TYPE_ID + /// + /// The low-order word of the lpstrDeviceType member of the structure identified by lpOpen contains a standard MCI device type + /// identifier and the high-order word optionally contains the ordinal index for the device. Use this flag with the + /// MCI_OPEN_TYPE flag. + /// + /// The following additional flags apply to compound devices: + /// MCI_OPEN_ELEMENT + /// A filename is included in the lpstrElementName member of the structure identified by lpOpen. + /// MCI_OPEN_ELEMENT_ID + /// + /// The lpstrElementName member of the structure identified by lpOpen is interpreted as a DWORD value and has meaning internal + /// to the device. Use this flag with the MCI_OPEN_ELEMENT flag. + /// + /// The following additional flags are used with the digitalvideo device type: + /// MCI_DGV_OPEN_NOSTATIC + /// + /// The device should reduce the number of static (system) colors in the palette. This increases the number of colors available + /// for rendering the video stream. This flag applies only to devices that share a palette with Windows. + /// + /// MCI_DGV_OPEN_PARENT + /// The parent window handle is specified in the hWndParent member of the structure identified by lpOpen. + /// MCI_DGV_OPEN_WS + /// A window style is specified in the dwStyle member of the structure identified by lpOpen. + /// MCI_DGV_OPEN_16BIT + /// Indicates a preference for 16-bit MCI device support. + /// MCI_DGV_OPEN_32BIT + /// Indicates a preference for 32-bit MCI device support. + /// For digital-video devices, the lpOpen parameter points to an MCI_DGV_OPEN_PARMS structure. + /// The following additional flags are used with the overlay device type: + /// MCI_OVLY_OPEN_PARENT + /// The parent window handle is specified in the hWndParent member of the structure identified by lpOpen. + /// MCI_OVLY_OPEN_WS + /// + /// A window style is specified in the dwStyle member of the structure identified by lpOpen. The dwStyle value specifies the + /// style of the window that the driver will create and display if the application does not provide one. The style parameter + /// takes an integer that defines the window style. These constants are the same as the standard window styles (such as + /// WS_CHILD, WS_OVERLAPPEDWINDOW, or WS_POPUP). + /// + /// For video-overlay devices, the lpOpen parameter points to an MCI_OVLY_OPEN_PARMS structure. + /// The following additional flag is used with the waveaudio device type: + /// MCI_WAVE_OPEN_BUFFER + /// A buffer length is specified in the dwBufferSeconds member of the structure identified by lpOpen. + /// + /// For waveform-audio devices, the lpOpen parameter points to an MCI_WAVE_OPEN_PARMS structure. The MCIWAVE driver requires an + /// asynchronous waveform-audio device. + /// + /// + MCI_OPEN = 0x0803, + + /// + MCI_CLOSE = 0x0804, + + /// + MCI_PLAY = 0x0806, + + /// + MCI_SEEK = 0x0807, + + /// + MCI_STOP = 0x0808, + + /// + MCI_PAUSE = 0x0809, + + /// + MCI_STEP = 0x080E, + + /// + MCI_RECORD = 0x080F, + + /// + MCI_SAVE = 0x0813, + + /// + MCI_CUT = 0x0851, + + /// + MCI_COPY = 0x0852, + + /// + MCI_PASTE = 0x0853, + + /// + MCI_RESUME = 0x0855, + + /// + MCI_DELETE = 0x0856, + } + + /// The MCI constant defining the time format. + [PInvokeData("mciapi.h")] + public enum MCI_FORMAT + { + /// Milliseconds + MCI_FORMAT_MILLISECONDS = 0, + + /// Hours, minutes, seconds + MCI_FORMAT_HMS = 1, + + /// Minutes, seconds, frames + MCI_FORMAT_MSF = 2, + + /// Frames + MCI_FORMAT_FRAMES = 3, + + /// SMPTE 24 + MCI_FORMAT_SMPTE_24 = 4, + + /// SMPTE 25 + MCI_FORMAT_SMPTE_25 = 5, + + /// SMPTE 30 drop + MCI_FORMAT_SMPTE_30 = 6, + + /// SMPTE 30 non-drop + MCI_FORMAT_SMPTE_30DROP = 7, + + /// Bytes + MCI_FORMAT_BYTES = 8, + + /// Samples + MCI_FORMAT_SAMPLES = 9, + + /// Tracks, minutes, seconds, frames + MCI_FORMAT_TMSF = 10, + } + + /// An integer corresponding to the MCI constant defining the mode. + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndGetMode")] + public enum MCI_MODE + { + /// Not ready + MCI_MODE_NOT_READY = 524, + + /// Stopped + MCI_MODE_STOP = 525, + + /// Playing + MCI_MODE_PLAY = 526, + + /// Recording + MCI_MODE_RECORD = 527, + + /// Seeking + MCI_MODE_SEEK = 528, + + /// Paused + MCI_MODE_PAUSE = 529, + + /// Open + MCI_MODE_OPEN = 530, + } + + /// Window messages for MCI functions. + [PInvokeData("vfw.h")] + public enum MCIMessage : uint + { + /// + MCIWNDM_GETDEVICEID = WM_USER + 100, + + /// + MCIWNDM_GETSTART = WM_USER + 103, + + /// + MCIWNDM_GETLENGTH = WM_USER + 104, + + /// + MCIWNDM_GETEND = WM_USER + 105, + + /// + MCIWNDM_EJECT = WM_USER + 107, + + /// + MCIWNDM_SETZOOM = WM_USER + 108, + + /// + MCIWNDM_GETZOOM = WM_USER + 109, + + /// + MCIWNDM_SETVOLUME = WM_USER + 110, + + /// + MCIWNDM_GETVOLUME = WM_USER + 111, + + /// + MCIWNDM_SETSPEED = WM_USER + 112, + + /// + MCIWNDM_GETSPEED = WM_USER + 113, + + /// + MCIWNDM_SETREPEAT = WM_USER + 114, + + /// + MCIWNDM_GETREPEAT = WM_USER + 115, + + /// + MCIWNDM_REALIZE = WM_USER + 118, + + /// + MCIWNDM_VALIDATEMEDIA = WM_USER + 121, + + /// + MCIWNDM_PLAYFROM = WM_USER + 122, + + /// + MCIWNDM_PLAYTO = WM_USER + 123, + + /// + MCIWNDM_GETPALETTE = WM_USER + 126, + + /// + MCIWNDM_SETPALETTE = WM_USER + 127, + + /// + MCIWNDM_SETTIMERS = WM_USER + 129, + + /// + MCIWNDM_SETACTIVETIMER = WM_USER + 130, + + /// + MCIWNDM_SETINACTIVETIMER = WM_USER + 131, + + /// + MCIWNDM_GETACTIVETIMER = WM_USER + 132, + + /// + MCIWNDM_GETINACTIVETIMER = WM_USER + 133, + + /// + MCIWNDM_CHANGESTYLES = WM_USER + 135, + + /// + MCIWNDM_GETSTYLES = WM_USER + 136, + + /// + MCIWNDM_GETALIAS = WM_USER + 137, + + /// + MCIWNDM_PLAYREVERSE = WM_USER + 139, + + /// + MCIWNDM_GET_SOURCE = WM_USER + 140, + + /// + MCIWNDM_PUT_SOURCE = WM_USER + 141, + + /// + MCIWNDM_GET_DEST = WM_USER + 142, + + /// + MCIWNDM_PUT_DEST = WM_USER + 143, + + /// + MCIWNDM_CAN_PLAY = WM_USER + 144, + + /// + MCIWNDM_CAN_WINDOW = WM_USER + 145, + + /// + MCIWNDM_CAN_RECORD = WM_USER + 146, + + /// + MCIWNDM_CAN_SAVE = WM_USER + 147, + + /// + MCIWNDM_CAN_EJECT = WM_USER + 148, + + /// + MCIWNDM_CAN_CONFIG = WM_USER + 149, + + /// + MCIWNDM_PALETTEKICK = WM_USER + 150, + + /// + MCIWNDM_OPENINTERFACE = WM_USER + 151, + + /// + MCIWNDM_SETOWNER = WM_USER + 152, + + //define both A and W messages + /// + MCIWNDM_SENDSTRINGA = WM_USER + 101, + + /// + MCIWNDM_GETPOSITIONA = WM_USER + 102, + + /// + MCIWNDM_GETMODEA = WM_USER + 106, + + /// + MCIWNDM_SETTIMEFORMATA = WM_USER + 119, + + /// + MCIWNDM_GETTIMEFORMATA = WM_USER + 120, + + /// + MCIWNDM_GETFILENAMEA = WM_USER + 124, + + /// + MCIWNDM_GETDEVICEA = WM_USER + 125, + + /// + MCIWNDM_GETERRORA = WM_USER + 128, + + /// + MCIWNDM_NEWA = WM_USER + 134, + + /// + MCIWNDM_RETURNSTRINGA = WM_USER + 138, + + /// + MCIWNDM_OPENA = WM_USER + 153, + + /// + MCIWNDM_SENDSTRINGW = WM_USER + 201, + + /// + MCIWNDM_GETPOSITIONW = WM_USER + 202, + + /// + MCIWNDM_GETMODEW = WM_USER + 206, + + /// + MCIWNDM_SETTIMEFORMATW = WM_USER + 219, + + /// + MCIWNDM_GETTIMEFORMATW = WM_USER + 220, + + /// + MCIWNDM_GETFILENAMEW = WM_USER + 224, + + /// + MCIWNDM_GETDEVICEW = WM_USER + 225, + + /// + MCIWNDM_GETERRORW = WM_USER + 228, + + /// + MCIWNDM_NEWW = WM_USER + 234, + + /// + MCIWNDM_RETURNSTRINGW = WM_USER + 238, + + /// map defaults to A or W depending on app's UNICODE setting + MCIWNDM_OPENW = WM_USER + 252, + + /// + MCIWNDM_SENDSTRING = MCIWNDM_SENDSTRINGW, + + /// + MCIWNDM_GETPOSITION = MCIWNDM_GETPOSITIONW, + + /// + MCIWNDM_GETMODE = MCIWNDM_GETMODEW, + + /// + MCIWNDM_SETTIMEFORMAT = MCIWNDM_SETTIMEFORMATW, + + /// + MCIWNDM_GETTIMEFORMAT = MCIWNDM_GETTIMEFORMATW, + + /// + MCIWNDM_GETFILENAME = MCIWNDM_GETFILENAMEW, + + /// + MCIWNDM_GETDEVICE = MCIWNDM_GETDEVICEW, + + /// + MCIWNDM_GETERROR = MCIWNDM_GETERRORW, + + /// + MCIWNDM_NEW = MCIWNDM_NEWW, + + /// + MCIWNDM_RETURNSTRING = MCIWNDM_RETURNSTRINGW, + + /// + MCIWNDM_OPEN = MCIWNDM_OPENW, + } + + /// + /// Flags defining the window style. In addition to specifying the window styles used with the function, you can specify the following styles to use with MCIWnd windows. + /// + [Flags] + public enum MCIWNDF : uint + { + /// Will not change the dimensions of an MCIWnd window when the image size changes. + MCIWNDF_NOAUTOSIZEWINDOW = 0x0001, + + /// Hides the toolbar from view and prohibits users from accessing it. + MCIWNDF_NOPLAYBAR = 0x0002, + + /// Will not change the dimensions of the destination rectangle when an MCIWnd window size changes. + MCIWNDF_NOAUTOSIZEMOVIE = 0x0004, + + /// Hides the Menu button from view on the toolbar and prohibits users from accessing its pop-up menu. + MCIWNDF_NOMENU = 0x0008, + + /// Displays the name of the open MCI device or data file in the MCIWnd window title bar. + MCIWNDF_SHOWNAME = 0x0010, + + /// Displays the current position within the content of the MCI device in the window title bar. + MCIWNDF_SHOWPOS = 0x0020, + + /// + /// Displays the current mode of the MCI device in the window title bar. For a list of device modes, see the MCIWndGetMode macro. + /// + MCIWNDF_SHOWMODE = 0x0040, + + /// Causes all MCIWNDF_SHOW styles to be used. + MCIWNDF_SHOWALL = 0x0070, + + /// + /// Causes MCIWnd to notify the parent window with an MCIMessage.MCIWNDM_NOTIFYMODE message whenever the device changes + /// operating modes. The lParam parameter of this message identifies the new mode, such as MCI_MODE_STOP. + /// + MCIWNDF_NOTIFYMODE = 0x0100, + + /// + /// Causes MCIWnd to notify the parent window with an MCIMessage.MCIWNDM_NOTIFYPOS message whenever a change in the playback or + /// record position within the content occurs. The lParam parameter of this message contains the new position in the content. + /// + MCIWNDF_NOTIFYPOS = 0x0200, + + /// Causes MCIWnd to notify the parent window when the MCIWnd window size changes. + MCIWNDF_NOTIFYSIZE = 0x0400, + + /// Causes MCIWnd to notify the parent window when an MCI error occurs. + MCIWNDF_NOTIFYERROR = 0x1000, + + /// Causes all MCIWNDF window notification styles to be used. + MCIWNDF_NOTIFYALL = 0x1F00, + + /// + /// Causes MCIWnd to use an ANSI string instead of a Unicode string when notifying the parent window of device mode changes. + /// This flag is used in combination with MCIWNDF_NOTIFYMODE. + /// + MCIWNDF_NOTIFYANSI = 0x0080, + + /// + /// Causes MCIWnd to notify the parent window with an MCIMessage.MCIWNDM_NOTIFYMEDIA message whenever a new device is used or a + /// data file is opened or closed. The lParam parameter of this message contains a pointer to the new file name. + /// + MCIWNDF_NOTIFYMEDIAA = 0x0880, + + /// + /// Causes MCIWnd to notify the parent window with an MCIMessage.MCIWNDM_NOTIFYMEDIA message whenever a new device is used or a + /// data file is opened or closed. The lParam parameter of this message contains a pointer to the new file name. + /// + MCIWNDF_NOTIFYMEDIAW = 0x0800, + + /// + /// Causes MCIWnd to notify the parent window with an MCIMessage.MCIWNDM_NOTIFYMEDIA message whenever a new device is used or a + /// data file is opened or closed. The lParam parameter of this message contains a pointer to the new file name. + /// + MCIWNDF_NOTIFYMEDIA = MCIWNDF_NOTIFYMEDIAW, + + /// + /// Adds a Record button to the toolbar and adds a new file command to the menu if the MCI device has recording capability. + /// + MCIWNDF_RECORD = 0x2000, + + /// Inhibits display of MCI errors to users. + MCIWNDF_NOERRORDLG = 0x4000, + + /// + /// Hides the open and close commands from the MCIWnd menu and prohibits users from accessing these choices in the pop-up menu. + /// + MCIWNDF_NOOPEN = 0x8000, + } + + /// Flags associated with the device or file to open. + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndOpen")] + [Flags] + public enum MCIWNDOPENF + { + /// Specifies a new file is to be created with the name specified in szFile. + MCIWNDOPENF_NEW = 0x0001 + } + + /// + /// The MCIWndCanConfig macro determines if an MCI device can display a configuration dialog box. You can use this macro or + /// explicitly send the MCIWNDM_CAN_CONFIG message. + /// + /// Handle of the MCIWnd window. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndcanconfig void MCIWndCanConfig( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndCanConfig")] + public static bool MCIWndCanConfig(HWND hwnd) => MCIWndSM(hwnd, MCIMessage.MCIWNDM_CAN_CONFIG) != 0; + + /// + /// The MCIWndCanEject macro determines if an MCI device can eject its media. You can use this macro or explicitly send the + /// MCIWNDM_CAN_EJECT message. + /// + /// Handle of the MCIWnd window. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndcaneject void MCIWndCanEject( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndCanEject")] + public static bool MCIWndCanEject(HWND hwnd) => MCIWndSM(hwnd, MCIMessage.MCIWNDM_CAN_EJECT) != 0; + + /// + /// The MCIWndCanPlay macro determines if an MCI device can play a data file or content of some other kind. You can use this + /// macro or explicitly send the MCIWNDM_CAN_PLAY message. + /// + /// Handle of the MCIWnd window. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndcanplay void MCIWndCanPlay( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndCanPlay")] + public static bool MCIWndCanPlay(HWND hwnd) => MCIWndSM(hwnd, MCIMessage.MCIWNDM_CAN_PLAY) != 0; + + /// + /// The MCIWndCanRecord macro determines if an MCI device supports recording. You can use this macro or explicitly send the + /// MCIWNDM_CAN_RECORD message. + /// + /// Handle of the MCIWnd window. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndcanrecord void MCIWndCanRecord( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndCanRecord")] + public static bool MCIWndCanRecord(HWND hwnd) => MCIWndSM(hwnd, MCIMessage.MCIWNDM_CAN_RECORD) != 0; + + /// + /// The MCIWndCanSave macro determines if an MCI device can save data. You can use this macro or explicitly send the + /// MCIWNDM_CAN_SAVE message. + /// + /// Handle of the MCIWnd window. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndcansave void MCIWndCanSave( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndCanSave")] + public static bool MCIWndCanSave(HWND hwnd) => MCIWndSM(hwnd, MCIMessage.MCIWNDM_CAN_SAVE) != 0; + + /// + /// The MCIWndCanWindow macro determines if an MCI device supports window-oriented MCI commands. You can use this macro or + /// explicitly send the MCIWNDM_CAN_WINDOW message. + /// + /// Handle of the MCIWnd window. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndcanwindow void MCIWndCanWindow( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndCanWindow")] + public static bool MCIWndCanWindow(HWND hwnd) => MCIWndSM(hwnd, MCIMessage.MCIWNDM_CAN_WINDOW) != 0; + + /// + /// The MCIWndChangeStyles macro changes the styles used by the MCIWnd window. You can use this macro or explicitly send the + /// MCIWNDM_CHANGESTYLES message. + /// + /// Handle of the MCIWnd window. + /// + /// Mask that identifies the styles that can change. This mask is the bitwise OR operator of all styles that will be permitted to change. + /// + /// + /// New style settings for the window. Specify zero for this parameter to turn off all styles identified in the mask. For a list of + /// the available styles, see the MCIWndCreate function. + /// + /// None + /// For an example of using MCIWndChangeStyles, see Pausing and Resuming Playback. + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndchangestyles void MCIWndChangeStyles( hwnd, mask, value ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndChangeStyles")] + public static int MCIWndChangeStyles(HWND hwnd, MCIWNDF mask, [Optional] int value) => MCIWndSM(hwnd, MCIMessage.MCIWNDM_CHANGESTYLES, unchecked((int)mask), value); + + /// + /// The MCIWndClose macro closes an MCI device or file associated with an MCIWnd window. Although the MCI device closes, the + /// MCIWnd window is still open and can be associated with another MCI device. You can use this macro or explicitly send the + /// MCI_CLOSE command. + /// + /// Handle of the MCIWnd window. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndclose void MCIWndClose( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndClose")] + public static int MCIWndClose(HWND hwnd) => MCIWndSM(hwnd, MCI.MCI_CLOSE); + + /// + /// The MCIWndCreate function registers the MCIWnd window class and creates an MCIWnd window for using MCI services. + /// MCIWndCreate can also open an MCI device or file (such as an AVI file) and associate it with the MCIWnd window. + /// + /// Handle to the parent window. + /// Handle to the module instance to associate with the MCIWnd window. + /// + /// + /// Flags defining the window style. In addition to specifying the window styles used with the CreateWindowEx function, you can + /// specify the following styles to use with MCIWnd windows. + /// + /// + /// + /// Value + /// Meaning + /// + /// + /// MCIWNDF_NOAUTOSIZEWINDOW + /// Will not change the dimensions of an MCIWnd window when the image size changes. + /// + /// + /// MCIWNDF_NOAUTOSIZEMOVIE + /// Will not change the dimensions of the destination rectangle when an MCIWnd window size changes. + /// + /// + /// MCIWNDF_NOERRORDLG + /// Inhibits display of MCI errors to users. + /// + /// + /// MCIWNDF_NOMENU + /// Hides the Menu button from view on the toolbar and prohibits users from accessing its pop-up menu. + /// + /// + /// MCIWNDF_NOOPEN + /// + /// Hides the open and close commands from the MCIWnd menu and prohibits users from accessing these choices in the pop-up menu. + /// + /// + /// + /// MCIWNDF_NOPLAYBAR + /// Hides the toolbar from view and prohibits users from accessing it. + /// + /// + /// MCIWNDF_NOTIFYANSI + /// + /// Causes MCIWnd to use an ANSI string instead of a Unicode string when notifying the parent window of device mode changes. This + /// flag is used in combination with MCIWNDF_NOTIFYMODE. + /// + /// + /// + /// MCIWNDF_NOTIFYMODE + /// + /// Causes MCIWnd to notify the parent window with an MCIMessage.MCIWNDM_NOTIFYMODE message whenever the device changes operating + /// modes. The lParam parameter of this message identifies the new mode, such as MCI_MODE_STOP. + /// + /// + /// + /// MCIWNDF_NOTIFYPOS + /// + /// Causes MCIWnd to notify the parent window with an MCIMessage.MCIWNDM_NOTIFYPOS message whenever a change in the playback or + /// record position within the content occurs. The lParam parameter of this message contains the new position in the content. + /// + /// + /// + /// MCIWNDF_NOTIFYMEDIA + /// + /// Causes MCIWnd to notify the parent window with an MCIMessage.MCIWNDM_NOTIFYMEDIA message whenever a new device is used or a data + /// file is opened or closed. The lParam parameter of this message contains a pointer to the new file name. + /// + /// + /// + /// MCIWNDF_NOTIFYSIZE + /// Causes MCIWnd to notify the parent window when the MCIWnd window size changes. + /// + /// + /// MCIWNDF_NOTIFYERROR + /// Causes MCIWnd to notify the parent window when an MCI error occurs. + /// + /// + /// MCIWNDF_NOTIFYALL + /// Causes all MCIWNDF window notification styles to be used. + /// + /// + /// MCIWNDF_RECORD + /// Adds a Record button to the toolbar and adds a new file command to the menu if the MCI device has recording capability. + /// + /// + /// MCIWNDF_SHOWALL + /// Causes all MCIWNDF_SHOW styles to be used. + /// + /// + /// MCIWNDF_SHOWMODE + /// + /// Displays the current mode of the MCI device in the window title bar. For a list of device modes, see the MCIWndGetMode macro. + /// + /// + /// + /// MCIWNDF_SHOWNAME + /// Displays the name of the open MCI device or data file in the MCIWnd window title bar. + /// + /// + /// MCIWNDF_SHOWPOS + /// Displays the current position within the content of the MCI device in the window title bar. + /// + /// + /// + /// Null-terminated string indicating the name of an MCI device or data file to open. + /// Returns the handle to an MCI window if successful or zero otherwise. + /// + /// + /// Default window styles for a child window are WS_CHILD, WS_BORDER, and WS_VISIBLE. MCIWndCreate assumes a child window + /// when a non- NULL handle of a parent window is specified. + /// + /// + /// Default window styles for a parent window are WS_OVERLAPPEDWINDOW and WS_VISIBLE. MCIWndCreate assumes a parent window + /// when a NULL handle of a parent window is specified. + /// + /// + /// Use the window handle returned by this function for the window handle in the MCIWnd macros. If your application uses this + /// function, it does not need to use the MCIWndRegisterClass function. + /// + /// + /// Note + /// + /// The vfw.h header defines MCIWndCreate as an alias which automatically selects the ANSI or Unicode version of this function based + /// on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not + /// encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for + /// Function Prototypes. + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndcreatea HWND VFWAPIV MCIWndCreateA( HWND hwndParent, + // HINSTANCE hInstance, DWORD dwStyle, LPCSTR szFile ); + [DllImport(Lib_Msvfw32, SetLastError = false, CharSet = CharSet.Auto)] + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndCreateA")] + public static extern HWND MCIWndCreate([In, Optional] HWND hwndParent, [In, Optional] HINSTANCE hInstance, MCIWNDF dwStyle, [In, Optional, MarshalAs(UnmanagedType.LPTStr)] string szFile); + + /// + /// The MCIWndDestroy macro closes an MCI device or file associated with an MCIWnd window and destroys the window. You can + /// use this macro or explicitly send the WM_CLOSE message. + /// + /// Handle of the MCIWnd window. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwnddestroy void MCIWndDestroy( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndDestroy")] + public static void MCIWndDestroy(HWND hwnd) => MCIWndSM(hwnd, WindowMessage.WM_CLOSE); + + /// + /// The MCIWndEject macro sends a command to an MCI device to eject its media. You can use this macro or explicitly send the + /// MCIWNDM_EJECT message. + /// + /// Handle of the MCIWnd window. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndeject void MCIWndEject( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndEject")] + public static int MCIWndEject(HWND hwnd) => MCIWndSM(hwnd, MCIMessage.MCIWNDM_EJECT); + + /// + /// The MCIWndEnd macro moves the current position to the end of the content. You can use this macro or explicitly send the + /// MCI_SEEK message. + /// + /// Handle of the MCIWnd window. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndend void MCIWndEnd( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndEnd")] + public static int MCIWndEnd(HWND hwnd) => MCIWndSeek(hwnd, MCIWND_END); + + /// + /// The MCIWndGetActiveTimer macro retrieves the update period used when the MCIWnd window is the active window. You can use + /// this macro or explicitly send the MCIWNDM_GETACTIVETIMER message. + /// + /// Handle of the MCIWnd window. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndgetactivetimer void MCIWndGetActiveTimer( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndGetActiveTimer")] + public static uint MCIWndGetActiveTimer(HWND hwnd) => unchecked((uint)MCIWndSM(hwnd, MCIMessage.MCIWNDM_GETACTIVETIMER)); + + /// + /// The MCIWndGetAlias macro retrieves the alias used to open an MCI device or file with the mciSendString function. You can + /// use this macro or explicitly send the MCIWNDM_GETALIAS message. + /// + /// Handle of the MCIWnd window. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndgetalias void MCIWndGetAlias( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndGetAlias")] + public static uint MCIWndGetAlias(HWND hwnd) => unchecked((uint)MCIWndSM(hwnd, MCIMessage.MCIWNDM_GETALIAS)); + + /// + /// The MCIWndGetDest macro retrieves the coordinates of the destination rectangle used for zooming or stretching the images + /// of an AVI file during playback. You can use this macro or explicitly send the MCIWNDM_GET_DEST message. + /// + /// Handle of the MCIWnd window. + /// Pointer to a RECT structure to return the coordinates of the destination rectangle. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndgetdest void MCIWndGetDest( hwnd, prc ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndGetDest")] + public static bool MCIWndGetDest(HWND hwnd, out RECT prc) => MCIWndSM(hwnd, MCIMessage.MCIWNDM_GET_DEST, out prc, 0) != 0; + + /// + /// The MCIWndGetDevice macro retrieves the name of the current MCI device. You can use this macro or explicitly send the + /// MCIWNDM_GETDEVICE message. + /// + /// Handle of the MCIWnd window. + /// Pointer to an application-defined buffer to return the device name. + /// None + /// If the null-terminated string containing the device name is longer than the buffer, MCIWnd truncates it. + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndgetdevice void MCIWndGetDevice( hwnd, lp, len ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndGetDevice")] + public static bool MCIWndGetDevice(HWND hwnd, StringBuilder lp) => MCIWndSM(hwnd, MCIMessage.MCIWNDM_GETDEVICE, lp) != 0; + + /// + /// The MCIWndGetDeviceID macro retrieves the identifier of the current MCI device to use with the mciSendCommand function. + /// You can use this macro or explicitly send the MCIWNDM_GETDEVICEID message. + /// + /// Handle of the MCIWnd window. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndgetdeviceid void MCIWndGetDeviceID( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndGetDeviceID")] + public static uint MCIWndGetDeviceID(HWND hwnd) => unchecked((uint)MCIWndSM(hwnd, MCIMessage.MCIWNDM_GETDEVICEID)); + + /// + /// The MCIWndGetEnd macro retrieves the location of the end of the content of an MCI device or file. You can use this macro + /// or explicitly send the MCIWNDM_GETEND message. + /// + /// Handle of the MCIWnd window. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndgetend void MCIWndGetEnd( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndGetEnd")] + public static int MCIWndGetEnd(HWND hwnd) => MCIWndSM(hwnd, MCIMessage.MCIWNDM_GETEND); + + /// + /// The MCIWndGetError macro retrieves the last MCI error encountered. You can use this macro or explicitly send the + /// MCIWNDM_GETERROR message. + /// + /// Handle of the MCIWnd window. + /// Pointer to an application-defined buffer used to return the error string. + /// None + /// + /// If lp is a valid pointer, a null-terminated string corresponding to the error is returned in its buffer. If the error string is + /// longer than the buffer, MCIWnd truncates it. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndgeterror void MCIWndGetError( hwnd, lp, len ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndGetError")] + public static int MCIWndGetError(HWND hwnd, StringBuilder lp) => MCIWndSM(hwnd, MCIMessage.MCIWNDM_GETERROR, lp); + + /// + /// The MCIWndGetFileName macro retrieves the filename used by an MCI device. You can use this macro or explicitly send the + /// MCIWNDM_GETFILENAME message. + /// + /// Handle of the MCIWnd window. + /// Pointer to an application-defined buffer to return the filename. + /// None + /// If the null-terminated string containing the filename is longer than the buffer, MCIWnd truncates the filename. + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndgetfilename void MCIWndGetFileName( hwnd, lp, len ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndGetFileName")] + public static int MCIWndGetFileName(HWND hwnd, StringBuilder lp) => MCIWndSM(hwnd, MCIMessage.MCIWNDM_GETFILENAME, lp); + + /// + /// The MCIWndGetInactiveTimer macro retrieves the update period used when the MCIWnd window is the inactive window. You can + /// use this macro or explicitly send the MCIWNDM_GETINACTIVETIMER message. + /// + /// Handle of the MCIWnd window. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndgetinactivetimer void MCIWndGetInactiveTimer( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndGetInactiveTimer")] + public static uint MCIWndGetInactiveTimer(HWND hwnd) => unchecked((uint)MCIWndSM(hwnd, MCIMessage.MCIWNDM_GETINACTIVETIMER)); + + /// + /// The MCIWndGetLength macro retrieves the length of the content or file currently used by an MCI device. You can use this + /// macro or explicitly send the MCIWNDM_GETLENGTH message. + /// + /// Handle of the MCIWnd window. + /// None + /// This value added to the value returned for the MCIWndGetStart macro equals the end of the content. + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndgetlength void MCIWndGetLength( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndGetLength")] + public static int MCIWndGetLength(HWND hwnd) => MCIWndSM(hwnd, MCIMessage.MCIWNDM_GETLENGTH); + + /// + /// The MCIWndGetMode macro retrieves the current operating mode of an MCI device. MCI devices have several operating modes, + /// which are designated by constants. You can use this macro or explicitly send the MCIWNDM_GETMODE message. + /// + /// Handle of the MCIWnd window. + /// Pointer to the application-defined buffer used to return the mode. + /// None + /// + /// If the null-terminated string describing the mode is longer than the buffer, it is truncated. + /// + /// Not all devices can operate in every mode. For example, the MCIAVI device is a playback device; it doesn't support the recording + /// mode. The following modes can be retrieved by using MCIWNDM_GETMODE: + /// + /// + /// + /// Operating mode + /// MCI constant + /// + /// + /// not ready + /// MCI_MODE_NOT_READY + /// + /// + /// open + /// MCI_MODE_OPEN + /// + /// + /// paused + /// MCI_MODE_PAUSE + /// + /// + /// playing + /// MCI_MODE_PLAY + /// + /// + /// recording + /// MCI_MODE_RECORD + /// + /// + /// seeking + /// MCI_MODE_SEEK + /// + /// + /// stopped + /// MCI_MODE_STOP + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndgetmode void MCIWndGetMode( hwnd, lp, len ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndGetMode")] + public static MCI_MODE MCIWndGetMode(HWND hwnd, StringBuilder lp) => (MCI_MODE)MCIWndSM(hwnd, MCIMessage.MCIWNDM_GETMODE, lp); + + /// + /// The MCIWndGetPalette macro retrieves a handle of the palette used by an MCI device. You can use this macro or explicitly + /// send the MCIWNDM_GETPALETTE message. + /// + /// Handle of the MCIWnd window. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndgetpalette void MCIWndGetPalette( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndGetPalette")] + public static HPALETTE MCIWndGetPalette(HWND hwnd) => SendMessage(hwnd, MCIMessage.MCIWNDM_GETPALETTE); + + /// + /// The MCIWndGetPosition macro retrieves the numerical value of the current position within the content of the MCI device. + /// You can use this macro or explicitly send the MCIWNDM_GETPOSITION message. + /// + /// Handle of the MCIWnd window. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndgetposition void MCIWndGetPosition( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndGetPosition")] + public static int MCIWndGetPosition(HWND hwnd) => MCIWndSM(hwnd, MCIMessage.MCIWNDM_GETPOSITION); + + /// + /// The MCIWndGetPositionString macro retrieves the numerical value of the current position within the content of the MCI + /// device. This macro also provides the current position in string form in an application-defined buffer. You can use this macro or + /// explicitly send the MCIWNDM_GETPOSITION message. + /// + /// Handle of the MCIWnd window. + /// + /// Pointer to an application-defined buffer used to return the position. Use zero to inhibit retrieval of the position as a string. + /// If the device supports tracks, the string position information is returned in the form TT:MM:SS:FF where TT corresponds to + /// tracks, MM and SS correspond to minutes and seconds, and FF corresponds to frames. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndgetpositionstring void MCIWndGetPositionString( hwnd, lp, len ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndGetPositionString")] + public static int MCIWndGetPositionString(HWND hwnd, StringBuilder lp) => MCIWndSM(hwnd, MCIMessage.MCIWNDM_GETPOSITION, lp); + + /// + /// The MCIWndGetRepeat macro determines if continuous playback has been activated. You can use this macro or explicitly send + /// the MCIWNDM_GETREPEAT message. + /// + /// Handle of the MCIWnd window. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndgetrepeat void MCIWndGetRepeat( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndGetRepeat")] + public static bool MCIWndGetRepeat(HWND hwnd) => MCIWndSM(hwnd, MCIMessage.MCIWNDM_GETREPEAT) != 0; + + /// + /// The MCIWndGetSource macro retrieves the coordinates of the source rectangle used for cropping the images of an AVI file + /// during playback. You can use this macro or explicitly send the MCIWNDM_GET_SOURCE message. + /// + /// Handle of the MCIWnd window. + /// Pointer to a RECT structure to contain the coordinates of the source rectangle. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndgetsource void MCIWndGetSource( hwnd, prc ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndGetSource")] + public static bool MCIWndGetSource(HWND hwnd, out RECT prc) => MCIWndSM(hwnd, MCIMessage.MCIWNDM_GET_SOURCE, out prc, 0) != 0; + + /// + /// The MCIWndGetSpeed macro retrieves the playback speed of an MCI device. You can use this macro or explicitly send the + /// MCIWNDM_GETSPEED message. + /// + /// Handle of the MCIWnd window. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndgetspeed void MCIWndGetSpeed( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndGetSpeed")] + public static int MCIWndGetSpeed(HWND hwnd) => MCIWndSM(hwnd, MCIMessage.MCIWNDM_GETSPEED); + + /// + /// The MCIWndGetStart macro retrieves the location of the beginning of the content of an MCI device or file. You can use + /// this macro or explicitly send the MCIWNDM_GETSTART message. + /// + /// Handle of the MCIWnd window. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndgetstart void MCIWndGetStart( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndGetStart")] + public static int MCIWndGetStart(HWND hwnd) => MCIWndSM(hwnd, MCIMessage.MCIWNDM_GETSTART); + + /// + /// The MCIWndGetStyles macro retrieves the flags specifying the current MCIWnd window styles used by a window. You can use + /// this macro or explicitly send the MCIWNDM_GETSTYLES message. + /// + /// Handle of the MCIWnd window. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndgetstyles void MCIWndGetStyles( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndGetStyles")] + public static MCIWNDF MCIWndGetStyles(HWND hwnd) => unchecked((MCIWNDF)MCIWndSM(hwnd, MCIMessage.MCIWNDM_GETSTYLES)); + + /// + /// The MCIWndGetTimeFormat macro retrieves the current time format of an MCI device in two forms: as a numerical value and + /// as a string. You can use this macro or explicitly send the MCIWNDM_GETTIMEFORMAT message. + /// + /// Handle of the MCIWnd window. + /// Pointer to a buffer to contain the null-terminated string form of the time format. + /// None + /// + /// If the time format string is longer than the return buffer, MCIWnd truncates the string. + /// An MCI device can support one or more of the following time formats: + /// + /// + /// Time format + /// MCI constant + /// + /// + /// Bytes + /// MCI_FORMAT_BYTES + /// + /// + /// Frames + /// MCI_FORMAT_FRAMES + /// + /// + /// Hours, minutes, seconds + /// MCI_FORMAT_HMS + /// + /// + /// Milliseconds + /// MCI_FORMAT_MILLISECONDS + /// + /// + /// Minutes, seconds, frames + /// MCI_FORMAT_MSF + /// + /// + /// Samples + /// MCI_FORMAT_SAMPLES + /// + /// + /// SMPTE 24 + /// MCI_FORMAT_SMPTE_24 + /// + /// + /// SMPTE 25 + /// MCI_FORMAT_SMPTE_25 + /// + /// + /// SMPTE 30 drop + /// MCI_FORMAT_SMPTE_30DROP + /// + /// + /// SMPTE 30 (non-drop) + /// MCI_FORMAT_SMPTE_30 + /// + /// + /// Tracks, minutes, seconds, frames + /// MCI_FORMAT_TMSF + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndgettimeformat void MCIWndGetTimeFormat( hwnd, lp, len ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndGetTimeFormat")] + public static MCI_FORMAT MCIWndGetTimeFormat(HWND hwnd, StringBuilder lp) => (MCI_FORMAT)MCIWndSM(hwnd, MCIMessage.MCIWNDM_GETTIMEFORMAT, lp); + + /// + /// The MCIWndGetVolume macro retrieves the current volume setting of an MCI device. You can use this macro or explicitly + /// send the MCIWNDM_GETVOLUME message. + /// + /// Handle of the MCIWnd window. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndgetvolume void MCIWndGetVolume( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndGetVolume")] + public static int MCIWndGetVolume(HWND hwnd) => MCIWndSM(hwnd, MCIMessage.MCIWNDM_GETVOLUME); + + /// + /// The MCIWndGetZoom macro retrieves the current zoom value used by an MCI device. You can use this macro or explicitly send + /// the MCIWNDM_GETZOOM message. + /// + /// Handle of the MCIWnd window. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndgetzoom void MCIWndGetZoom( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndGetZoom")] + public static uint MCIWndGetZoom(HWND hwnd) => unchecked((uint)MCIWndSM(hwnd, MCIMessage.MCIWNDM_GETZOOM)); + + /// + /// The MCIWndHome macro moves the current position to the beginning of the content. You can use this macro or explicitly + /// send the MCI_SEEK command. + /// + /// Handle of the MCIWnd window. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndhome void MCIWndHome( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndHome")] + public static int MCIWndHome(HWND hwnd) => MCIWndSeek(hwnd, MCIWND_START); + + /// + /// The MCIWndNew macro creates a new file for the current MCI device. You can use this macro or explicitly send the + /// MCIWNDM_NEW message. + /// + /// Handle of the MCIWnd window. + /// Pointer to a buffer containing the name of the MCI device that will use the file. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndnew void MCIWndNew( hwnd, lp ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndNew")] + public static bool MCIWndNew(HWND hwnd, string lp) => SendMessage(hwnd, MCIMessage.MCIWNDM_NEW, 0, lp) != IntPtr.Zero; + + /// + /// The MCIWndOpen macro opens an MCI device and associates it with an MCIWnd window. For MCI devices that use data files, + /// this macro can also open a specified data file, name a new file to be created, or display a dialog box to let the user select a + /// file to open. You can use this macro or explicitly send the MCIWNDM_OPEN message. + /// + /// Handle of the MCIWnd window. + /// + /// Pointer to a null-terminated string identifying the filename or MCI Device Names to open. Specify ?1 for this parameter to + /// display the Open dialog box. + /// + /// + /// Flags associated with the device or file to open. The MCIWNDOPENF_NEW flag specifies a new file is to be created with the name + /// specified in szFile. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndopen void MCIWndOpen( hwnd, sz, f ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndOpen")] + public static int MCIWndOpen(HWND hwnd, string sz, MCIWNDOPENF f) => SendMessage(hwnd, MCIMessage.MCIWNDM_OPEN, (IntPtr)(int)f, sz).ToInt32(); + + /// + /// The MCIWndOpenDialog macro opens a user-specified data file and corresponding type of MCI device, and associates them + /// with an MCIWnd window. This macro displays the Open dialog box for the user to select the data file to associate with an MCI + /// window. You can use this macro or explicitly send the MCIWNDM_OPEN message. + /// + /// Handle of the MCIWnd window. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndopendialog void MCIWndOpenDialog( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndOpenDialog")] + public static int MCIWndOpenDialog(HWND hwnd) => SendMessage(hwnd, MCIMessage.MCIWNDM_OPEN, (IntPtr)0, new IntPtr(-1)).ToInt32(); + + /// + /// The MCIWndOpenInterface macro attaches the data stream or file associated with the specified interface to an MCIWnd + /// window. You can use this macro or explicitly send the MCIWNDM_OPENINTERFACE message. + /// + /// Handle of the MCIWnd window. + /// Pointer to an IAVI interface that points to a file or a data stream in a file. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndopeninterface void MCIWndOpenInterface( hwnd, pUnk ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndOpenInterface")] + public static bool MCIWndOpenInterface(HWND hwnd, [In, MarshalAs(UnmanagedType.IUnknown)] object pUnk) => MCIWndSM(hwnd, MCIMessage.MCIWNDM_OPENINTERFACE, default, Marshal.GetIUnknownForObject(pUnk)) != 0; + + /// Undocumented. + /// Handle of the MCIWnd window. + /// None + [PInvokeData("vfw.h")] + public static bool MCIWndPaletteKick(HWND hwnd) => MCIWndSM(hwnd, MCIMessage.MCIWNDM_PALETTEKICK) != 0; + + /// The MCIWndPause macro sends a command to an MCI device to pause playing or recording. + /// Handle of the MCIWnd window. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndpause void MCIWndPause( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndPause")] + public static int MCIWndPause(HWND hwnd) => MCIWndSM(hwnd, MCI.MCI_PAUSE); + + /// + /// The MCIWndPlay macro sends a command to an MCI device to start playing from the current position in the content. You can + /// use this macro or explicitly send the MCI_PLAY command. + /// + /// Handle of the MCIWnd window. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndplay void MCIWndPlay( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndPlay")] + public static int MCIWndPlay(HWND hwnd) => MCIWndSM(hwnd, MCI.MCI_PLAY); + + /// + /// The MCIWndPlayFrom macro plays the content of an MCI device from the specified location to the end of the content or + /// until another command stops playback. You can use this macro or explicitly send the MCIWNDM_PLAYFROM message. + /// + /// Handle of the MCIWnd window. + /// Starting location. The units for the starting location depend on the current time format. + /// None + /// You can also specify both a starting and ending location for playback by using the MCIWndPlayFromTo macro. + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndplayfrom void MCIWndPlayFrom( hwnd, lPos ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndPlayFrom")] + public static int MCIWndPlayFrom(HWND hwnd, int lPos) => MCIWndSM(hwnd, MCIMessage.MCIWNDM_PLAYFROM, 0, lPos); + + /// + /// The MCIWndPlayFromTo macro plays a portion of content between specified starting and ending locations. This macro seeks + /// to the specified point to begin playback, then plays the content to the specified ending location. This macro is defined using + /// the MCIWndSeek and MCIWndPlayTo macros, which in turn use the MCI_SEEK command and the MCIWNDM_PLAYTO message. + /// + /// Handle of the MCIWnd window. + /// Position to seek; it is also the starting location. + /// Ending location. + /// None + /// The units for the seek position depend on the current time format. + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndplayfromto void MCIWndPlayFromTo( hwnd, lStart, lEnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndPlayFromTo")] + public static int MCIWndPlayFromTo(HWND hwnd, int lStart, int lEnd) { MCIWndSeek(hwnd, lStart); return MCIWndPlayTo(hwnd, lEnd); } + + /// + /// The MCIWndPlayReverse macro plays the current content in the reverse direction, beginning at the current position and + /// ending at the beginning of the content or until another command stops playback. You can use this macro or explicitly send the + /// MCIWNDM_PLAYREVERSE message. + /// + /// Handle of the MCIWnd window. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndplayreverse void MCIWndPlayReverse( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndPlayReverse")] + public static int MCIWndPlayReverse(HWND hwnd) => MCIWndSM(hwnd, MCIMessage.MCIWNDM_PLAYREVERSE); + + /// + /// The MCIWndPlayTo macro plays the content of an MCI device from the current position to the specified ending location or + /// until another command stops playback. If the specified ending location is beyond the end of the content, playback stops at the + /// end of the content. You can use this macro or explicitly send the MCIWNDM_PLAYTO message. + /// + /// Handle of the MCIWnd window. + /// Ending location. The units for the ending location depend on the current time format. + /// None + /// You can also specify both a starting and ending location for playback by using the MCIWndPlayFromTo macro. + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndplayto void MCIWndPlayTo( hwnd, lPos ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndPlayTo")] + public static int MCIWndPlayTo(HWND hwnd, int lPos) => MCIWndSM(hwnd, MCIMessage.MCIWNDM_PLAYTO, 0, lPos); + + /// + /// The MCIWndPutDest macro redefines the coordinates of the destination rectangle used for zooming or stretching the images + /// of an AVI file during playback. You can use this macro or explicitly send the MCIWNDM_PUT_DEST message. + /// + /// Handle of the MCIWnd window. + /// Pointer to a RECT structure containing the coordinates of the destination rectangle. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndputdest void MCIWndPutDest( hwnd, prc ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndPutDest")] + public static int MCIWndPutDest(HWND hwnd, in RECT prc) => MCIWndSM(hwnd, MCIMessage.MCIWNDM_PUT_DEST, 0, prc); + + /// + /// The MCIWndPutSource macro redefines the coordinates of the source rectangle used for cropping the images of an AVI file + /// during playback. You can use this macro or explicitly send the MCIWNDM_PUT_SOURCE message. + /// + /// Handle of the MCIWnd window. + /// Pointer to a RECT structure containing the coordinates of the source rectangle. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndputsource void MCIWndPutSource( hwnd, prc ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndPutSource")] + public static int MCIWndPutSource(HWND hwnd, in RECT prc) => MCIWndSM(hwnd, MCIMessage.MCIWNDM_PUT_SOURCE, 0, prc); + + /// + /// The MCIWndRealize macro controls how an MCI window realized in the foreground or background. This macro also causes the + /// palette for the MCI window to be realized in the process. You can use this macro or explicitly send the MCIWNDM_REALIZE message. + /// + /// Handle of the MCIWnd window. + /// + /// Background flag. Specify TRUE for this parameter for the window to be realized in the background or FALSE if the + /// window can be realized in the foreground. + /// + /// None + /// + /// + /// A common use for MCIWndRealize is to coordinate palette ownership between an MCI control and the application that + /// contains it. The application can have the MCI window realize in the background and realize its own palette in the foreground. + /// + /// + /// If your application contains an MCI control, but does not need to realize its palette, you can use this macro to handle the + /// WM_PALETTECHANGED and WM_QUERYNEWPALETTE messages, instead of using RealizePalette. However, it is usually easier to call + /// the SendMessage function to forward the message to the MCIWnd window, which will automatically realize the palette. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndrealize void MCIWndRealize( hwnd, fBkgnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndRealize")] + public static int MCIWndRealize(HWND hwnd, bool fBkgnd) => MCIWndSM(hwnd, MCIMessage.MCIWNDM_REALIZE, fBkgnd ? 1 : 0, 0); + + /// + /// The MCIWndRecord macro begins recording content using the MCI device. The recording process begins at the current + /// position in the content and will overwrite existing data for the duration of the recording. + /// + /// Handle of the MCIWnd window. + /// None + /// + /// The function that an MCI device performs during recording depends on the characteristics of the device. An MCI device that uses + /// files, such as a waveform-audio device, sends data to the file during recording. An MCI device that does not use files, such as + /// a video-cassette recorder, receives and externally records data on another medium. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndrecord void MCIWndRecord( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndRecord")] + public static int MCIWndRecord(HWND hwnd) => MCIWndSM(hwnd, MCI.MCI_RECORD); + + /// The MCIWndRegisterClass function registers the MCI window class MCIWND_WINDOW_CLASS. + /// Returns zero if successful. + /// + /// After registering the MCI window class, use the CreateWindow or CreateWindowEx functions to create an MCIWnd + /// window. If your application uses this function, it does not need to use the MCIWndCreate function. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndregisterclass BOOL VFWAPIV MCIWndRegisterClass(); + [DllImport(Lib_Msvfw32, SetLastError = false, ExactSpelling = true)] + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndRegisterClass")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool MCIWndRegisterClass(); + + /// + /// The MCIWndResume macro resumes playback or recording content from the paused mode. This macro restarts playback or + /// recording from the current position in the content. You can use this macro or explicitly send the MCI_RESUME command. + /// + /// Handle of the MCIWnd window. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndresume void MCIWndResume( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndResume")] + public static int MCIWndResume(HWND hwnd) => MCIWndSM(hwnd, MCI.MCI_RESUME); + + /// + /// The MCIWndReturnString macro retrieves the reply to the most recent MCI string command sent to an MCI device. Information + /// in the reply is supplied as a null-terminated string. You can use this macro or explicitly send the MCIWNDM_RETURNSTRING message. + /// + /// Handle of the MCIWnd window. + /// Pointer to an application-defined buffer to contain the null-terminated string. + /// None + /// If the null-terminated string is longer than the buffer, the string is truncated. + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndreturnstring void MCIWndReturnString( hwnd, lp, len ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndReturnString")] + public static int MCIWndReturnString(HWND hwnd, StringBuilder lp) => MCIWndSM(hwnd, MCIMessage.MCIWNDM_RETURNSTRING, lp); + + /// + /// The MCIWndSave macro saves the content currently used by an MCI device. This macro can save the content to a specified + /// data file or display the Save dialog box to let the user select a filename to store the content. You can use this macro or + /// explicitly send the MCI_SAVE command. + /// + /// Handle of the MCIWnd window. + /// + /// Null-terminated string containing the name and path of the destination file. Specify ?1 for this parameter to display the Save + /// dialog box. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndsave void MCIWndSave( hwnd, szFile ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndSave")] + public static int MCIWndSave(HWND hwnd, string szFile) => SendMessage(hwnd, MCI.MCI_SAVE, 0, szFile).ToInt32(); + + /// + /// The MCIWndSaveDialog macro saves the content currently used by an MCI device. This macro displays the Save dialog box to + /// let the user select a filename to store the content. You can use this macro or explicitly send the MCI_SAVE command. + /// + /// Handle of the MCIWnd window. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndsavedialog void MCIWndSaveDialog( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndSaveDialog")] + public static int MCIWndSaveDialog(HWND hwnd) => SendMessage(hwnd, MCI.MCI_SAVE, (IntPtr)0, new IntPtr(-1)).ToInt32(); + + /// + /// The MCIWndSave macro saves the content currently used by an MCI device. This macro can save the content to a specified + /// data file or display the Save dialog box to let the user select a filename to store the content. You can use this macro or + /// explicitly send the MCI_SAVE command. + /// + /// Handle of the MCIWnd window. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndsave void MCIWndSave( hwnd, szFile ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndSave")] + public static int MCIWndSaveWithDialog(HWND hwnd) => MCIWndSM(hwnd, MCI.MCI_SAVE, 0, -1); + + /// + /// The MCIWndSeek macro moves the playback position to the specified location in the content. You can use this macro or + /// explicitly use the MCI_SEEK command. + /// + /// Handle of the MCIWnd window. + /// + /// Position to seek. You can specify a position using the current time format, the MCIWND_START constant to designate the beginning + /// of the content, or the MCIWND_END constant to designate the end of the content. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndseek void MCIWndSeek( hwnd, lPos ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndSeek")] + public static int MCIWndSeek(HWND hwnd, int lPos) => MCIWndSM(hwnd, MCI.MCI_SEEK, 0, lPos); + + /// + /// The MCIWndSendString macro sends an MCI command in string form to the device associated with the MCIWnd window. You can + /// use this macro or explicitly send the MCIWNDM_SENDSTRING message. + /// + /// Handle of the MCIWnd window. + /// String command to send to the MCI device. + /// None + /// + /// + /// The message handler for MCIWndSendString (and MCIWNDM_SENDSTRING) appends a device alias to the MCI command you + /// send to the device. Therefore, you should not use any alias in an MCI command that you issue with MCIWndSendString. + /// + /// To get the return string, which contains the result of the command, use the MCIWndReturnString macro. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndsendstring void MCIWndSendString( hwnd, sz ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndSendString")] + public static int MCIWndSendString(HWND hwnd, string sz) => SendMessage(hwnd, MCIMessage.MCIWNDM_SENDSTRING, IntPtr.Zero, sz).ToInt32(); + + /// + /// The MCIWndSetActiveTimer macro sets the update period used by MCIWnd to update the trackbar in the MCIWnd window, update + /// position information displayed in the window title bar, and send notification messages to the parent window when the MCIWnd + /// window is active. You can use this macro or explicitly send the MCIWNDM_SETACTIVETIMER message. + /// + /// Handle of the MCIWnd window. + /// Update period, in milliseconds. The default is 500 milliseconds. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndsetactivetimer void MCIWndSetActiveTimer( hwnd, active ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndSetActiveTimer")] + public static void MCIWndSetActiveTimer(HWND hwnd, uint active) => MCIWndSM(hwnd, MCIMessage.MCIWNDM_SETACTIVETIMER, unchecked((int)active), 0); + + /// + /// The MCIWndSetInactiveTimer macro sets the update period used by MCIWnd to update the trackbar in the MCIWnd window, + /// update position information displayed in the window title bar, and send notification messages to the parent window when the + /// MCIWnd window is inactive. You can use this macro or explicitly send the MCIWNDM_SETINACTIVETIMER message. + /// + /// Handle of the MCIWnd window. + /// Update period, in milliseconds. The default is 2000 milliseconds. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndsetinactivetimer void MCIWndSetInactiveTimer( hwnd, inactive ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndSetInactiveTimer")] + public static void MCIWndSetInactiveTimer(HWND hwnd, uint inactive) => MCIWndSM(hwnd, MCIMessage.MCIWNDM_SETINACTIVETIMER, unchecked((int)inactive), 0); + + /// + /// The MCIWndSetOwner macro sets the window to receive notification messages associated with the MCIWnd window. You can use + /// this macro or explicitly send the MCIWNDM_SETOWNER message. + /// + /// Handle of the MCIWnd window. + /// Handle of the window to receive the notification messages. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndsetowner void MCIWndSetOwner( hwnd, hwndP ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndSetOwner")] + public static int MCIWndSetOwner(HWND hwnd, HWND hwndP) => MCIWndSM(hwnd, MCIMessage.MCIWNDM_SETOWNER, (IntPtr)hwndP); + + /// + /// The MCIWndSetPalette macro sends a palette handle to the MCI device associated with the MCIWnd window. You can use this + /// macro or explicitly send the MCIWNDM_SETPALETTE message. + /// + /// Handle of the MCIWnd window. + /// Palette handle. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndsetpalette void MCIWndSetPalette( hwnd, hpal ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndSetPalette")] + public static int MCIWndSetPalette(HWND hwnd, HPALETTE hpal) => MCIWndSM(hwnd, MCIMessage.MCIWNDM_SETPALETTE, (IntPtr)hpal); + + /// + /// The MCIWndSetRepeat macro sets the repeat flag associated with continuous playback. You can use this macro or explicitly + /// send the MCIWNDM_SETREPEAT message. + /// + /// Handle of the MCIWnd window. + /// New state of the repeat flag. Specify TRUE to turn on continuous playback. + /// None + /// + /// + /// The MCIWndSetRepeat macro only affects playback that the user initiates by hitting the play button on the toolbar. It + /// will not affect playback started with the MCIWndPlay macro. + /// + /// Currently, MCIAVI is the only device that supports continuous playback. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndsetrepeat void MCIWndSetRepeat( hwnd, f ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndSetRepeat")] + public static void MCIWndSetRepeat(HWND hwnd, bool f) => MCIWndSM(hwnd, MCIMessage.MCIWNDM_SETREPEAT, 0, f ? 1 : 0); + + /// + /// The MCIWndSetSpeed macro sets the playback speed of an MCI device. You can use this macro or explicitly send the + /// MCIWNDM_SETSPEED message. + /// + /// Handle of the MCIWnd window. + /// + /// Playback speed. Specify 1000 for normal speed, larger values for faster speeds, and smaller values for slower speeds. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndsetspeed void MCIWndSetSpeed( hwnd, iSpeed ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndSetSpeed")] + public static int MCIWndSetSpeed(HWND hwnd, uint iSpeed) => MCIWndSM(hwnd, MCIMessage.MCIWNDM_SETSPEED, 0, iSpeed); + + /// + /// The MCIWndSetTimeFormat macro sets the time format of an MCI device. You can use this macro or explicitly send the + /// MCIWNDM_SETTIMEFORMAT message. + /// + /// Handle of the MCIWnd window. + /// + /// Pointer to a buffer containing the null-terminated string indicating the time format. Specify "frames" to set the time format to + /// frames, or "ms" to set the time format to milliseconds. + /// + /// None + /// + /// + /// An application can specify time formats other than frames or milliseconds as long as the formats are supported by the MCI + /// device. Noncontinuous formats, such as tracks and SMPTE, can cause the trackbar to behave erratically. For these time formats, + /// you might want to turn off the toolbar by using the MCIWndChangeStyles macro and specifying the MCIWNDF_NOPLAYBAR window style. + /// + /// + /// If you want to set the time format to frames or milliseconds, you can also use the MCIWndUseFrames or + /// MCIWndUseTime macro. For a list of time formats, see the MCIWndGetTimeFormat macro. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndsettimeformat void MCIWndSetTimeFormat( hwnd, lp ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndSetTimeFormat")] + public static int MCIWndSetTimeFormat(HWND hwnd, string lp) => SendMessage(hwnd, MCIMessage.MCIWNDM_SETTIMEFORMAT, 0, lp).ToInt32(); + + /// + /// The MCIWndSetTimers macro sets the update periods used by MCIWnd to update the trackbar in the MCIWnd window, update the + /// position information displayed in the window title bar, and send notification messages to the parent window. You can use this + /// macro or explicitly send the MCIWNDM_SETTIMERS message. + /// + /// Handle of the MCIWnd window. + /// + /// Update period used by MCIWnd when it is the active window. The default value is 500 milliseconds. Storage for this value is + /// limited to 16 bits. + /// + /// + /// Update period used by MCIWnd when it is the inactive window. The default value is 2000 milliseconds. Storage for this value is + /// limited to 16 bits. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndsettimers void MCIWndSetTimers( hwnd, active, inactive ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndSetTimers")] + public static void MCIWndSetTimers(HWND hwnd, uint active, uint inactive) => MCIWndSM(hwnd, MCIMessage.MCIWNDM_SETTIMERS, unchecked((int)active), unchecked((int)inactive)); + + /// + /// The MCIWndSetVolume macro sets the volume level of an MCI device. You can use this macro or explicitly send the + /// MCIWNDM_SETVOLUME message. + /// + /// Handle of the MCIWnd window. + /// + /// New volume level. Specify 1000 for normal volume level. Specify a higher value for a louder volume or a lower value for a + /// quieter volume. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndsetvolume void MCIWndSetVolume( hwnd, iVol ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndSetVolume")] + public static int MCIWndSetVolume(HWND hwnd, uint iVol) => MCIWndSM(hwnd, MCIMessage.MCIWNDM_SETVOLUME, 0, iVol); + + /// + /// The MCIWndSetZoom macro resizes a video image according to a zoom factor. This marco adjusts the size of an MCIWnd window + /// while maintaining a constant aspect ratio. You can use this macro or explicitly send the MCIWNDM_SETZOOM message. + /// + /// Handle of the MCIWnd window. + /// + /// Zoom factor expressed as a percentage of the original image. Specify 100 to display the image at its authored size, 200 to + /// display the image at twice its normal size, or 50 to display the image at half its normal size. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndsetzoom void MCIWndSetZoom( hwnd, iZoom ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndSetZoom")] + public static void MCIWndSetZoom(HWND hwnd, uint iZoom) => MCIWndSM(hwnd, MCIMessage.MCIWNDM_SETZOOM, 0, iZoom); + + /// + /// The MCIWndStep macro moves the current position in the content forward or backward by a specified increment. You can use + /// this macro or explicitly send the MCI_STEP command. + /// + /// Handle of the MCIWnd window. + /// + /// Step value. Negative values step the device through the content in reverse. The units for the step value depend on the current + /// time format. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndstep void MCIWndStep( hwnd, n ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndStep")] + public static int MCIWndStep(HWND hwnd, int n) => MCIWndSM(hwnd, MCI.MCI_STEP, 0, n); + + /// + /// The MCIWndStop macro stops playing or recording the content of the MCI device associated with the MCIWnd window. You can + /// use this macro or explicitly send the MCI_STOP command. + /// + /// Handle of the MCIWnd window. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndstop void MCIWndStop( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndStop")] + public static int MCIWndStop(HWND hwnd) => MCIWndSM(hwnd, MCI.MCI_STOP); + + /// + /// The MCIWndUseFrames macro sets the time format of an MCI device to frames. You can use this macro or explicitly send the + /// MCIWNDM_SETTIMEFORMAT message. + /// + /// Handle of the MCIWnd window. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwnduseframes void MCIWndUseFrames( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndUseFrames")] + public static int MCIWndUseFrames(HWND hwnd) => MCIWndSetTimeFormat(hwnd, "frames"); + + /// + /// The MCIWndUseTime macro sets the time format of an MCI device to milliseconds. You can use this macro or explicitly send + /// the MCIWNDM_SETTIMEFORMAT message. + /// + /// Handle of the MCIWnd window. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndusetime void MCIWndUseTime( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndUseTime")] + public static int MCIWndUseTime(HWND hwnd) => MCIWndSetTimeFormat(hwnd, "ms"); + + /// + /// The MCIWndValidateMedia macro updates the starting and ending locations of the content, the current position in the + /// content, and the trackbar according to the current time format. You can use this macro or explicitly send the + /// MCIWNDM_VALIDATEMEDIA message. + /// + /// Handle of the MCIWnd window. + /// None + /// + /// Typically, you should not need to use this macro; however, if your application changes the time format of a device without using + /// MCIWnd; the starting and ending locations of the content, as well as the trackbar, continue to use the old format. You can use + /// this macro to update these values. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-mciwndvalidatemedia void MCIWndValidateMedia( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.MCIWndValidateMedia")] + public static void MCIWndValidateMedia(HWND hwnd) => MCIWndSM(hwnd, MCIMessage.MCIWNDM_VALIDATEMEDIA); + + private static int MCIWndSM(HWND hwnd, TEnum msg, int wparam, int lparam) where TEnum : struct, IConvertible => SendMessage(hwnd, msg, (IntPtr)wparam, (IntPtr)lparam).ToInt32(); + + private static int MCIWndSM(HWND hwnd, TEnum msg, [Optional] IntPtr wparam, [Optional] IntPtr lparam) where TEnum : struct, IConvertible => SendMessage(hwnd, msg, wparam, lparam).ToInt32(); + + private static int MCIWndSM(HWND hwnd, TEnum msg, StringBuilder lparam) where TEnum : struct, IConvertible => SendMessage(hwnd, msg, (IntPtr)(lparam?.Capacity ?? 0), lparam).ToInt32(); + + private static int MCIWndSM(HWND hwnd, TEnum msg, out TLP lparam, int size = -1) where TEnum : struct, IConvertible where TLP : struct + { + TLP res = default; + var ret = SendMessage(hwnd, msg, (IntPtr)(size == -1 ? Marshal.SizeOf(typeof(TLP)) : size), ref res).ToInt32(); + lparam = res; + return ret; + } + + private static int MCIWndSM(HWND hwnd, TEnum msg, int size, in TLP lparam) where TEnum : struct, IConvertible where TLP : struct + { + TLP res = lparam; + return SendMessage(hwnd, msg, (IntPtr)(size == -1 ? Marshal.SizeOf(typeof(TLP)) : size), ref res).ToInt32(); + } } } \ No newline at end of file diff --git a/PInvoke/Multimedia/Vfw.cap.cs b/PInvoke/Multimedia/Vfw.cap.cs index 8f3a3153..c539a9fb 100644 --- a/PInvoke/Multimedia/Vfw.cap.cs +++ b/PInvoke/Multimedia/Vfw.cap.cs @@ -2,6 +2,7 @@ using System; using System.Runtime.InteropServices; +using System.Text; using static Vanara.PInvoke.WinMm; namespace Vanara.PInvoke @@ -9,323 +10,1929 @@ namespace Vanara.PInvoke /// Items from the Vfw32.dll public static partial class Vfw32 { - /* - CAPCONTROLCALLBACK - CAPERRORCALLBACKA - CAPERRORCALLBACKW - CAPSTATUSCALLBACKA - CAPSTATUSCALLBACKW - CAPVIDEOCALLBACK - CAPWAVECALLBACK - CAPYIELDCALLBACK + private const string Lib_Avicap32 = "avicap32.dll"; - IAVIEditStream - IAVIFile - IAVIStream - IAVIStreaming - IGetFrame + /// + /// + /// The capControlCallback function is the callback function used for precision control to begin and end streaming capture. + /// The name capControlCallback is a placeholder for the application-supplied function name. + /// + /// + /// To set the callback, send the WM_CAP_SET_CALLBACK_CAPCONTROL message to the capture window or call the + /// capSetCallbackOnCapControl macro. + /// + /// + /// Handle to the capture window associated with the callback function. + /// + /// Current state of the capture operation. The CONTROLCALLBACK_PREROLL value is sent initially to enable prerolling of the video + /// sources and to return control to the capture application at the exact moment recording is to begin. The + /// CONTROLCALLBACK_CAPTURING value is sent once per captured frame to indicate that streaming capture is in progress and to enable + /// the application to end capture. + /// + /// + /// When nState is set to CONTROLCALLBACK_PREROLL, this callback function must return TRUE to start capture or FALSE + /// to abort it. When nState is set to CONTROLCALLBACK_CAPTURING, this callback function must return TRUE to continue capture + /// or FALSE to end it. + /// + /// + /// The first message sent to the callback procedure sets the nState parameter to CONTROLCALLBACK_PREROLL after allocating all + /// buffers and all other capture preparations are complete. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nc-vfw-capcontrolcallback CAPCONTROLCALLBACK Capcontrolcallback; LRESULT + // Capcontrolcallback( HWND hWnd, int nState ) {...} + [UnmanagedFunctionPointer(CallingConvention.Winapi)] + [PInvokeData("vfw.h", MSDNShortId = "NC:vfw.CAPCONTROLCALLBACK")] + public delegate IntPtr capControlCallback(HWND hWnd, CONTROLCALLBACK nState); - AVIBuildFilterA - AVIBuildFilterW - AVIClearClipboard - AVIFileAddRef - AVIFileCreateStream - AVIFileCreateStreamA - AVIFileCreateStreamW - AVIFileEndRecord - AVIFileExit - AVIFileGetStream - AVIFileInfo - AVIFileInfoA - AVIFileInfoW - AVIFileInit - AVIFileOpen - AVIFileOpenA - AVIFileOpenW - AVIFileReadData - AVIFileRelease - AVIFileWriteData - AVIGetFromClipboard - AVIMakeCompressedStream - AVIMakeFileFromStreams - AVIMakeStreamFromClipboard - AVIPutFileOnClipboard - AVISaveA - AVISaveOptions - AVISaveOptionsFree - AVISaveVA - AVISaveVW - AVISaveW - AVIStreamAddRef - AVIStreamBeginStreaming - AVIStreamCreate - AVIStreamDataSize - AVIStreamEnd - AVIStreamEndStreaming - AVIStreamEndTime - AVIStreamFindSample - AVIStreamFormatSize - AVIStreamGetFrame - AVIStreamGetFrameClose - AVIStreamGetFrameOpen - AVIStreamInfoA - AVIStreamInfoW - AVIStreamIsKeyFrame - AVIStreamLength - AVIStreamLengthTime - AVIStreamNearestKeyFrame - AVIStreamNearestKeyFrameTime - AVIStreamNearestSample - AVIStreamNearestSampleTime - AVIStreamNextKeyFrame - AVIStreamNextKeyFrameTime - AVIStreamNextSample - AVIStreamNextSampleTime - AVIStreamOpenFromFileA - AVIStreamOpenFromFileW - AVIStreamPrevKeyFrame - AVIStreamPrevKeyFrameTime - AVIStreamPrevSample - AVIStreamPrevSampleTime - AVIStreamRead - AVIStreamReadData - AVIStreamReadFormat - AVIStreamRelease - AVIStreamSampleSize - AVIStreamSampleToSample - AVIStreamSampleToTime - AVIStreamSetFormat - AVIStreamStart - AVIStreamStartTime - AVIStreamTimeToSample - AVIStreamWrite - AVIStreamWriteData - capCaptureAbort - capCaptureGetSetup - capCaptureSequence - capCaptureSequenceNoFile - capCaptureSetSetup - capCaptureSingleFrame - capCaptureSingleFrameClose - capCaptureSingleFrameOpen - capCaptureStop - capCreateCaptureWindowA - capCreateCaptureWindowW - capDlgVideoCompression - capDlgVideoDisplay - capDlgVideoFormat - capDlgVideoSource - capDriverConnect - capDriverDisconnect - capDriverGetCaps - capDriverGetName - capDriverGetVersion - capEditCopy - capFileAlloc - capFileGetCaptureFile - capFileSaveAs - capFileSaveDIB - capFileSetCaptureFile - capFileSetInfoChunk - capGetAudioFormat - capGetAudioFormatSize - capGetDriverDescriptionA - capGetDriverDescriptionW - capGetMCIDeviceName - capGetStatus - capGetUserData - capGetVideoFormat - capGetVideoFormatSize - capGrabFrame - capGrabFrameNoStop - capOverlay - capPaletteAuto - capPaletteManual - capPaletteOpen - capPalettePaste - capPaletteSave - capPreview - capPreviewRate - capPreviewScale - capSetAudioFormat - capSetCallbackOnCapControl - capSetCallbackOnError - capSetCallbackOnFrame - capSetCallbackOnStatus - capSetCallbackOnVideoStream - capSetCallbackOnWaveStream - capSetCallbackOnYield - capSetMCIDeviceName - capSetScrollPos - capSetUserData - capSetVideoFormat - CreateEditableStream - DrawDibBegin - DrawDibChangePalette - DrawDibClose - DrawDibDraw - DrawDibEnd - DrawDibGetBuffer - DrawDibGetPalette - DrawDibOpen - DrawDibProfileDisplay - DrawDibRealize - DrawDibSetPalette - DrawDibStart - DrawDibStop - DrawDibTime - DrawDibUpdate - EditStreamClone - EditStreamCopy - EditStreamCut - EditStreamPaste - EditStreamSetInfoA - EditStreamSetInfoW - EditStreamSetNameA - EditStreamSetNameW - GetOpenFileNamePreviewA - GetOpenFileNamePreviewW - GetSaveFileNamePreviewA - GetSaveFileNamePreviewW - ICAbout - ICClose - ICCompress - ICCompressBegin - ICCompressEnd - ICCompressGetFormat - ICCompressGetFormatSize - ICCompressGetSize - ICCompressorChoose - ICCompressorFree - ICCompressQuery - ICConfigure - ICDecompress - ICDecompressBegin - ICDecompressEnd - ICDecompressEx - ICDecompressExBegin - ICDecompressExEnd - ICDecompressExQuery - ICDecompressGetFormat - ICDecompressGetFormatSize - ICDecompressGetPalette - ICDecompressOpen - ICDecompressQuery - ICDecompressSetPalette - ICDraw - ICDrawBegin - ICDrawChangePalette - ICDrawEnd - ICDrawFlush - ICDrawGetTime - ICDrawOpen - ICDrawQuery - ICDrawRealize - ICDrawRenderBuffer - ICDrawSetTime - ICDrawStart - ICDrawStartPlay - ICDrawStop - ICDrawStopPlay - ICDrawSuggestFormat - ICDrawWindow - ICGetBuffersWanted - ICGetDefaultKeyFrameRate - ICGetDefaultQuality - ICGetDisplayFormat - ICGetInfo - ICGetState - ICGetStateSize - ICImageCompress - ICImageDecompress - ICInfo - ICInstall - ICLocate - ICOpen - ICOpenFunction - ICQueryAbout - ICQueryConfigure - ICRemove - ICSendMessage - ICSeqCompressFrame - ICSeqCompressFrameEnd - ICSeqCompressFrameStart - ICSetState - ICSetStatusProc - MCIWndCanConfig - MCIWndCanEject - MCIWndCanPlay - MCIWndCanRecord - MCIWndCanSave - MCIWndCanWindow - MCIWndChangeStyles - MCIWndClose - MCIWndCreateA - MCIWndCreateW - MCIWndDestroy - MCIWndEject - MCIWndEnd - MCIWndGetActiveTimer - MCIWndGetAlias - MCIWndGetDest - MCIWndGetDevice - MCIWndGetDeviceID - MCIWndGetEnd - MCIWndGetError - MCIWndGetFileName - MCIWndGetInactiveTimer - MCIWndGetLength - MCIWndGetMode - MCIWndGetPalette - MCIWndGetPosition - MCIWndGetPositionString - MCIWndGetRepeat - MCIWndGetSource - MCIWndGetSpeed - MCIWndGetStart - MCIWndGetStyles - MCIWndGetTimeFormat - MCIWndGetVolume - MCIWndGetZoom - MCIWndHome - MCIWndNew - MCIWndOpen - MCIWndOpenDialog - MCIWndOpenInterface - MCIWndPause - MCIWndPlay - MCIWndPlayFrom - MCIWndPlayFromTo - MCIWndPlayReverse - MCIWndPlayTo - MCIWndPutDest - MCIWndPutSource - MCIWndRealize - MCIWndRecord - MCIWndRegisterClass - MCIWndResume - MCIWndReturnString - MCIWndSave - MCIWndSaveDialog - MCIWndSeek - MCIWndSendString - MCIWndSetActiveTimer - MCIWndSetInactiveTimer - MCIWndSetOwner - MCIWndSetPalette - MCIWndSetRepeat - MCIWndSetSpeed - MCIWndSetTimeFormat - MCIWndSetTimers - MCIWndSetVolume - MCIWndSetZoom - MCIWndStep - MCIWndStop - MCIWndUseFrames - MCIWndUseTime - MCIWndValidateMedia - mmioFOURCC - StretchDIB - */ + /// + /// + /// The capErrorCallback function is the error callback function used with video capture. The name capErrorCallback is + /// a placeholder for the application-supplied function name. + /// + /// + /// To set the callback, send the WM_CAP_SET_CALLBACK_ERROR message to the capture window or call the capSetCallbackOnError macro. + /// + /// + /// Handle to the capture window associated with the callback function. + /// Error identification number. + /// Pointer to a textual description of the returned error. + /// None + /// + /// + /// A message identifier of zero indicates a new operation is starting and the callback function should clear the current error. + /// + /// + /// Note + /// + /// The vfw.h header defines CAPERRORCALLBACK as an alias which automatically selects the ANSI or Unicode version of this function + /// based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not + /// encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for + /// Function Prototypes. + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nc-vfw-caperrorcallbacka CAPERRORCALLBACKA Caperrorcallbacka; LRESULT + // Caperrorcallbacka( HWND hWnd, int nID, LPCSTR lpsz ) {...} + [UnmanagedFunctionPointer(CallingConvention.Winapi, CharSet = CharSet.Auto)] + [PInvokeData("vfw.h", MSDNShortId = "NC:vfw.CAPERRORCALLBACKA")] + public delegate IntPtr capErrorCallback(HWND hWnd, int nID, [MarshalAs(UnmanagedType.LPTStr)] string lpsz); + + /// + /// + /// The capStatusCallback function is the status callback function used with video capture. The name capStatusCallback + /// is a placeholder for the application-supplied function name. + /// + /// + /// To set the callback, send the WM_CAP_SET_CALLBACK_STATUS message to the capture window or call the capSetCallbackOnStatus macro. + /// + /// + /// Handle to the capture window associated with the callback function. + /// Message identification number. + /// Pointer to a textual description of the returned status. + /// None + /// + /// + /// During capture operations, the first message sent to the callback function is always IDS_CAP_BEGIN and the last is always + /// IDS_CAP_END. A message identifier of zero indicates a new operation is starting and the callback function should clear the + /// current status. + /// + /// + /// Note + /// + /// The vfw.h header defines CAPSTATUSCALLBACK as an alias which automatically selects the ANSI or Unicode version of this function + /// based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not + /// encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for + /// Function Prototypes. + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nc-vfw-capstatuscallbacka CAPSTATUSCALLBACKA Capstatuscallbacka; LRESULT + // Capstatuscallbacka( HWND hWnd, int nID, LPCSTR lpsz ) {...} + [UnmanagedFunctionPointer(CallingConvention.Winapi, CharSet = CharSet.Auto)] + [PInvokeData("vfw.h", MSDNShortId = "NC:vfw.CAPSTATUSCALLBACKA")] + public delegate IntPtr capStatusCallback(HWND hWnd, int nID, [MarshalAs(UnmanagedType.LPTStr)] string lpsz); + + /// + /// + /// The capVideoStreamCallback function is the callback function used with streaming capture to optionally process a frame of + /// captured video. The name capVideoStreamCallback is a placeholder for the application-supplied function name. + /// + /// + /// To set this callback for streaming capture, send the WM_CAP_SET_CALLBACK_VIDEOSTREAM message to the capture window or call the + /// capSetCallbackOnVideoStream macro. + /// + /// + /// To set this callback for preview frame capture, send the WM_CAP_SET_CALLBACK_FRAME message to the capture window or call the + /// capSetCallbackOnFrame macro. + /// + /// + /// Handle to the capture window associated with the callback function. + /// Pointer to a VIDEOHDR structure containing information about the captured frame. + /// None + /// + /// The capture window calls a video stream callback function when a video buffer is marked done by the capture driver. When + /// capturing to disk, this will precede the disk write operation. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nc-vfw-capvideocallback CAPVIDEOCALLBACK Capvideocallback; LRESULT + // Capvideocallback( HWND hWnd, LPVIDEOHDR lpVHdr ) {...} + [UnmanagedFunctionPointer(CallingConvention.Winapi)] + [PInvokeData("vfw.h", MSDNShortId = "NC:vfw.CAPVIDEOCALLBACK")] + public delegate IntPtr capVideoStreamCallback(HWND hWnd, in VIDEOHDR lpVHdr); + + /// + /// + /// The capWaveStreamCallback function is the callback function used with streaming capture to optionally process buffers of + /// audio data. The name capWaveStreamCallback is a placeholder for the application-supplied function name. + /// + /// + /// To set the callback, send the WM_CAP_SET_CALLBACK_WAVESTREAM message to the capture window or call the + /// capSetCallbackOnWaveStream macro. + /// + /// + /// Handle to the capture window associated with the callback function. + /// Pointer to a WAVEHDR structure containing information about the captured audio data. + /// None + /// + /// The capture window calls a wave stream callback function when an audio buffer is marked done by the waveform-audio driver. When + /// capturing to disk, this will precede the disk write operation. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nc-vfw-capwavecallback CAPWAVECALLBACK Capwavecallback; LRESULT + // Capwavecallback( HWND hWnd, LPWAVEHDR lpWHdr ) {...} + [UnmanagedFunctionPointer(CallingConvention.Winapi)] + [PInvokeData("vfw.h", MSDNShortId = "NC:vfw.CAPWAVECALLBACK")] + public delegate IntPtr capWaveStreamCallback(HWND hWnd, in WAVEHDR lpWHdr); + + /// + /// + /// The capYieldCallback function is the yield callback function used with video capture. The name capYieldCallback is + /// a placeholder for the application-supplied function name. + /// + /// + /// To set the callback, send the WM_CAP_SET_CALLBACK_YIELD message to the capture window or call the capSetCallbackOnYield macro. + /// + /// + /// Handle to the capture window associated with the callback function. + /// None + /// + /// The capture window calls the yield callback function at least once for every captured video frame, but the exact rate depends on + /// the frame rate and the overhead of the capture driver and disk. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nc-vfw-capyieldcallback CAPYIELDCALLBACK Capyieldcallback; LRESULT + // Capyieldcallback( HWND hWnd ) {...} + [UnmanagedFunctionPointer(CallingConvention.Winapi)] + [PInvokeData("vfw.h", MSDNShortId = "NC:vfw.CAPYIELDCALLBACK")] + public delegate IntPtr capYieldCallback(HWND hWnd); + + /// Window messages for capture drivers. + [PInvokeData("vfw.h")] + public enum capMessage : uint + { + /// start of unicode messages + WM_CAP_START = User32.WM_USER, + + /// + WM_CAP_UNICODE_START = User32.WM_USER + 100, + + /// + WM_CAP_GET_CAPSTREAMPTR = WM_CAP_START + 1, + + /// + WM_CAP_SET_CALLBACK_ERRORW = WM_CAP_UNICODE_START + 2, + + /// + WM_CAP_SET_CALLBACK_STATUSW = WM_CAP_UNICODE_START + 3, + + /// + WM_CAP_SET_CALLBACK_ERRORA = WM_CAP_START + 2, + + /// + WM_CAP_SET_CALLBACK_STATUSA = WM_CAP_START + 3, + + /// + WM_CAP_SET_CALLBACK_ERROR = WM_CAP_SET_CALLBACK_ERRORW, + + /// + WM_CAP_SET_CALLBACK_STATUS = WM_CAP_SET_CALLBACK_STATUSW, + + /// + WM_CAP_SET_CALLBACK_YIELD = WM_CAP_START + 4, + + /// + WM_CAP_SET_CALLBACK_FRAME = WM_CAP_START + 5, + + /// + WM_CAP_SET_CALLBACK_VIDEOSTREAM = WM_CAP_START + 6, + + /// + WM_CAP_SET_CALLBACK_WAVESTREAM = WM_CAP_START + 7, + + /// + WM_CAP_GET_USER_DATA = WM_CAP_START + 8, + + /// + WM_CAP_SET_USER_DATA = WM_CAP_START + 9, + + /// + WM_CAP_DRIVER_CONNECT = WM_CAP_START + 10, + + /// + WM_CAP_DRIVER_DISCONNECT = WM_CAP_START + 11, + + /// + WM_CAP_DRIVER_GET_NAMEA = WM_CAP_START + 12, + + /// + WM_CAP_DRIVER_GET_VERSIONA = WM_CAP_START + 13, + + /// + WM_CAP_DRIVER_GET_NAMEW = WM_CAP_UNICODE_START + 12, + + /// + WM_CAP_DRIVER_GET_VERSIONW = WM_CAP_UNICODE_START + 13, + + /// + WM_CAP_DRIVER_GET_NAME = WM_CAP_DRIVER_GET_NAMEW, + + /// + WM_CAP_DRIVER_GET_VERSION = WM_CAP_DRIVER_GET_VERSIONW, + + /// + WM_CAP_DRIVER_GET_CAPS = WM_CAP_START + 14, + + /// + WM_CAP_FILE_SET_CAPTURE_FILEA = WM_CAP_START + 20, + + /// + WM_CAP_FILE_GET_CAPTURE_FILEA = WM_CAP_START + 21, + + /// + WM_CAP_FILE_SAVEASA = WM_CAP_START + 23, + + /// + WM_CAP_FILE_SAVEDIBA = WM_CAP_START + 25, + + /// + WM_CAP_FILE_SET_CAPTURE_FILEW = WM_CAP_UNICODE_START + 20, + + /// + WM_CAP_FILE_GET_CAPTURE_FILEW = WM_CAP_UNICODE_START + 21, + + /// + WM_CAP_FILE_SAVEASW = WM_CAP_UNICODE_START + 23, + + /// + WM_CAP_FILE_SAVEDIBW = WM_CAP_UNICODE_START + 25, + + /// + WM_CAP_FILE_SET_CAPTURE_FILE = WM_CAP_FILE_SET_CAPTURE_FILEW, + + /// + WM_CAP_FILE_GET_CAPTURE_FILE = WM_CAP_FILE_GET_CAPTURE_FILEW, + + /// + WM_CAP_FILE_SAVEAS = WM_CAP_FILE_SAVEASW, + + /// + WM_CAP_FILE_SAVEDIB = WM_CAP_FILE_SAVEDIBW, + + /// + WM_CAP_FILE_ALLOCATE = WM_CAP_START + 22, + + /// + WM_CAP_FILE_SET_INFOCHUNK = WM_CAP_START + 24, + + /// + WM_CAP_EDIT_COPY = WM_CAP_START + 30, + + /// + WM_CAP_SET_AUDIOFORMAT = WM_CAP_START + 35, + + /// + WM_CAP_GET_AUDIOFORMAT = WM_CAP_START + 36, + + /// + WM_CAP_DLG_VIDEOFORMAT = WM_CAP_START + 41, + + /// + WM_CAP_DLG_VIDEOSOURCE = WM_CAP_START + 42, + + /// + WM_CAP_DLG_VIDEODISPLAY = WM_CAP_START + 43, + + /// + WM_CAP_GET_VIDEOFORMAT = WM_CAP_START + 44, + + /// + WM_CAP_SET_VIDEOFORMAT = WM_CAP_START + 45, + + /// + WM_CAP_DLG_VIDEOCOMPRESSION = WM_CAP_START + 46, + + /// + WM_CAP_SET_PREVIEW = WM_CAP_START + 50, + + /// + WM_CAP_SET_OVERLAY = WM_CAP_START + 51, + + /// + WM_CAP_SET_PREVIEWRATE = WM_CAP_START + 52, + + /// + WM_CAP_SET_SCALE = WM_CAP_START + 53, + + /// + WM_CAP_GET_STATUS = WM_CAP_START + 54, + + /// + WM_CAP_SET_SCROLL = WM_CAP_START + 55, + + /// + WM_CAP_GRAB_FRAME = WM_CAP_START + 60, + + /// + WM_CAP_GRAB_FRAME_NOSTOP = WM_CAP_START + 61, + + /// + WM_CAP_SEQUENCE = WM_CAP_START + 62, + + /// + WM_CAP_SEQUENCE_NOFILE = WM_CAP_START + 63, + + /// + WM_CAP_SET_SEQUENCE_SETUP = WM_CAP_START + 64, + + /// + WM_CAP_GET_SEQUENCE_SETUP = WM_CAP_START + 65, + + /// + WM_CAP_SET_MCI_DEVICEA = WM_CAP_START + 66, + + /// + WM_CAP_GET_MCI_DEVICEA = WM_CAP_START + 67, + + /// + WM_CAP_SET_MCI_DEVICEW = WM_CAP_UNICODE_START + 66, + + /// + WM_CAP_GET_MCI_DEVICEW = WM_CAP_UNICODE_START + 67, + + /// + WM_CAP_SET_MCI_DEVICE = WM_CAP_SET_MCI_DEVICEW, + + /// + WM_CAP_GET_MCI_DEVICE = WM_CAP_GET_MCI_DEVICEW, + + /// + WM_CAP_STOP = WM_CAP_START + 68, + + /// + WM_CAP_ABORT = WM_CAP_START + 69, + + /// + WM_CAP_SINGLE_FRAME_OPEN = WM_CAP_START + 70, + + /// + WM_CAP_SINGLE_FRAME_CLOSE = WM_CAP_START + 71, + + /// + WM_CAP_SINGLE_FRAME = WM_CAP_START + 72, + + /// + WM_CAP_PAL_OPENA = WM_CAP_START + 80, + + /// + WM_CAP_PAL_SAVEA = WM_CAP_START + 81, + + /// + WM_CAP_PAL_OPENW = WM_CAP_UNICODE_START + 80, + + /// + WM_CAP_PAL_SAVEW = WM_CAP_UNICODE_START + 81, + + /// + WM_CAP_PAL_OPEN = WM_CAP_PAL_OPENW, + + /// + WM_CAP_PAL_SAVE = WM_CAP_PAL_SAVEW, + + /// + WM_CAP_PAL_PASTE = WM_CAP_START + 82, + + /// + WM_CAP_PAL_AUTOCREATE = WM_CAP_START + 83, + + /// Following added post VFW 1.1 + WM_CAP_PAL_MANUALCREATE = WM_CAP_START + 84, + + /// + WM_CAP_SET_CALLBACK_CAPCONTROL = WM_CAP_START + 85, + } + + /// Current state of the capture operation. + [PInvokeData("vfw.h", MSDNShortId = "NC:vfw.CAPCONTROLCALLBACK")] + public enum CONTROLCALLBACK + { + /// Waiting to start capture + CONTROLCALLBACK_PREROLL = 1, + + /// Now capturing + CONTROLCALLBACK_CAPTURING = 2, + } + + /// Flags for VIDEOHDR. + [Flags] + public enum VHDR : uint + { + /// Done bit + VHDR_DONE = 0x00000001, + + /// Set if this header has been prepared + VHDR_PREPARED = 0x00000002, + + /// Reserved for driver + VHDR_INQUEUE = 0x00000004, + + /// Key Frame + VHDR_KEYFRAME = 0x00000008, + } + + /// + /// The capCaptureAbort macro stops the capture operation. You can use this macro or explictly send the WM_CAP_ABORT message. + /// + /// Handle to a capture window. + /// None + /// + /// The capture operation must yield to use this macro. + /// + /// In the case of step capture, the image data collected up to the point of the capCaptureAbort macro will be retained in + /// the capture file, but audio will not be captured. + /// + /// Use the capCaptureStop macro to halt step capture at the current position, and then capture audio. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-capcaptureabort void capCaptureAbort( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capCaptureAbort")] + public static bool capCaptureAbort(HWND hwnd) => AVICapSM(hwnd, capMessage.WM_CAP_ABORT); + + /// + /// The capCaptureGetSetup macro retrieves the current settings of the streaming capture parameters. You can use this macro + /// or explictly send the WM_CAP_GET_SEQUENCE_SETUP message. + /// + /// Handle to a capture window. + /// Pointer to a CAPTUREPARMS structure. + /// None + /// For information about the parameters used to control streaming capture, see the CAPTUREPARMS structure. + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-capcapturegetsetup void capCaptureGetSetup( hwnd, s, wSize ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capCaptureGetSetup")] + public static bool capCaptureGetSetup(HWND hwnd, out CAPTUREPARMS s) => AVICapSM(hwnd, capMessage.WM_CAP_GET_SEQUENCE_SETUP, out s) != 0; + + /// + /// The capCaptureSequence macro initiates streaming video and audio capture to a file. You can use this macro or explicitly + /// send the WM_CAP_SEQUENCE message. + /// + /// Handle to a capture window. + /// None + /// + /// + /// If you want to alter the parameters controlling streaming capture, use the capCaptureSetSetup macro prior to starting the capture. + /// + /// + /// By default, the capture window does not allow other applications to continue running during capture. To override this, either + /// set the fYield member of the CAPTUREPARMS structure to TRUE, or install a yield callback function. + /// + /// + /// During streaming capture, the capture window can optionally issue notifications to your application of specific types of + /// conditions. To install callback procedures for these notifications, use the following macros: + /// + /// + /// + /// capSetCallbackOnError + /// + /// + /// capSetCallbackOnStatus + /// + /// + /// capSetCallbackOnVideoStream + /// + /// + /// capSetCallbackOnWaveStream + /// + /// + /// capSetCallbackOnYield + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-capcapturesequence void capCaptureSequence( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capCaptureSequence")] + public static bool capCaptureSequence(HWND hwnd) => AVICapSM(hwnd, capMessage.WM_CAP_SEQUENCE); + + /// + /// The capCaptureSequenceNoFile macro initiates streaming video capture without writing data to a file. You can use this + /// macro or explicitly send the WM_CAP_SEQUENCE_NOFILE message. + /// + /// Handle to a capture window. + /// None + /// + /// + /// This message is useful in conjunction with video stream or waveform-audio stream callback functions that let your application + /// use the video and audio data directly. + /// + /// + /// If you want to alter the parameters controlling streaming capture, use the capCaptureSetSetup macro prior to starting the capture. + /// + /// + /// By default, the capture window does not allow other applications to continue running during capture. To override this, either + /// set the fYield member of the CAPTUREPARMS structure to TRUE, or install a yield callback function. + /// + /// + /// During streaming capture, the capture window can optionally issue notifications to your application of specific types of + /// conditions. To install callback procedures for these notifications, use the following macros: + /// + /// + /// + /// capSetCallbackOnError + /// + /// + /// capSetCallbackOnStatus + /// + /// + /// capSetCallbackOnVideoStream + /// + /// + /// capSetCallbackOnWaveStream + /// + /// + /// capSetCallbackOnYield + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-capcapturesequencenofile void capCaptureSequenceNoFile( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capCaptureSequenceNoFile")] + public static bool capCaptureSequenceNoFile(HWND hwnd) => AVICapSM(hwnd, capMessage.WM_CAP_SEQUENCE_NOFILE); + + /// + /// The capCaptureSetSetup macro sets the configuration parameters used with streaming capture. You can use this macro or + /// explicitly send the WM_CAP_SET_SEQUENCE_SETUP message. + /// + /// Handle to a capture window. + /// Pointer to a CAPTUREPARMS structure. + /// None + /// For information about the parameters used to control streaming capture, see the CAPTUREPARMS structure. + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-capcapturesetsetup void capCaptureSetSetup( hwnd, s, wSize ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capCaptureSetSetup")] + public static bool capCaptureSetSetup(HWND hwnd, in CAPTUREPARMS s) => AVICapSM(hwnd, capMessage.WM_CAP_SET_SEQUENCE_SETUP, -1, s) != 0; + + /// + /// The capCaptureSingleFrame macro appends a single frame to a capture file that was opened using the + /// capCaptureSingleFrameOpen macro. You can use this macro or explicitly send the WM_CAP_SINGLE_FRAME message. + /// + /// Handle to a capture window. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-capcapturesingleframe void capCaptureSingleFrame( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capCaptureSingleFrame")] + public static bool capCaptureSingleFrame(HWND hwnd) => AVICapSM(hwnd, capMessage.WM_CAP_SINGLE_FRAME); + + /// + /// The capCaptureSingleFrameClose macro closes the capture file opened by the capCaptureSingleFrameOpen macro. You can use + /// this macro or explicitly send the WM_CAP_SINGLE_FRAME_CLOSE message. + /// + /// Handle to a capture window. + /// None + /// For information about installing callback functions, see the capSetCallbackOnError and capSetCallbackOnFrame macros. + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-capcapturesingleframeclose void capCaptureSingleFrameClose( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capCaptureSingleFrameClose")] + public static bool capCaptureSingleFrameClose(HWND hwnd) => AVICapSM(hwnd, capMessage.WM_CAP_SINGLE_FRAME_CLOSE); + + /// + /// The capCaptureSingleFrameOpen macro opens the capture file for single-frame capturing. Any previous information in the + /// capture file is overwritten. You can use this macro or explicitly send the WM_CAP_SINGLE_FRAME_OPEN message. + /// + /// Handle to a capture window. + /// None + /// For information about installing callback functions, see the capSetCallbackOnError and capSetCallbackOnFrame macros. + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-capcapturesingleframeopen void capCaptureSingleFrameOpen( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capCaptureSingleFrameOpen")] + public static bool capCaptureSingleFrameOpen(HWND hwnd) => AVICapSM(hwnd, capMessage.WM_CAP_SINGLE_FRAME_OPEN); + + /// + /// + /// The capCaptureStop macro stops the capture operation. You can use this macro or explicitly send the WM_CAP_STOP message. + /// + /// + /// In step frame capture, the image data that was collected before this message was sent is retained in the capture file. An + /// equivalent duration of audio data is also retained in the capture file if audio capture was enabled. + /// + /// + /// Handle to a capture window. + /// None + /// + /// The capture operation must yield to use this message. Use the capCaptureAbort macro to abandon the current capture operation. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-capcapturestop void capCaptureStop( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capCaptureStop")] + public static bool capCaptureStop(HWND hwnd) => AVICapSM(hwnd, capMessage.WM_CAP_STOP); + + /// The capCreateCaptureWindow function creates a capture window. + /// Null-terminated string containing the name used for the capture window. + /// Window styles used for the capture window. Window styles are described with the CreateWindowEx function. + /// The x-coordinate of the upper left corner of the capture window. + /// The y-coordinate of the upper left corner of the capture window. + /// Width of the capture window. + /// Height of the capture window. + /// Handle to the parent window. + /// Window identifier. + /// Returns a handle of the capture window if successful or NULL otherwise. + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-capcreatecapturewindowa HWND VFWAPI capCreateCaptureWindowA( LPCSTR + // lpszWindowName, DWORD dwStyle, int x, int y, int nWidth, int nHeight, HWND hwndParent, int nID ); + [DllImport(Lib_Avicap32, SetLastError = false, CharSet = CharSet.Auto)] + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capCreateCaptureWindowA")] + public static extern HWND capCreateCaptureWindow([MarshalAs(UnmanagedType.LPTStr)] string lpszWindowName, User32.WindowStyles dwStyle, int x, int y, int nWidth, int nHeight, [In, Optional] HWND hwndParent, int nID); + + /// + /// The capDlgVideoCompression macro displays a dialog box in which the user can select a compressor to use during the + /// capture process. The list of available compressors can vary with the video format selected in the capture driver's Video Format + /// dialog box. You can use this macro or explicitly send the WM_CAP_DLG_VIDEOCOMPRESSION message. + /// + /// Handle to a capture window. + /// None + /// + /// + /// Use this message with capture drivers that provide frames only in the BI_RGB format. This message is most useful in the step + /// capture operation to combine capture and compression in a single operation. Compressing frames with a software compressor as + /// part of a real-time capture operation is most likely too time-consuming to perform. + /// + /// Compression does not affect the frames copied to the clipboard. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-capdlgvideocompression void capDlgVideoCompression( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capDlgVideoCompression")] + public static bool capDlgVideoCompression(HWND hwnd) => AVICapSM(hwnd, capMessage.WM_CAP_DLG_VIDEOCOMPRESSION); + + /// + /// The capDlgVideoDisplay macro displays a dialog box in which the user can set or adjust the video output. This dialog box + /// might contain controls that affect the hue, contrast, and brightness of the displayed image, as well as key color alignment. You + /// can use this macro or explicitly send the WM_CAP_DLG_VIDEODISPLAY message. + /// + /// Handle to a capture window. + /// None + /// + /// + /// The controls in this dialog box do not affect digitized video data; they affect only the output or redisplay of the video signal. + /// + /// + /// The Video Display dialog box is unique for each capture driver. Some capture drivers might not support a Video Display dialog + /// box. Applications can determine if the capture driver supports this message by checking the fHasDlgVideoDisplay member of + /// the CAPDRIVERCAPS structure. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-capdlgvideodisplay void capDlgVideoDisplay( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capDlgVideoDisplay")] + public static bool capDlgVideoDisplay(HWND hwnd) => AVICapSM(hwnd, capMessage.WM_CAP_DLG_VIDEODISPLAY); + + /// + /// The capDlgVideoFormat macro displays a dialog box in which the user can select the video format. The Video Format dialog + /// box might be used to select image dimensions, bit depth, and hardware compression options. You can use this macro or explicitly + /// send the WM_CAP_DLG_VIDEOFORMAT message. + /// + /// Handle to a capture window. + /// None + /// + /// + /// After this message returns, applications might need to update the CAPSTATUS structure because the user might have changed the + /// image dimensions. + /// + /// + /// The Video Format dialog box is unique for each capture driver. Some capture drivers might not support a Video Format dialog box. + /// Applications can determine if the capture driver supports this message by checking the fHasDlgVideoFormat member of CAPDRIVERCAPS. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-capdlgvideoformat void capDlgVideoFormat( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capDlgVideoFormat")] + public static bool capDlgVideoFormat(HWND hwnd) => AVICapSM(hwnd, capMessage.WM_CAP_DLG_VIDEOFORMAT); + + /// + /// The capDlgVideoSource macro displays a dialog box in which the user can control the video source. The Video Source dialog + /// box might contain controls that select input sources; alter the hue, contrast, brightness of the image; and modify the video + /// quality before digitizing the images into the frame buffer. You can use this macro or explicitly send the WM_CAP_DLG_VIDEOSOURCE message. + /// + /// Handle to a capture window. + /// None + /// + /// The Video Source dialog box is unique for each capture driver. Some capture drivers might not support a Video Source dialog box. + /// Applications can determine if the capture driver supports this message by checking the fHasDlgVideoSource member of the + /// CAPDRIVERCAPS structure. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-capdlgvideosource void capDlgVideoSource( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capDlgVideoSource")] + public static bool capDlgVideoSource(HWND hwnd) => AVICapSM(hwnd, capMessage.WM_CAP_DLG_VIDEOSOURCE); + + /// + /// The capDriverConnect macro connects a capture window to a capture driver. You can use this macro or explicitly send the + /// WM_CAP_DRIVER_CONNECT message. + /// + /// Handle to a capture window. + /// Index of the capture driver. The index can range from 0 through 9. + /// None + /// Connecting a capture driver to a capture window automatically disconnects any previously connected capture driver. + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-capdriverconnect void capDriverConnect( hwnd, i ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capDriverConnect")] + public static bool capDriverConnect(HWND hwnd, int i) => AVICapSM(hwnd, capMessage.WM_CAP_DRIVER_CONNECT, (IntPtr)i); + + /// + /// The capDriverDisconnect macro disconnects a capture driver from a capture window. You can use this macro or explicitly + /// send the WM_CAP_DRIVER_DISCONNECT message. + /// + /// Handle to a capture window. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-capdriverdisconnect void capDriverDisconnect( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capDriverDisconnect")] + public static bool capDriverDisconnect(HWND hwnd) => AVICapSM(hwnd, capMessage.WM_CAP_DRIVER_DISCONNECT); + + /// + /// The capDriverGetCaps macro returns the hardware capabilities of the capture driver currently connected to a capture + /// window. You can use this macro or explicitly send the WM_CAP_DRIVER_GET_CAPS message. + /// + /// Handle to a capture window. + /// Pointer to the CAPDRIVERCAPS structure to contain the hardware capabilities. + /// None + /// + /// The capabilities returned in CAPDRIVERCAPS are constant for a given capture driver. Applications need to retrieve this + /// information once when the capture driver is first connected to a capture window. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-capdrivergetcaps void capDriverGetCaps( hwnd, s, wSize ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capDriverGetCaps")] + public static bool capDriverGetCaps(HWND hwnd, out CAPDRIVERCAPS s) => AVICapSM(hwnd, capMessage.WM_CAP_DRIVER_GET_CAPS, out s) != 0; + + /// + /// The capDriverGetName macro returns the name of the capture driver connected to the capture window. You can use this macro + /// or explicitly call the WM_CAP_DRIVER_GET_NAME message. + /// + /// Handle to a capture window. + /// Pointer to an application-defined buffer used to return the device name as a null-terminated string. + /// None + /// + /// The name is a text string retrieved from the driver's resource area. Applications should allocate approximately 80 bytes for + /// this string. If the driver does not contain a name resource, the full path name of the driver listed in the registry or in the + /// SYSTEM.INI file is returned. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-capdrivergetname void capDriverGetName( hwnd, szName, wSize ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capDriverGetName")] + public static bool capDriverGetName(HWND hwnd, StringBuilder szName) => AVICapSM(hwnd, capMessage.WM_CAP_DRIVER_GET_NAME, szName); + + /// + /// The capDriverGetVersion macro returns the version information of the capture driver connected to a capture window. You + /// can use this macro or explicitly send the WM_CAP_DRIVER_GET_VERSION message. + /// + /// Handle to a capture window. + /// Pointer to an application-defined buffer used to return the version information as a null-terminated string. + /// None + /// + /// The version information is a text string retrieved from the driver's resource area. Applications should allocate approximately + /// 40 bytes for this string. If version information is not available, a NULL string is returned. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-capdrivergetversion void capDriverGetVersion( hwnd, szVer, wSize ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capDriverGetVersion")] + public static bool capDriverGetVersion(HWND hwnd, StringBuilder szVer) => AVICapSM(hwnd, capMessage.WM_CAP_DRIVER_GET_VERSION, szVer); + + /// + /// The capEditCopy macro copies the contents of the video frame buffer and associated palette to the clipboard. You can use + /// this macro or explicitly send the WM_CAP_EDIT_COPY message. + /// + /// Handle to a capture window. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-capeditcopy void capEditCopy( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capEditCopy")] + public static bool capEditCopy(HWND hwnd) => AVICapSM(hwnd, capMessage.WM_CAP_EDIT_COPY); + + /// + /// The capFileAlloc macro creates (preallocates) a capture file of a specified size. You can use this macro or explicitly + /// send the WM_CAP_FILE_ALLOCATE message. + /// + /// Handle to a capture window. + /// Size, in bytes, to create the capture file. + /// None + /// + /// You can improve streaming capture performance significantly by preallocating a capture file large enough to store an entire + /// video clip and by defragmenting the capture file before capturing the clip. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-capfilealloc void capFileAlloc( hwnd, dwSize ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capFileAlloc")] + public static bool capFileAlloc(HWND hwnd, int dwSize) => AVICapSM(hwnd, capMessage.WM_CAP_FILE_ALLOCATE, (IntPtr)0, (IntPtr)dwSize); + + /// + /// The capFileGetCaptureFile macro returns the name of the current capture file. You can use this macro or explicitly call + /// the WM_CAP_FILE_GET_CAPTURE_FILE message. + /// + /// Handle to a capture window. + /// + /// Pointer to an application-defined buffer used to return the name of the capture file as a null-terminated string. + /// + /// None + /// The default capture filename is C:\CAPTURE.AVI. + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-capfilegetcapturefile void capFileGetCaptureFile( hwnd, szName, + // wSize ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capFileGetCaptureFile")] + public static bool capFileGetCaptureFile(HWND hwnd, StringBuilder szName) => AVICapSM(hwnd, capMessage.WM_CAP_FILE_GET_CAPTURE_FILE, szName); + + /// + /// The capFileSaveAs macro copies the contents of the capture file to another file. You can use this macro or explicitly + /// call the WM_CAP_FILE_SAVEAS message. + /// + /// Handle to a capture window. + /// + /// Pointer to the null-terminated string that contains the name of the destination file used to copy the file. + /// + /// None + /// + /// This message does not change the name or contents of the current capture file. + /// If the copy operation is unsuccessful due to a disk full error, the destination file is automatically deleted. + /// + /// Typically, a capture file is preallocated for the largest capture segment anticipated and only a portion of it might be used to + /// capture data. This message copies only the portion of the file containing the capture data. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-capfilesaveas void capFileSaveAs( hwnd, szName ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capFileSaveAs")] + public static bool capFileSaveAs(HWND hwnd, string szName) => AVICapSM(hwnd, capMessage.WM_CAP_FILE_SAVEAS, szName); + + /// + /// The capFileSaveDIB macro copies the current frame to a DIB file. You can use this macro or explicitly call the + /// WM_CAP_FILE_SAVEDIB message. + /// + /// Handle to a capture window. + /// Pointer to the null-terminated string that contains the name of the destination DIB file. + /// None + /// + /// If the capture driver supplies frames in a compressed format, this call attempts to decompress the frame before writing the file. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-capfilesavedib void capFileSaveDIB( hwnd, szName ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capFileSaveDIB")] + public static bool capFileSaveDIB(HWND hwnd, string szName) => AVICapSM(hwnd, capMessage.WM_CAP_FILE_SAVEDIB, szName); + + /// + /// The capFileSetCaptureFile macro names the file used for video capture. You can use this macro or explicitly call the + /// WM_CAP_FILE_SET_CAPTURE_FILE message. + /// + /// Handle to a capture window. + /// Pointer to the null-terminated string that contains the name of the capture file to use. + /// None + /// + /// This message stores the filename in an internal structure. It does not create, allocate, or open the specified file. The default + /// capture filename is C:\CAPTURE.AVI. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-capfilesetcapturefile void capFileSetCaptureFile( hwnd, szName ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capFileSetCaptureFile")] + public static bool capFileSetCaptureFile(HWND hwnd, string szName) => AVICapSM(hwnd, capMessage.WM_CAP_FILE_SET_CAPTURE_FILE, szName); + + /// + /// The capFileSetInfoChunk macro sets and clears information chunks. Information chunks can be inserted in an AVI file + /// during capture to embed text strings or custom data. You can use this macro or explicitly call the WM_CAP_FILE_SET_INFOCHUNK message. + /// + /// Handle to a capture window. + /// Pointer to a CAPINFOCHUNK structure defining the information chunk to be created or deleted. + /// None + /// + /// Multiple registered information chunks can be added to an AVI file. After an information chunk is set, it continues to be added + /// to subsequent capture files until either the entry is cleared or all information chunk entries are cleared. To clear a single + /// entry, specify the information chunk in the fccInfoID member and NULL in the lpData member of the + /// CAPINFOCHUNK structure. To clear all entries, specify NULL in fccInfoID. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-capfilesetinfochunk void capFileSetInfoChunk( hwnd, lpInfoChunk ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capFileSetInfoChunk")] + public static bool capFileSetInfoChunk(HWND hwnd, out CAPINFOCHUNK lpInfoChunk) => AVICapSM(hwnd, capMessage.WM_CAP_FILE_SET_INFOCHUNK, out lpInfoChunk, 0) != 0; + + /// + /// The capGetAudioFormat macro obtains the audio format. You can use this macro or explicitly call the + /// WM_CAP_GET_AUDIOFORMAT message. + /// + /// Handle to a capture window. + /// + /// Pointer to a WAVEFORMATEX structure, or NULL. If the value is NULL, the size, in bytes, required to hold the + /// WAVEFORMATEX structure is returned. + /// + /// Size, in bytes, of the structure referenced by s. + /// None + /// + /// Because compressed audio formats vary in size requirements applications must first retrieve the size, then allocate memory, and + /// finally request the audio format data. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-capgetaudioformat void capGetAudioFormat( hwnd, s, wSize ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capGetAudioFormat")] + public static int capGetAudioFormat(HWND hwnd, IntPtr s, int wSize) => User32.SendMessage(hwnd, capMessage.WM_CAP_GET_AUDIOFORMAT, (IntPtr)wSize, s).ToInt32(); + + /// + /// The capGetAudioFormatSize macro obtains the size of the audio format. You can use this macro or explicitly call the + /// WM_CAP_GET_AUDIOFORMAT message. + /// + /// Handle to a capture window. + /// None + /// + /// Because compressed audio formats vary in size requirements applications must first retrieve the size, then allocate memory, and + /// finally request the audio format data. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-capgetaudioformatsize void capGetAudioFormatSize( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capGetAudioFormatSize")] + public static int capGetAudioFormatSize(HWND hwnd) => User32.SendMessage(hwnd, capMessage.WM_CAP_GET_AUDIOFORMAT).ToInt32(); + + /// The capGetDriverDescription function retrieves the version description of the capture driver. + /// + /// Index of the capture driver. The index can range from 0 through 9. + /// + /// Plug-and-Play capture drivers are enumerated first, followed by capture drivers listed in the registry, which are then followed + /// by capture drivers listed in SYSTEM.INI. + /// + /// + /// Pointer to a buffer containing a null-terminated string corresponding to the capture driver name. + /// Length, in bytes, of the buffer pointed to by lpszName. + /// + /// Pointer to a buffer containing a null-terminated string corresponding to the description of the capture driver. + /// + /// Length, in bytes, of the buffer pointed to by lpszVer. + /// Returns TRUE if successful or FALSE otherwise. + /// + /// + /// If the information description is longer than its buffer, the description is truncated. The returned string is always + /// null-terminated. If a buffer size is zero, its corresponding description is not copied. + /// + /// + /// Note + /// + /// The vfw.h header defines capGetDriverDescription as an alias which automatically selects the ANSI or Unicode version of this + /// function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that + /// not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions + /// for Function Prototypes. + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-capgetdriverdescriptiona BOOL VFWAPI capGetDriverDescriptionA( UINT + // wDriverIndex, LPSTR lpszName, int cbName, LPSTR lpszVer, int cbVer ); + [DllImport(Lib_Avicap32, SetLastError = false, CharSet = CharSet.Auto)] + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capGetDriverDescriptionA")] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool capGetDriverDescription(uint wDriverIndex, [MarshalAs(UnmanagedType.LPTStr)] StringBuilder lpszName, int cbName, [MarshalAs(UnmanagedType.LPTStr)] StringBuilder lpszVer, int cbVer); + + /// + /// The capGetMCIDeviceName macro retrieves the name of an MCI device previously set with the capSetMCIDeviceName macro. You + /// can use this macro or explicitly call the WM_CAP_GET_MCI_DEVICE message. + /// + /// Handle to a capture window. + /// Pointer to a null-terminated string that contains the MCI device name. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-capgetmcidevicename void capGetMCIDeviceName( hwnd, szName, wSize ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capGetMCIDeviceName")] + public static bool capGetMCIDeviceName(HWND hwnd, StringBuilder szName) => AVICapSM(hwnd, capMessage.WM_CAP_GET_MCI_DEVICE, szName); + + /// + /// The capGetStatus macro retrieves the status of the capture window. You can use this macro or explicitly call the + /// WM_CAP_GET_STATUS message. + /// + /// Handle to a capture window. + /// Pointer to a CAPSTATUS structure. + /// None + /// + /// The CAPSTATUS structure contains the current state of the capture window. Since this state is dynamic and changes in response to + /// various messages, the application should initialize this structure after sending the capDlgVideoFormat macro and whenever it + /// needs to enable menu items or determine the actual state of the window. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-capgetstatus void capGetStatus( hwnd, s, wSize ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capGetStatus")] + public static bool capGetStatus(HWND hwnd, out CAPSTATUS s) => AVICapSM(hwnd, capMessage.WM_CAP_GET_STATUS, out s) != 0; + + /// + /// The capGetUserData macro retrieves a LONG_PTR data value associated with a capture window. You can use this macro + /// or explicitly call the WM_CAP_GET_USER_DATA message. + /// + /// Handle to a capture window. + /// Returns a value previously saved by using the WM_CAP_SET_USER_DATA message. + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-capgetuserdata void capGetUserData( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capGetUserData")] + public static IntPtr capGetUserData(HWND hwnd) => User32.SendMessage(hwnd, capMessage.WM_CAP_GET_USER_DATA); + + /// + /// The capGetVideoFormat macro retrieves a copy of the video format in use. You can use this macro or explicitly call the + /// WM_CAP_GET_VIDEOFORMAT message. + /// + /// Handle to a capture window. + /// + /// Pointer to a BITMAPINFO structure. You can also specify NULL to retrieve the number of bytes needed by BITMAPINFO. + /// + /// None + /// + /// Because compressed video formats vary in size requirements applications must first retrieve the size, then allocate memory, and + /// finally request the video format data. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-capgetvideoformat void capGetVideoFormat( hwnd, s, wSize ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capGetVideoFormat")] + public static int capGetVideoFormat(HWND hwnd, [Out] Gdi32.SafeBITMAPINFO s) => User32.SendMessage(hwnd, capMessage.WM_CAP_GET_VIDEOFORMAT, (IntPtr)(int)s.Size, s.DangerousGetHandle()).ToInt32(); + + /// + /// The capGetVideoFormatSize macro retrieves the size required for the video format. You can use this macro or explicitly + /// call the WM_CAP_GET_VIDEOFORMAT message. + /// + /// Handle to a capture window. + /// None + /// + /// Because compressed video formats vary in size requirements applications must first retrieve the size, then allocate memory, and + /// finally request the video format data. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-capgetvideoformatsize void capGetVideoFormatSize( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capGetVideoFormatSize")] + public static int capGetVideoFormatSize(HWND hwnd) => User32.SendMessage(hwnd, capMessage.WM_CAP_GET_VIDEOFORMAT).ToInt32(); + + /// + /// The capGrabFrame macro retrieves and displays a single frame from the capture driver. After capture, overlay and preview + /// are disabled. You can use this macro or explicitly call the WM_CAP_GRAB_FRAME message. + /// + /// Handle to a capture window. + /// None + /// For information about installing callback functions, see the capSetCallbackOnError and capSetCallbackOnFrame macros. + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-capgrabframe void capGrabFrame( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capGrabFrame")] + public static bool capGrabFrame(HWND hwnd) => AVICapSM(hwnd, capMessage.WM_CAP_GRAB_FRAME); + + /// + /// The capGrabFrameNoStop macro fills the frame buffer with a single uncompressed frame from the capture device and displays + /// it. Unlike with the capGrabFrame macro, the state of overlay or preview is not altered by this message. You can use this macro + /// or explicitly call the WM_CAP_GRAB_FRAME_NOSTOP message. + /// + /// Handle to a capture window. + /// None + /// + /// For information about installing callback functions, see the capSetCallbackOnError and capSetCallbackOnFrame macros. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-capgrabframenostop void capGrabFrameNoStop( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capGrabFrameNoStop")] + public static bool capGrabFrameNoStop(HWND hwnd) => AVICapSM(hwnd, capMessage.WM_CAP_GRAB_FRAME_NOSTOP); + + /// + /// The capOverlay macro enables or disables overlay mode. In overlay mode, video is displayed using hardware overlay. You + /// can use this macro or explicitly call the WM_CAP_SET_OVERLAY message. + /// + /// Handle to a capture window. + /// Overlay flag. Specify TRUE for this parameter to enable overlay mode or FALSE to disable it. + /// None + /// + /// Using an overlay does not require CPU resources. + /// + /// The fHasOverlay member of the CAPDRIVERCAPS structure indicates whether the device is capable of overlay. The + /// fOverlayWindow member of the CAPSTATUS structure indicates whether overlay mode is currently enabled. + /// + /// Enabling overlay mode automatically disables preview mode. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-capoverlay void capOverlay( hwnd, f ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capOverlay")] + public static bool capOverlay(HWND hwnd, bool f) => AVICapSM(hwnd, capMessage.WM_CAP_SET_OVERLAY, (IntPtr)(f ? 1 : 0)); + + /// + /// The capPaletteAuto macro requests that the capture driver sample video frames and automatically create a new palette. You + /// can use this macro or explicitly call the WM_CAP_PAL_AUTOCREATE message. + /// + /// Handle to a capture window. + /// Number of frames to sample. + /// Number of colors in the palette. The maximum value for this parameter is 256. + /// None + /// + /// The sampled video sequence should include all the colors you want in the palette. To obtain the best palette, you might have to + /// sample the whole sequence rather than a portion of it. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-cappaletteauto void capPaletteAuto( hwnd, iFrames, iColors ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capPaletteAuto")] + public static bool capPaletteAuto(HWND hwnd, int iFrames, int iColors) => AVICapSM(hwnd, capMessage.WM_CAP_PAL_AUTOCREATE, (IntPtr)iFrames, (IntPtr)iColors); + + /// + /// The capPaletteManual macro requests that the capture driver manually sample video frames and create a new palette. You + /// can use this macro or explicitly call the WM_CAP_PAL_MANUALCREATE message. + /// + /// Handle to a capture window. + /// + /// Palette histogram flag. Set this parameter to TRUE for each frame included in creating the optimal palette. After the + /// last frame has been collected, set this parameter to FALSE to calculate the optimal palette and send it to the capture driver. + /// + /// + /// Number of colors in the palette. The maximum value for this parameter is 256. This value is used only during collection of the + /// first frame in a sequence. + /// + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-cappalettemanual void capPaletteManual( hwnd, fGrab, iColors ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capPaletteManual")] + public static bool capPaletteManual(HWND hwnd, bool fGrab, int iColors) => AVICapSM(hwnd, capMessage.WM_CAP_PAL_MANUALCREATE, (IntPtr)(fGrab ? 1 : 0), (IntPtr)iColors); + + /// + /// The capPaletteOpen macro loads a new palette from a palette file and passes it to a capture driver. Palette files + /// typically use the filename extension .PAL. A capture driver uses a palette when required by the specified digitized image + /// format. You can use this macro or explicitly call the WM_CAP_PAL_OPEN message. + /// + /// Handle to a capture window. + /// Pointer to a null-terminated string containing the palette filename. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-cappaletteopen void capPaletteOpen( hwnd, szName ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capPaletteOpen")] + public static bool capPaletteOpen(HWND hwnd, string szName) => AVICapSM(hwnd, capMessage.WM_CAP_PAL_OPEN, szName); + + /// + /// The capPalettePaste macro copies the palette from the clipboard and passes it to a capture driver. You can use this macro + /// or explicitly call the WM_CAP_PAL_PASTE message. + /// + /// Handle to a capture window. + /// None + /// A capture driver uses a palette when required by the specified digitized video format. + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-cappalettepaste void capPalettePaste( hwnd ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capPalettePaste")] + public static bool capPalettePaste(HWND hwnd) => AVICapSM(hwnd, capMessage.WM_CAP_PAL_PASTE); + + /// + /// The capPaletteSave macro saves the current palette to a palette file. Palette files typically use the filename extension + /// .PAL. You can use this macro or explicitly send the WM_CAP_PAL_SAVE message. + /// + /// Handle to a capture window. + /// Pointer to a null-terminated string containing the palette filename. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-cappalettesave void capPaletteSave( hwnd, szName ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capPaletteSave")] + public static bool capPaletteSave(HWND hwnd, string szName) => AVICapSM(hwnd, capMessage.WM_CAP_PAL_SAVE, szName); + + /// + /// The capPreview macro enables or disables preview mode. In preview mode, frames are transferred from the capture hardware + /// to system memory and then displayed in the capture window using GDI functions. You can use this macro or explicitly call the + /// WM_CAP_SET_PREVIEW message. + /// + /// Handle to a capture window. + /// Preview flag. Specify TRUE for this parameter to enable preview mode or FALSE to disable it. + /// None + /// + /// + /// The preview mode uses substantial CPU resources. Applications can disable preview or lower the preview rate when another + /// application has the focus. The fLiveWindow member of the CAPSTATUS structure indicates if preview mode is currently enabled. + /// + /// Enabling preview mode automatically disables overlay mode. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-cappreview void capPreview( hwnd, f ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capPreview")] + public static bool capPreview(HWND hwnd, bool f) => AVICapSM(hwnd, capMessage.WM_CAP_SET_PREVIEW, (IntPtr)(f ? 1 : 0)); + + /// + /// The capPreviewRate macro sets the frame display rate in preview mode. You can use this macro or explicitly call the + /// WM_CAP_SET_PREVIEWRATE message. + /// + /// Handle to a capture window. + /// Rate, in milliseconds, at which new frames are captured and displayed. + /// None + /// + /// The preview mode uses substantial CPU resources. Applications can disable preview or lower the preview rate when another + /// application has the focus. During streaming video capture, the previewing task is lower priority than writing frames to disk, + /// and preview frames are displayed only if no other buffers are available for writing. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-cappreviewrate void capPreviewRate( hwnd, wMS ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capPreviewRate")] + public static bool capPreviewRate(HWND hwnd, int wMS) => AVICapSM(hwnd, capMessage.WM_CAP_SET_PREVIEWRATE, (IntPtr)wMS); + + /// + /// The capPreviewScale macro enables or disables scaling of the preview video images. If scaling is enabled, the captured + /// video frame is stretched to the dimensions of the capture window. You can use this macro or explicitly call the WM_CAP_SET_SCALE message. + /// + /// Handle to a capture window. + /// + /// Preview scaling flag. Specify TRUE for this parameter to stretch preview frames to the size of the capture window or + /// FALSE to display them at their natural size. + /// + /// None + /// + /// + /// Scaling preview images controls the immediate presentation of captured frames within the capture window. It has no effect on the + /// size of the frames saved to file. + /// + /// Scaling has no effect when using overlay to display video in the frame buffer. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-cappreviewscale void capPreviewScale( hwnd, f ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capPreviewScale")] + public static bool capPreviewScale(HWND hwnd, bool f) => AVICapSM(hwnd, capMessage.WM_CAP_SET_SCALE, (IntPtr)(f ? 1 : 0)); + + /// + /// The capSetAudioFormat macro sets the audio format to use when performing streaming or step capture. You can use this + /// macro or explicitly call the WM_CAP_SET_AUDIOFORMAT message. + /// + /// Handle to a capture window. + /// Pointer to a WAVEFORMATEX or PCMWAVEFORMAT structure that defines the audio format. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-capsetaudioformat void capSetAudioFormat( hwnd, s, wSize ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capSetAudioFormat")] + public static bool capSetAudioFormat(HWND hwnd, in WAVEFORMATEX s) => AVICapSM(hwnd, capMessage.WM_CAP_SET_AUDIOFORMAT, -1, s) != 0; + + /// + /// The capSetAudioFormat macro sets the audio format to use when performing streaming or step capture. You can use this + /// macro or explicitly call the WM_CAP_SET_AUDIOFORMAT message. + /// + /// Handle to a capture window. + /// Pointer to a WAVEFORMATEX or PCMWAVEFORMAT structure that defines the audio format. + /// None + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-capsetaudioformat void capSetAudioFormat( hwnd, s, wSize ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capSetAudioFormat")] + public static bool capSetAudioFormat(HWND hwnd, in PCMWAVEFORMAT s) => AVICapSM(hwnd, capMessage.WM_CAP_SET_AUDIOFORMAT, -1, s) != 0; + + /// + /// The capSetCallbackOnCapControl macro sets a callback function in the application giving it precise recording control. You + /// can use this macro or explicitly call the WM_CAP_SET_CALLBACK_CAPCONTROL message. + /// + /// Handle to a capture window. + /// + /// Pointer to the callback function, of type capControlCallback . Specify NULL for this parameter to disable a previously + /// installed callback function. + /// + /// None + /// + /// A single callback function is used to give the application precise control over the moments that streaming capture begins and + /// completes. The capture window first calls the procedure with nState set to CONTROLCALLBACK_PREROLL after all buffers have been + /// allocated and all other capture preparations have finished. This gives the application the ability to preroll video sources, + /// returning from the callback function at the exact moment recording is to begin. A return value of TRUE from the callback + /// function continues capture, and a return value of FALSE aborts capture. After capture begins, this callback function will + /// be called frequently with nState set to CONTROLCALLBACK_CAPTURING to allow the application to end capture by returning FALSE. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-capsetcallbackoncapcontrol void capSetCallbackOnCapControl( hwnd, + // fpProc ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capSetCallbackOnCapControl")] + public static bool capSetCallbackOnCapControl(HWND hwnd, [Optional] capControlCallback fpProc) => AVICapSM(hwnd, capMessage.WM_CAP_SET_CALLBACK_CAPCONTROL, 0, fpProc); + + /// + /// The capSetCallbackOnError macro sets an error callback function in the client application. AVICap calls this procedure + /// when errors occur. You can use this macro or explicitly call the WM_CAP_SET_CALLBACK_ERROR message. + /// + /// Handle to a capture window. + /// + /// Pointer to the error callback function, of type capErrorCallback. Specify NULL for this parameter to disable a previously + /// installed error callback function. + /// + /// None + /// + /// + /// Applications can optionally set an error callback function. If set, AVICap calls the error procedure in the following situations: + /// + /// + /// + /// The disk is full. + /// + /// + /// A capture window cannot be connected with a capture driver. + /// + /// + /// A waveform-audio device cannot be opened. + /// + /// + /// The number of frames dropped during capture exceeds the specified percentage. + /// + /// + /// The frames cannot be captured due to vertical synchronization interrupt problems. + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-capsetcallbackonerror void capSetCallbackOnError( hwnd, fpProc ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capSetCallbackOnError")] + public static bool capSetCallbackOnError(HWND hwnd, [Optional] capErrorCallback fpProc) => AVICapSM(hwnd, capMessage.WM_CAP_SET_CALLBACK_ERROR, 0, fpProc); + + /// + /// The capSetCallbackOnFrame macro sets a preview callback function in the application. AVICap calls this procedure when the + /// capture window captures preview frames. You can use this macro or explicitly call the WM_CAP_SET_CALLBACK_FRAME message. + /// + /// Handle to a capture window. + /// + /// Pointer to the preview callback function, of type capVideoStreamCallback. Specify NULL for this parameter to disable a + /// previously installed callback function. + /// + /// None + /// + /// The capture window calls the callback function before displaying preview frames. This allows an application to modify the frame + /// if desired. This callback function is not used during streaming video capture. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-capsetcallbackonframe void capSetCallbackOnFrame( hwnd, fpProc ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capSetCallbackOnFrame")] + public static bool capSetCallbackOnFrame(HWND hwnd, capVideoStreamCallback fpProc) => AVICapSM(hwnd, capMessage.WM_CAP_SET_CALLBACK_FRAME, 0, fpProc); + + /// + /// The capSetCallbackOnStatus macro sets a status callback function in the application. AVICap calls this procedure whenever + /// the capture window status changes. You can use this macro or explicitly call the WM_CAP_SET_CALLBACK_STATUS message. + /// + /// Handle to a capture window. + /// + /// Pointer to the status callback function, of type capStatusCallback. Specify NULL for this parameter to disable a + /// previously installed status callback function. + /// + /// None + /// + /// Applications can optionally set a status callback function. If set, AVICap calls this procedure in the following situations: + /// + /// + /// A capture session is completed. + /// + /// + /// A capture driver successfully connected to a capture window. + /// + /// + /// An optimal palette is created. + /// + /// + /// The number of captured frames is reported. + /// + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-capsetcallbackonstatus void capSetCallbackOnStatus( hwnd, fpProc ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capSetCallbackOnStatus")] + public static bool capSetCallbackOnStatus(HWND hwnd, [Optional] capStatusCallback fpProc) => AVICapSM(hwnd, capMessage.WM_CAP_SET_CALLBACK_STATUS, 0, fpProc); + + /// + /// The capSetCallbackOnVideoStream macro sets a callback function in the application. AVICap calls this procedure during + /// streaming capture when a video buffer is filled. You can use this macro or explicitly call the WM_CAP_SET_CALLBACK_VIDEOSTREAM message. + /// + /// Handle to a capture window. + /// + /// Pointer to the video-stream callback function, of type capVideoStreamCallback. Specify NULL for this parameter to disable + /// a previously installed video-stream callback function. + /// + /// None + /// + /// + /// The capture window calls the callback function before writing the captured frame to disk. This allows applications to modify the + /// frame if desired. + /// + /// + /// If a video stream callback function is used for streaming capture, the procedure must be installed before starting the capture + /// session and it must remain enabled for the duration of the session. It can be disabled after streaming capture ends. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-capsetcallbackonvideostream void capSetCallbackOnVideoStream( hwnd, + // fpProc ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capSetCallbackOnVideoStream")] + public static bool capSetCallbackOnVideoStream(HWND hwnd, [Optional] capVideoStreamCallback fpProc) => AVICapSM(hwnd, capMessage.WM_CAP_SET_CALLBACK_VIDEOSTREAM, 0, fpProc); + + /// + /// The capSetCallbackOnWaveStream macro sets a callback function in the application. AVICap calls this procedure during + /// streaming capture when a new audio buffer becomes available. You can use this macro or explicitly call the + /// WM_CAP_SET_CALLBACK_WAVESTREAM message. + /// + /// Handle to a capture window. + /// + /// Pointer to the wave stream callback function, of type capWaveStreamCallback. Specify NULL for this parameter to disable a + /// previously installed wave stream callback function. + /// + /// None + /// + /// + /// The capture window calls the procedure before writing the audio buffer to disk. This allows applications to modify the audio + /// buffer if desired. + /// + /// + /// If a wave stream callback function is used, it must be installed before starting the capture session and it must remain enabled + /// for the duration of the session. It can be disabled after streaming capture ends. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-capsetcallbackonwavestream void capSetCallbackOnWaveStream( hwnd, + // fpProc ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capSetCallbackOnWaveStream")] + public static bool capSetCallbackOnWaveStream(HWND hwnd, [Optional] capWaveStreamCallback fpProc) => AVICapSM(hwnd, capMessage.WM_CAP_SET_CALLBACK_WAVESTREAM, 0, fpProc); + + /// + /// The capSetCallbackOnYield macro sets a callback function in the application. AVICap calls this procedure when the capture + /// window yields during streaming capture. You can use this macro or explicitly call the WM_CAP_SET_CALLBACK_YIELD message. + /// + /// Handle to a capture window. + /// + /// Pointer to the yield callback function, of type capYieldCallback. Specify NULL for this parameter to disable a previously + /// installed yield callback function. + /// + /// None + /// + /// + /// Applications can optionally set a yield callback function. The yield callback function is called at least once for each video + /// frame captured during streaming capture. If a yield callback function is installed, it will be called regardless of the state of + /// the fYield member of the CAPTUREPARMS structure. + /// + /// + /// If the yield callback function is used, it must be installed before starting the capture session and it must remain enabled for + /// the duration of the session. It can be disabled after streaming capture ends. + /// + /// + /// Applications typically perform some type of message processing in the callback function consisting of a PeekMessage, + /// TranslateMessage, DispatchMessage loop, as in the message loop of a WinMain function. The yield callback function must also + /// filter and remove messages that can cause reentrancy problems. + /// + /// + /// An application typically returns TRUE in the yield procedure to continue streaming capture. If a yield callback function + /// returns FALSE, the capture window stops the capture process. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-capsetcallbackonyield void capSetCallbackOnYield( hwnd, fpProc ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capSetCallbackOnYield")] + public static bool capSetCallbackOnYield(HWND hwnd, [Optional] capYieldCallback fpProc) => AVICapSM(hwnd, capMessage.WM_CAP_SET_CALLBACK_YIELD, 0, fpProc); + + /// + /// The capSetMCIDeviceName macro specifies the name of the MCI video device to be used to capture data. You can use this + /// macro or explicitly call the WM_CAP_SET_MCI_DEVICE message. + /// + /// Handle to a capture window. + /// Pointer to a null-terminated string containing the name of the device. + /// None + /// + /// This message stores the MCI device name in an internal structure. It does not open or access the device. The default device name + /// is NULL. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-capsetmcidevicename void capSetMCIDeviceName( hwnd, szName ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capSetMCIDeviceName")] + public static bool capSetMCIDeviceName(HWND hwnd, string szName) => AVICapSM(hwnd, capMessage.WM_CAP_SET_MCI_DEVICE, szName); + + /// + /// The capSetScrollPos macro defines the portion of the video frame to display in the capture window. This message sets the + /// upper left corner of the client area of the capture window to the coordinates of a specified pixel within the video frame. You + /// can use this macro or explicitly call the WM_CAP_SET_SCROLL message. + /// + /// Handle to a capture window. + /// Address to contain the desired scroll position. + /// None + /// The scroll position affects the image in both preview and overlay modes. + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-capsetscrollpos void capSetScrollPos( hwnd, lpP ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capSetScrollPos")] + public static bool capSetScrollPos(HWND hwnd, System.Drawing.Point lpP) => AVICapSM(hwnd, capMessage.WM_CAP_SET_SCROLL, 0, lpP) != 0; + + /// + /// The capSetUserData macro associates a LONG_PTR data value with a capture window. You can use this macro or + /// explicitly call the WM_CAP_SET_USER_DATA message. + /// + /// Handle to a capture window. + /// Data value to associate with a capture window. + /// None + /// Typically this message is used to point to a block of data associated with a capture window. + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-capsetuserdata void capSetUserData( hwnd, lUser ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capSetUserData")] + public static bool capSetUserData(HWND hwnd, IntPtr lUser) => AVICapSM(hwnd, capMessage.WM_CAP_SET_USER_DATA, default, lUser); + + /// + /// The capSetVideoFormat macro sets the format of captured video data. You can use this macro or explicitly call the + /// WM_CAP_SET_VIDEOFORMAT message. + /// + /// Handle to a capture window. + /// Pointer to a BITMAPINFO structure. + /// None + /// + /// Because video formats are device-specific, applications should check the return value from this function to determine if the + /// format is accepted by the driver. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/nf-vfw-capsetvideoformat void capSetVideoFormat( hwnd, s, wSize ); + [PInvokeData("vfw.h", MSDNShortId = "NF:vfw.capSetVideoFormat")] + public static bool capSetVideoFormat(HWND hwnd, [In] Gdi32.SafeBITMAPINFO s) => AVICapSM(hwnd, capMessage.WM_CAP_SET_VIDEOFORMAT, (IntPtr)(int)s.Size, s.DangerousGetHandle()); + + private static bool AVICapSM(HWND hwnd, capMessage msg, int v, Delegate d) => User32.SendMessage(hwnd, unchecked((uint)msg), (IntPtr)v, Marshal.GetFunctionPointerForDelegate(d)) != IntPtr.Zero; + + private static bool AVICapSM(HWND hwnd, capMessage msg, [Optional] IntPtr wparam, [Optional] IntPtr lparam) => User32.SendMessage(hwnd, unchecked((uint)msg), wparam, lparam) != IntPtr.Zero; + + private static bool AVICapSM(HWND hwnd, capMessage msg, StringBuilder lparam) => User32.SendMessage(hwnd, unchecked((uint)msg), (IntPtr)(lparam?.Capacity ?? 0), lparam) != IntPtr.Zero; + + private static int AVICapSM(HWND hwnd, capMessage msg, int size, in TLP lparam) where TLP : struct + { + TLP res = lparam; + return User32.SendMessage(hwnd, msg, (IntPtr)(size == -1 ? Marshal.SizeOf(typeof(TLP)) : size), ref res).ToInt32(); + } + + private static int AVICapSM(HWND hwnd, capMessage msg, out TLP lparam, int size = -1) where TLP : struct + { + TLP res = default; + var ret = User32.SendMessage(hwnd, msg, (IntPtr)(size == -1 ? Marshal.SizeOf(typeof(TLP)) : size), ref res).ToInt32(); + lparam = res; + return ret; + } + + private static bool AVICapSM(HWND hwnd, capMessage msg, string lparam) => User32.SendMessage(hwnd, unchecked((uint)msg), default, lparam) != IntPtr.Zero; + + /// + /// The CAPDRIVERCAPS structure defines the capabilities of the capture driver. + /// + /// An application should use the WM_CAP_DRIVER_GET_CAPS message or capDriverGetCaps macro to place a copy of the driver + /// capabilities in a CAPDRIVERCAPS structure whenever the application connects a capture window to a capture driver. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/ns-vfw-capdrivercaps typedef struct tagCapDriverCaps { UINT wDeviceIndex; + // BOOL fHasOverlay; BOOL fHasDlgVideoSource; BOOL fHasDlgVideoFormat; BOOL fHasDlgVideoDisplay; BOOL fCaptureInitialized; BOOL + // fDriverSuppliesPalettes; HANDLE hVideoIn; HANDLE hVideoOut; HANDLE hVideoExtIn; HANDLE hVideoExtOut; } CAPDRIVERCAPS, + // *PCAPDRIVERCAPS, *LPCAPDRIVERCAPS; + [PInvokeData("vfw.h", MSDNShortId = "NS:vfw.tagCapDriverCaps")] + [StructLayout(LayoutKind.Sequential)] + public struct CAPDRIVERCAPS + { + /// Index of the capture driver. An index value can range from 0 to 9. + public uint wDeviceIndex; + + /// Video-overlay flag. The value of this member is TRUE if the device supports video overlay. + [MarshalAs(UnmanagedType.Bool)] + public bool fHasOverlay; + + /// + /// Video source dialog flag. The value of this member is TRUE if the device supports a dialog box for selecting and + /// controlling the video source. + /// + [MarshalAs(UnmanagedType.Bool)] + public bool fHasDlgVideoSource; + + /// + /// Video format dialog flag. The value of this member is TRUE if the device supports a dialog box for selecting the + /// video format. + /// + [MarshalAs(UnmanagedType.Bool)] + public bool fHasDlgVideoFormat; + + /// + /// Video display dialog flag. The value of this member is TRUE if the device supports a dialog box for controlling the + /// redisplay of video from the capture frame buffer. + /// + [MarshalAs(UnmanagedType.Bool)] + public bool fHasDlgVideoDisplay; + + /// + /// Capture initialization flag. The value of this member is TRUE if a capture device has been successfully connected. + /// + [MarshalAs(UnmanagedType.Bool)] + public bool fCaptureInitialized; + + /// Driver palette flag. The value of this member is TRUE if the driver can create palettes. + [MarshalAs(UnmanagedType.Bool)] + public bool fDriverSuppliesPalettes; + + /// Not used in Win32 applications. + public HANDLE hVideoIn; + + /// Not used in Win32 applications. + public HANDLE hVideoOut; + + /// Not used in Win32 applications. + public HANDLE hVideoExtIn; + + /// Not used in Win32 applications. + public HANDLE hVideoExtOut; + } + + /// + /// The CAPINFOCHUNK structure contains parameters that can be used to define an information chunk within an AVI capture + /// file. The WM_CAP_FILE_SET_INFOCHUNK message or capSetInfoChunk macro is used to send a CAPINFOCHUNK structure to a + /// capture window. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/ns-vfw-capinfochunk typedef struct tagCapInfoChunk { FOURCC fccInfoID; + // LPVOID lpData; LONG cbData; } CAPINFOCHUNK, *PCAPINFOCHUNK, *LPCAPINFOCHUNK; + [PInvokeData("vfw.h", MSDNShortId = "NS:vfw.tagCapInfoChunk")] + [StructLayout(LayoutKind.Sequential)] + public struct CAPINFOCHUNK + { + /// + /// Four-character code that identifies the representation of the chunk data. If this value is NULL and lpData is + /// NULL, all accumulated information chunks are deleted. + /// + public uint fccInfoID; + + /// Pointer to the data. If this value is NULL, all fccInfoID information chunks are deleted. + public IntPtr lpData; + + /// + /// Size, in bytes, of the data pointed to by lpData. If lpData specifies a null-terminated string, use the string + /// length incremented by one to save the NULL with the string. + /// + public int cbData; + } + + /// The CAPSTATUS structure defines the current state of the capture window. + /// + /// Because the state of a capture window changes in response to various messages, an application should update the information in + /// this structure whenever it needs to enable menu items, determine the actual state of the capture window, or call the video + /// format dialog box. If the application yields during streaming capture, this structure returns the progress of the capture in the + /// dwCurrentVideoFrame, dwCurrentVideoFramesDropped, dwCurre ntWaveSamples, and dwCurrentTimeElapsedMS + /// members. Use the WM_CAP_GET_STATUS message or capGetStatus macro to update the contents of this structure. + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/ns-vfw-capstatus typedef struct tagCapStatus { UINT uiImageWidth; UINT + // uiImageHeight; BOOL fLiveWindow; BOOL fOverlayWindow; BOOL fScale; POINT ptScroll; BOOL fUsingDefaultPalette; BOOL + // fAudioHardware; BOOL fCapFileExists; DWORD dwCurrentVideoFrame; DWORD dwCurrentVideoFramesDropped; DWORD dwCurrentWaveSamples; + // DWORD dwCurrentTimeElapsedMS; HPALETTE hPalCurrent; BOOL fCapturingNow; DWORD dwReturn; UINT wNumVideoAllocated; UINT + // wNumAudioAllocated; } CAPSTATUS, *PCAPSTATUS, *LPCAPSTATUS; + [PInvokeData("vfw.h", MSDNShortId = "NS:vfw.tagCapStatus")] + [StructLayout(LayoutKind.Sequential)] + public struct CAPSTATUS + { + /// Image width, in pixels. + public uint uiImageWidth; + + /// Image height, in pixels + public uint uiImageHeight; + + /// + /// Live window flag. The value of this member is TRUE if the window is displaying video using the preview method. + /// + [MarshalAs(UnmanagedType.Bool)] + public bool fLiveWindow; + + /// + /// Overlay window flag. The value of this member is TRUE if the window is displaying video using hardware overlay. + /// + [MarshalAs(UnmanagedType.Bool)] + public bool fOverlayWindow; + + /// + /// Input scaling flag. The value of this member is TRUE if the window is scaling the input video to the client area when + /// displaying video using preview. This parameter has no effect when displaying video using overlay. + /// + [MarshalAs(UnmanagedType.Bool)] + public bool fScale; + + /// The x- and y-offset of the pixel displayed in the upper left corner of the client area of the window. + public System.Drawing.Point ptScroll; + + /// Default palette flag. The value of this member is TRUE if the capture driver is using its default palette. + [MarshalAs(UnmanagedType.Bool)] + public bool fUsingDefaultPalette; + + /// Audio hardware flag. The value of this member is TRUE if the system has waveform-audio hardware installed. + [MarshalAs(UnmanagedType.Bool)] + public bool fAudioHardware; + + /// Capture file flag. The value of this member is TRUE if a valid capture file has been generated. + [MarshalAs(UnmanagedType.Bool)] + public bool fCapFileExists; + + /// + /// Number of frames processed during the current (or most recent) streaming capture. This count includes dropped frames. + /// + public uint dwCurrentVideoFrame; + + /// + /// Number of frames dropped during the current (or most recent) streaming capture. Dropped frames occur when the capture rate + /// exceeds the rate at which frames can be saved to file. In this case, the capture driver has no buffers available for storing + /// data. Dropping frames does not affect synchronization because the previous frame is displayed in place of the dropped frame. + /// + public uint dwCurrentVideoFramesDropped; + + /// Number of waveform-audio samples processed during the current (or most recent) streaming capture. + public uint dwCurrentWaveSamples; + + /// Time, in milliseconds, since the start of the current (or most recent) streaming capture. + public uint dwCurrentTimeElapsedMS; + + /// Handle to current palette. + public HPALETTE hPalCurrent; + + /// Capturing flag. The value of this member is TRUE when capturing is in progress. + [MarshalAs(UnmanagedType.Bool)] + public bool fCapturingNow; + + /// Error return values. Use this member if your application does not support an error callback function. + public uint dwReturn; + + /// + /// Number of video buffers allocated. This value might be less than the number specified in the wNumVideoRequested + /// member of the CAPTUREPARMS structure. + /// + public uint wNumVideoAllocated; + + /// + /// Number of audio buffers allocated. This value might be less than the number specified in the wNumAudioRequested + /// member of the CAPTUREPARMS structure. + /// + public uint wNumAudioAllocated; + } + + /// + /// The CAPTUREPARMS structure contains parameters that control the streaming video capture process. This structure is used + /// to get and set parameters that affect the capture rate, the number of buffers to use while capturing, and how capture is terminated. + /// + /// + /// + /// The WM_CAP_GET_SEQUENCE_SETUP message or capCaptureGetSetup macro is used to retrieve the current capture parameters. The + /// WM_CAP_SET_SEQUENCE_SETUP message or capCaptureSetSetup macro is used to set the capture parameters. + /// + /// + /// The WM_CAP_GET_SEQUENCE_SETUP message or capCaptureGetSetup macro is used to retrieve the current capture parameters. The + /// WM_CAP_SET_SEQUENCE_SETUP message or capCaptureSetSetup macro is used to set the capture parameters. + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/ns-vfw-captureparms typedef struct tagCaptureParms { DWORD + // dwRequestMicroSecPerFrame; BOOL fMakeUserHitOKToCapture; UINT wPercentDropForError; BOOL fYield; DWORD dwIndexSize; UINT + // wChunkGranularity; BOOL fUsingDOSMemory; UINT wNumVideoRequested; BOOL fCaptureAudio; UINT wNumAudioRequested; UINT vKeyAbort; + // BOOL fAbortLeftMouse; BOOL fAbortRightMouse; BOOL fLimitEnabled; UINT wTimeLimit; BOOL fMCIControl; BOOL fStepMCIDevice; DWORD + // dwMCIStartTime; DWORD dwMCIStopTime; BOOL fStepCaptureAt2x; UINT wStepCaptureAverageFrames; DWORD dwAudioBufferSize; BOOL + // fDisableWriteCache; UINT AVStreamMaster; } CAPTUREPARMS, *PCAPTUREPARMS, *LPCAPTUREPARMS; + [PInvokeData("vfw.h", MSDNShortId = "NS:vfw.tagCaptureParms")] + [StructLayout(LayoutKind.Sequential)] + public struct CAPTUREPARMS + { + /// Requested frame rate, in microseconds. The default value is 66667, which corresponds to 15 frames per second. + public uint dwRequestMicroSecPerFrame; + + /// + /// User-initiated capture flag. If this member is TRUE, AVICap displays a dialog box prompting the user to initiate + /// capture. The default value is FALSE. + /// + [MarshalAs(UnmanagedType.Bool)] + public bool fMakeUserHitOKToCapture; + + /// + /// Maximum allowable percentage of dropped frames during capture. Values range from 0 to 100. The default value is 10. + /// + public uint wPercentDropForError; + + /// + /// + /// Yield flag. If this member is TRUE, the capture window spawns a separate background thread to perform step and + /// streaming capture. The default value is FALSE. + /// + /// + /// Applications that set this flag must handle potential reentry issues because the controls in the application are not + /// disabled while capture is in progress. + /// + /// + [MarshalAs(UnmanagedType.Bool)] + public bool fYield; + + /// + /// + /// Maximum number of index entries in an AVI file. Values range from 1800 to 324,000. If set to 0, a default value of 34,952 + /// (32K frames plus a proportional number of audio buffers) is used. + /// + /// + /// Each video frame or buffer of waveform-audio data uses one index entry. The value of this entry establishes a limit for the + /// number of frames or audio buffers that can be captured. + /// + /// + public uint dwIndexSize; + + /// Logical block size, in bytes, of an AVI file. The value 0 indicates the current sector size is used as the granularity. + public uint wChunkGranularity; + + /// Not used in Win32 applications. + [MarshalAs(UnmanagedType.Bool)] + public bool fUsingDOSMemory; + + /// + /// Maximum number of video buffers to allocate. The memory area to place the buffers is specified with fUsingDOSMemory. + /// The actual number of buffers allocated might be lower if memory is unavailable. + /// + public uint wNumVideoRequested; + + /// + /// Capture audio flag. If this member is TRUE, audio is captured during streaming capture. This is the default value if + /// audio hardware is installed. + /// + [MarshalAs(UnmanagedType.Bool)] + public bool fCaptureAudio; + + /// Maximum number of audio buffers to allocate. The maximum number of buffers is 10. + public uint wNumAudioRequested; + + /// + /// + /// Virtual keycode used to terminate streaming capture. The default value is VK_ESCAPE. You must call the RegisterHotKey + /// function before specifying a keystroke that can abort a capture session. + /// + /// + /// You can combine keycodes that include CTRL and SHIFT keystrokes by using the logical OR operator with the keycodes for CTRL + /// (0x8000) and SHIFT (0x4000). + /// + /// + public uint vKeyAbort; + + /// + /// Abort flag for left mouse button. If this member is TRUE, streaming capture stops if the left mouse button is + /// pressed. The default value is TRUE. + /// + [MarshalAs(UnmanagedType.Bool)] + public bool fAbortLeftMouse; + + /// + /// Abort flag for right mouse button. If this member is TRUE, streaming capture stops if the right mouse button is + /// pressed. The default value is TRUE. + /// + [MarshalAs(UnmanagedType.Bool)] + public bool fAbortRightMouse; + + /// + /// Time limit enabled flag. If this member is TRUE, streaming capture stops after the number of seconds in + /// wTimeLimit has elapsed. The default value is FALSE. + /// + [MarshalAs(UnmanagedType.Bool)] + public bool fLimitEnabled; + + /// Time limit for capture, in seconds. This parameter is used only if fLimitEnabled is TRUE. + public uint wTimeLimit; + + /// + /// MCI device capture flag. If this member is TRUE, AVICap controls an MCI-compatible video source during streaming + /// capture. MCI-compatible video sources include VCRs and laserdiscs. + /// + [MarshalAs(UnmanagedType.Bool)] + public bool fMCIControl; + + /// + /// MCI device step capture flag. If this member is TRUE, step capture using an MCI device as a video source is enabled. + /// If it is FALSE, real-time capture using an MCI device is enabled. (If fMCIControl is FALSE, this member + /// is ignored.) + /// + [MarshalAs(UnmanagedType.Bool)] + public bool fStepMCIDevice; + + /// + /// Starting position, in milliseconds, of the MCI device for the capture sequence. (If fMCIControl is FALSE, this + /// member is ignored.) + /// + public uint dwMCIStartTime; + + /// + /// Stopping position, in milliseconds, of the MCI device for the capture sequence. When this position in the content is + /// reached, capture ends and the MCI device stops. (If fMCIControl is FALSE, this member is ignored.) + /// + public uint dwMCIStopTime; + + /// + /// + /// Double-resolution step capture flag. If this member is TRUE, the capture hardware captures at twice the specified + /// resolution. (The resolution for the height and width is doubled.) + /// + /// Enable this option if the hardware does not support hardware-based decimation and you are capturing in the RGB format. + /// + [MarshalAs(UnmanagedType.Bool)] + public bool fStepCaptureAt2x; + + /// + /// Number of times a frame is sampled when creating a frame based on the average sample. A typical value for the number of + /// averages is 5. + /// + public uint wStepCaptureAverageFrames; + + /// + /// Audio buffer size. If the default value of zero is used, the size of each buffer will be the maximum of 0.5 seconds of audio + /// or 10K bytes. + /// + public uint dwAudioBufferSize; + + /// Not used in Win32 applications. + [MarshalAs(UnmanagedType.Bool)] + public bool fDisableWriteCache; + + /// + /// Indicates whether the audio stream controls the clock when writing an AVI file. If this member is set to + /// AVSTREAMMASTER_AUDIO, the audio stream is considered the master stream and the video stream duration is forced to match the + /// audio duration. If this member is set to AVSTREAMMASTER_NONE, the durations of audio and video streams can differ. + /// + public uint AVStreamMaster; + } + + /// The VIDEOHDR structure is used by the capVideoStreamCallback function. + // https://docs.microsoft.com/en-us/windows/win32/api/vfw/ns-vfw-videohdr typedef struct videohdr_tag { LPBYTE lpData; DWORD + // dwBufferLength; DWORD dwBytesUsed; DWORD dwTimeCaptured; DWORD_PTR dwUser; DWORD dwFlags; DWORD_PTR dwReserved[4]; } VIDEOHDR, + // *PVIDEOHDR, *LPVIDEOHDR; + [PInvokeData("vfw.h", MSDNShortId = "NS:vfw.videohdr_tag")] + [StructLayout(LayoutKind.Sequential)] + public struct VIDEOHDR + { + /// Pointer to locked data buffer. + public IntPtr lpData; + + /// Length of data buffer. + public uint dwBufferLength; + + /// Bytes actually used. + public uint dwBytesUsed; + + /// Milliseconds from start of stream. + public uint dwTimeCaptured; + + /// User-defined data. + public IntPtr dwUser; + + /// + /// The flags are defined as follows. + /// + /// + /// Flag + /// Meaning + /// + /// + /// VHDR_DONE + /// Done bit + /// + /// + /// VHDR_PREPARED + /// Set if this header has been prepared + /// + /// + /// VHDR_INQUEUE + /// Reserved for driver + /// + /// + /// VHDR_KEYFRAME + /// Key Frame + /// + /// + /// + public VHDR dwFlags; + + /// Reserved for driver. + public IntPtr dwReserved1; + + /// Reserved for driver. + public IntPtr dwReserved2; + + /// Reserved for driver. + public IntPtr dwReserved3; + + /// Reserved for driver. + public IntPtr dwReserved4; + } } } \ No newline at end of file diff --git a/PInvoke/Multimedia/Vfw.cs b/PInvoke/Multimedia/Vfw.cs index bd3da835..6d7f3060 100644 --- a/PInvoke/Multimedia/Vfw.cs +++ b/PInvoke/Multimedia/Vfw.cs @@ -573,148 +573,5 @@ namespace Vanara.PInvoke private readonly IntPtr dwReserved3; private readonly IntPtr dwReserved4; } - - /* - CAPCONTROLCALLBACK - CAPERRORCALLBACKA - CAPERRORCALLBACKW - CAPSTATUSCALLBACKA - CAPSTATUSCALLBACKW - CAPVIDEOCALLBACK - CAPWAVECALLBACK - CAPYIELDCALLBACK - - capCaptureAbort - capCaptureGetSetup - capCaptureSequence - capCaptureSequenceNoFile - capCaptureSetSetup - capCaptureSingleFrame - capCaptureSingleFrameClose - capCaptureSingleFrameOpen - capCaptureStop - capCreateCaptureWindowA - capCreateCaptureWindowW - capDlgVideoCompression - capDlgVideoDisplay - capDlgVideoFormat - capDlgVideoSource - capDriverConnect - capDriverDisconnect - capDriverGetCaps - capDriverGetName - capDriverGetVersion - capEditCopy - capFileAlloc - capFileGetCaptureFile - capFileSaveAs - capFileSaveDIB - capFileSetCaptureFile - capFileSetInfoChunk - capGetAudioFormat - capGetAudioFormatSize - capGetDriverDescriptionA - capGetDriverDescriptionW - capGetMCIDeviceName - capGetStatus - capGetUserData - capGetVideoFormat - capGetVideoFormatSize - capGrabFrame - capGrabFrameNoStop - capOverlay - capPaletteAuto - capPaletteManual - capPaletteOpen - capPalettePaste - capPaletteSave - capPreview - capPreviewRate - capPreviewScale - capSetAudioFormat - capSetCallbackOnCapControl - capSetCallbackOnError - capSetCallbackOnFrame - capSetCallbackOnStatus - capSetCallbackOnVideoStream - capSetCallbackOnWaveStream - capSetCallbackOnYield - capSetMCIDeviceName - capSetScrollPos - capSetUserData - capSetVideoFormat - MCIWndCanConfig - MCIWndCanEject - MCIWndCanPlay - MCIWndCanRecord - MCIWndCanSave - MCIWndCanWindow - MCIWndChangeStyles - MCIWndClose - MCIWndCreateA - MCIWndCreateW - MCIWndDestroy - MCIWndEject - MCIWndEnd - MCIWndGetActiveTimer - MCIWndGetAlias - MCIWndGetDest - MCIWndGetDevice - MCIWndGetDeviceID - MCIWndGetEnd - MCIWndGetError - MCIWndGetFileName - MCIWndGetInactiveTimer - MCIWndGetLength - MCIWndGetMode - MCIWndGetPalette - MCIWndGetPosition - MCIWndGetPositionString - MCIWndGetRepeat - MCIWndGetSource - MCIWndGetSpeed - MCIWndGetStart - MCIWndGetStyles - MCIWndGetTimeFormat - MCIWndGetVolume - MCIWndGetZoom - MCIWndHome - MCIWndNew - MCIWndOpen - MCIWndOpenDialog - MCIWndOpenInterface - MCIWndPause - MCIWndPlay - MCIWndPlayFrom - MCIWndPlayFromTo - MCIWndPlayReverse - MCIWndPlayTo - MCIWndPutDest - MCIWndPutSource - MCIWndRealize - MCIWndRecord - MCIWndRegisterClass - MCIWndResume - MCIWndReturnString - MCIWndSave - MCIWndSaveDialog - MCIWndSeek - MCIWndSendString - MCIWndSetActiveTimer - MCIWndSetInactiveTimer - MCIWndSetOwner - MCIWndSetPalette - MCIWndSetRepeat - MCIWndSetSpeed - MCIWndSetTimeFormat - MCIWndSetTimers - MCIWndSetVolume - MCIWndSetZoom - MCIWndStep - MCIWndStop - MCIWndUseFrames - MCIWndUseTime - MCIWndValidateMedia - */ } } \ No newline at end of file