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

MPEG_SERVICE_REQUEST

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

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

フィールド

フィールドサイズx64x86説明
TypeMPEG_REQUEST_TYPE4+0+0サービス要求の種別を示す列挙値(MPEG_REQUEST_TYPE)。
ContextMPEG_CONTEXT8+4+4要求のコンテキスト情報(MPEG_CONTEXT)。
PidWORD2+12+12対象のパケット識別子(PID)。
TableIdBYTE1+14+14対象セクションのテーブルID。
FilterMPEG2_FILTER124+15+15適用するセクションフィルタ(MPEG2_FILTER)。
FlagsDWORD4+139+139サービス要求のフラグ。

各言語での定義

#include <windows.h>

// MPEG_CONTEXT  (x64 8 / x86 8 バイト)
#pragma pack(push, 1)
typedef struct MPEG_CONTEXT {
    MPEG_CONTEXT_TYPE Type;
    _U_e__Union U;
} MPEG_CONTEXT;
#pragma pack(pop)

// DSMCC_FILTER_OPTIONS  (x64 45 / x86 45 バイト)
#pragma pack(push, 1)
typedef struct DSMCC_FILTER_OPTIONS {
    BOOL fSpecifyProtocol;
    BYTE Protocol;
    BOOL fSpecifyType;
    BYTE Type;
    BOOL fSpecifyMessageId;
    WORD MessageId;
    BOOL fSpecifyTransactionId;
    BOOL fUseTrxIdMessageIdMask;
    DWORD TransactionId;
    BOOL fSpecifyModuleVersion;
    BYTE ModuleVersion;
    BOOL fSpecifyBlockNumber;
    WORD BlockNumber;
    BOOL fGetModuleCall;
    WORD NumberOfBlocksInModule;
} DSMCC_FILTER_OPTIONS;
#pragma pack(pop)

// ATSC_FILTER_OPTIONS  (x64 8 / x86 8 バイト)
#pragma pack(push, 1)
typedef struct ATSC_FILTER_OPTIONS {
    BOOL fSpecifyEtmId;
    DWORD EtmId;
} ATSC_FILTER_OPTIONS;
#pragma pack(pop)

// MPEG2_FILTER  (x64 124 / x86 124 バイト)
#pragma pack(push, 1)
typedef struct MPEG2_FILTER {
    BYTE bVersionNumber;
    WORD wFilterSize;
    BOOL fUseRawFilteringBits;
    BYTE Filter[16];
    BYTE Mask[16];
    BOOL fSpecifyTableIdExtension;
    WORD TableIdExtension;
    BOOL fSpecifyVersion;
    BYTE Version;
    BOOL fSpecifySectionNumber;
    BYTE SectionNumber;
    BOOL fSpecifyCurrentNext;
    BOOL fNext;
    BOOL fSpecifyDsmccOptions;
    DSMCC_FILTER_OPTIONS Dsmcc;
    BOOL fSpecifyAtscOptions;
    ATSC_FILTER_OPTIONS Atsc;
} MPEG2_FILTER;
#pragma pack(pop)

