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

KS_DATARANGE_VIDEO2

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

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

フィールド

フィールドサイズx64x86説明
DataRangeKSDATAFORMAT64+0+0基底となるKSDATAFORMATデータ範囲記述子である。
bFixedSizeSamplesBOOL4+64+64サンプルサイズが固定かを示すブール値である。
bTemporalCompressionBOOL4+68+68時間圧縮(フレーム間圧縮)を行うかを示すブール値である。
StreamDescriptionFlagsDWORD4+72+72ストリーム記述に関するフラグの集合である。
MemoryAllocationFlagsDWORD4+76+76メモリ割り当てに関するフラグの集合である。
ConfigCapsKS_VIDEO_STREAM_CONFIG_CAPS128+80+80ストリーム構成能力を示すKS_VIDEO_STREAM_CONFIG_CAPSである。
VideoInfoHeaderKS_VIDEOINFOHEADER2112+208+208映像フォーマットを記述するKS_VIDEOINFOHEADER2である。

各言語での定義

#include <windows.h>

// KSDATAFORMAT  (x64 64 / x86 64 バイト)
typedef struct KSDATAFORMAT {
    _Anonymous_e__Struct Anonymous;
    LONGLONG Alignment;
} KSDATAFORMAT;

// SIZE  (x64 8 / x86 8 バイト)
typedef struct SIZE {
    INT cx;
    INT cy;
} SIZE;

// KS_VIDEO_STREAM_CONFIG_CAPS  (x64 128 / x86 128 バイト)
typedef struct KS_VIDEO_STREAM_CONFIG_CAPS {
    GUID guid;
    DWORD VideoStandard;
    SIZE InputSize;
    SIZE MinCroppingSize;
    SIZE MaxCroppingSize;
    INT CropGranularityX;
    INT CropGranularityY;
    INT CropAlignX;
    INT CropAlignY;
    SIZE MinOutputSize;
    SIZE MaxOutputSize;
    INT OutputGranularityX;
    INT OutputGranularityY;
    INT StretchTapsX;
    INT StretchTapsY;
    INT ShrinkTapsX;
    INT ShrinkTapsY;
    LONGLONG MinFrameInterval;
    LONGLONG MaxFrameInterval;
    INT MinBitsPerSecond;
    INT MaxBitsPerSecond;
} KS_VIDEO_STREAM_CONFIG_CAPS;

// RECT  (x64 16 / x86 16 バイト)
typedef struct RECT {
    INT left;
    INT top;
    INT right;
    INT bottom;
} RECT;

// KS_BITMAPINFOHEADER  (x64 40 / x86 40 バイト)
typedef struct KS_BITMAPINFOHEADER {
    DWORD biSize;
    INT biWidth;
    INT biHeight;
    WORD biPlanes;
    WORD biBitCount;
    DWORD biCompression;
    DWORD biSizeImage;
    INT biXPelsPerMeter;
    INT biYPelsPerMeter;
    DWORD biClrUsed;
    DWORD biClrImportant;
} KS_BITMAPINFOHEADER;

// KS_VIDEOINFOHEADER2  (x64 112 / x86 112 バイト)
typedef struct KS_VIDEOINFOHEADER2 {
    RECT rcSource;
    RECT rcTarget;
    DWORD dwBitRate;
    DWORD dwBitErrorRate;
    LONGLONG AvgTimePerFrame;
    DWORD dwInterlaceFlags;
    DWORD dwCopyProtectFlags;
    DWORD dwPictAspectRatioX;
    DWORD dwPictAspectRatioY;
    _Anonymous_e__Union Anonymous;
    DWORD dwReserved2;
    KS_BITMAPINFOHEADER bmiHeader;
} KS_VIDEOINFOHEADER2;

