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

MFVIDEOFORMAT

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

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

フィールド

フィールドサイズx64x86説明
dwSizeDWORD4+0+0この構造体全体のバイトサイズ。
videoInfoMFVideoInfo112+8+8ビデオ基本情報を示すMFVideoInfo構造体。
guidFormatGUID16+120+120ビデオ形式(サブタイプ)を識別するGUID。
compressedInfoMFVideoCompressedInfo24+136+136圧縮に関する情報を示すMFVideoCompressedInfo構造体。
surfaceInfoMFVideoSurfaceInfo12+160+160サーフェス・パレット情報を示すMFVideoSurfaceInfo構造体。

各言語での定義

#include <windows.h>

// MFRatio  (x64 8 / x86 8 バイト)
typedef struct MFRatio {
    DWORD Numerator;
    DWORD Denominator;
} MFRatio;

// MFOffset  (x64 4 / x86 4 バイト)
typedef struct MFOffset {
    WORD fract;
    SHORT value;
} MFOffset;

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

// MFVideoArea  (x64 16 / x86 16 バイト)
typedef struct MFVideoArea {
    MFOffset OffsetX;
    MFOffset OffsetY;
    SIZE Area;
} MFVideoArea;

// MFVideoInfo  (x64 112 / x86 112 バイト)
typedef struct MFVideoInfo {
    DWORD dwWidth;
    DWORD dwHeight;
    MFRatio PixelAspectRatio;
    MFVideoChromaSubsampling SourceChromaSubsampling;
    MFVideoInterlaceMode InterlaceMode;
    MFVideoTransferFunction TransferFunction;
    MFVideoPrimaries ColorPrimaries;
    MFVideoTransferMatrix TransferMatrix;
    MFVideoLighting SourceLighting;
    MFRatio FramesPerSecond;
    MFNominalRange NominalRange;
    MFVideoArea GeometricAperture;
    MFVideoArea MinimumDisplayAperture;
    MFVideoArea PanScanAperture;
    ULONGLONG VideoFlags;
} MFVideoInfo;

// MFVideoCompressedInfo  (x64 24 / x86 24 バイト)
typedef struct MFVideoCompressedInfo {
    LONGLONG AvgBitrate;
    LONGLONG AvgBitErrorRate;
    DWORD MaxKeyFrameSpacing;
} MFVideoCompressedInfo;

// MFARGB  (x64 4 / x86 4 バイト)
typedef struct MFARGB {
    BYTE rgbBlue;
    BYTE rgbGreen;
    BYTE rgbRed;
    BYTE rgbAlpha;
} MFARGB;

// MFAYUVSample  (x64 4 / x86 4 バイト)
typedef struct MFAYUVSample {
    BYTE bCrValue;
    BYTE bCbValue;
    BYTE bYValue;
    BYTE bSampleAlpha8;
} MFAYUVSample;

// MFPaletteEntry  (x64 4 / x86 4 バイト)
typedef struct MFPaletteEntry {
    MFARGB ARGB;
    MFAYUVSample AYCbCr;
} MFPaletteEntry;

// MFVideoSurfaceInfo  (x64 12 / x86 12 バイト)
typedef struct MFVideoSurfaceInfo {
    DWORD Format;
    DWORD PaletteEntries;
    MFPaletteEntry Palette[1];
} MFVideoSurfaceInfo;

