ホーム › Media.MediaFoundation › MFInitVideoFormat_RGB
MFInitVideoFormat_RGB
関数幅高さとD3D形式からRGBのMFVIDEOFORMATを初期化する。
シグネチャ
// MFPlat.dll
#include <windows.h>
HRESULT MFInitVideoFormat_RGB(
MFVIDEOFORMAT* pVideoFormat,
DWORD dwWidth,
DWORD dwHeight,
DWORD D3Dfmt
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pVideoFormat | MFVIDEOFORMAT* | in |
| dwWidth | DWORD | in |
| dwHeight | DWORD | in |
| D3Dfmt | DWORD | in |
戻り値の型: HRESULT
各言語での呼び出し定義
// MFPlat.dll
#include <windows.h>
HRESULT MFInitVideoFormat_RGB(
MFVIDEOFORMAT* pVideoFormat,
DWORD dwWidth,
DWORD dwHeight,
DWORD D3Dfmt
);[DllImport("MFPlat.dll", ExactSpelling = true)]
static extern int MFInitVideoFormat_RGB(
IntPtr pVideoFormat, // MFVIDEOFORMAT*
uint dwWidth, // DWORD
uint dwHeight, // DWORD
uint D3Dfmt // DWORD
);<DllImport("MFPlat.dll", ExactSpelling:=True)>
Public Shared Function MFInitVideoFormat_RGB(
pVideoFormat As IntPtr, ' MFVIDEOFORMAT*
dwWidth As UInteger, ' DWORD
dwHeight As UInteger, ' DWORD
D3Dfmt As UInteger ' DWORD
) As Integer
End Function' pVideoFormat : MFVIDEOFORMAT*
' dwWidth : DWORD
' dwHeight : DWORD
' D3Dfmt : DWORD
Declare PtrSafe Function MFInitVideoFormat_RGB Lib "mfplat" ( _
ByVal pVideoFormat As LongPtr, _
ByVal dwWidth As Long, _
ByVal dwHeight As Long, _
ByVal D3Dfmt As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
MFInitVideoFormat_RGB = ctypes.windll.mfplat.MFInitVideoFormat_RGB
MFInitVideoFormat_RGB.restype = ctypes.c_int
MFInitVideoFormat_RGB.argtypes = [
ctypes.c_void_p, # pVideoFormat : MFVIDEOFORMAT*
wintypes.DWORD, # dwWidth : DWORD
wintypes.DWORD, # dwHeight : DWORD
wintypes.DWORD, # D3Dfmt : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('MFPlat.dll')
MFInitVideoFormat_RGB = Fiddle::Function.new(
lib['MFInitVideoFormat_RGB'],
[
Fiddle::TYPE_VOIDP, # pVideoFormat : MFVIDEOFORMAT*
-Fiddle::TYPE_INT, # dwWidth : DWORD
-Fiddle::TYPE_INT, # dwHeight : DWORD
-Fiddle::TYPE_INT, # D3Dfmt : DWORD
],
Fiddle::TYPE_INT)#[link(name = "mfplat")]
extern "system" {
fn MFInitVideoFormat_RGB(
pVideoFormat: *mut MFVIDEOFORMAT, // MFVIDEOFORMAT*
dwWidth: u32, // DWORD
dwHeight: u32, // DWORD
D3Dfmt: u32 // DWORD
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("MFPlat.dll")]
public static extern int MFInitVideoFormat_RGB(IntPtr pVideoFormat, uint dwWidth, uint dwHeight, uint D3Dfmt);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MFPlat_MFInitVideoFormat_RGB' -Namespace Win32 -PassThru
# $api::MFInitVideoFormat_RGB(pVideoFormat, dwWidth, dwHeight, D3Dfmt)#uselib "MFPlat.dll"
#func global MFInitVideoFormat_RGB "MFInitVideoFormat_RGB" sptr, sptr, sptr, sptr
; MFInitVideoFormat_RGB varptr(pVideoFormat), dwWidth, dwHeight, D3Dfmt ; 戻り値は stat
; pVideoFormat : MFVIDEOFORMAT* -> "sptr"
; dwWidth : DWORD -> "sptr"
; dwHeight : DWORD -> "sptr"
; D3Dfmt : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "MFPlat.dll" #cfunc global MFInitVideoFormat_RGB "MFInitVideoFormat_RGB" var, int, int, int ; res = MFInitVideoFormat_RGB(pVideoFormat, dwWidth, dwHeight, D3Dfmt) ; pVideoFormat : MFVIDEOFORMAT* -> "var" ; dwWidth : DWORD -> "int" ; dwHeight : DWORD -> "int" ; D3Dfmt : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "MFPlat.dll" #cfunc global MFInitVideoFormat_RGB "MFInitVideoFormat_RGB" sptr, int, int, int ; res = MFInitVideoFormat_RGB(varptr(pVideoFormat), dwWidth, dwHeight, D3Dfmt) ; pVideoFormat : MFVIDEOFORMAT* -> "sptr" ; dwWidth : DWORD -> "int" ; dwHeight : DWORD -> "int" ; D3Dfmt : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT MFInitVideoFormat_RGB(MFVIDEOFORMAT* pVideoFormat, DWORD dwWidth, DWORD dwHeight, DWORD D3Dfmt) #uselib "MFPlat.dll" #cfunc global MFInitVideoFormat_RGB "MFInitVideoFormat_RGB" var, int, int, int ; res = MFInitVideoFormat_RGB(pVideoFormat, dwWidth, dwHeight, D3Dfmt) ; pVideoFormat : MFVIDEOFORMAT* -> "var" ; dwWidth : DWORD -> "int" ; dwHeight : DWORD -> "int" ; D3Dfmt : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT MFInitVideoFormat_RGB(MFVIDEOFORMAT* pVideoFormat, DWORD dwWidth, DWORD dwHeight, DWORD D3Dfmt) #uselib "MFPlat.dll" #cfunc global MFInitVideoFormat_RGB "MFInitVideoFormat_RGB" intptr, int, int, int ; res = MFInitVideoFormat_RGB(varptr(pVideoFormat), dwWidth, dwHeight, D3Dfmt) ; pVideoFormat : MFVIDEOFORMAT* -> "intptr" ; dwWidth : DWORD -> "int" ; dwHeight : DWORD -> "int" ; D3Dfmt : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
mfplat = windows.NewLazySystemDLL("MFPlat.dll")
procMFInitVideoFormat_RGB = mfplat.NewProc("MFInitVideoFormat_RGB")
)
// pVideoFormat (MFVIDEOFORMAT*), dwWidth (DWORD), dwHeight (DWORD), D3Dfmt (DWORD)
r1, _, err := procMFInitVideoFormat_RGB.Call(
uintptr(pVideoFormat),
uintptr(dwWidth),
uintptr(dwHeight),
uintptr(D3Dfmt),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction MFInitVideoFormat_RGB(
pVideoFormat: Pointer; // MFVIDEOFORMAT*
dwWidth: DWORD; // DWORD
dwHeight: DWORD; // DWORD
D3Dfmt: DWORD // DWORD
): Integer; stdcall;
external 'MFPlat.dll' name 'MFInitVideoFormat_RGB';result := DllCall("MFPlat\MFInitVideoFormat_RGB"
, "Ptr", pVideoFormat ; MFVIDEOFORMAT*
, "UInt", dwWidth ; DWORD
, "UInt", dwHeight ; DWORD
, "UInt", D3Dfmt ; DWORD
, "Int") ; return: HRESULT●MFInitVideoFormat_RGB(pVideoFormat, dwWidth, dwHeight, D3Dfmt) = DLL("MFPlat.dll", "int MFInitVideoFormat_RGB(void*, dword, dword, dword)")
# 呼び出し: MFInitVideoFormat_RGB(pVideoFormat, dwWidth, dwHeight, D3Dfmt)
# pVideoFormat : MFVIDEOFORMAT* -> "void*"
# dwWidth : DWORD -> "dword"
# dwHeight : DWORD -> "dword"
# D3Dfmt : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。