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

OPMGetVideoOutputForTarget

関数
指定したVidPnターゲットの出力保護用ビデオ出力を取得する。
DLLdxva2.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

HRESULT OPMGetVideoOutputForTarget(
    LUID* pAdapterLuid,
    DWORD VidPnTarget,
    OPM_VIDEO_OUTPUT_SEMANTICS vos,
    IOPMVideoOutput** ppOPMVideoOutput
);

パラメーター

名前方向
pAdapterLuidLUID*in
VidPnTargetDWORDin
vosOPM_VIDEO_OUTPUT_SEMANTICSin
ppOPMVideoOutputIOPMVideoOutput**out

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT OPMGetVideoOutputForTarget(
    LUID* pAdapterLuid,
    DWORD VidPnTarget,
    OPM_VIDEO_OUTPUT_SEMANTICS vos,
    IOPMVideoOutput** ppOPMVideoOutput
);
[DllImport("dxva2.dll", ExactSpelling = true)]
static extern int OPMGetVideoOutputForTarget(
    IntPtr pAdapterLuid,   // LUID*
    uint VidPnTarget,   // DWORD
    int vos,   // OPM_VIDEO_OUTPUT_SEMANTICS
    IntPtr ppOPMVideoOutput   // IOPMVideoOutput** out
);
<DllImport("dxva2.dll", ExactSpelling:=True)>
Public Shared Function OPMGetVideoOutputForTarget(
    pAdapterLuid As IntPtr,   ' LUID*
    VidPnTarget As UInteger,   ' DWORD
    vos As Integer,   ' OPM_VIDEO_OUTPUT_SEMANTICS
    ppOPMVideoOutput As IntPtr   ' IOPMVideoOutput** out
) As Integer
End Function
' pAdapterLuid : LUID*
' VidPnTarget : DWORD
' vos : OPM_VIDEO_OUTPUT_SEMANTICS
' ppOPMVideoOutput : IOPMVideoOutput** out
Declare PtrSafe Function OPMGetVideoOutputForTarget Lib "dxva2" ( _
    ByVal pAdapterLuid As LongPtr, _
    ByVal VidPnTarget As Long, _
    ByVal vos As Long, _
    ByVal ppOPMVideoOutput As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

OPMGetVideoOutputForTarget = ctypes.windll.dxva2.OPMGetVideoOutputForTarget
OPMGetVideoOutputForTarget.restype = ctypes.c_int
OPMGetVideoOutputForTarget.argtypes = [
    ctypes.c_void_p,  # pAdapterLuid : LUID*
    wintypes.DWORD,  # VidPnTarget : DWORD
    ctypes.c_int,  # vos : OPM_VIDEO_OUTPUT_SEMANTICS
    ctypes.c_void_p,  # ppOPMVideoOutput : IOPMVideoOutput** out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	dxva2 = windows.NewLazySystemDLL("dxva2.dll")
	procOPMGetVideoOutputForTarget = dxva2.NewProc("OPMGetVideoOutputForTarget")
)

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