// MPEG_SERVICE_REQUEST  (x64 143 / x86 143 バイト)
#pragma pack(push, 1)
typedef struct MPEG_SERVICE_REQUEST {
    MPEG_REQUEST_TYPE Type;
    MPEG_CONTEXT Context;
    WORD Pid;
    BYTE TableId;
    MPEG2_FILTER Filter;
    DWORD Flags;
} MPEG_SERVICE_REQUEST;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct MPEG_CONTEXT
{
    public int Type;
    public _U_e__Union U;
}

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct DSMCC_FILTER_OPTIONS
{
    [MarshalAs(UnmanagedType.Bool)] public bool fSpecifyProtocol;
    public byte Protocol;
    [MarshalAs(UnmanagedType.Bool)] public bool fSpecifyType;
    public byte Type;
    [MarshalAs(UnmanagedType.Bool)] public bool fSpecifyMessageId;
    public ushort MessageId;
    [MarshalAs(UnmanagedType.Bool)] public bool fSpecifyTransactionId;
    [MarshalAs(UnmanagedType.Bool)] public bool fUseTrxIdMessageIdMask;
    public uint TransactionId;
    [MarshalAs(UnmanagedType.Bool)] public bool fSpecifyModuleVersion;
    public byte ModuleVersion;
    [MarshalAs(UnmanagedType.Bool)] public bool fSpecifyBlockNumber;
    public ushort BlockNumber;
    [MarshalAs(UnmanagedType.Bool)] public bool fGetModuleCall;
    public ushort NumberOfBlocksInModule;
}

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct ATSC_FILTER_OPTIONS
{
    [MarshalAs(UnmanagedType.Bool)] public bool fSpecifyEtmId;
    public uint EtmId;
}

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct MPEG2_FILTER
{
    public byte bVersionNumber;
    public ushort wFilterSize;
    [MarshalAs(UnmanagedType.Bool)] public bool fUseRawFilteringBits;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] Filter;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] Mask;
    [MarshalAs(UnmanagedType.Bool)] public bool fSpecifyTableIdExtension;
    public ushort TableIdExtension;
    [MarshalAs(UnmanagedType.Bool)] public bool fSpecifyVersion;
    public byte Version;
    [MarshalAs(UnmanagedType.Bool)] public bool fSpecifySectionNumber;
    public byte SectionNumber;
    [MarshalAs(UnmanagedType.Bool)] public bool fSpecifyCurrentNext;
    [MarshalAs(UnmanagedType.Bool)] public bool fNext;
    [MarshalAs(UnmanagedType.Bool)] public bool fSpecifyDsmccOptions;
    public DSMCC_FILTER_OPTIONS Dsmcc;
    [MarshalAs(UnmanagedType.Bool)] public bool fSpecifyAtscOptions;
    public ATSC_FILTER_OPTIONS Atsc;
}

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct MPEG_SERVICE_REQUEST
{
    public int Type;
    public MPEG_CONTEXT Context;
    public ushort Pid;
    public byte TableId;
    public MPEG2_FILTER Filter;
    public uint Flags;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure MPEG_CONTEXT
    Public Type As Integer
    Public U As _U_e__Union
End Structure

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure DSMCC_FILTER_OPTIONS
    <MarshalAs(UnmanagedType.Bool)> Public fSpecifyProtocol As Boolean
    Public Protocol As Byte
    <MarshalAs(UnmanagedType.Bool)> Public fSpecifyType As Boolean
    Public Type As Byte
    <MarshalAs(UnmanagedType.Bool)> Public fSpecifyMessageId As Boolean
    Public MessageId As UShort
    <MarshalAs(UnmanagedType.Bool)> Public fSpecifyTransactionId As Boolean
    <MarshalAs(UnmanagedType.Bool)> Public fUseTrxIdMessageIdMask As Boolean
    Public TransactionId As UInteger
    <MarshalAs(UnmanagedType.Bool)> Public fSpecifyModuleVersion As Boolean
    Public ModuleVersion As Byte
    <MarshalAs(UnmanagedType.Bool)> Public fSpecifyBlockNumber As Boolean
    Public BlockNumber As UShort
    <MarshalAs(UnmanagedType.Bool)> Public fGetModuleCall As Boolean
    Public NumberOfBlocksInModule As UShort
End Structure

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure ATSC_FILTER_OPTIONS
    <MarshalAs(UnmanagedType.Bool)> Public fSpecifyEtmId As Boolean
    Public EtmId As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure MPEG2_FILTER
    Public bVersionNumber As Byte
    Public wFilterSize As UShort
    <MarshalAs(UnmanagedType.Bool)> Public fUseRawFilteringBits As Boolean
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=16)> Public Filter() As Byte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=16)> Public Mask() As Byte
    <MarshalAs(UnmanagedType.Bool)> Public fSpecifyTableIdExtension As Boolean
    Public TableIdExtension As UShort
    <MarshalAs(UnmanagedType.Bool)> Public fSpecifyVersion As Boolean
    Public Version As Byte
    <MarshalAs(UnmanagedType.Bool)> Public fSpecifySectionNumber As Boolean
    Public SectionNumber As Byte
    <MarshalAs(UnmanagedType.Bool)> Public fSpecifyCurrentNext As Boolean
    <MarshalAs(UnmanagedType.Bool)> Public fNext As Boolean
    <MarshalAs(UnmanagedType.Bool)> Public fSpecifyDsmccOptions As Boolean
    Public Dsmcc As DSMCC_FILTER_OPTIONS
    <MarshalAs(UnmanagedType.Bool)> Public fSpecifyAtscOptions As Boolean
    Public Atsc As ATSC_FILTER_OPTIONS
