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

MFUnwrapMediaType

関数
ラップされたメディア型から元のメディア型を取り出す。
DLLMFPlat.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

HRESULT MFUnwrapMediaType(
    IMFMediaType* pWrap,
    IMFMediaType** ppOrig
);

パラメーター

名前方向
pWrapIMFMediaType*in
ppOrigIMFMediaType**out

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

MFUnwrapMediaType = ctypes.windll.mfplat.MFUnwrapMediaType
MFUnwrapMediaType.restype = ctypes.c_int
MFUnwrapMediaType.argtypes = [
    ctypes.c_void_p,  # pWrap : IMFMediaType*
    ctypes.c_void_p,  # ppOrig : IMFMediaType** out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	mfplat = windows.NewLazySystemDLL("MFPlat.dll")
	procMFUnwrapMediaType = mfplat.NewProc("MFUnwrapMediaType")
)

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