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

MFCreateAggregateSource

関数
複数のメディアソースを統合する集約ソースを生成する。
DLLMF.dll呼出規約winapi対応OSWindows 7 以降

シグネチャ

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

HRESULT MFCreateAggregateSource(
    IMFCollection* pSourceCollection,
    IMFMediaSource** ppAggSource
);

パラメーター

名前方向
pSourceCollectionIMFCollection*in
ppAggSourceIMFMediaSource**out

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT MFCreateAggregateSource(
    IMFCollection* pSourceCollection,
    IMFMediaSource** ppAggSource
);
[DllImport("MF.dll", ExactSpelling = true)]
static extern int MFCreateAggregateSource(
    IntPtr pSourceCollection,   // IMFCollection*
    IntPtr ppAggSource   // IMFMediaSource** out
);
<DllImport("MF.dll", ExactSpelling:=True)>
Public Shared Function MFCreateAggregateSource(
    pSourceCollection As IntPtr,   ' IMFCollection*
    ppAggSource As IntPtr   ' IMFMediaSource** out
) As Integer
End Function
' pSourceCollection : IMFCollection*
' ppAggSource : IMFMediaSource** out
Declare PtrSafe Function MFCreateAggregateSource Lib "mf" ( _
    ByVal pSourceCollection As LongPtr, _
    ByVal ppAggSource As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

MFCreateAggregateSource = ctypes.windll.mf.MFCreateAggregateSource
MFCreateAggregateSource.restype = ctypes.c_int
MFCreateAggregateSource.argtypes = [
    ctypes.c_void_p,  # pSourceCollection : IMFCollection*
    ctypes.c_void_p,  # ppAggSource : IMFMediaSource** out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('MF.dll')
MFCreateAggregateSource = Fiddle::Function.new(
  lib['MFCreateAggregateSource'],
  [
    Fiddle::TYPE_VOIDP,  # pSourceCollection : IMFCollection*
    Fiddle::TYPE_VOIDP,  # ppAggSource : IMFMediaSource** out
  ],
  Fiddle::TYPE_INT)
#[link(name = "mf")]
extern "system" {
    fn MFCreateAggregateSource(
        pSourceCollection: *mut core::ffi::c_void,  // IMFCollection*
        ppAggSource: *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 MFCreateAggregateSource(IntPtr pSourceCollection, IntPtr ppAggSource);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MF_MFCreateAggregateSource' -Namespace Win32 -PassThru
# $api::MFCreateAggregateSource(pSourceCollection, ppAggSource)
#uselib "MF.dll"
#func global MFCreateAggregateSource "MFCreateAggregateSource" sptr, sptr
; MFCreateAggregateSource pSourceCollection, ppAggSource   ; 戻り値は stat
; pSourceCollection : IMFCollection* -> "sptr"
; ppAggSource : IMFMediaSource** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "MF.dll"
#cfunc global MFCreateAggregateSource "MFCreateAggregateSource" sptr, sptr
; res = MFCreateAggregateSource(pSourceCollection, ppAggSource)
; pSourceCollection : IMFCollection* -> "sptr"
; ppAggSource : IMFMediaSource** out -> "sptr"
; HRESULT MFCreateAggregateSource(IMFCollection* pSourceCollection, IMFMediaSource** ppAggSource)
#uselib "MF.dll"
#cfunc global MFCreateAggregateSource "MFCreateAggregateSource" intptr, intptr
; res = MFCreateAggregateSource(pSourceCollection, ppAggSource)
; pSourceCollection : IMFCollection* -> "intptr"
; ppAggSource : IMFMediaSource** out -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	mf = windows.NewLazySystemDLL("MF.dll")
	procMFCreateAggregateSource = mf.NewProc("MFCreateAggregateSource")
)

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