ホーム › Media.DirectShow.Tv › DvbParentalRatingDescriptor
DvbParentalRatingDescriptor
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| ulNumParams | DWORD | 4 | +0 | +0 | pParamsに含まれるレーティングパラメータの個数を示す。 |
| pParams | DvbParentalRatingParam | 5 | +4 | +4 | DvbParentalRatingParam配列の先頭要素。各国レーティングを保持する。 |
各言語での定義
#include <windows.h>
// DvbParentalRatingParam (x64 5 / x86 5 バイト)
typedef struct DvbParentalRatingParam {
CHAR szCountryCode[4];
BYTE bRating;
} DvbParentalRatingParam;
// DvbParentalRatingDescriptor (x64 12 / x86 12 バイト)
typedef struct DvbParentalRatingDescriptor {
DWORD ulNumParams;
DvbParentalRatingParam pParams[1];
} DvbParentalRatingDescriptor;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DvbParentalRatingParam
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public sbyte[] szCountryCode;
public byte bRating;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DvbParentalRatingDescriptor
{
public uint ulNumParams;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public DvbParentalRatingParam[] pParams;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DvbParentalRatingParam
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=4)> Public szCountryCode() As SByte
Public bRating As Byte
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DvbParentalRatingDescriptor
Public ulNumParams As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public pParams() As DvbParentalRatingParam
End Structureimport ctypes
from ctypes import wintypes
class DvbParentalRatingParam(ctypes.Structure):
_fields_ = [
("szCountryCode", ctypes.c_byte * 4),
("bRating", ctypes.c_ubyte),
]
class DvbParentalRatingDescriptor(ctypes.Structure):
_fields_ = [
("ulNumParams", wintypes.DWORD),
("pParams", DvbParentalRatingParam * 1),
]#[repr(C)]
pub struct DvbParentalRatingParam {
pub szCountryCode: [i8; 4],
pub bRating: u8,
}
#[repr(C)]
pub struct DvbParentalRatingDescriptor {
pub ulNumParams: u32,
pub pParams: [DvbParentalRatingParam; 1],
}import "golang.org/x/sys/windows"
type DvbParentalRatingParam struct {
szCountryCode [4]int8
bRating byte
}
type DvbParentalRatingDescriptor struct {
ulNumParams uint32
pParams [1]DvbParentalRatingParam
}type
DvbParentalRatingParam = record
szCountryCode: array[0..3] of Shortint;
bRating: Byte;
end;
DvbParentalRatingDescriptor = record
ulNumParams: DWORD;
pParams: array[0..0] of DvbParentalRatingParam;
end;const DvbParentalRatingParam = extern struct {
szCountryCode: [4]i8,
bRating: u8,
};
const DvbParentalRatingDescriptor = extern struct {
ulNumParams: u32,
pParams: [1]DvbParentalRatingParam,
};type
DvbParentalRatingParam {.bycopy.} = object
szCountryCode: array[4, int8]
bRating: uint8
DvbParentalRatingDescriptor {.bycopy.} = object
ulNumParams: uint32
pParams: array[1, DvbParentalRatingParam]struct DvbParentalRatingParam
{
byte[4] szCountryCode;
ubyte bRating;
}
struct DvbParentalRatingDescriptor
{
uint ulNumParams;
DvbParentalRatingParam[1] pParams;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DvbParentalRatingDescriptor サイズ: 12 バイト(x64)
dim st, 3 ; 4byte整数×3(構造体サイズ 12 / 4 切り上げ)
; ulNumParams : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; pParams : DvbParentalRatingParam (+4, 5byte) varptr(st)+4 を基点に操作(5byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global DvbParentalRatingParam
#field byte szCountryCode 4
#field byte bRating
#endstruct
#defstruct global DvbParentalRatingDescriptor
#field int ulNumParams
#field DvbParentalRatingParam pParams 1
#endstruct
stdim st, DvbParentalRatingDescriptor ; NSTRUCT 変数を確保
st->ulNumParams = 100
mes "ulNumParams=" + st->ulNumParams