// KS_DATARANGE_VIDEO2  (x64 320 / x86 320 バイト)
typedef struct KS_DATARANGE_VIDEO2 {
    KSDATAFORMAT DataRange;
    BOOL bFixedSizeSamples;
    BOOL bTemporalCompression;
    DWORD StreamDescriptionFlags;
    DWORD MemoryAllocationFlags;
    KS_VIDEO_STREAM_CONFIG_CAPS ConfigCaps;
    KS_VIDEOINFOHEADER2 VideoInfoHeader;
} KS_DATARANGE_VIDEO2;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct KSDATAFORMAT
{
    public _Anonymous_e__Struct Anonymous;
    public long Alignment;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SIZE
{
    public int cx;
    public int cy;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct KS_VIDEO_STREAM_CONFIG_CAPS
{
    public Guid guid;
    public uint VideoStandard;
    public SIZE InputSize;
    public SIZE MinCroppingSize;
    public SIZE MaxCroppingSize;
    public int CropGranularityX;
    public int CropGranularityY;
    public int CropAlignX;
    public int CropAlignY;
    public SIZE MinOutputSize;
    public SIZE MaxOutputSize;
    public int OutputGranularityX;
    public int OutputGranularityY;
    public int StretchTapsX;
    public int StretchTapsY;
    public int ShrinkTapsX;
    public int ShrinkTapsY;
    public long MinFrameInterval;
    public long MaxFrameInterval;
    public int MinBitsPerSecond;
    public int MaxBitsPerSecond;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct RECT
{
    public int left;
    public int top;
    public int right;
    public int bottom;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct KS_BITMAPINFOHEADER
{
    public uint biSize;
    public int biWidth;
    public int biHeight;
    public ushort biPlanes;
    public ushort biBitCount;
    public uint biCompression;
    public uint biSizeImage;
    public int biXPelsPerMeter;
    public int biYPelsPerMeter;
    public uint biClrUsed;
    public uint biClrImportant;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct KS_VIDEOINFOHEADER2
{
    public RECT rcSource;
    public RECT rcTarget;
    public uint dwBitRate;
    public uint dwBitErrorRate;
    public long AvgTimePerFrame;
    public uint dwInterlaceFlags;
    public uint dwCopyProtectFlags;
    public uint dwPictAspectRatioX;
    public uint dwPictAspectRatioY;
    public _Anonymous_e__Union Anonymous;
    public uint dwReserved2;
    public KS_BITMAPINFOHEADER bmiHeader;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct KS_DATARANGE_VIDEO2
{
    public KSDATAFORMAT DataRange;
    [MarshalAs(UnmanagedType.Bool)] public bool bFixedSizeSamples;
    [MarshalAs(UnmanagedType.Bool)] public bool bTemporalCompression;
    public uint StreamDescriptionFlags;
    public uint MemoryAllocationFlags;
    public KS_VIDEO_STREAM_CONFIG_CAPS ConfigCaps;
    public KS_VIDEOINFOHEADER2 VideoInfoHeader;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure KSDATAFORMAT
    Public Anonymous As _Anonymous_e__Struct
    Public Alignment As Long
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SIZE
    Public cx As Integer
    Public cy As Integer
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure KS_VIDEO_STREAM_CONFIG_CAPS
    Public guid As Guid
    Public VideoStandard As UInteger
    Public InputSize As SIZE
    Public MinCroppingSize As SIZE
    Public MaxCroppingSize As SIZE
    Public CropGranularityX As Integer
    Public CropGranularityY As Integer
    Public CropAlignX As Integer
    Public CropAlignY As Integer
    Public MinOutputSize As SIZE
    Public MaxOutputSize As SIZE
    Public OutputGranularityX As Integer
    Public OutputGranularityY As Integer
    Public StretchTapsX As Integer
    Public StretchTapsY As Integer
    Public ShrinkTapsX As Integer
    Public ShrinkTapsY As Integer
    Public MinFrameInterval As Long
    Public MaxFrameInterval As Long
    Public MinBitsPerSecond As Integer
    Public MaxBitsPerSecond As Integer
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure RECT
    Public left As Integer
    Public top As Integer
    Public right As Integer
    Public bottom As Integer
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure KS_BITMAPINFOHEADER
    Public biSize As UInteger
    Public biWidth As Integer
    Public biHeight As Integer
    Public biPlanes As UShort
    Public biBitCount As UShort
    Public biCompression As UInteger
    Public biSizeImage As UInteger
    Public biXPelsPerMeter As Integer
    Public biYPelsPerMeter As Integer
    Public biClrUsed As UInteger
    Public biClrImportant As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure KS_VIDEOINFOHEADER2
    Public rcSource As RECT
    Public rcTarget As RECT
    Public dwBitRate As UInteger
    Public dwBitErrorRate As UInteger
    Public AvgTimePerFrame As Long
    Public dwInterlaceFlags As UInteger
    Public dwCopyProtectFlags As UInteger
    Public dwPictAspectRatioX As UInteger
    Public dwPictAspectRatioY As UInteger
    Public Anonymous As _Anonymous_e__Union
    Public dwReserved2 As UInteger
    Public bmiHeader As KS_BITMAPINFOHEADER
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure KS_DATARANGE_VIDEO2
    Public DataRange As KSDATAFORMAT
    <MarshalAs(UnmanagedType.Bool)> Public bFixedSizeSamples As Boolean
    <MarshalAs(UnmanagedType.Bool)> Public bTemporalCompression As Boolean
    Public StreamDescriptionFlags As UInteger
    Public MemoryAllocationFlags As UInteger
    Public ConfigCaps As KS_VIDEO_STREAM_CONFIG_CAPS
    Public VideoInfoHeader As KS_VIDEOINFOHEADER2
End Structure
import ctypes
from ctypes import wintypes

class KSDATAFORMAT(ctypes.Structure):
    _fields_ = [
        ("Anonymous", _Anonymous_e__Struct),
        ("Alignment", ctypes.c_longlong),
    ]

class SIZE(ctypes.Structure):
    _fields_ = [
        ("cx", ctypes.c_int),
        ("cy", ctypes.c_int),
    ]

class KS_VIDEO_STREAM_CONFIG_CAPS(ctypes.Structure):
    _fields_ = [
        ("guid", GUID),
        ("VideoStandard", wintypes.DWORD),
        ("InputSize", SIZE),
        ("MinCroppingSize", SIZE),
        ("MaxCroppingSize", SIZE),
        ("CropGranularityX", ctypes.c_int),
        ("CropGranularityY", ctypes.c_int),
        ("CropAlignX", ctypes.c_int),
        ("CropAlignY", ctypes.c_int),
        ("MinOutputSize", SIZE),
        ("MaxOutputSize", SIZE),
        ("OutputGranularityX", ctypes.c_int),
        ("OutputGranularityY", ctypes.c_int),
        ("StretchTapsX", ctypes.c_int),
        ("StretchTapsY", ctypes.c_int),
        ("ShrinkTapsX", ctypes.c_int),
        ("ShrinkTapsY", ctypes.c_int),
        ("MinFrameInterval", ctypes.c_longlong),
        ("MaxFrameInterval", ctypes.c_longlong),
        ("MinBitsPerSecond", ctypes.c_int),
        ("MaxBitsPerSecond", ctypes.c_int),
    ]

class RECT(ctypes.Structure):
    _fields_ = [
        ("left", ctypes.c_int),
        ("top", ctypes.c_int),
        ("right", ctypes.c_int),
        ("bottom", ctypes.c_int),
    ]

class KS_BITMAPINFOHEADER(ctypes.Structure):
    _fields_ = [
        ("biSize", wintypes.DWORD),
        ("biWidth", ctypes.c_int),
        ("biHeight", ctypes.c_int),
        ("biPlanes", ctypes.c_ushort),
        ("biBitCount", ctypes.c_ushort),
        ("biCompression", wintypes.DWORD),
        ("biSizeImage", wintypes.DWORD),
        ("biXPelsPerMeter", ctypes.c_int),
        ("biYPelsPerMeter", ctypes.c_int),
        ("biClrUsed", wintypes.DWORD),
        ("biClrImportant", wintypes.DWORD),
    ]

class KS_VIDEOINFOHEADER2(ctypes.Structure):
    _fields_ = [
        ("rcSource", RECT),
        ("rcTarget", RECT),
        ("dwBitRate", wintypes.DWORD),
        ("dwBitErrorRate", wintypes.DWORD),
        ("AvgTimePerFrame", ctypes.c_longlong),
        ("dwInterlaceFlags", wintypes.DWORD),
        ("dwCopyProtectFlags", wintypes.DWORD),
        ("dwPictAspectRatioX", wintypes.DWORD),
        ("dwPictAspectRatioY", wintypes.DWORD),
        ("Anonymous", _Anonymous_e__Union),
        ("dwReserved2", wintypes.DWORD),
        ("bmiHeader", KS_BITMAPINFOHEADER),
    ]

class KS_DATARANGE_VIDEO2(ctypes.Structure):
    _fields_ = [
        ("DataRange", KSDATAFORMAT),
        ("bFixedSizeSamples", wintypes.BOOL),
        ("bTemporalCompression", wintypes.BOOL),
        ("StreamDescriptionFlags", wintypes.DWORD),
        ("MemoryAllocationFlags", wintypes.DWORD),
        ("ConfigCaps", KS_VIDEO_STREAM_CONFIG_CAPS),
        ("VideoInfoHeader", KS_VIDEOINFOHEADER2),
    ]
#[repr(C)]
pub struct KSDATAFORMAT {
    pub Anonymous: _Anonymous_e__Struct,
    pub Alignment: i64,
}

#[repr(C)]
pub struct SIZE {
    pub cx: i32,
    pub cy: i32,
}

#[repr(C)]
pub struct KS_VIDEO_STREAM_CONFIG_CAPS {
    pub guid: GUID,
    pub VideoStandard: u32,
    pub InputSize: SIZE,
    pub MinCroppingSize: SIZE,
    pub MaxCroppingSize: SIZE,
    pub CropGranularityX: i32,
    pub CropGranularityY: i32,
    pub CropAlignX: i32,
    pub CropAlignY: i32,
    pub MinOutputSize: SIZE,
    pub MaxOutputSize: SIZE,
    pub OutputGranularityX: i32,
    pub OutputGranularityY: i32,
    pub StretchTapsX: i32,
    pub StretchTapsY: i32,
    pub ShrinkTapsX: i32,
    pub ShrinkTapsY: i32,
    pub MinFrameInterval: i64,
    pub MaxFrameInterval: i64,
    pub MinBitsPerSecond: i32,
    pub MaxBitsPerSecond: i32,
}

#[repr(C)]
pub struct RECT {
    pub left: i32,
    pub top: i32,
    pub right: i32,
    pub bottom: i32,
}

#[repr(C)]
pub struct KS_BITMAPINFOHEADER {
    pub biSize: u32,
    pub biWidth: i32,
    pub biHeight: i32,
    pub biPlanes: u16,
    pub biBitCount: u16,
    pub biCompression: u32,
    pub biSizeImage: u32,
    pub biXPelsPerMeter: i32,
    pub biYPelsPerMeter: i32,
    pub biClrUsed: u32,
    pub biClrImportant: u32,
}

#[repr(C)]
pub struct KS_VIDEOINFOHEADER2 {
    pub rcSource: RECT,
    pub rcTarget: RECT,
    pub dwBitRate: u32,
    pub dwBitErrorRate: u32,
    pub AvgTimePerFrame: i64,
    pub dwInterlaceFlags: u32,
    pub dwCopyProtectFlags: u32,
    pub dwPictAspectRatioX: u32,
    pub dwPictAspectRatioY: u32,
    pub Anonymous: _Anonymous_e__Union,
    pub dwReserved2: u32,
    pub bmiHeader: KS_BITMAPINFOHEADER,
}

#[repr(C)]
pub struct KS_DATARANGE_VIDEO2 {
    pub DataRange: KSDATAFORMAT,
    pub bFixedSizeSamples: i32,
    pub bTemporalCompression: i32,
    pub StreamDescriptionFlags: u32,
    pub MemoryAllocationFlags: u32,
    pub ConfigCaps: KS_VIDEO_STREAM_CONFIG_CAPS,
    pub VideoInfoHeader: KS_VIDEOINFOHEADER2,
}
import "golang.org/x/sys/windows"

type KSDATAFORMAT struct {
	Anonymous _Anonymous_e__Struct
	Alignment int64
}

type SIZE struct {
	cx int32
	cy int32
}

type KS_VIDEO_STREAM_CONFIG_CAPS struct {
	guid windows.GUID
	VideoStandard uint32
	InputSize SIZE
	MinCroppingSize SIZE
	MaxCroppingSize SIZE
	CropGranularityX int32
	CropGranularityY int32
	CropAlignX int32
	CropAlignY int32
	MinOutputSize SIZE
	MaxOutputSize SIZE
	OutputGranularityX int32
	OutputGranularityY int32
	StretchTapsX int32
	StretchTapsY int32
	ShrinkTapsX int32
	ShrinkTapsY int32
	MinFrameInterval int64
	MaxFrameInterval int64
	MinBitsPerSecond int32
	MaxBitsPerSecond int32
}

type RECT struct {
	left int32
	top int32
	right int32
	bottom int32
}

type KS_BITMAPINFOHEADER struct {
	biSize uint32
	biWidth int32
	biHeight int32
	biPlanes uint16
	biBitCount uint16
	biCompression uint32
	biSizeImage uint32
	biXPelsPerMeter int32
	biYPelsPerMeter int32
	biClrUsed uint32
	biClrImportant uint32
}

type KS_VIDEOINFOHEADER2 struct {
	rcSource RECT
	rcTarget RECT
	dwBitRate uint32
	dwBitErrorRate uint32
	AvgTimePerFrame int64
	dwInterlaceFlags uint32
	dwCopyProtectFlags uint32
	dwPictAspectRatioX uint32
	dwPictAspectRatioY uint32
	Anonymous _Anonymous_e__Union
	dwReserved2 uint32
	bmiHeader KS_BITMAPINFOHEADER
}

type KS_DATARANGE_VIDEO2 struct {
	DataRange KSDATAFORMAT
	bFixedSizeSamples int32
	bTemporalCompression int32
	StreamDescriptionFlags uint32
	MemoryAllocationFlags uint32
	ConfigCaps KS_VIDEO_STREAM_CONFIG_CAPS
	VideoInfoHeader KS_VIDEOINFOHEADER2
}
type
  KSDATAFORMAT = record
    Anonymous: _Anonymous_e__Struct;
    Alignment: Int64;
  end;

  SIZE = record
    cx: Integer;
    cy: Integer;
  end;

  KS_VIDEO_STREAM_CONFIG_CAPS = record
    guid: TGUID;
    VideoStandard: DWORD;
    InputSize: SIZE;
    MinCroppingSize: SIZE;
    MaxCroppingSize: SIZE;
    CropGranularityX: Integer;
    CropGranularityY: Integer;
    CropAlignX: Integer;
    CropAlignY: Integer;
    MinOutputSize: SIZE;
    MaxOutputSize: SIZE;
    OutputGranularityX: Integer;
    OutputGranularityY: Integer;
    StretchTapsX: Integer;
    StretchTapsY: Integer;
    ShrinkTapsX: Integer;
    ShrinkTapsY: Integer;
    MinFrameInterval: Int64;
    MaxFrameInterval: Int64;
    MinBitsPerSecond: Integer;
    MaxBitsPerSecond: Integer;
  end;

  RECT = record
    left: Integer;
    top: Integer;
    right: Integer;
    bottom: Integer;
  end;

  KS_BITMAPINFOHEADER = record
    biSize: DWORD;
    biWidth: Integer;
    biHeight: Integer;
    biPlanes: Word;
    biBitCount: Word;
    biCompression: DWORD;
    biSizeImage: DWORD;
    biXPelsPerMeter: Integer;
    biYPelsPerMeter: Integer;
    biClrUsed: DWORD;
    biClrImportant: DWORD;
  end;

  KS_VIDEOINFOHEADER2 = record
    rcSource: RECT;
    rcTarget: RECT;
    dwBitRate: DWORD;
    dwBitErrorRate: DWORD;
    AvgTimePerFrame: Int64;
    dwInterlaceFlags: DWORD;
    dwCopyProtectFlags: DWORD;
    dwPictAspectRatioX: DWORD;
    dwPictAspectRatioY: DWORD;
    Anonymous: _Anonymous_e__Union;
    dwReserved2: DWORD;
    bmiHeader: KS_BITMAPINFOHEADER;
  end;

  KS_DATARANGE_VIDEO2 = record
    DataRange: KSDATAFORMAT;
    bFixedSizeSamples: BOOL;
    bTemporalCompression: BOOL;
    StreamDescriptionFlags: DWORD;
    MemoryAllocationFlags: DWORD;
    ConfigCaps: KS_VIDEO_STREAM_CONFIG_CAPS;
    VideoInfoHeader: KS_VIDEOINFOHEADER2;
  end;
const KSDATAFORMAT = extern struct {
    Anonymous: _Anonymous_e__Struct,
    Alignment: i64,
};

const SIZE = extern struct {
    cx: i32,
    cy: i32,
};

const KS_VIDEO_STREAM_CONFIG_CAPS = extern struct {
    guid: GUID,
    VideoStandard: u32,
    InputSize: SIZE,
    MinCroppingSize: SIZE,
    MaxCroppingSize: SIZE,
    CropGranularityX: i32,
    CropGranularityY: i32,
    CropAlignX: i32,
    CropAlignY: i32,
    MinOutputSize: SIZE,
    MaxOutputSize: SIZE,
    OutputGranularityX: i32,
    OutputGranularityY: i32,
    StretchTapsX: i32,
    StretchTapsY: i32,
    ShrinkTapsX: i32,
    ShrinkTapsY: i32,
    MinFrameInterval: i64,
    MaxFrameInterval: i64,
    MinBitsPerSecond: i32,
    MaxBitsPerSecond: i32,
};

const RECT = extern struct {
    left: i32,
    top: i32,
    right: i32,
    bottom: i32,
};

const KS_BITMAPINFOHEADER = extern struct {
    biSize: u32,
    biWidth: i32,
    biHeight: i32,
    biPlanes: u16,
    biBitCount: u16,
    biCompression: u32,
    biSizeImage: u32,
    biXPelsPerMeter: i32,
    biYPelsPerMeter: i32,
    biClrUsed: u32,
    biClrImportant: u32,
};

const KS_VIDEOINFOHEADER2 = extern struct {
    rcSource: RECT,
    rcTarget: RECT,
    dwBitRate: u32,
    dwBitErrorRate: u32,
    AvgTimePerFrame: i64,
    dwInterlaceFlags: u32,
    dwCopyProtectFlags: u32,
    dwPictAspectRatioX: u32,
    dwPictAspectRatioY: u32,
    Anonymous: _Anonymous_e__Union,
    dwReserved2: u32,
    bmiHeader: KS_BITMAPINFOHEADER,
};

const KS_DATARANGE_VIDEO2 = extern struct {
    DataRange: KSDATAFORMAT,
    bFixedSizeSamples: i32,
    bTemporalCompression: i32,
    StreamDescriptionFlags: u32,
    MemoryAllocationFlags: u32,
    ConfigCaps: KS_VIDEO_STREAM_CONFIG_CAPS,
    VideoInfoHeader: KS_VIDEOINFOHEADER2,
};
type
  KSDATAFORMAT {.bycopy.} = object
    Anonymous: _Anonymous_e__Struct
    Alignment: int64

  SIZE {.bycopy.} = object
    cx: int32
    cy: int32

  KS_VIDEO_STREAM_CONFIG_CAPS {.bycopy.} = object
    guid: GUID
    VideoStandard: uint32
    InputSize: SIZE
    MinCroppingSize: SIZE
    MaxCroppingSize: SIZE
    CropGranularityX: int32
    CropGranularityY: int32
    CropAlignX: int32
    CropAlignY: int32
    MinOutputSize: SIZE
    MaxOutputSize: SIZE
    OutputGranularityX: int32
    OutputGranularityY: int32
    StretchTapsX: int32
    StretchTapsY: int32
    ShrinkTapsX: int32
    ShrinkTapsY: int32
    MinFrameInterval: int64
    MaxFrameInterval: int64
    MinBitsPerSecond: int32
    MaxBitsPerSecond: int32

  RECT {.bycopy.} = object
    left: int32
    top: int32
    right: int32
    bottom: int32

  KS_BITMAPINFOHEADER {.bycopy.} = object
    biSize: uint32
    biWidth: int32
    biHeight: int32
    biPlanes: uint16
    biBitCount: uint16
    biCompression: uint32
    biSizeImage: uint32
    biXPelsPerMeter: int32
    biYPelsPerMeter: int32
    biClrUsed: uint32
    biClrImportant: uint32

  KS_VIDEOINFOHEADER2 {.bycopy.} = object
    rcSource: RECT
    rcTarget: RECT
    dwBitRate: uint32
    dwBitErrorRate: uint32
    AvgTimePerFrame: int64
    dwInterlaceFlags: uint32
    dwCopyProtectFlags: uint32
    dwPictAspectRatioX: uint32
    dwPictAspectRatioY: uint32
    Anonymous: _Anonymous_e__Union
    dwReserved2: uint32
    bmiHeader: KS_BITMAPINFOHEADER

  KS_DATARANGE_VIDEO2 {.bycopy.} = object
    DataRange: KSDATAFORMAT
    bFixedSizeSamples: int32
    bTemporalCompression: int32
    StreamDescriptionFlags: uint32
    MemoryAllocationFlags: uint32
    ConfigCaps: KS_VIDEO_STREAM_CONFIG_CAPS
    VideoInfoHeader: KS_VIDEOINFOHEADER2
struct KSDATAFORMAT
{
    _Anonymous_e__Struct Anonymous;
    long Alignment;
}

struct SIZE
{
    int cx;
    int cy;
}

struct KS_VIDEO_STREAM_CONFIG_CAPS
{
    GUID guid;
    uint VideoStandard;
    SIZE InputSize;
    SIZE MinCroppingSize;
    SIZE MaxCroppingSize;
    int CropGranularityX;
    int CropGranularityY;
    int CropAlignX;
    int CropAlignY;
    SIZE MinOutputSize;
    SIZE MaxOutputSize;
    int OutputGranularityX;
    int OutputGranularityY;
    int StretchTapsX;
    int StretchTapsY;
    int ShrinkTapsX;
    int ShrinkTapsY;
    long MinFrameInterval;
    long MaxFrameInterval;
    int MinBitsPerSecond;
    int MaxBitsPerSecond;
}

struct RECT
{
    int left;
    int top;
    int right;
    int bottom;
}

struct KS_BITMAPINFOHEADER
{
    uint biSize;
    int biWidth;
    int biHeight;
    ushort biPlanes;
    ushort biBitCount;
    uint biCompression;
    uint biSizeImage;
    int biXPelsPerMeter;
    int biYPelsPerMeter;
    uint biClrUsed;
    uint biClrImportant;
}

struct KS_VIDEOINFOHEADER2
{
    RECT rcSource;
    RECT rcTarget;
    uint dwBitRate;
    uint dwBitErrorRate;
    long AvgTimePerFrame;
    uint dwInterlaceFlags;
    uint dwCopyProtectFlags;
    uint dwPictAspectRatioX;
    uint dwPictAspectRatioY;
    _Anonymous_e__Union Anonymous;
    uint dwReserved2;
    KS_BITMAPINFOHEADER bmiHeader;
}

struct KS_DATARANGE_VIDEO2
{
    KSDATAFORMAT DataRange;
    int bFixedSizeSamples;
    int bTemporalCompression;
    uint StreamDescriptionFlags;
    uint MemoryAllocationFlags;
    KS_VIDEO_STREAM_CONFIG_CAPS ConfigCaps;
    KS_VIDEOINFOHEADER2 VideoInfoHeader;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; KS_DATARANGE_VIDEO2 サイズ: 320 バイト(x64)
dim st, 80    ; 4byte整数×80(構造体サイズ 320 / 4 切り上げ)
; DataRange : KSDATAFORMAT (+0, 64byte)  varptr(st)+0 を基点に操作(64byte:入れ子/配列)
; bFixedSizeSamples : BOOL (+64, 4byte)  st.16 = 値  /  値 = st.16   (lpoke/lpeek も可)
; bTemporalCompression : BOOL (+68, 4byte)  st.17 = 値  /  値 = st.17   (lpoke/lpeek も可)
; StreamDescriptionFlags : DWORD (+72, 4byte)  st.18 = 値  /  値 = st.18   (lpoke/lpeek も可)
; MemoryAllocationFlags : DWORD (+76, 4byte)  st.19 = 値  /  値 = st.19   (lpoke/lpeek も可)
; ConfigCaps : KS_VIDEO_STREAM_CONFIG_CAPS (+80, 128byte)  varptr(st)+80 を基点に操作(128byte:入れ子/配列)
; VideoInfoHeader : KS_VIDEOINFOHEADER2 (+208, 112byte)  varptr(st)+208 を基点に操作(112byte:入れ子/配列)
; ※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 SIZE
    #field int cx
    #field int cy
#endstruct

#defstruct global KS_VIDEO_STREAM_CONFIG_CAPS
    #field GUID guid
    #field int VideoStandard
    #field SIZE InputSize
    #field SIZE MinCroppingSize
    #field SIZE MaxCroppingSize
    #field int CropGranularityX
    #field int CropGranularityY
    #field int CropAlignX
    #field int CropAlignY
    #field SIZE MinOutputSize
    #field SIZE MaxOutputSize
    #field int OutputGranularityX
    #field int OutputGranularityY
    #field int StretchTapsX
    #field int StretchTapsY
    #field int ShrinkTapsX
    #field int ShrinkTapsY
    #field int64 MinFrameInterval
    #field int64 MaxFrameInterval
    #field int MinBitsPerSecond
    #field int MaxBitsPerSecond
#endstruct

#defstruct global RECT
    #field int left
    #field int top
    #field int right
    #field int bottom
#endstruct

#defstruct global KS_BITMAPINFOHEADER
    #field int biSize
    #field int biWidth
    #field int biHeight
    #field short biPlanes
    #field short biBitCount
    #field int biCompression
    #field int biSizeImage
    #field int biXPelsPerMeter
    #field int biYPelsPerMeter
    #field int biClrUsed
    #field int biClrImportant
#endstruct

#defstruct global KS_VIDEOINFOHEADER2
    #field RECT rcSource
    #field RECT rcTarget
    #field int dwBitRate
    #field int dwBitErrorRate
    #field int64 AvgTimePerFrame
    #field int dwInterlaceFlags
    #field int dwCopyProtectFlags
    #field int dwPictAspectRatioX
    #field int dwPictAspectRatioY
    #field byte Anonymous 4
    #field int dwReserved2
    #field KS_BITMAPINFOHEADER bmiHeader
#endstruct

#defstruct global KS_DATARANGE_VIDEO2
    #field byte DataRange 64
    #field bool bFixedSizeSamples
    #field bool bTemporalCompression
    #field int StreamDescriptionFlags
    #field int MemoryAllocationFlags
    #field KS_VIDEO_STREAM_CONFIG_CAPS ConfigCaps
    #field KS_VIDEOINFOHEADER2 VideoInfoHeader
#endstruct

stdim st, KS_DATARANGE_VIDEO2        ; NSTRUCT 変数を確保
st->bFixedSizeSamples = 100
mes "bFixedSizeSamples=" + st->bFixedSizeSamples
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。