ホーム › Media.MediaFoundation › MFVideoSurfaceInfo
MFVideoSurfaceInfo
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Format | DWORD | 4 | +0 | +0 | サーフェスのピクセル形式を示すFOURCCまたはD3DFORMAT値。 |
| PaletteEntries | DWORD | 4 | +4 | +4 | パレットエントリの数。 |
| Palette | MFPaletteEntry | 4 | +8 | +8 | パレットエントリの配列(MFPaletteEntry)。可変長配列の先頭。 |
各言語での定義
#include <windows.h>
// 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;using System;
using System.Runtime.InteropServices;
[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;
}Imports System.Runtime.InteropServices
<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 Structureimport ctypes
from ctypes import wintypes
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),
]#[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],
}import "golang.org/x/sys/windows"
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
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;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,
};type
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]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;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; MFVideoSurfaceInfo サイズ: 12 バイト(x64)
dim st, 3 ; 4byte整数×3(構造体サイズ 12 / 4 切り上げ)
; Format : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; PaletteEntries : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; Palette : MFPaletteEntry (+8, 4byte) varptr(st)+8 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global MFVideoSurfaceInfo
#field int Format
#field int PaletteEntries
#field byte Palette 4
#endstruct
stdim st, MFVideoSurfaceInfo ; NSTRUCT 変数を確保
st->Format = 100
mes "Format=" + st->Format
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。