End Structure

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure MPEG_SERVICE_REQUEST
    Public Type As Integer
    Public Context As MPEG_CONTEXT
    Public Pid As UShort
    Public TableId As Byte
    Public Filter As MPEG2_FILTER
    Public Flags As UInteger
End Structure
import ctypes
from ctypes import wintypes

class MPEG_CONTEXT(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("Type", ctypes.c_int),
        ("U", _U_e__Union),
    ]

class DSMCC_FILTER_OPTIONS(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("fSpecifyProtocol", wintypes.BOOL),
        ("Protocol", ctypes.c_ubyte),
        ("fSpecifyType", wintypes.BOOL),
        ("Type", ctypes.c_ubyte),
        ("fSpecifyMessageId", wintypes.BOOL),
        ("MessageId", ctypes.c_ushort),
        ("fSpecifyTransactionId", wintypes.BOOL),
        ("fUseTrxIdMessageIdMask", wintypes.BOOL),
        ("TransactionId", wintypes.DWORD),
        ("fSpecifyModuleVersion", wintypes.BOOL),
        ("ModuleVersion", ctypes.c_ubyte),
        ("fSpecifyBlockNumber", wintypes.BOOL),
        ("BlockNumber", ctypes.c_ushort),
        ("fGetModuleCall", wintypes.BOOL),
        ("NumberOfBlocksInModule", ctypes.c_ushort),
    ]

class ATSC_FILTER_OPTIONS(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("fSpecifyEtmId", wintypes.BOOL),
        ("EtmId", wintypes.DWORD),
    ]

class MPEG2_FILTER(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("bVersionNumber", ctypes.c_ubyte),
        ("wFilterSize", ctypes.c_ushort),
        ("fUseRawFilteringBits", wintypes.BOOL),
        ("Filter", ctypes.c_ubyte * 16),
        ("Mask", ctypes.c_ubyte * 16),
        ("fSpecifyTableIdExtension", wintypes.BOOL),
        ("TableIdExtension", ctypes.c_ushort),
        ("fSpecifyVersion", wintypes.BOOL),
        ("Version", ctypes.c_ubyte),
        ("fSpecifySectionNumber", wintypes.BOOL),
        ("SectionNumber", ctypes.c_ubyte),
        ("fSpecifyCurrentNext", wintypes.BOOL),
        ("fNext", wintypes.BOOL),
        ("fSpecifyDsmccOptions", wintypes.BOOL),
        ("Dsmcc", DSMCC_FILTER_OPTIONS),
        ("fSpecifyAtscOptions", wintypes.BOOL),
        ("Atsc", ATSC_FILTER_OPTIONS),
    ]

class MPEG_SERVICE_REQUEST(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("Type", ctypes.c_int),
        ("Context", MPEG_CONTEXT),
        ("Pid", ctypes.c_ushort),
        ("TableId", ctypes.c_ubyte),
        ("Filter", MPEG2_FILTER),
        ("Flags", wintypes.DWORD),
    ]
#[repr(C, packed(1))]
pub struct MPEG_CONTEXT {
    pub Type: i32,
    pub U: _U_e__Union,
}

#[repr(C, packed(1))]
pub struct DSMCC_FILTER_OPTIONS {
    pub fSpecifyProtocol: i32,
    pub Protocol: u8,
    pub fSpecifyType: i32,
    pub Type: u8,
    pub fSpecifyMessageId: i32,
    pub MessageId: u16,
    pub fSpecifyTransactionId: i32,
    pub fUseTrxIdMessageIdMask: i32,
    pub TransactionId: u32,
    pub fSpecifyModuleVersion: i32,
    pub ModuleVersion: u8,
    pub fSpecifyBlockNumber: i32,
    pub BlockNumber: u16,
    pub fGetModuleCall: i32,
    pub NumberOfBlocksInModule: u16,
}

#[repr(C, packed(1))]
pub struct ATSC_FILTER_OPTIONS {
    pub fSpecifyEtmId: i32,
    pub EtmId: u32,
}

