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

KSJACK_SINK_INFORMATION

構造体
サイズx64: 96 バイト / x86: 96 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
ConnTypeKSJACK_SINK_CONNECTIONTYPE4+0+0シンクの接続種別を示すKSJACK_SINK_CONNECTIONTYPE列挙値。
ManufacturerIdWORD2+4+4接続シンク機器の製造元IDを示す。
ProductIdWORD2+6+6接続シンク機器の製品IDを示す。
AudioLatencyWORD2+8+8音声遅延量を示す。
HDCPCapableBOOL4+12+12HDCPに対応しているかを示すBOOL値。
AICapableBOOL4+16+16オーディオインフォフレームに対応しているかを示すBOOL値。
SinkDescriptionLengthBYTE1+20+20SinkDescription文字列の長さ(文字数)を示す。
SinkDescriptionWCHAR64+22+22シンクの説明文字列の先頭WCHAR(固定長配列)。
PortIdLUID8+88+88ポートを識別するLUID。

各言語での定義

#include <windows.h>

// LUID  (x64 8 / x86 8 バイト)
typedef struct LUID {
    DWORD LowPart;
    INT HighPart;
} LUID;

// KSJACK_SINK_INFORMATION  (x64 96 / x86 96 バイト)
typedef struct KSJACK_SINK_INFORMATION {
    KSJACK_SINK_CONNECTIONTYPE ConnType;
    WORD ManufacturerId;
    WORD ProductId;
    WORD AudioLatency;
    BOOL HDCPCapable;
    BOOL AICapable;
    BYTE SinkDescriptionLength;
    WCHAR SinkDescription[32];
    LUID PortId;
} KSJACK_SINK_INFORMATION;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct LUID
{
    public uint LowPart;
    public int HighPart;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct KSJACK_SINK_INFORMATION
{
    public int ConnType;
    public ushort ManufacturerId;
    public ushort ProductId;
    public ushort AudioLatency;
    [MarshalAs(UnmanagedType.Bool)] public bool HDCPCapable;
    [MarshalAs(UnmanagedType.Bool)] public bool AICapable;
    public byte SinkDescriptionLength;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] public string SinkDescription;
    public LUID PortId;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure LUID
    Public LowPart As UInteger
    Public HighPart As Integer
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure KSJACK_SINK_INFORMATION
    Public ConnType As Integer
    Public ManufacturerId As UShort
    Public ProductId As UShort
    Public AudioLatency As UShort
    <MarshalAs(UnmanagedType.Bool)> Public HDCPCapable As Boolean
    <MarshalAs(UnmanagedType.Bool)> Public AICapable As Boolean
    Public SinkDescriptionLength As Byte
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=32)> Public SinkDescription As String
    Public PortId As LUID
End Structure
import ctypes
from ctypes import wintypes

class LUID(ctypes.Structure):
    _fields_ = [
        ("LowPart", wintypes.DWORD),
        ("HighPart", ctypes.c_int),
    ]

class KSJACK_SINK_INFORMATION(ctypes.Structure):
    _fields_ = [
        ("ConnType", ctypes.c_int),
        ("ManufacturerId", ctypes.c_ushort),
        ("ProductId", ctypes.c_ushort),
        ("AudioLatency", ctypes.c_ushort),
        ("HDCPCapable", wintypes.BOOL),
        ("AICapable", wintypes.BOOL),
        ("SinkDescriptionLength", ctypes.c_ubyte),
        ("SinkDescription", ctypes.c_wchar * 32),
        ("PortId", LUID),
    ]
#[repr(C)]
pub struct LUID {
    pub LowPart: u32,
    pub HighPart: i32,
}

#[repr(C)]
pub struct KSJACK_SINK_INFORMATION {
    pub ConnType: i32,
    pub ManufacturerId: u16,
    pub ProductId: u16,
    pub AudioLatency: u16,
    pub HDCPCapable: i32,
    pub AICapable: i32,
    pub SinkDescriptionLength: u8,
    pub SinkDescription: [u16; 32],
    pub PortId: LUID,
}
import "golang.org/x/sys/windows"

type LUID struct {
	LowPart uint32
	HighPart int32
}

type KSJACK_SINK_INFORMATION struct {
	ConnType int32
	ManufacturerId uint16
	ProductId uint16
	AudioLatency uint16
	HDCPCapable int32
	AICapable int32
	SinkDescriptionLength byte
	SinkDescription [32]uint16
	PortId LUID
}
type
  LUID = record
    LowPart: DWORD;
    HighPart: Integer;
  end;

  KSJACK_SINK_INFORMATION = record
    ConnType: Integer;
    ManufacturerId: Word;
    ProductId: Word;
    AudioLatency: Word;
    HDCPCapable: BOOL;
    AICapable: BOOL;
    SinkDescriptionLength: Byte;
    SinkDescription: array[0..31] of WideChar;
    PortId: LUID;
  end;
const LUID = extern struct {
    LowPart: u32,
    HighPart: i32,
};

const KSJACK_SINK_INFORMATION = extern struct {
    ConnType: i32,
    ManufacturerId: u16,
    ProductId: u16,
    AudioLatency: u16,
    HDCPCapable: i32,
    AICapable: i32,
    SinkDescriptionLength: u8,
    SinkDescription: [32]u16,
    PortId: LUID,
};
type
  LUID {.bycopy.} = object
    LowPart: uint32
    HighPart: int32

  KSJACK_SINK_INFORMATION {.bycopy.} = object
    ConnType: int32
    ManufacturerId: uint16
    ProductId: uint16
    AudioLatency: uint16
    HDCPCapable: int32
    AICapable: int32
    SinkDescriptionLength: uint8
    SinkDescription: array[32, uint16]
    PortId: LUID
struct LUID
{
    uint LowPart;
    int HighPart;
}

struct KSJACK_SINK_INFORMATION
{
    int ConnType;
    ushort ManufacturerId;
    ushort ProductId;
    ushort AudioLatency;
    int HDCPCapable;
    int AICapable;
    ubyte SinkDescriptionLength;
    wchar[32] SinkDescription;
    LUID PortId;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; KSJACK_SINK_INFORMATION サイズ: 96 バイト(x64)
dim st, 24    ; 4byte整数×24(構造体サイズ 96 / 4 切り上げ)
; ConnType : KSJACK_SINK_CONNECTIONTYPE (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; ManufacturerId : WORD (+4, 2byte)  wpoke st,4,値  /  値 = wpeek(st,4)
; ProductId : WORD (+6, 2byte)  wpoke st,6,値  /  値 = wpeek(st,6)
; AudioLatency : WORD (+8, 2byte)  wpoke st,8,値  /  値 = wpeek(st,8)
; HDCPCapable : BOOL (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; AICapable : BOOL (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; SinkDescriptionLength : BYTE (+20, 1byte)  poke st,20,値  /  値 = peek(st,20)
; SinkDescription : WCHAR (+22, 64byte)  varptr(st)+22 を基点に操作(64byte:入れ子/配列)
; PortId : LUID (+88, 8byte)  varptr(st)+88 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global LUID
    #field int LowPart
    #field int HighPart
#endstruct

#defstruct global KSJACK_SINK_INFORMATION
    #field int ConnType
    #field short ManufacturerId
    #field short ProductId
    #field short AudioLatency
    #field bool HDCPCapable
    #field bool AICapable
    #field byte SinkDescriptionLength
    #field wchar SinkDescription 32
    #field LUID PortId
#endstruct

stdim st, KSJACK_SINK_INFORMATION        ; NSTRUCT 変数を確保
st->ConnType = 100
mes "ConnType=" + st->ConnType