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

MFCreateSensorStream

関数
指定したストリームIDと属性からセンサーストリームを生成する。
DLLMFSENSORGROUP.dll呼出規約winapi対応OSWindows 10 以降

シグネチャ

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

HRESULT MFCreateSensorStream(
    DWORD StreamId,
    IMFAttributes* pAttributes,   // optional
    IMFCollection* pMediaTypeCollection,
    IMFSensorStream** ppStream
);

パラメーター

名前方向
StreamIdDWORDin
pAttributesIMFAttributes*inoptional
pMediaTypeCollectionIMFCollection*in
ppStreamIMFSensorStream**out

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT MFCreateSensorStream(
    DWORD StreamId,
    IMFAttributes* pAttributes,   // optional
    IMFCollection* pMediaTypeCollection,
    IMFSensorStream** ppStream
);
[DllImport("MFSENSORGROUP.dll", ExactSpelling = true)]
static extern int MFCreateSensorStream(
    uint StreamId,   // DWORD
    IntPtr pAttributes,   // IMFAttributes* optional
    IntPtr pMediaTypeCollection,   // IMFCollection*
    IntPtr ppStream   // IMFSensorStream** out
);
<DllImport("MFSENSORGROUP.dll", ExactSpelling:=True)>
Public Shared Function MFCreateSensorStream(
    StreamId As UInteger,   ' DWORD
    pAttributes As IntPtr,   ' IMFAttributes* optional
    pMediaTypeCollection As IntPtr,   ' IMFCollection*
    ppStream As IntPtr   ' IMFSensorStream** out
) As Integer
End Function
' StreamId : DWORD
' pAttributes : IMFAttributes* optional
' pMediaTypeCollection : IMFCollection*
' ppStream : IMFSensorStream** out
Declare PtrSafe Function MFCreateSensorStream Lib "mfsensorgroup" ( _
    ByVal StreamId As Long, _
    ByVal pAttributes As LongPtr, _
    ByVal pMediaTypeCollection As LongPtr, _
    ByVal ppStream As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

MFCreateSensorStream = ctypes.windll.mfsensorgroup.MFCreateSensorStream
MFCreateSensorStream.restype = ctypes.c_int
MFCreateSensorStream.argtypes = [
    wintypes.DWORD,  # StreamId : DWORD
    ctypes.c_void_p,  # pAttributes : IMFAttributes* optional
    ctypes.c_void_p,  # pMediaTypeCollection : IMFCollection*
    ctypes.c_void_p,  # ppStream : IMFSensorStream** out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('MFSENSORGROUP.dll')
MFCreateSensorStream = Fiddle::Function.new(
  lib['MFCreateSensorStream'],
  [
    -Fiddle::TYPE_INT,  # StreamId : DWORD
    Fiddle::TYPE_VOIDP,  # pAttributes : IMFAttributes* optional
    Fiddle::TYPE_VOIDP,  # pMediaTypeCollection : IMFCollection*
    Fiddle::TYPE_VOIDP,  # ppStream : IMFSensorStream** out
  ],
  Fiddle::TYPE_INT)
#[link(name = "mfsensorgroup")]
extern "system" {
    fn MFCreateSensorStream(
        StreamId: u32,  // DWORD
        pAttributes: *mut core::ffi::c_void,  // IMFAttributes* optional
        pMediaTypeCollection: *mut core::ffi::c_void,  // IMFCollection*
        ppStream: *mut *mut core::ffi::c_void  // IMFSensorStream** out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("MFSENSORGROUP.dll")]
public static extern int MFCreateSensorStream(uint StreamId, IntPtr pAttributes, IntPtr pMediaTypeCollection, IntPtr ppStream);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MFSENSORGROUP_MFCreateSensorStream' -Namespace Win32 -PassThru
# $api::MFCreateSensorStream(StreamId, pAttributes, pMediaTypeCollection, ppStream)
#uselib "MFSENSORGROUP.dll"
#func global MFCreateSensorStream "MFCreateSensorStream" sptr, sptr, sptr, sptr
; MFCreateSensorStream StreamId, pAttributes, pMediaTypeCollection, ppStream   ; 戻り値は stat
; StreamId : DWORD -> "sptr"
; pAttributes : IMFAttributes* optional -> "sptr"
; pMediaTypeCollection : IMFCollection* -> "sptr"
; ppStream : IMFSensorStream** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "MFSENSORGROUP.dll"
#cfunc global MFCreateSensorStream "MFCreateSensorStream" int, sptr, sptr, sptr
; res = MFCreateSensorStream(StreamId, pAttributes, pMediaTypeCollection, ppStream)
; StreamId : DWORD -> "int"
; pAttributes : IMFAttributes* optional -> "sptr"
; pMediaTypeCollection : IMFCollection* -> "sptr"
; ppStream : IMFSensorStream** out -> "sptr"
; HRESULT MFCreateSensorStream(DWORD StreamId, IMFAttributes* pAttributes, IMFCollection* pMediaTypeCollection, IMFSensorStream** ppStream)
#uselib "MFSENSORGROUP.dll"
#cfunc global MFCreateSensorStream "MFCreateSensorStream" int, intptr, intptr, intptr
; res = MFCreateSensorStream(StreamId, pAttributes, pMediaTypeCollection, ppStream)
; StreamId : DWORD -> "int"
; pAttributes : IMFAttributes* optional -> "intptr"
; pMediaTypeCollection : IMFCollection* -> "intptr"
; ppStream : IMFSensorStream** out -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	mfsensorgroup = windows.NewLazySystemDLL("MFSENSORGROUP.dll")
	procMFCreateSensorStream = mfsensorgroup.NewProc("MFCreateSensorStream")
)

// StreamId (DWORD), pAttributes (IMFAttributes* optional), pMediaTypeCollection (IMFCollection*), ppStream (IMFSensorStream** out)
r1, _, err := procMFCreateSensorStream.Call(
	uintptr(StreamId),
	uintptr(pAttributes),
	uintptr(pMediaTypeCollection),
	uintptr(ppStream),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function MFCreateSensorStream(
  StreamId: DWORD;   // DWORD
  pAttributes: Pointer;   // IMFAttributes* optional
  pMediaTypeCollection: Pointer;   // IMFCollection*
  ppStream: Pointer   // IMFSensorStream** out
): Integer; stdcall;
  external 'MFSENSORGROUP.dll' name 'MFCreateSensorStream';
result := DllCall("MFSENSORGROUP\MFCreateSensorStream"
    , "UInt", StreamId   ; DWORD
    , "Ptr", pAttributes   ; IMFAttributes* optional
    , "Ptr", pMediaTypeCollection   ; IMFCollection*
    , "Ptr", ppStream   ; IMFSensorStream** out
    , "Int")   ; return: HRESULT
●MFCreateSensorStream(StreamId, pAttributes, pMediaTypeCollection, ppStream) = DLL("MFSENSORGROUP.dll", "int MFCreateSensorStream(dword, void*, void*, void*)")
# 呼び出し: MFCreateSensorStream(StreamId, pAttributes, pMediaTypeCollection, ppStream)
# StreamId : DWORD -> "dword"
# pAttributes : IMFAttributes* optional -> "void*"
# pMediaTypeCollection : IMFCollection* -> "void*"
# ppStream : IMFSensorStream** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。