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