ホーム › Media.DirectShow.Tv › DSMCC_SECTION
DSMCC_SECTION
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| TableId | BYTE | 1 | +0 | +0 | DSM-CCセクションのテーブルID。 |
| Header | _Header_e__Union | 2 | +1 | +1 | セクションヘッダ情報を表す無名共用体。 |
| TableIdExtension | WORD | 2 | +3 | +3 | テーブルID拡張値。サブテーブルを識別する。 |
| Version | _Version_e__Union | 1 | +5 | +5 | バージョン番号とカレント/ネクスト表示を含む無名共用体。 |
| SectionNumber | BYTE | 1 | +6 | +6 | セクション番号。分割セクションの順序を示す。 |
| LastSectionNumber | BYTE | 1 | +7 | +7 | 最終セクション番号。全体のセクション数を示す。 |
| ProtocolDiscriminator | BYTE | 1 | +8 | +8 | DSM-CCプロトコル識別子。 |
| DsmccType | BYTE | 1 | +9 | +9 | DSM-CCメッセージの種別を示す値。 |
| MessageId | WORD | 2 | +10 | +10 | DSM-CCメッセージID。 |
| TransactionId | DWORD | 4 | +12 | +12 | DSM-CCトランザクションID。 |
| Reserved | BYTE | 1 | +16 | +16 | 予約フィールド。将来の拡張用で通常は0。 |
| AdaptationLength | BYTE | 1 | +17 | +17 | アダプテーションヘッダのバイト長。 |
| MessageLength | WORD | 2 | +18 | +18 | メッセージ本体のバイト長。 |
| RemainingData | BYTE | 1 | +20 | +20 | 残りのデータの可変長配列。先頭1バイトを起点とする。 |
共用体: _Header_e__Union x64 2B / x86 2B
| フィールド | 型 | サイズ | x64 | x86 |
|---|---|---|---|---|
| S | MPEG_HEADER_BITS_MIDL | 2 | +0 | +0 |
| W | WORD | 2 | +0 | +0 |
共用体: _Version_e__Union x64 1B / x86 1B
| フィールド | 型 | サイズ | x64 | x86 |
|---|---|---|---|---|
| S | MPEG_HEADER_VERSION_BITS_MIDL | 1 | +0 | +0 |
| B | BYTE | 1 | +0 | +0 |
各言語での定義
#include <windows.h>
// DSMCC_SECTION (x64 21 / x86 21 バイト)
#pragma pack(push, 1)
typedef struct DSMCC_SECTION {
BYTE TableId;
_Header_e__Union Header;
WORD TableIdExtension;
_Version_e__Union Version;
BYTE SectionNumber;
BYTE LastSectionNumber;
BYTE ProtocolDiscriminator;
BYTE DsmccType;
WORD MessageId;
DWORD TransactionId;
BYTE Reserved;
BYTE AdaptationLength;
WORD MessageLength;
BYTE RemainingData[1];
} DSMCC_SECTION;
#pragma pack(pop)using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct DSMCC_SECTION
{
public byte TableId;
public _Header_e__Union Header;
public ushort TableIdExtension;
public _Version_e__Union Version;
public byte SectionNumber;
public byte LastSectionNumber;
public byte ProtocolDiscriminator;
public byte DsmccType;
public ushort MessageId;
public uint TransactionId;
public byte Reserved;
public byte AdaptationLength;
public ushort MessageLength;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public byte[] RemainingData;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure DSMCC_SECTION
Public TableId As Byte
Public Header As _Header_e__Union
Public TableIdExtension As UShort
Public Version As _Version_e__Union
Public SectionNumber As Byte
Public LastSectionNumber As Byte
Public ProtocolDiscriminator As Byte
Public DsmccType As Byte
Public MessageId As UShort
Public TransactionId As UInteger
Public Reserved As Byte
Public AdaptationLength As Byte
Public MessageLength As UShort
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public RemainingData() As Byte
End Structureimport ctypes
from ctypes import wintypes
class DSMCC_SECTION(ctypes.Structure):
_pack_ = 1
_fields_ = [
("TableId", ctypes.c_ubyte),
("Header", _Header_e__Union),
("TableIdExtension", ctypes.c_ushort),
("Version", _Version_e__Union),
("SectionNumber", ctypes.c_ubyte),
("LastSectionNumber", ctypes.c_ubyte),
("ProtocolDiscriminator", ctypes.c_ubyte),
("DsmccType", ctypes.c_ubyte),
("MessageId", ctypes.c_ushort),
("TransactionId", wintypes.DWORD),
("Reserved", ctypes.c_ubyte),
("AdaptationLength", ctypes.c_ubyte),
("MessageLength", ctypes.c_ushort),
("RemainingData", ctypes.c_ubyte * 1),
]#[repr(C, packed(1))]
pub struct DSMCC_SECTION {
pub TableId: u8,
pub Header: _Header_e__Union,
pub TableIdExtension: u16,
pub Version: _Version_e__Union,
pub SectionNumber: u8,
pub LastSectionNumber: u8,
pub ProtocolDiscriminator: u8,
pub DsmccType: u8,
pub MessageId: u16,
pub TransactionId: u32,
pub Reserved: u8,
pub AdaptationLength: u8,
pub MessageLength: u16,
pub RemainingData: [u8; 1],
}import "golang.org/x/sys/windows"
type DSMCC_SECTION struct {
TableId byte
Header _Header_e__Union
TableIdExtension uint16
Version _Version_e__Union
SectionNumber byte
LastSectionNumber byte
ProtocolDiscriminator byte
DsmccType byte
MessageId uint16
TransactionId uint32
Reserved byte
AdaptationLength byte
MessageLength uint16
RemainingData [1]byte
}type
DSMCC_SECTION = packed record
TableId: Byte;
Header: _Header_e__Union;
TableIdExtension: Word;
Version: _Version_e__Union;
SectionNumber: Byte;
LastSectionNumber: Byte;
ProtocolDiscriminator: Byte;
DsmccType: Byte;
MessageId: Word;
TransactionId: DWORD;
Reserved: Byte;
AdaptationLength: Byte;
MessageLength: Word;
RemainingData: array[0..0] of Byte;
end;const DSMCC_SECTION = extern struct {
TableId: u8,
Header: _Header_e__Union,
TableIdExtension: u16,
Version: _Version_e__Union,
SectionNumber: u8,
LastSectionNumber: u8,
ProtocolDiscriminator: u8,
DsmccType: u8,
MessageId: u16,
TransactionId: u32,
Reserved: u8,
AdaptationLength: u8,
MessageLength: u16,
RemainingData: [1]u8,
};type
DSMCC_SECTION {.packed.} = object
TableId: uint8
Header: _Header_e__Union
TableIdExtension: uint16
Version: _Version_e__Union
SectionNumber: uint8
LastSectionNumber: uint8
ProtocolDiscriminator: uint8
DsmccType: uint8
MessageId: uint16
TransactionId: uint32
Reserved: uint8
AdaptationLength: uint8
MessageLength: uint16
RemainingData: array[1, uint8]align(1)
struct DSMCC_SECTION
{
ubyte TableId;
_Header_e__Union Header;
ushort TableIdExtension;
_Version_e__Union Version;
ubyte SectionNumber;
ubyte LastSectionNumber;
ubyte ProtocolDiscriminator;
ubyte DsmccType;
ushort MessageId;
uint TransactionId;
ubyte Reserved;
ubyte AdaptationLength;
ushort MessageLength;
ubyte[1] RemainingData;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DSMCC_SECTION サイズ: 21 バイト(x64)
dim st, 6 ; 4byte整数×6(構造体サイズ 21 / 4 切り上げ)
; TableId : BYTE (+0, 1byte) poke st,0,値 / 値 = peek(st,0)
; Header : _Header_e__Union (+1, 2byte) varptr(st)+1 を基点に操作(2byte:入れ子/配列)
; TableIdExtension : WORD (+3, 2byte) wpoke st,3,値 / 値 = wpeek(st,3)
; Version : _Version_e__Union (+5, 1byte) varptr(st)+5 を基点に操作(1byte:入れ子/配列)
; SectionNumber : BYTE (+6, 1byte) poke st,6,値 / 値 = peek(st,6)
; LastSectionNumber : BYTE (+7, 1byte) poke st,7,値 / 値 = peek(st,7)
; ProtocolDiscriminator : BYTE (+8, 1byte) poke st,8,値 / 値 = peek(st,8)
; DsmccType : BYTE (+9, 1byte) poke st,9,値 / 値 = peek(st,9)
; MessageId : WORD (+10, 2byte) wpoke st,10,値 / 値 = wpeek(st,10)
; TransactionId : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; Reserved : BYTE (+16, 1byte) poke st,16,値 / 値 = peek(st,16)
; AdaptationLength : BYTE (+17, 1byte) poke st,17,値 / 値 = peek(st,17)
; MessageLength : WORD (+18, 2byte) wpoke st,18,値 / 値 = wpeek(st,18)
; RemainingData : BYTE (+20, 1byte) varptr(st)+20 を基点に操作(1byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DSMCC_SECTION, pack=1
#field byte TableId
#field byte Header 2
#field short TableIdExtension
#field byte Version 1
#field byte SectionNumber
#field byte LastSectionNumber
#field byte ProtocolDiscriminator
#field byte DsmccType
#field short MessageId
#field int TransactionId
#field byte Reserved
#field byte AdaptationLength
#field short MessageLength
#field byte RemainingData 1
#endstruct
stdim st, DSMCC_SECTION ; NSTRUCT 変数を確保
st->TableId = 100
mes "TableId=" + st->TableId
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。