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

MFSerializeAttributesToStream

関数
メディア属性ストアの内容をストリームへシリアル化する。
DLLMFPlat.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

HRESULT MFSerializeAttributesToStream(
    IMFAttributes* pAttr,
    DWORD dwOptions,
    IStream* pStm
);

パラメーター

名前方向
pAttrIMFAttributes*in
dwOptionsDWORDin
pStmIStream*in

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT MFSerializeAttributesToStream(
    IMFAttributes* pAttr,
    DWORD dwOptions,
    IStream* pStm
);
[DllImport("MFPlat.dll", ExactSpelling = true)]
static extern int MFSerializeAttributesToStream(
    IntPtr pAttr,   // IMFAttributes*
    uint dwOptions,   // DWORD
    IntPtr pStm   // IStream*
);
<DllImport("MFPlat.dll", ExactSpelling:=True)>
Public Shared Function MFSerializeAttributesToStream(
    pAttr As IntPtr,   ' IMFAttributes*
    dwOptions As UInteger,   ' DWORD
    pStm As IntPtr   ' IStream*
) As Integer
End Function
' pAttr : IMFAttributes*
' dwOptions : DWORD
' pStm : IStream*
Declare PtrSafe Function MFSerializeAttributesToStream Lib "mfplat" ( _
    ByVal pAttr As LongPtr, _
    ByVal dwOptions As Long, _
    ByVal pStm As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

MFSerializeAttributesToStream = ctypes.windll.mfplat.MFSerializeAttributesToStream
MFSerializeAttributesToStream.restype = ctypes.c_int
MFSerializeAttributesToStream.argtypes = [
    ctypes.c_void_p,  # pAttr : IMFAttributes*
    wintypes.DWORD,  # dwOptions : DWORD
    ctypes.c_void_p,  # pStm : IStream*
]
require 'fiddle'
require 'fiddle/import'

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

var (
	mfplat = windows.NewLazySystemDLL("MFPlat.dll")
	procMFSerializeAttributesToStream = mfplat.NewProc("MFSerializeAttributesToStream")
)

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