ホーム › Media.KernelStreaming › KsGetMediaType
KsGetMediaType
関数指定位置のピンファクトリのメディアタイプを取得する。
シグネチャ
// ksproxy.ax
#include <windows.h>
HRESULT KsGetMediaType(
INT Position,
AM_MEDIA_TYPE* AmMediaType,
HANDLE FilterHandle,
DWORD PinFactoryId
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| Position | INT | in |
| AmMediaType | AM_MEDIA_TYPE* | out |
| FilterHandle | HANDLE | in |
| PinFactoryId | DWORD | in |
戻り値の型: HRESULT
各言語での呼び出し定義
// ksproxy.ax
#include <windows.h>
HRESULT KsGetMediaType(
INT Position,
AM_MEDIA_TYPE* AmMediaType,
HANDLE FilterHandle,
DWORD PinFactoryId
);[DllImport("ksproxy.ax", ExactSpelling = true)]
static extern int KsGetMediaType(
int Position, // INT
IntPtr AmMediaType, // AM_MEDIA_TYPE* out
IntPtr FilterHandle, // HANDLE
uint PinFactoryId // DWORD
);<DllImport("ksproxy.ax", ExactSpelling:=True)>
Public Shared Function KsGetMediaType(
Position As Integer, ' INT
AmMediaType As IntPtr, ' AM_MEDIA_TYPE* out
FilterHandle As IntPtr, ' HANDLE
PinFactoryId As UInteger ' DWORD
) As Integer
End Function' Position : INT
' AmMediaType : AM_MEDIA_TYPE* out
' FilterHandle : HANDLE
' PinFactoryId : DWORD
Declare PtrSafe Function KsGetMediaType Lib "ksproxy.ax" ( _
ByVal Position As Long, _
ByVal AmMediaType As LongPtr, _
ByVal FilterHandle As LongPtr, _
ByVal PinFactoryId As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
KsGetMediaType = ctypes.windll.LoadLibrary("ksproxy.ax").KsGetMediaType
KsGetMediaType.restype = ctypes.c_int
KsGetMediaType.argtypes = [
ctypes.c_int, # Position : INT
ctypes.c_void_p, # AmMediaType : AM_MEDIA_TYPE* out
wintypes.HANDLE, # FilterHandle : HANDLE
wintypes.DWORD, # PinFactoryId : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('ksproxy.ax')
KsGetMediaType = Fiddle::Function.new(
lib['KsGetMediaType'],
[
Fiddle::TYPE_INT, # Position : INT
Fiddle::TYPE_VOIDP, # AmMediaType : AM_MEDIA_TYPE* out
Fiddle::TYPE_VOIDP, # FilterHandle : HANDLE
-Fiddle::TYPE_INT, # PinFactoryId : DWORD
],
Fiddle::TYPE_INT)#[link(name = "ksproxy.ax")]
extern "system" {
fn KsGetMediaType(
Position: i32, // INT
AmMediaType: *mut AM_MEDIA_TYPE, // AM_MEDIA_TYPE* out
FilterHandle: *mut core::ffi::c_void, // HANDLE
PinFactoryId: u32 // DWORD
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("ksproxy.ax")]
public static extern int KsGetMediaType(int Position, IntPtr AmMediaType, IntPtr FilterHandle, uint PinFactoryId);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ksproxy.ax_KsGetMediaType' -Namespace Win32 -PassThru
# $api::KsGetMediaType(Position, AmMediaType, FilterHandle, PinFactoryId)#uselib "ksproxy.ax"
#func global KsGetMediaType "KsGetMediaType" sptr, sptr, sptr, sptr
; KsGetMediaType Position, varptr(AmMediaType), FilterHandle, PinFactoryId ; 戻り値は stat
; Position : INT -> "sptr"
; AmMediaType : AM_MEDIA_TYPE* out -> "sptr"
; FilterHandle : HANDLE -> "sptr"
; PinFactoryId : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "ksproxy.ax" #cfunc global KsGetMediaType "KsGetMediaType" int, var, sptr, int ; res = KsGetMediaType(Position, AmMediaType, FilterHandle, PinFactoryId) ; Position : INT -> "int" ; AmMediaType : AM_MEDIA_TYPE* out -> "var" ; FilterHandle : HANDLE -> "sptr" ; PinFactoryId : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "ksproxy.ax" #cfunc global KsGetMediaType "KsGetMediaType" int, sptr, sptr, int ; res = KsGetMediaType(Position, varptr(AmMediaType), FilterHandle, PinFactoryId) ; Position : INT -> "int" ; AmMediaType : AM_MEDIA_TYPE* out -> "sptr" ; FilterHandle : HANDLE -> "sptr" ; PinFactoryId : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT KsGetMediaType(INT Position, AM_MEDIA_TYPE* AmMediaType, HANDLE FilterHandle, DWORD PinFactoryId) #uselib "ksproxy.ax" #cfunc global KsGetMediaType "KsGetMediaType" int, var, intptr, int ; res = KsGetMediaType(Position, AmMediaType, FilterHandle, PinFactoryId) ; Position : INT -> "int" ; AmMediaType : AM_MEDIA_TYPE* out -> "var" ; FilterHandle : HANDLE -> "intptr" ; PinFactoryId : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT KsGetMediaType(INT Position, AM_MEDIA_TYPE* AmMediaType, HANDLE FilterHandle, DWORD PinFactoryId) #uselib "ksproxy.ax" #cfunc global KsGetMediaType "KsGetMediaType" int, intptr, intptr, int ; res = KsGetMediaType(Position, varptr(AmMediaType), FilterHandle, PinFactoryId) ; Position : INT -> "int" ; AmMediaType : AM_MEDIA_TYPE* out -> "intptr" ; FilterHandle : HANDLE -> "intptr" ; PinFactoryId : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
ksproxy_ax = windows.NewLazySystemDLL("ksproxy.ax")
procKsGetMediaType = ksproxy_ax.NewProc("KsGetMediaType")
)
// Position (INT), AmMediaType (AM_MEDIA_TYPE* out), FilterHandle (HANDLE), PinFactoryId (DWORD)
r1, _, err := procKsGetMediaType.Call(
uintptr(Position),
uintptr(AmMediaType),
uintptr(FilterHandle),
uintptr(PinFactoryId),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction KsGetMediaType(
Position: Integer; // INT
AmMediaType: Pointer; // AM_MEDIA_TYPE* out
FilterHandle: THandle; // HANDLE
PinFactoryId: DWORD // DWORD
): Integer; stdcall;
external 'ksproxy.ax' name 'KsGetMediaType';result := DllCall("ksproxy.ax\KsGetMediaType"
, "Int", Position ; INT
, "Ptr", AmMediaType ; AM_MEDIA_TYPE* out
, "Ptr", FilterHandle ; HANDLE
, "UInt", PinFactoryId ; DWORD
, "Int") ; return: HRESULT●KsGetMediaType(Position, AmMediaType, FilterHandle, PinFactoryId) = DLL("ksproxy.ax", "int KsGetMediaType(int, void*, void*, dword)")
# 呼び出し: KsGetMediaType(Position, AmMediaType, FilterHandle, PinFactoryId)
# Position : INT -> "int"
# AmMediaType : AM_MEDIA_TYPE* out -> "void*"
# FilterHandle : HANDLE -> "void*"
# PinFactoryId : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。