#[repr(C, packed(1))]
pub struct MPEG2_FILTER {
    pub bVersionNumber: u8,
    pub wFilterSize: u16,
    pub fUseRawFilteringBits: i32,
    pub Filter: [u8; 16],
    pub Mask: [u8; 16],
    pub fSpecifyTableIdExtension: i32,
    pub TableIdExtension: u16,
    pub fSpecifyVersion: i32,
    pub Version: u8,
    pub fSpecifySectionNumber: i32,
    pub SectionNumber: u8,
    pub fSpecifyCurrentNext: i32,
    pub fNext: i32,
    pub fSpecifyDsmccOptions: i32,
    pub Dsmcc: DSMCC_FILTER_OPTIONS,
    pub fSpecifyAtscOptions: i32,
    pub Atsc: ATSC_FILTER_OPTIONS,
}

#[repr(C, packed(1))]
pub struct MPEG_SERVICE_REQUEST {
    pub Type: i32,
    pub Context: MPEG_CONTEXT,
    pub Pid: u16,
    pub TableId: u8,
    pub Filter: MPEG2_FILTER,
    pub Flags: u32,
}
import "golang.org/x/sys/windows"

type MPEG_CONTEXT struct {
	Type int32
	U _U_e__Union
}

type DSMCC_FILTER_OPTIONS struct {
	fSpecifyProtocol int32
	Protocol byte
	fSpecifyType int32
	Type byte
	fSpecifyMessageId int32
	MessageId uint16
	fSpecifyTransactionId int32
	fUseTrxIdMessageIdMask int32
	TransactionId uint32
	fSpecifyModuleVersion int32
	ModuleVersion byte
	fSpecifyBlockNumber int32
	BlockNumber uint16
	fGetModuleCall int32
	NumberOfBlocksInModule uint16
}

type ATSC_FILTER_OPTIONS struct {
	fSpecifyEtmId int32
	EtmId uint32
}

type MPEG2_FILTER struct {
	bVersionNumber byte
	wFilterSize uint16
	fUseRawFilteringBits int32
	Filter [16]byte
	Mask [16]byte
	fSpecifyTableIdExtension int32
	TableIdExtension uint16
	fSpecifyVersion int32
	Version byte
	fSpecifySectionNumber int32
	SectionNumber byte
	fSpecifyCurrentNext int32
	fNext int32
	fSpecifyDsmccOptions int32
	Dsmcc DSMCC_FILTER_OPTIONS
	fSpecifyAtscOptions int32
	Atsc ATSC_FILTER_OPTIONS
}

type MPEG_SERVICE_REQUEST struct {
	Type int32
	Context MPEG_CONTEXT
	Pid uint16
	TableId byte
	Filter MPEG2_FILTER
	Flags uint32
}
type
  MPEG_CONTEXT = packed record
    Type: Integer;
    U: _U_e__Union;
  end;

  DSMCC_FILTER_OPTIONS = packed record
    fSpecifyProtocol: BOOL;
    Protocol: Byte;
    fSpecifyType: BOOL;
    Type: Byte;
    fSpecifyMessageId: BOOL;
    MessageId: Word;
    fSpecifyTransactionId: BOOL;
    fUseTrxIdMessageIdMask: BOOL;
    TransactionId: DWORD;
    fSpecifyModuleVersion: BOOL;
    ModuleVersion: Byte;
    fSpecifyBlockNumber: BOOL;
    BlockNumber: Word;
    fGetModuleCall: BOOL;
    NumberOfBlocksInModule: Word;
  end;

  ATSC_FILTER_OPTIONS = packed record
    fSpecifyEtmId: BOOL;
    EtmId: DWORD;
  end;

  MPEG2_FILTER = packed record
    bVersionNumber: Byte;
    wFilterSize: Word;
    fUseRawFilteringBits: BOOL;
    Filter: array[0..15] of Byte;
    Mask: array[0..15] of Byte;
    fSpecifyTableIdExtension: BOOL;
    TableIdExtension: Word;
    fSpecifyVersion: BOOL;
    Version: Byte;
    fSpecifySectionNumber: BOOL;
    SectionNumber: Byte;
    fSpecifyCurrentNext: BOOL;
    fNext: BOOL;
    fSpecifyDsmccOptions: BOOL;
    Dsmcc: DSMCC_FILTER_OPTIONS;
    fSpecifyAtscOptions: BOOL;
    Atsc: ATSC_FILTER_OPTIONS;
  end;

  MPEG_SERVICE_REQUEST = packed record
    Type: Integer;
    Context: MPEG_CONTEXT;
    Pid: Word;
    TableId: Byte;
    Filter: MPEG2_FILTER;
    Flags: DWORD;
  end;
