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