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

D3D12_VIDEO_SAMPLE

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

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

フィールド

フィールドサイズx64x86説明
WidthDWORD4+0+0映像サンプルの幅(ピクセル単位)。
HeightDWORD4+4+4映像サンプルの高さ(ピクセル単位)。
FormatD3D12_VIDEO_FORMAT8+8+8映像サンプルの形式と色空間を示すD3D12_VIDEO_FORMAT。

各言語での定義

#include <windows.h>

// D3D12_VIDEO_FORMAT  (x64 8 / x86 8 バイト)
typedef struct D3D12_VIDEO_FORMAT {
    DXGI_FORMAT Format;
    DXGI_COLOR_SPACE_TYPE ColorSpace;
} D3D12_VIDEO_FORMAT;

// D3D12_VIDEO_SAMPLE  (x64 16 / x86 16 バイト)
typedef struct D3D12_VIDEO_SAMPLE {
    DWORD Width;
    DWORD Height;
    D3D12_VIDEO_FORMAT Format;
} D3D12_VIDEO_SAMPLE;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D12_VIDEO_FORMAT
{
    public int Format;
    public int ColorSpace;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D12_VIDEO_SAMPLE
{
    public uint Width;
    public uint Height;
    public D3D12_VIDEO_FORMAT Format;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D12_VIDEO_FORMAT
    Public Format As Integer
    Public ColorSpace As Integer
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D12_VIDEO_SAMPLE
    Public Width As UInteger
    Public Height As UInteger
    Public Format As D3D12_VIDEO_FORMAT
End Structure
import ctypes
from ctypes import wintypes

class D3D12_VIDEO_FORMAT(ctypes.Structure):
    _fields_ = [
        ("Format", ctypes.c_int),
        ("ColorSpace", ctypes.c_int),
    ]

class D3D12_VIDEO_SAMPLE(ctypes.Structure):
    _fields_ = [
        ("Width", wintypes.DWORD),
        ("Height", wintypes.DWORD),
        ("Format", D3D12_VIDEO_FORMAT),
    ]
#[repr(C)]
pub struct D3D12_VIDEO_FORMAT {
    pub Format: i32,
    pub ColorSpace: i32,
}

#[repr(C)]
pub struct D3D12_VIDEO_SAMPLE {
    pub Width: u32,
    pub Height: u32,
    pub Format: D3D12_VIDEO_FORMAT,
}
import "golang.org/x/sys/windows"

type D3D12_VIDEO_FORMAT struct {
	Format int32
	ColorSpace int32
}

type D3D12_VIDEO_SAMPLE struct {
	Width uint32
	Height uint32
	Format D3D12_VIDEO_FORMAT
}
type
  D3D12_VIDEO_FORMAT = record
    Format: Integer;
    ColorSpace: Integer;
  end;

  D3D12_VIDEO_SAMPLE = record
    Width: DWORD;
    Height: DWORD;
    Format: D3D12_VIDEO_FORMAT;
  end;
const D3D12_VIDEO_FORMAT = extern struct {
    Format: i32,
    ColorSpace: i32,
};

const D3D12_VIDEO_SAMPLE = extern struct {
    Width: u32,
    Height: u32,
    Format: D3D12_VIDEO_FORMAT,
};
type
  D3D12_VIDEO_FORMAT {.bycopy.} = object
    Format: int32
    ColorSpace: int32

  D3D12_VIDEO_SAMPLE {.bycopy.} = object
    Width: uint32
    Height: uint32
    Format: D3D12_VIDEO_FORMAT
struct D3D12_VIDEO_FORMAT
{
    int Format;
    int ColorSpace;
}

struct D3D12_VIDEO_SAMPLE
{
    uint Width;
    uint Height;
    D3D12_VIDEO_FORMAT Format;
}

HSP用 定義

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

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

#defstruct global D3D12_VIDEO_SAMPLE
    #field int Width
    #field int Height
    #field D3D12_VIDEO_FORMAT Format
#endstruct

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