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

DXVAHD_BLT_STATE_BACKGROUND_COLOR_DATA

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

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

フィールド

フィールドサイズx64x86説明
YCbCrBOOL4+0+0背景色をYCbCr形式で扱うか否かを示す。TRUEでYCbCr、FALSEでRGB。
BackgroundColorDXVAHD_COLOR16+4+4出力背景に塗りつぶす色を示す。

各言語での定義

#include <windows.h>

// DXVAHD_COLOR_RGBA  (x64 16 / x86 16 バイト)
typedef struct DXVAHD_COLOR_RGBA {
    FLOAT R;
    FLOAT G;
    FLOAT B;
    FLOAT A;
} DXVAHD_COLOR_RGBA;

// DXVAHD_COLOR_YCbCrA  (x64 16 / x86 16 バイト)
typedef struct DXVAHD_COLOR_YCbCrA {
    FLOAT Y;
    FLOAT Cb;
    FLOAT Cr;
    FLOAT A;
} DXVAHD_COLOR_YCbCrA;

// DXVAHD_COLOR  (x64 16 / x86 16 バイト)
typedef struct DXVAHD_COLOR {
    DXVAHD_COLOR_RGBA RGB;
    DXVAHD_COLOR_YCbCrA YCbCr;
} DXVAHD_COLOR;

