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