const MPEG_CONTEXT = extern struct {
    Type: i32,
    U: _U_e__Union,
};

const DSMCC_FILTER_OPTIONS = extern struct {
    fSpecifyProtocol: i32,
    Protocol: u8,
    fSpecifyType: i32,
    Type: u8,
    fSpecifyMessageId: i32,
    MessageId: u16,
    fSpecifyTransactionId: i32,
    fUseTrxIdMessageIdMask: i32,
    TransactionId: u32,
    fSpecifyModuleVersion: i32,
    ModuleVersion: u8,
    fSpecifyBlockNumber: i32,
    BlockNumber: u16,
    fGetModuleCall: i32,
    NumberOfBlocksInModule: u16,
};

const ATSC_FILTER_OPTIONS = extern struct {
    fSpecifyEtmId: i32,
    EtmId: u32,
};

const MPEG2_FILTER = extern struct {
    bVersionNumber: u8,
    wFilterSize: u16,
    fUseRawFilteringBits: i32,
    Filter: [16]u8,
    Mask: [16]u8,
    fSpecifyTableIdExtension: i32,
    TableIdExtension: u16,
    fSpecifyVersion: i32,
    Version: u8,
    fSpecifySectionNumber: i32,
    SectionNumber: u8,
    fSpecifyCurrentNext: i32,
    fNext: i32,
    fSpecifyDsmccOptions: i32,
    Dsmcc: DSMCC_FILTER_OPTIONS,
    fSpecifyAtscOptions: i32,
    Atsc: ATSC_FILTER_OPTIONS,
};

const MPEG_SERVICE_REQUEST = extern struct {
    Type: i32,
    Context: MPEG_CONTEXT,
    Pid: u16,
    TableId: u8,
    Filter: MPEG2_FILTER,
    Flags: u32,
};
type
  MPEG_CONTEXT {.packed.} = object
    Type: int32
    U: _U_e__Union

  DSMCC_FILTER_OPTIONS {.packed.} = object
    fSpecifyProtocol: int32
    Protocol: uint8
    fSpecifyType: int32
    Type: uint8
    fSpecifyMessageId: int32
    MessageId: uint16
    fSpecifyTransactionId: int32
    fUseTrxIdMessageIdMask: int32
    TransactionId: uint32
    fSpecifyModuleVersion: int32
    ModuleVersion: uint8
    fSpecifyBlockNumber: int32
    BlockNumber: uint16
    fGetModuleCall: int32
    NumberOfBlocksInModule: uint16

  ATSC_FILTER_OPTIONS {.packed.} = object
    fSpecifyEtmId: int32
    EtmId: uint32

  MPEG2_FILTER {.packed.} = object
    bVersionNumber: uint8
    wFilterSize: uint16
    fUseRawFilteringBits: int32
    Filter: array[16, uint8]
    Mask: array[16, uint8]
    fSpecifyTableIdExtension: int32
    TableIdExtension: uint16
    fSpecifyVersion: int32
    Version: uint8
    fSpecifySectionNumber: int32
    SectionNumber: uint8
    fSpecifyCurrentNext: int32
    fNext: int32
    fSpecifyDsmccOptions: int32
    Dsmcc: DSMCC_FILTER_OPTIONS
    fSpecifyAtscOptions: int32
    Atsc: ATSC_FILTER_OPTIONS

  MPEG_SERVICE_REQUEST {.packed.} = object
    Type: int32
    Context: MPEG_CONTEXT
    Pid: uint16
    TableId: uint8
    Filter: MPEG2_FILTER
    Flags: uint32
align(1)
struct MPEG_CONTEXT
{
    int Type;
    _U_e__Union U;
}