// MFVIDEOFORMAT  (x64 176 / x86 176 バイト)
typedef struct MFVIDEOFORMAT {
    DWORD dwSize;
    MFVideoInfo videoInfo;
    GUID guidFormat;
    MFVideoCompressedInfo compressedInfo;
    MFVideoSurfaceInfo surfaceInfo;
} MFVIDEOFORMAT;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MFRatio
{
    public uint Numerator;
    public uint Denominator;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MFOffset
{
    public ushort fract;
    public short value;
}

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

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MFVideoArea
{
    public MFOffset OffsetX;
    public MFOffset OffsetY;
    public SIZE Area;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MFVideoInfo
{
    public uint dwWidth;
    public uint dwHeight;
    public MFRatio PixelAspectRatio;
    public int SourceChromaSubsampling;
    public int InterlaceMode;
    public int TransferFunction;
    public int ColorPrimaries;
    public int TransferMatrix;
    public int SourceLighting;
    public MFRatio FramesPerSecond;
    public int NominalRange;
    public MFVideoArea GeometricAperture;
    public MFVideoArea MinimumDisplayAperture;
    public MFVideoArea PanScanAperture;
    public ulong VideoFlags;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MFVideoCompressedInfo
{
    public long AvgBitrate;
    public long AvgBitErrorRate;
    public uint MaxKeyFrameSpacing;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MFARGB
{
    public byte rgbBlue;
    public byte rgbGreen;
    public byte rgbRed;
    public byte rgbAlpha;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MFAYUVSample
{
    public byte bCrValue;
    public byte bCbValue;
    public byte bYValue;
    public byte bSampleAlpha8;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MFPaletteEntry
{
    public MFARGB ARGB;
    public MFAYUVSample AYCbCr;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MFVideoSurfaceInfo
{
    public uint Format;
    public uint PaletteEntries;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public MFPaletteEntry[] Palette;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MFVIDEOFORMAT
{
    public uint dwSize;
    public MFVideoInfo videoInfo;
    public Guid guidFormat;
    public MFVideoCompressedInfo compressedInfo;
    public MFVideoSurfaceInfo surfaceInfo;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MFRatio
    Public Numerator As UInteger
    Public Denominator As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MFOffset
    Public fract As UShort
    Public value As Short
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 MFVideoArea
    Public OffsetX As MFOffset
    Public OffsetY As MFOffset
    Public Area As SIZE
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MFVideoInfo
    Public dwWidth As UInteger
    Public dwHeight As UInteger
    Public PixelAspectRatio As MFRatio
    Public SourceChromaSubsampling As Integer
    Public InterlaceMode As Integer
    Public TransferFunction As Integer
    Public ColorPrimaries As Integer
    Public TransferMatrix As Integer
    Public SourceLighting As Integer
    Public FramesPerSecond As MFRatio
    Public NominalRange As Integer
    Public GeometricAperture As MFVideoArea
    Public MinimumDisplayAperture As MFVideoArea
    Public PanScanAperture As MFVideoArea
    Public VideoFlags As ULong
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MFVideoCompressedInfo
    Public AvgBitrate As Long
    Public AvgBitErrorRate As Long
    Public MaxKeyFrameSpacing As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MFARGB
    Public rgbBlue As Byte
    Public rgbGreen As Byte
    Public rgbRed As Byte
    Public rgbAlpha As Byte
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MFAYUVSample
    Public bCrValue As Byte
    Public bCbValue As Byte
    Public bYValue As Byte
    Public bSampleAlpha8 As Byte
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MFPaletteEntry
    Public ARGB As MFARGB
    Public AYCbCr As MFAYUVSample
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MFVideoSurfaceInfo
    Public Format As UInteger
    Public PaletteEntries As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public Palette() As MFPaletteEntry
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MFVIDEOFORMAT
    Public dwSize As UInteger
    Public videoInfo As MFVideoInfo
    Public guidFormat As Guid
    Public compressedInfo As MFVideoCompressedInfo
    Public surfaceInfo As MFVideoSurfaceInfo
End Structure
import ctypes
from ctypes import wintypes

class MFRatio(ctypes.Structure):
    _fields_ = [
        ("Numerator", wintypes.DWORD),
        ("Denominator", wintypes.DWORD),
    ]

class MFOffset(ctypes.Structure):
    _fields_ = [
        ("fract", ctypes.c_ushort),
        ("value", ctypes.c_short),
    ]

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

class MFVideoArea(ctypes.Structure):
    _fields_ = [
        ("OffsetX", MFOffset),
        ("OffsetY", MFOffset),
        ("Area", SIZE),
    ]

class MFVideoInfo(ctypes.Structure):
    _fields_ = [
        ("dwWidth", wintypes.DWORD),
        ("dwHeight", wintypes.DWORD),
        ("PixelAspectRatio", MFRatio),
        ("SourceChromaSubsampling", ctypes.c_int),
        ("InterlaceMode", ctypes.c_int),
        ("TransferFunction", ctypes.c_int),
        ("ColorPrimaries", ctypes.c_int),
        ("TransferMatrix", ctypes.c_int),
        ("SourceLighting", ctypes.c_int),
        ("FramesPerSecond", MFRatio),
        ("NominalRange", ctypes.c_int),
        ("GeometricAperture", MFVideoArea),
        ("MinimumDisplayAperture", MFVideoArea),
        ("PanScanAperture", MFVideoArea),
        ("VideoFlags", ctypes.c_ulonglong),
    ]

class MFVideoCompressedInfo(ctypes.Structure):
    _fields_ = [
        ("AvgBitrate", ctypes.c_longlong),
        ("AvgBitErrorRate", ctypes.c_longlong),
        ("MaxKeyFrameSpacing", wintypes.DWORD),
    ]

class MFARGB(ctypes.Structure):
    _fields_ = [
        ("rgbBlue", ctypes.c_ubyte),
        ("rgbGreen", ctypes.c_ubyte),
        ("rgbRed", ctypes.c_ubyte),
        ("rgbAlpha", ctypes.c_ubyte),
    ]

class MFAYUVSample(ctypes.Structure):
    _fields_ = [
        ("bCrValue", ctypes.c_ubyte),
        ("bCbValue", ctypes.c_ubyte),
        ("bYValue", ctypes.c_ubyte),
        ("bSampleAlpha8", ctypes.c_ubyte),
    ]

class MFPaletteEntry(ctypes.Structure):
    _fields_ = [
        ("ARGB", MFARGB),
        ("AYCbCr", MFAYUVSample),
    ]

class MFVideoSurfaceInfo(ctypes.Structure):
    _fields_ = [
        ("Format", wintypes.DWORD),
        ("PaletteEntries", wintypes.DWORD),
        ("Palette", MFPaletteEntry * 1),
    ]

class MFVIDEOFORMAT(ctypes.Structure):
    _fields_ = [
        ("dwSize", wintypes.DWORD),
        ("videoInfo", MFVideoInfo),
        ("guidFormat", GUID),
        ("compressedInfo", MFVideoCompressedInfo),
        ("surfaceInfo", MFVideoSurfaceInfo),
    ]
#[repr(C)]
pub struct MFRatio {
    pub Numerator: u32,
    pub Denominator: u32,
}

#[repr(C)]
pub struct MFOffset {
    pub fract: u16,
    pub value: i16,
}

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

#[repr(C)]
pub struct MFVideoArea {
    pub OffsetX: MFOffset,
    pub OffsetY: MFOffset,
    pub Area: SIZE,
}

#[repr(C)]
pub struct MFVideoInfo {
    pub dwWidth: u32,
    pub dwHeight: u32,
    pub PixelAspectRatio: MFRatio,
    pub SourceChromaSubsampling: i32,
    pub InterlaceMode: i32,
    pub TransferFunction: i32,
    pub ColorPrimaries: i32,
    pub TransferMatrix: i32,
    pub SourceLighting: i32,
    pub FramesPerSecond: MFRatio,
    pub NominalRange: i32,
    pub GeometricAperture: MFVideoArea,
    pub MinimumDisplayAperture: MFVideoArea,
    pub PanScanAperture: MFVideoArea,
    pub VideoFlags: u64,
}

#[repr(C)]
pub struct MFVideoCompressedInfo {
    pub AvgBitrate: i64,
    pub AvgBitErrorRate: i64,
    pub MaxKeyFrameSpacing: u32,
}

#[repr(C)]
pub struct MFARGB {
    pub rgbBlue: u8,
    pub rgbGreen: u8,
    pub rgbRed: u8,
    pub rgbAlpha: u8,
}

#[repr(C)]
pub struct MFAYUVSample {
    pub bCrValue: u8,
    pub bCbValue: u8,
    pub bYValue: u8,
    pub bSampleAlpha8: u8,
}

#[repr(C)]
pub struct MFPaletteEntry {
    pub ARGB: MFARGB,
    pub AYCbCr: MFAYUVSample,
}

#[repr(C)]
pub struct MFVideoSurfaceInfo {
    pub Format: u32,
    pub PaletteEntries: u32,
    pub Palette: [MFPaletteEntry; 1],
}

#[repr(C)]
pub struct MFVIDEOFORMAT {
    pub dwSize: u32,
    pub videoInfo: MFVideoInfo,
    pub guidFormat: GUID,
    pub compressedInfo: MFVideoCompressedInfo,
    pub surfaceInfo: MFVideoSurfaceInfo,
}
import "golang.org/x/sys/windows"

type MFRatio struct {
	Numerator uint32
	Denominator uint32
}

type MFOffset struct {
	fract uint16
	value int16
}

type SIZE struct {
	cx int32
	cy int32
}

type MFVideoArea struct {
	OffsetX MFOffset
	OffsetY MFOffset
	Area SIZE
}

type MFVideoInfo struct {
	dwWidth uint32
	dwHeight uint32
	PixelAspectRatio MFRatio
	SourceChromaSubsampling int32
	InterlaceMode int32
	TransferFunction int32
	ColorPrimaries int32
	TransferMatrix int32
	SourceLighting int32
	FramesPerSecond MFRatio
	NominalRange int32
	GeometricAperture MFVideoArea
	MinimumDisplayAperture MFVideoArea
	PanScanAperture MFVideoArea
	VideoFlags uint64
}

type MFVideoCompressedInfo struct {
	AvgBitrate int64
	AvgBitErrorRate int64
	MaxKeyFrameSpacing uint32
}

type MFARGB struct {
	rgbBlue byte
	rgbGreen byte
	rgbRed byte
	rgbAlpha byte
}

type MFAYUVSample struct {
	bCrValue byte
	bCbValue byte
	bYValue byte
	bSampleAlpha8 byte
}

type MFPaletteEntry struct {
	ARGB MFARGB
	AYCbCr MFAYUVSample
}

type MFVideoSurfaceInfo struct {
	Format uint32
	PaletteEntries uint32
	Palette [1]MFPaletteEntry
}

type MFVIDEOFORMAT struct {
	dwSize uint32
	videoInfo MFVideoInfo
	guidFormat windows.GUID
	compressedInfo MFVideoCompressedInfo
	surfaceInfo MFVideoSurfaceInfo
}
type
  MFRatio = record
    Numerator: DWORD;
    Denominator: DWORD;
  end;

  MFOffset = record
    fract: Word;
    value: Smallint;
  end;

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

  MFVideoArea = record
    OffsetX: MFOffset;
    OffsetY: MFOffset;
    Area: SIZE;
  end;

  MFVideoInfo = record
    dwWidth: DWORD;
    dwHeight: DWORD;
    PixelAspectRatio: MFRatio;
    SourceChromaSubsampling: Integer;
    InterlaceMode: Integer;
    TransferFunction: Integer;
    ColorPrimaries: Integer;
    TransferMatrix: Integer;
    SourceLighting: Integer;
    FramesPerSecond: MFRatio;
    NominalRange: Integer;
    GeometricAperture: MFVideoArea;
    MinimumDisplayAperture: MFVideoArea;
    PanScanAperture: MFVideoArea;
    VideoFlags: UInt64;
  end;

  MFVideoCompressedInfo = record
    AvgBitrate: Int64;
    AvgBitErrorRate: Int64;
    MaxKeyFrameSpacing: DWORD;
  end;

  MFARGB = record
    rgbBlue: Byte;
    rgbGreen: Byte;
    rgbRed: Byte;
    rgbAlpha: Byte;
  end;

  MFAYUVSample = record
    bCrValue: Byte;
    bCbValue: Byte;
    bYValue: Byte;
    bSampleAlpha8: Byte;
  end;

  MFPaletteEntry = record
    ARGB: MFARGB;
    AYCbCr: MFAYUVSample;
  end;

  MFVideoSurfaceInfo = record
    Format: DWORD;
    PaletteEntries: DWORD;
    Palette: array[0..0] of MFPaletteEntry;
  end;

  MFVIDEOFORMAT = record
    dwSize: DWORD;
    videoInfo: MFVideoInfo;
    guidFormat: TGUID;
    compressedInfo: MFVideoCompressedInfo;
    surfaceInfo: MFVideoSurfaceInfo;
  end;
const MFRatio = extern struct {
    Numerator: u32,
    Denominator: u32,
};

const MFOffset = extern struct {
    fract: u16,
    value: i16,
};

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

const MFVideoArea = extern struct {
    OffsetX: MFOffset,
    OffsetY: MFOffset,
    Area: SIZE,
};

const MFVideoInfo = extern struct {
    dwWidth: u32,
    dwHeight: u32,
    PixelAspectRatio: MFRatio,
    SourceChromaSubsampling: i32,
    InterlaceMode: i32,
    TransferFunction: i32,
    ColorPrimaries: i32,
    TransferMatrix: i32,
    SourceLighting: i32,
    FramesPerSecond: MFRatio,
    NominalRange: i32,
    GeometricAperture: MFVideoArea,
    MinimumDisplayAperture: MFVideoArea,
    PanScanAperture: MFVideoArea,
    VideoFlags: u64,
};

const MFVideoCompressedInfo = extern struct {
    AvgBitrate: i64,
    AvgBitErrorRate: i64,
    MaxKeyFrameSpacing: u32,
};

const MFARGB = extern struct {
    rgbBlue: u8,
    rgbGreen: u8,
    rgbRed: u8,
    rgbAlpha: u8,
};

const MFAYUVSample = extern struct {
    bCrValue: u8,
    bCbValue: u8,
    bYValue: u8,
    bSampleAlpha8: u8,
};

const MFPaletteEntry = extern struct {
    ARGB: MFARGB,
    AYCbCr: MFAYUVSample,
};

const MFVideoSurfaceInfo = extern struct {
    Format: u32,
    PaletteEntries: u32,
    Palette: [1]MFPaletteEntry,
};

const MFVIDEOFORMAT = extern struct {
    dwSize: u32,
    videoInfo: MFVideoInfo,
    guidFormat: GUID,
    compressedInfo: MFVideoCompressedInfo,
    surfaceInfo: MFVideoSurfaceInfo,
};
type
  MFRatio {.bycopy.} = object
    Numerator: uint32
    Denominator: uint32

  MFOffset {.bycopy.} = object
    fract: uint16
    value: int16

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

  MFVideoArea {.bycopy.} = object
    OffsetX: MFOffset
    OffsetY: MFOffset
    Area: SIZE

  MFVideoInfo {.bycopy.} = object
    dwWidth: uint32
    dwHeight: uint32
    PixelAspectRatio: MFRatio
    SourceChromaSubsampling: int32
    InterlaceMode: int32
    TransferFunction: int32
    ColorPrimaries: int32
    TransferMatrix: int32
    SourceLighting: int32
    FramesPerSecond: MFRatio
    NominalRange: int32
    GeometricAperture: MFVideoArea
    MinimumDisplayAperture: MFVideoArea
    PanScanAperture: MFVideoArea
    VideoFlags: uint64

  MFVideoCompressedInfo {.bycopy.} = object
    AvgBitrate: int64
    AvgBitErrorRate: int64
    MaxKeyFrameSpacing: uint32

  MFARGB {.bycopy.} = object
    rgbBlue: uint8
    rgbGreen: uint8
    rgbRed: uint8
    rgbAlpha: uint8

  MFAYUVSample {.bycopy.} = object
    bCrValue: uint8
    bCbValue: uint8
    bYValue: uint8
    bSampleAlpha8: uint8

  MFPaletteEntry {.bycopy.} = object
    ARGB: MFARGB
    AYCbCr: MFAYUVSample

  MFVideoSurfaceInfo {.bycopy.} = object
    Format: uint32
    PaletteEntries: uint32
    Palette: array[1, MFPaletteEntry]

  MFVIDEOFORMAT {.bycopy.} = object
    dwSize: uint32
    videoInfo: MFVideoInfo
    guidFormat: GUID
    compressedInfo: MFVideoCompressedInfo
    surfaceInfo: MFVideoSurfaceInfo
struct MFRatio
{
    uint Numerator;
    uint Denominator;
}

struct MFOffset
{
    ushort fract;
    short value;
}

struct SIZE
{
    int cx;
    int cy;
}

struct MFVideoArea
{
    MFOffset OffsetX;
    MFOffset OffsetY;
    SIZE Area;
}

struct MFVideoInfo
{
    uint dwWidth;
    uint dwHeight;
    MFRatio PixelAspectRatio;
    int SourceChromaSubsampling;
    int InterlaceMode;
    int TransferFunction;
    int ColorPrimaries;
    int TransferMatrix;
    int SourceLighting;
    MFRatio FramesPerSecond;
    int NominalRange;
    MFVideoArea GeometricAperture;
    MFVideoArea MinimumDisplayAperture;
    MFVideoArea PanScanAperture;
    ulong VideoFlags;
}

struct MFVideoCompressedInfo
{
    long AvgBitrate;
    long AvgBitErrorRate;
    uint MaxKeyFrameSpacing;
}

struct MFARGB
{
    ubyte rgbBlue;
    ubyte rgbGreen;
    ubyte rgbRed;
    ubyte rgbAlpha;
}

struct MFAYUVSample
{
    ubyte bCrValue;
    ubyte bCbValue;
    ubyte bYValue;
    ubyte bSampleAlpha8;
}

struct MFPaletteEntry
{
    MFARGB ARGB;
    MFAYUVSample AYCbCr;
}

struct MFVideoSurfaceInfo
{
    uint Format;
    uint PaletteEntries;
    MFPaletteEntry[1] Palette;
}

struct MFVIDEOFORMAT
{
    uint dwSize;
    MFVideoInfo videoInfo;
    GUID guidFormat;
    MFVideoCompressedInfo compressedInfo;
    MFVideoSurfaceInfo surfaceInfo;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; MFVIDEOFORMAT サイズ: 176 バイト(x64)
dim st, 44    ; 4byte整数×44(構造体サイズ 176 / 4 切り上げ)
; dwSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; videoInfo : MFVideoInfo (+8, 112byte)  varptr(st)+8 を基点に操作(112byte:入れ子/配列)
; guidFormat : GUID (+120, 16byte)  varptr(st)+120 を基点に操作(16byte:入れ子/配列)
; compressedInfo : MFVideoCompressedInfo (+136, 24byte)  varptr(st)+136 を基点に操作(24byte:入れ子/配列)
; surfaceInfo : MFVideoSurfaceInfo (+160, 12byte)  varptr(st)+160 を基点に操作(12byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global MFRatio
    #field int Numerator
    #field int Denominator
#endstruct

#defstruct global MFOffset
    #field short fract
    #field short value
#endstruct

#defstruct global SIZE
    #field int cx
    #field int cy
#endstruct

#defstruct global MFVideoArea
    #field MFOffset OffsetX
    #field MFOffset OffsetY
    #field SIZE Area
#endstruct

#defstruct global MFVideoInfo
    #field int dwWidth
    #field int dwHeight
    #field MFRatio PixelAspectRatio
    #field int SourceChromaSubsampling
    #field int InterlaceMode
    #field int TransferFunction
    #field int ColorPrimaries
    #field int TransferMatrix
    #field int SourceLighting
    #field MFRatio FramesPerSecond
    #field int NominalRange
    #field MFVideoArea GeometricAperture
    #field MFVideoArea MinimumDisplayAperture
    #field MFVideoArea PanScanAperture
    #field int64 VideoFlags
#endstruct

#defstruct global GUID, pack=1
    #field int Data1
    #field short Data2
    #field short Data3
    #field byte Data4 8
#endstruct

#defstruct global MFVideoCompressedInfo
    #field int64 AvgBitrate
    #field int64 AvgBitErrorRate
    #field int MaxKeyFrameSpacing
#endstruct

#defstruct global MFVideoSurfaceInfo
    #field int Format
    #field int PaletteEntries
    #field byte Palette 4
#endstruct

#defstruct global MFVIDEOFORMAT
    #field int dwSize
    #field MFVideoInfo videoInfo
    #field GUID guidFormat
    #field MFVideoCompressedInfo compressedInfo
    #field MFVideoSurfaceInfo surfaceInfo
#endstruct

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