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

MFCreateContentDecryptorContext

関数
コンテンツ復号処理を行うデクリプタコンテキストを生成する。
DLLMFPlat.dll呼出規約winapi対応OSWindows 10 以降

シグネチャ

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

HRESULT MFCreateContentDecryptorContext(
    const GUID* guidMediaProtectionSystemId,
    IMFDXGIDeviceManager* pD3DManager,   // optional
    IMFContentProtectionDevice* pContentProtectionDevice,
    IMFContentDecryptorContext** ppContentDecryptorContext
);

パラメーター

名前方向説明
guidMediaProtectionSystemIdGUID*inメディア保護システムを示す GUID への参照。
pD3DManagerIMFDXGIDeviceManager*inoptional復号に用いる Direct3D デバイスを管理する IMFDXGIDeviceManager ポインタ。
pContentProtectionDeviceIMFContentProtectionDevice*in復号処理を担う IMFContentProtectionDevice ポインタ。
ppContentDecryptorContextIMFContentDecryptorContext**out生成された IMFContentDecryptorContext を受け取る出力ポインタ。

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT MFCreateContentDecryptorContext(
    const GUID* guidMediaProtectionSystemId,
    IMFDXGIDeviceManager* pD3DManager,   // optional
    IMFContentProtectionDevice* pContentProtectionDevice,
    IMFContentDecryptorContext** ppContentDecryptorContext
);
[DllImport("MFPlat.dll", ExactSpelling = true)]
static extern int MFCreateContentDecryptorContext(
    ref Guid guidMediaProtectionSystemId,   // GUID*
    IntPtr pD3DManager,   // IMFDXGIDeviceManager* optional
    IntPtr pContentProtectionDevice,   // IMFContentProtectionDevice*
    IntPtr ppContentDecryptorContext   // IMFContentDecryptorContext** out
);
<DllImport("MFPlat.dll", ExactSpelling:=True)>
Public Shared Function MFCreateContentDecryptorContext(
    ByRef guidMediaProtectionSystemId As Guid,   ' GUID*
    pD3DManager As IntPtr,   ' IMFDXGIDeviceManager* optional
    pContentProtectionDevice As IntPtr,   ' IMFContentProtectionDevice*
    ppContentDecryptorContext As IntPtr   ' IMFContentDecryptorContext** out
) As Integer
End Function
' guidMediaProtectionSystemId : GUID*
' pD3DManager : IMFDXGIDeviceManager* optional
' pContentProtectionDevice : IMFContentProtectionDevice*
' ppContentDecryptorContext : IMFContentDecryptorContext** out
Declare PtrSafe Function MFCreateContentDecryptorContext Lib "mfplat" ( _
    ByVal guidMediaProtectionSystemId As LongPtr, _
    ByVal pD3DManager As LongPtr, _
    ByVal pContentProtectionDevice As LongPtr, _
    ByVal ppContentDecryptorContext As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

MFCreateContentDecryptorContext = ctypes.windll.mfplat.MFCreateContentDecryptorContext
MFCreateContentDecryptorContext.restype = ctypes.c_int
MFCreateContentDecryptorContext.argtypes = [
    ctypes.c_void_p,  # guidMediaProtectionSystemId : GUID*
    ctypes.c_void_p,  # pD3DManager : IMFDXGIDeviceManager* optional
    ctypes.c_void_p,  # pContentProtectionDevice : IMFContentProtectionDevice*
    ctypes.c_void_p,  # ppContentDecryptorContext : IMFContentDecryptorContext** out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('MFPlat.dll')
MFCreateContentDecryptorContext = Fiddle::Function.new(
  lib['MFCreateContentDecryptorContext'],
  [
    Fiddle::TYPE_VOIDP,  # guidMediaProtectionSystemId : GUID*
    Fiddle::TYPE_VOIDP,  # pD3DManager : IMFDXGIDeviceManager* optional
    Fiddle::TYPE_VOIDP,  # pContentProtectionDevice : IMFContentProtectionDevice*
    Fiddle::TYPE_VOIDP,  # ppContentDecryptorContext : IMFContentDecryptorContext** out
  ],
  Fiddle::TYPE_INT)
#[link(name = "mfplat")]
extern "system" {
    fn MFCreateContentDecryptorContext(
        guidMediaProtectionSystemId: *const GUID,  // GUID*
        pD3DManager: *mut core::ffi::c_void,  // IMFDXGIDeviceManager* optional
        pContentProtectionDevice: *mut core::ffi::c_void,  // IMFContentProtectionDevice*
        ppContentDecryptorContext: *mut *mut core::ffi::c_void  // IMFContentDecryptorContext** out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("MFPlat.dll")]
public static extern int MFCreateContentDecryptorContext(ref Guid guidMediaProtectionSystemId, IntPtr pD3DManager, IntPtr pContentProtectionDevice, IntPtr ppContentDecryptorContext);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MFPlat_MFCreateContentDecryptorContext' -Namespace Win32 -PassThru
# $api::MFCreateContentDecryptorContext(guidMediaProtectionSystemId, pD3DManager, pContentProtectionDevice, ppContentDecryptorContext)
#uselib "MFPlat.dll"
#func global MFCreateContentDecryptorContext "MFCreateContentDecryptorContext" sptr, sptr, sptr, sptr
; MFCreateContentDecryptorContext varptr(guidMediaProtectionSystemId), pD3DManager, pContentProtectionDevice, ppContentDecryptorContext   ; 戻り値は stat
; guidMediaProtectionSystemId : GUID* -> "sptr"
; pD3DManager : IMFDXGIDeviceManager* optional -> "sptr"
; pContentProtectionDevice : IMFContentProtectionDevice* -> "sptr"
; ppContentDecryptorContext : IMFContentDecryptorContext** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "MFPlat.dll"
#cfunc global MFCreateContentDecryptorContext "MFCreateContentDecryptorContext" var, sptr, sptr, sptr
; res = MFCreateContentDecryptorContext(guidMediaProtectionSystemId, pD3DManager, pContentProtectionDevice, ppContentDecryptorContext)
; guidMediaProtectionSystemId : GUID* -> "var"
; pD3DManager : IMFDXGIDeviceManager* optional -> "sptr"
; pContentProtectionDevice : IMFContentProtectionDevice* -> "sptr"
; ppContentDecryptorContext : IMFContentDecryptorContext** out -> "sptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT MFCreateContentDecryptorContext(GUID* guidMediaProtectionSystemId, IMFDXGIDeviceManager* pD3DManager, IMFContentProtectionDevice* pContentProtectionDevice, IMFContentDecryptorContext** ppContentDecryptorContext)
#uselib "MFPlat.dll"
#cfunc global MFCreateContentDecryptorContext "MFCreateContentDecryptorContext" var, intptr, intptr, intptr
; res = MFCreateContentDecryptorContext(guidMediaProtectionSystemId, pD3DManager, pContentProtectionDevice, ppContentDecryptorContext)
; guidMediaProtectionSystemId : GUID* -> "var"
; pD3DManager : IMFDXGIDeviceManager* optional -> "intptr"
; pContentProtectionDevice : IMFContentProtectionDevice* -> "intptr"
; ppContentDecryptorContext : IMFContentDecryptorContext** out -> "intptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	mfplat = windows.NewLazySystemDLL("MFPlat.dll")
	procMFCreateContentDecryptorContext = mfplat.NewProc("MFCreateContentDecryptorContext")
)

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