align(1)
struct DSMCC_FILTER_OPTIONS
{
    int fSpecifyProtocol;
    ubyte Protocol;
    int fSpecifyType;
    ubyte Type;
    int fSpecifyMessageId;
    ushort MessageId;
    int fSpecifyTransactionId;
    int fUseTrxIdMessageIdMask;
    uint TransactionId;
    int fSpecifyModuleVersion;
    ubyte ModuleVersion;
    int fSpecifyBlockNumber;
    ushort BlockNumber;
    int fGetModuleCall;
    ushort NumberOfBlocksInModule;
}

align(1)
struct ATSC_FILTER_OPTIONS
{
    int fSpecifyEtmId;
    uint EtmId;
}

align(1)
struct MPEG2_FILTER
{
    ubyte bVersionNumber;
    ushort wFilterSize;
    int fUseRawFilteringBits;
    ubyte[16] Filter;
    ubyte[16] Mask;
    int fSpecifyTableIdExtension;
    ushort TableIdExtension;
    int fSpecifyVersion;
    ubyte Version;
    int fSpecifySectionNumber;
    ubyte SectionNumber;
    int fSpecifyCurrentNext;
    int fNext;
    int fSpecifyDsmccOptions;
    DSMCC_FILTER_OPTIONS Dsmcc;
    int fSpecifyAtscOptions;
    ATSC_FILTER_OPTIONS Atsc;
}

align(1)
struct MPEG_SERVICE_REQUEST
{
    int Type;
    MPEG_CONTEXT Context;
    ushort Pid;
    ubyte TableId;
    MPEG2_FILTER Filter;
    uint Flags;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; MPEG_SERVICE_REQUEST サイズ: 143 バイト(x64)
dim st, 36    ; 4byte整数×36(構造体サイズ 143 / 4 切り上げ)
; Type : MPEG_REQUEST_TYPE (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; Context : MPEG_CONTEXT (+4, 8byte)  varptr(st)+4 を基点に操作(8byte:入れ子/配列)
; Pid : WORD (+12, 2byte)  wpoke st,12,値  /  値 = wpeek(st,12)
; TableId : BYTE (+14, 1byte)  poke st,14,値  /  値 = peek(st,14)
; Filter : MPEG2_FILTER (+15, 124byte)  varptr(st)+15 を基点に操作(124byte:入れ子/配列)
; Flags : DWORD (+139, 4byte)  lpoke st,139,値  /  値 = lpeek(st,139)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global MPEG_CONTEXT, pack=1
    #field int Type
    #field byte U 4
#endstruct

#defstruct global DSMCC_FILTER_OPTIONS, pack=1
    #field bool fSpecifyProtocol
    #field byte Protocol
    #field bool fSpecifyType
    #field byte Type
    #field bool fSpecifyMessageId
    #field short MessageId
    #field bool fSpecifyTransactionId
    #field bool fUseTrxIdMessageIdMask
    #field int TransactionId
    #field bool fSpecifyModuleVersion
    #field byte ModuleVersion
    #field bool fSpecifyBlockNumber
    #field short BlockNumber
    #field bool fGetModuleCall
    #field short NumberOfBlocksInModule
#endstruct

#defstruct global ATSC_FILTER_OPTIONS, pack=1
    #field bool fSpecifyEtmId
    #field int EtmId
#endstruct

#defstruct global MPEG2_FILTER, pack=1
    #field byte bVersionNumber
    #field short wFilterSize
    #field bool fUseRawFilteringBits
    #field byte Filter 16
    #field byte Mask 16
    #field bool fSpecifyTableIdExtension
    #field short TableIdExtension
    #field bool fSpecifyVersion
    #field byte Version
    #field bool fSpecifySectionNumber
    #field byte SectionNumber
    #field bool fSpecifyCurrentNext
    #field bool fNext
    #field bool fSpecifyDsmccOptions
    #field DSMCC_FILTER_OPTIONS Dsmcc
    #field bool fSpecifyAtscOptions
    #field ATSC_FILTER_OPTIONS Atsc
#endstruct

#defstruct global MPEG_SERVICE_REQUEST, pack=1
    #field int Type
    #field MPEG_CONTEXT Context
    #field short Pid
    #field byte TableId
    #field MPEG2_FILTER Filter
    #field int Flags
#endstruct

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