Win32 API 日本語リファレンス
ホームMedia.MediaFoundation › MFCreateVideoSampleAllocatorEx

MFCreateVideoSampleAllocatorEx

関数
ハードウェア対応のビデオサンプルアロケーターを生成する。
DLLMFPlat.dll呼出規約winapi対応OSwindows8.0

シグネチャ

// MFPlat.dll
#include <windows.h>

HRESULT MFCreateVideoSampleAllocatorEx(
    const GUID* riid,
    void** ppSampleAllocator
);

パラメーター

名前方向説明
riidGUID*in要求するサンプルアロケータインターフェイスの識別子 GUID への参照。
ppSampleAllocatorvoid**out生成されたビデオサンプルアロケータを受け取る出力ポインタ。riid に対応する型で返る。

戻り値の型: HRESULT

各言語での呼び出し定義

// MFPlat.dll
#include <windows.h>

HRESULT MFCreateVideoSampleAllocatorEx(
    const GUID* riid,
    void** ppSampleAllocator
);
[DllImport("MFPlat.dll", ExactSpelling = true)]
static extern int MFCreateVideoSampleAllocatorEx(
    ref Guid riid,   // GUID*
    IntPtr ppSampleAllocator   // void** out
);
<DllImport("MFPlat.dll", ExactSpelling:=True)>
Public Shared Function MFCreateVideoSampleAllocatorEx(
    ByRef riid As Guid,   ' GUID*
    ppSampleAllocator As IntPtr   ' void** out
) As Integer
End Function
' riid : GUID*
' ppSampleAllocator : void** out
Declare PtrSafe Function MFCreateVideoSampleAllocatorEx Lib "mfplat" ( _
    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

MFCreateVideoSampleAllocatorEx = ctypes.windll.mfplat.MFCreateVideoSampleAllocatorEx
MFCreateVideoSampleAllocatorEx.restype = ctypes.c_int
MFCreateVideoSampleAllocatorEx.argtypes = [
    ctypes.c_void_p,  # riid : GUID*
    ctypes.c_void_p,  # ppSampleAllocator : void** out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('MFPlat.dll')
MFCreateVideoSampleAllocatorEx = Fiddle::Function.new(
  lib['MFCreateVideoSampleAllocatorEx'],
  [
    Fiddle::TYPE_VOIDP,  # riid : GUID*
    Fiddle::TYPE_VOIDP,  # ppSampleAllocator : void** out
  ],
  Fiddle::TYPE_INT)
#[link(name = "mfplat")]
extern "system" {
    fn MFCreateVideoSampleAllocatorEx(
        riid: *const GUID,  // GUID*
        ppSampleAllocator: *mut *mut ()  // void** out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("MFPlat.dll")]
public static extern int MFCreateVideoSampleAllocatorEx(ref Guid riid, IntPtr ppSampleAllocator);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MFPlat_MFCreateVideoSampleAllocatorEx' -Namespace Win32 -PassThru
# $api::MFCreateVideoSampleAllocatorEx(riid, ppSampleAllocator)
#uselib "MFPlat.dll"
#func global MFCreateVideoSampleAllocatorEx "MFCreateVideoSampleAllocatorEx" sptr, sptr
; MFCreateVideoSampleAllocatorEx varptr(riid), ppSampleAllocator   ; 戻り値は stat
; riid : GUID* -> "sptr"
; ppSampleAllocator : void** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "MFPlat.dll"
#cfunc global MFCreateVideoSampleAllocatorEx "MFCreateVideoSampleAllocatorEx" var, sptr
; res = MFCreateVideoSampleAllocatorEx(riid, ppSampleAllocator)
; riid : GUID* -> "var"
; ppSampleAllocator : void** out -> "sptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT MFCreateVideoSampleAllocatorEx(GUID* riid, void** ppSampleAllocator)
#uselib "MFPlat.dll"
#cfunc global MFCreateVideoSampleAllocatorEx "MFCreateVideoSampleAllocatorEx" var, intptr
; res = MFCreateVideoSampleAllocatorEx(riid, ppSampleAllocator)
; riid : GUID* -> "var"
; ppSampleAllocator : void** out -> "intptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	mfplat = windows.NewLazySystemDLL("MFPlat.dll")
	procMFCreateVideoSampleAllocatorEx = mfplat.NewProc("MFCreateVideoSampleAllocatorEx")
)

// riid (GUID*), ppSampleAllocator (void** out)
r1, _, err := procMFCreateVideoSampleAllocatorEx.Call(
	uintptr(riid),
	uintptr(ppSampleAllocator),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function MFCreateVideoSampleAllocatorEx(
  riid: PGUID;   // GUID*
  ppSampleAllocator: Pointer   // void** out
): Integer; stdcall;
  external 'MFPlat.dll' name 'MFCreateVideoSampleAllocatorEx';
result := DllCall("MFPlat\MFCreateVideoSampleAllocatorEx"
    , "Ptr", riid   ; GUID*
    , "Ptr", ppSampleAllocator   ; void** out
    , "Int")   ; return: HRESULT
●MFCreateVideoSampleAllocatorEx(riid, ppSampleAllocator) = DLL("MFPlat.dll", "int MFCreateVideoSampleAllocatorEx(void*, void*)")
# 呼び出し: MFCreateVideoSampleAllocatorEx(riid, ppSampleAllocator)
# riid : GUID* -> "void*"
# ppSampleAllocator : void** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。