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