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