ホーム › Media.MediaFoundation › MFCreateVideoSampleAllocatorEx
MFCreateVideoSampleAllocatorEx
関数ハードウェア対応のビデオサンプルアロケーターを生成する。
シグネチャ
// MFPlat.dll
#include <windows.h>
HRESULT MFCreateVideoSampleAllocatorEx(
const GUID* riid,
void** ppSampleAllocator
);パラメーター
| 名前 | 型 | 方向 | 説明 | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| riid | GUID* | in | 取得するインターフェイスの識別子。次のいずれかの値を指定します。
| ||||||||||
| ppSampleAllocator | void** | out | 要求されたインターフェイスへのポインターを受け取ります。呼び出し元はインターフェイスを解放する必要があります。 |
戻り値の型: HRESULT
公式ドキュメント
Microsoft DirectX Graphics Infrastructure (DXGI) と互換性のあるビデオサンプルを割り当てるオブジェクトを作成します。
戻り値
この関数が成功した場合は S_OK を返します。それ以外の場合は HRESULT エラーコードを返します。
解説(Remarks)
この関数は DXGI ビデオサーフェス用のアロケーターを作成します。このアロケーターによって作成されるバッファーは、IMFDXGIBuffer インターフェイスを公開します。Microsoft Direct3D 9 ビデオサーフェス用のアロケーターを作成するには、MFCreateVideoSampleAllocator を呼び出します。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// 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 方式にも切替可。#uselib "MFPlat.dll" #cfunc global MFCreateVideoSampleAllocatorEx "MFCreateVideoSampleAllocatorEx" sptr, sptr ; res = MFCreateVideoSampleAllocatorEx(varptr(riid), ppSampleAllocator) ; riid : GUID* -> "sptr" ; ppSampleAllocator : void** out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは 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 方式にも切替可。; HRESULT MFCreateVideoSampleAllocatorEx(GUID* riid, void** ppSampleAllocator) #uselib "MFPlat.dll" #cfunc global MFCreateVideoSampleAllocatorEx "MFCreateVideoSampleAllocatorEx" intptr, intptr ; res = MFCreateVideoSampleAllocatorEx(varptr(riid), ppSampleAllocator) ; riid : GUID* -> "intptr" ; ppSampleAllocator : void** out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは 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 // HRESULTfunction 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)。const std = @import("std");
extern "mfplat" fn MFCreateVideoSampleAllocatorEx(
riid: [*c]GUID, // GUID*
ppSampleAllocator: ?*anyopaque // void** out
) callconv(std.os.windows.WINAPI) i32;proc MFCreateVideoSampleAllocatorEx(
riid: ptr GUID, # GUID*
ppSampleAllocator: pointer # void** out
): int32 {.importc: "MFCreateVideoSampleAllocatorEx", stdcall, dynlib: "MFPlat.dll".}pragma(lib, "mfplat");
extern(Windows)
int MFCreateVideoSampleAllocatorEx(
GUID* riid, // GUID*
void** ppSampleAllocator // void** out
);ccall((:MFCreateVideoSampleAllocatorEx, "MFPlat.dll"), stdcall, Int32,
(Ptr{GUID}, Ptr{Cvoid}),
riid, ppSampleAllocator)
# riid : GUID* -> Ptr{GUID}
# ppSampleAllocator : void** out -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t MFCreateVideoSampleAllocatorEx(
void* riid,
void** ppSampleAllocator);
]]
local mfplat = ffi.load("mfplat")
-- mfplat.MFCreateVideoSampleAllocatorEx(riid, ppSampleAllocator)
-- riid : GUID*
-- ppSampleAllocator : void** out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('MFPlat.dll');
const MFCreateVideoSampleAllocatorEx = lib.func('__stdcall', 'MFCreateVideoSampleAllocatorEx', 'int32_t', ['void *', 'void *']);
// MFCreateVideoSampleAllocatorEx(riid, ppSampleAllocator)
// riid : GUID* -> 'void *'
// ppSampleAllocator : void** out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("MFPlat.dll", {
MFCreateVideoSampleAllocatorEx: { parameters: ["pointer", "pointer"], result: "i32" },
});
// lib.symbols.MFCreateVideoSampleAllocatorEx(riid, ppSampleAllocator)
// riid : GUID* -> "pointer"
// ppSampleAllocator : void** out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t MFCreateVideoSampleAllocatorEx(
void* riid,
void** ppSampleAllocator);
C, "MFPlat.dll");
// $ffi->MFCreateVideoSampleAllocatorEx(riid, ppSampleAllocator);
// riid : GUID*
// ppSampleAllocator : void** out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Mfplat extends StdCallLibrary {
Mfplat INSTANCE = Native.load("mfplat", Mfplat.class);
int MFCreateVideoSampleAllocatorEx(
Pointer riid, // GUID*
Pointer ppSampleAllocator // void** out
);
}@[Link("mfplat")]
lib LibMFPlat
fun MFCreateVideoSampleAllocatorEx = MFCreateVideoSampleAllocatorEx(
riid : GUID*, # GUID*
ppSampleAllocator : Void** # void** out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef MFCreateVideoSampleAllocatorExNative = Int32 Function(Pointer<Void>, Pointer<Void>);
typedef MFCreateVideoSampleAllocatorExDart = int Function(Pointer<Void>, Pointer<Void>);
final MFCreateVideoSampleAllocatorEx = DynamicLibrary.open('MFPlat.dll')
.lookupFunction<MFCreateVideoSampleAllocatorExNative, MFCreateVideoSampleAllocatorExDart>('MFCreateVideoSampleAllocatorEx');
// riid : GUID* -> Pointer<Void>
// ppSampleAllocator : void** out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function MFCreateVideoSampleAllocatorEx(
riid: PGUID; // GUID*
ppSampleAllocator: Pointer // void** out
): Integer; stdcall;
external 'MFPlat.dll' name 'MFCreateVideoSampleAllocatorEx';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "MFCreateVideoSampleAllocatorEx"
c_MFCreateVideoSampleAllocatorEx :: Ptr () -> Ptr () -> IO Int32
-- riid : GUID* -> Ptr ()
-- ppSampleAllocator : void** out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let mfcreatevideosampleallocatorex =
foreign "MFCreateVideoSampleAllocatorEx"
((ptr void) @-> (ptr void) @-> returning int32_t)
(* riid : GUID* -> (ptr void) *)
(* ppSampleAllocator : void** out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library mfplat (t "MFPlat.dll"))
(cffi:use-foreign-library mfplat)
(cffi:defcfun ("MFCreateVideoSampleAllocatorEx" mfcreate-video-sample-allocator-ex :convention :stdcall) :int32
(riid :pointer) ; GUID*
(pp-sample-allocator :pointer)) ; void** out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $MFCreateVideoSampleAllocatorEx = Win32::API::More->new('MFPlat',
'int MFCreateVideoSampleAllocatorEx(LPVOID riid, LPVOID ppSampleAllocator)');
# my $ret = $MFCreateVideoSampleAllocatorEx->Call($riid, $ppSampleAllocator);
# riid : GUID* -> LPVOID
# ppSampleAllocator : void** out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
類似 API
- f MFCreateVideoSampleAllocator — ビデオサンプルアロケーターを作成する。