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