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

BDA_TS_SELECTORINFO

構造体
サイズx64: 22 バイト / x86: 22 バイトパッキング1

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

フィールド

フィールドサイズx64x86説明
bTSInfolengthBYTE1+0+0TS情報領域のバイト長。後続データのサイズを示す。
bReservedBYTE2+1+1予約フィールド。将来の拡張用で通常は0。
guidNetworkTypeGUID16+3+3ネットワーク種別を示すGUID。ISDB等の方式を識別する。
bTSIDCountBYTE1+19+19後続のTSID配列の要素数。
usTSIDWORD2+20+20トランスポートストリーム識別子(TSID)。可変長配列の先頭。

各言語での定義

#include <windows.h>

// BDA_TS_SELECTORINFO  (x64 22 / x86 22 バイト)
#pragma pack(push, 1)
typedef struct BDA_TS_SELECTORINFO {
    BYTE bTSInfolength;
    BYTE bReserved[2];
    GUID guidNetworkType;
    BYTE bTSIDCount;
    WORD usTSID[1];
} BDA_TS_SELECTORINFO;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct BDA_TS_SELECTORINFO
{
    public byte bTSInfolength;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] bReserved;
    public Guid guidNetworkType;
    public byte bTSIDCount;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public ushort[] usTSID;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure BDA_TS_SELECTORINFO
    Public bTSInfolength As Byte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)> Public bReserved() As Byte
    Public guidNetworkType As Guid
    Public bTSIDCount As Byte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public usTSID() As UShort
End Structure
import ctypes
from ctypes import wintypes

class BDA_TS_SELECTORINFO(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("bTSInfolength", ctypes.c_ubyte),
        ("bReserved", ctypes.c_ubyte * 2),
        ("guidNetworkType", GUID),
        ("bTSIDCount", ctypes.c_ubyte),
        ("usTSID", ctypes.c_ushort * 1),
    ]
#[repr(C, packed(1))]
pub struct BDA_TS_SELECTORINFO {
    pub bTSInfolength: u8,
    pub bReserved: [u8; 2],
    pub guidNetworkType: GUID,
    pub bTSIDCount: u8,
    pub usTSID: [u16; 1],
}
import "golang.org/x/sys/windows"

type BDA_TS_SELECTORINFO struct {
	bTSInfolength byte
	bReserved [2]byte
	guidNetworkType windows.GUID
	bTSIDCount byte
	usTSID [1]uint16
}
type
  BDA_TS_SELECTORINFO = packed record
    bTSInfolength: Byte;
    bReserved: array[0..1] of Byte;
    guidNetworkType: TGUID;
    bTSIDCount: Byte;
    usTSID: array[0..0] of Word;
  end;
const BDA_TS_SELECTORINFO = extern struct {
    bTSInfolength: u8,
    bReserved: [2]u8,
    guidNetworkType: GUID,
    bTSIDCount: u8,
    usTSID: [1]u16,
};
type
  BDA_TS_SELECTORINFO {.packed.} = object
    bTSInfolength: uint8
    bReserved: array[2, uint8]
    guidNetworkType: GUID
    bTSIDCount: uint8
    usTSID: array[1, uint16]
align(1)
struct BDA_TS_SELECTORINFO
{
    ubyte bTSInfolength;
    ubyte[2] bReserved;
    GUID guidNetworkType;
    ubyte bTSIDCount;
    ushort[1] usTSID;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; BDA_TS_SELECTORINFO サイズ: 22 バイト(x64)
dim st, 6    ; 4byte整数×6(構造体サイズ 22 / 4 切り上げ)
; bTSInfolength : BYTE (+0, 1byte)  poke st,0,値  /  値 = peek(st,0)
; bReserved : BYTE (+1, 2byte)  varptr(st)+1 を基点に操作(2byte:入れ子/配列)
; guidNetworkType : GUID (+3, 16byte)  varptr(st)+3 を基点に操作(16byte:入れ子/配列)
; bTSIDCount : BYTE (+19, 1byte)  poke st,19,値  /  値 = peek(st,19)
; usTSID : WORD (+20, 2byte)  varptr(st)+20 を基点に操作(2byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global GUID, pack=1
    #field int Data1
    #field short Data2
    #field short Data3
    #field byte Data4 8
#endstruct

#defstruct global BDA_TS_SELECTORINFO, pack=1
    #field byte bTSInfolength
    #field byte bReserved 2
    #field GUID guidNetworkType
    #field byte bTSIDCount
    #field short usTSID 1
#endstruct

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