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