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