ホーム › Media.MediaFoundation › MFCreateSourceReaderFromURL
MFCreateSourceReaderFromURL
関数URLで指定したメディアファイルからソースリーダーを作成する。
シグネチャ
// MFReadWrite.dll
#include <windows.h>
HRESULT MFCreateSourceReaderFromURL(
LPCWSTR pwszURL,
IMFAttributes* pAttributes, // optional
IMFSourceReader** ppSourceReader
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pwszURL | LPCWSTR | in |
| pAttributes | IMFAttributes* | inoptional |
| ppSourceReader | IMFSourceReader** | out |
戻り値の型: HRESULT
各言語での呼び出し定義
// MFReadWrite.dll
#include <windows.h>
HRESULT MFCreateSourceReaderFromURL(
LPCWSTR pwszURL,
IMFAttributes* pAttributes, // optional
IMFSourceReader** ppSourceReader
);[DllImport("MFReadWrite.dll", ExactSpelling = true)]
static extern int MFCreateSourceReaderFromURL(
[MarshalAs(UnmanagedType.LPWStr)] string pwszURL, // LPCWSTR
IntPtr pAttributes, // IMFAttributes* optional
IntPtr ppSourceReader // IMFSourceReader** out
);<DllImport("MFReadWrite.dll", ExactSpelling:=True)>
Public Shared Function MFCreateSourceReaderFromURL(
<MarshalAs(UnmanagedType.LPWStr)> pwszURL As String, ' LPCWSTR
pAttributes As IntPtr, ' IMFAttributes* optional
ppSourceReader As IntPtr ' IMFSourceReader** out
) As Integer
End Function' pwszURL : LPCWSTR
' pAttributes : IMFAttributes* optional
' ppSourceReader : IMFSourceReader** out
Declare PtrSafe Function MFCreateSourceReaderFromURL Lib "mfreadwrite" ( _
ByVal pwszURL 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
MFCreateSourceReaderFromURL = ctypes.windll.mfreadwrite.MFCreateSourceReaderFromURL
MFCreateSourceReaderFromURL.restype = ctypes.c_int
MFCreateSourceReaderFromURL.argtypes = [
wintypes.LPCWSTR, # pwszURL : LPCWSTR
ctypes.c_void_p, # pAttributes : IMFAttributes* optional
ctypes.c_void_p, # ppSourceReader : IMFSourceReader** out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('MFReadWrite.dll')
MFCreateSourceReaderFromURL = Fiddle::Function.new(
lib['MFCreateSourceReaderFromURL'],
[
Fiddle::TYPE_VOIDP, # pwszURL : LPCWSTR
Fiddle::TYPE_VOIDP, # pAttributes : IMFAttributes* optional
Fiddle::TYPE_VOIDP, # ppSourceReader : IMFSourceReader** out
],
Fiddle::TYPE_INT)#[link(name = "mfreadwrite")]
extern "system" {
fn MFCreateSourceReaderFromURL(
pwszURL: *const u16, // LPCWSTR
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 MFCreateSourceReaderFromURL([MarshalAs(UnmanagedType.LPWStr)] string pwszURL, IntPtr pAttributes, IntPtr ppSourceReader);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MFReadWrite_MFCreateSourceReaderFromURL' -Namespace Win32 -PassThru
# $api::MFCreateSourceReaderFromURL(pwszURL, pAttributes, ppSourceReader)#uselib "MFReadWrite.dll"
#func global MFCreateSourceReaderFromURL "MFCreateSourceReaderFromURL" sptr, sptr, sptr
; MFCreateSourceReaderFromURL pwszURL, pAttributes, ppSourceReader ; 戻り値は stat
; pwszURL : LPCWSTR -> "sptr"
; pAttributes : IMFAttributes* optional -> "sptr"
; ppSourceReader : IMFSourceReader** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "MFReadWrite.dll"
#cfunc global MFCreateSourceReaderFromURL "MFCreateSourceReaderFromURL" wstr, sptr, sptr
; res = MFCreateSourceReaderFromURL(pwszURL, pAttributes, ppSourceReader)
; pwszURL : LPCWSTR -> "wstr"
; pAttributes : IMFAttributes* optional -> "sptr"
; ppSourceReader : IMFSourceReader** out -> "sptr"; HRESULT MFCreateSourceReaderFromURL(LPCWSTR pwszURL, IMFAttributes* pAttributes, IMFSourceReader** ppSourceReader)
#uselib "MFReadWrite.dll"
#cfunc global MFCreateSourceReaderFromURL "MFCreateSourceReaderFromURL" wstr, intptr, intptr
; res = MFCreateSourceReaderFromURL(pwszURL, pAttributes, ppSourceReader)
; pwszURL : LPCWSTR -> "wstr"
; pAttributes : IMFAttributes* optional -> "intptr"
; ppSourceReader : IMFSourceReader** out -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
mfreadwrite = windows.NewLazySystemDLL("MFReadWrite.dll")
procMFCreateSourceReaderFromURL = mfreadwrite.NewProc("MFCreateSourceReaderFromURL")
)
// pwszURL (LPCWSTR), pAttributes (IMFAttributes* optional), ppSourceReader (IMFSourceReader** out)
r1, _, err := procMFCreateSourceReaderFromURL.Call(
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pwszURL))),
uintptr(pAttributes),
uintptr(ppSourceReader),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction MFCreateSourceReaderFromURL(
pwszURL: PWideChar; // LPCWSTR
pAttributes: Pointer; // IMFAttributes* optional
ppSourceReader: Pointer // IMFSourceReader** out
): Integer; stdcall;
external 'MFReadWrite.dll' name 'MFCreateSourceReaderFromURL';result := DllCall("MFReadWrite\MFCreateSourceReaderFromURL"
, "WStr", pwszURL ; LPCWSTR
, "Ptr", pAttributes ; IMFAttributes* optional
, "Ptr", ppSourceReader ; IMFSourceReader** out
, "Int") ; return: HRESULT●MFCreateSourceReaderFromURL(pwszURL, pAttributes, ppSourceReader) = DLL("MFReadWrite.dll", "int MFCreateSourceReaderFromURL(char*, void*, void*)")
# 呼び出し: MFCreateSourceReaderFromURL(pwszURL, pAttributes, ppSourceReader)
# pwszURL : LPCWSTR -> "char*"
# pAttributes : IMFAttributes* optional -> "void*"
# ppSourceReader : IMFSourceReader** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。