// DXVAHD_BLT_STATE_BACKGROUND_COLOR_DATA  (x64 20 / x86 20 バイト)
typedef struct DXVAHD_BLT_STATE_BACKGROUND_COLOR_DATA {
    BOOL YCbCr;
    DXVAHD_COLOR BackgroundColor;
} DXVAHD_BLT_STATE_BACKGROUND_COLOR_DATA;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DXVAHD_COLOR_RGBA
{
    public float R;
    public float G;
    public float B;
    public float A;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DXVAHD_COLOR_YCbCrA
{
    public float Y;
    public float Cb;
    public float Cr;
    public float A;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DXVAHD_COLOR
{
    public DXVAHD_COLOR_RGBA RGB;
    public DXVAHD_COLOR_YCbCrA YCbCr;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DXVAHD_BLT_STATE_BACKGROUND_COLOR_DATA
{
    [MarshalAs(UnmanagedType.Bool)] public bool YCbCr;
    public DXVAHD_COLOR BackgroundColor;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DXVAHD_COLOR_RGBA
    Public R As Single
    Public G As Single
    Public B As Single
    Public A As Single
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DXVAHD_COLOR_YCbCrA
    Public Y As Single
    Public Cb As Single
    Public Cr As Single
    Public A As Single
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DXVAHD_COLOR
    Public RGB As DXVAHD_COLOR_RGBA
    Public YCbCr As DXVAHD_COLOR_YCbCrA
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DXVAHD_BLT_STATE_BACKGROUND_COLOR_DATA
    <MarshalAs(UnmanagedType.Bool)> Public YCbCr As Boolean
    Public BackgroundColor As DXVAHD_COLOR
End Structure
import ctypes
from ctypes import wintypes

class DXVAHD_COLOR_RGBA(ctypes.Structure):
    _fields_ = [
        ("R", ctypes.c_float),
        ("G", ctypes.c_float),
        ("B", ctypes.c_float),
        ("A", ctypes.c_float),
    ]

class DXVAHD_COLOR_YCbCrA(ctypes.Structure):
    _fields_ = [
        ("Y", ctypes.c_float),
        ("Cb", ctypes.c_float),
        ("Cr", ctypes.c_float),
        ("A", ctypes.c_float),
    ]

class DXVAHD_COLOR(ctypes.Structure):
    _fields_ = [
        ("RGB", DXVAHD_COLOR_RGBA),
        ("YCbCr", DXVAHD_COLOR_YCbCrA),
    ]

class DXVAHD_BLT_STATE_BACKGROUND_COLOR_DATA(ctypes.Structure):
    _fields_ = [
        ("YCbCr", wintypes.BOOL),
        ("BackgroundColor", DXVAHD_COLOR),
    ]
#[repr(C)]
pub struct DXVAHD_COLOR_RGBA {
    pub R: f32,
    pub G: f32,
    pub B: f32,
    pub A: f32,
}

#[repr(C)]
pub struct DXVAHD_COLOR_YCbCrA {
    pub Y: f32,
    pub Cb: f32,
    pub Cr: f32,
    pub A: f32,
}

#[repr(C)]
pub struct DXVAHD_COLOR {
    pub RGB: DXVAHD_COLOR_RGBA,
    pub YCbCr: DXVAHD_COLOR_YCbCrA,
}

#[repr(C)]
pub struct DXVAHD_BLT_STATE_BACKGROUND_COLOR_DATA {
    pub YCbCr: i32,
    pub BackgroundColor: DXVAHD_COLOR,
}
import "golang.org/x/sys/windows"

type DXVAHD_COLOR_RGBA struct {
	R float32
	G float32
	B float32
	A float32
}

type DXVAHD_COLOR_YCbCrA struct {
	Y float32
	Cb float32
	Cr float32
	A float32
}

type DXVAHD_COLOR struct {
	RGB DXVAHD_COLOR_RGBA
	YCbCr DXVAHD_COLOR_YCbCrA
}

type DXVAHD_BLT_STATE_BACKGROUND_COLOR_DATA struct {
	YCbCr int32
	BackgroundColor DXVAHD_COLOR
}
type
  DXVAHD_COLOR_RGBA = record
    R: Single;
    G: Single;
    B: Single;
    A: Single;
  end;

  DXVAHD_COLOR_YCbCrA = record
    Y: Single;
    Cb: Single;
    Cr: Single;
    A: Single;
  end;

  DXVAHD_COLOR = record
    RGB: DXVAHD_COLOR_RGBA;
    YCbCr: DXVAHD_COLOR_YCbCrA;
  end;

  DXVAHD_BLT_STATE_BACKGROUND_COLOR_DATA = record
    YCbCr: BOOL;
    BackgroundColor: DXVAHD_COLOR;
  end;
const DXVAHD_COLOR_RGBA = extern struct {
    R: f32,
    G: f32,
    B: f32,
    A: f32,
};

const DXVAHD_COLOR_YCbCrA = extern struct {
    Y: f32,
    Cb: f32,
    Cr: f32,
    A: f32,
};

const DXVAHD_COLOR = extern struct {
    RGB: DXVAHD_COLOR_RGBA,
    YCbCr: DXVAHD_COLOR_YCbCrA,
};

const DXVAHD_BLT_STATE_BACKGROUND_COLOR_DATA = extern struct {
    YCbCr: i32,
    BackgroundColor: DXVAHD_COLOR,
};
type
  DXVAHD_COLOR_RGBA {.bycopy.} = object
    R: float32
    G: float32
    B: float32
    A: float32

  DXVAHD_COLOR_YCbCrA {.bycopy.} = object
    Y: float32
    Cb: float32
    Cr: float32
    A: float32

  DXVAHD_COLOR {.bycopy.} = object
    RGB: DXVAHD_COLOR_RGBA
    YCbCr: DXVAHD_COLOR_YCbCrA

  DXVAHD_BLT_STATE_BACKGROUND_COLOR_DATA {.bycopy.} = object
    YCbCr: int32
    BackgroundColor: DXVAHD_COLOR
struct DXVAHD_COLOR_RGBA
{
    float R;
    float G;
    float B;
    float A;
}

struct DXVAHD_COLOR_YCbCrA
{
    float Y;
    float Cb;
    float Cr;
    float A;
}

struct DXVAHD_COLOR
{
    DXVAHD_COLOR_RGBA RGB;
    DXVAHD_COLOR_YCbCrA YCbCr;
}

struct DXVAHD_BLT_STATE_BACKGROUND_COLOR_DATA
{
    int YCbCr;
    DXVAHD_COLOR BackgroundColor;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DXVAHD_BLT_STATE_BACKGROUND_COLOR_DATA サイズ: 20 バイト(x64)
dim st, 5    ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; YCbCr : BOOL (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; BackgroundColor : DXVAHD_COLOR (+4, 16byte)  varptr(st)+4 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DXVAHD_BLT_STATE_BACKGROUND_COLOR_DATA
    #field bool YCbCr
    #field byte BackgroundColor 16
#endstruct

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