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

D3D12_FEATURE_DATA_VIDEO_ENCODER_RESOURCE_REQUIREMENTS

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

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

フィールド

フィールドサイズx64x86説明
NodeIndexDWORD4+0+0マルチGPUアダプタにおける対象ノードのインデックスを指定する。
CodecD3D12_VIDEO_ENCODER_CODEC4+4+4問い合わせ対象のエンコードコーデックを指定する。
ProfileD3D12_VIDEO_ENCODER_PROFILE_DESC16/8+8+8問い合わせ対象のプロファイル記述子を指定する。
InputFormatDXGI_FORMAT4+24+16入力フレームのDXGIピクセルフォーマットを指定する。
PictureTargetResolutionD3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC8+28+20エンコード対象ピクチャの解像度記述子を指定する。
IsSupportedBOOL4+36+28指定構成がサポートされるか否かを返す。TRUEで対応。
CompressedBitstreamBufferAccessAlignmentDWORD4+40+32圧縮ビットストリームバッファのアクセスに必要なアライメントを返す。
EncoderMetadataBufferAccessAlignmentDWORD4+44+36エンコーダメタデータバッファのアクセスに必要なアライメントを返す。
MaxEncoderOutputMetadataBufferSizeDWORD4+48+40出力メタデータバッファに必要な最大バイトサイズを返す。

各言語での定義

#include <windows.h>

// D3D12_VIDEO_ENCODER_PROFILE_DESC  (x64 16 / x86 8 バイト)
typedef struct D3D12_VIDEO_ENCODER_PROFILE_DESC {
    DWORD DataSize;
    _Anonymous_e__Union Anonymous;
} D3D12_VIDEO_ENCODER_PROFILE_DESC;

// D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC  (x64 8 / x86 8 バイト)
typedef struct D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC {
    DWORD Width;
    DWORD Height;
} D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC;

// D3D12_FEATURE_DATA_VIDEO_ENCODER_RESOURCE_REQUIREMENTS  (x64 56 / x86 44 バイト)
typedef struct D3D12_FEATURE_DATA_VIDEO_ENCODER_RESOURCE_REQUIREMENTS {
    DWORD NodeIndex;
    D3D12_VIDEO_ENCODER_CODEC Codec;
    D3D12_VIDEO_ENCODER_PROFILE_DESC Profile;
    DXGI_FORMAT InputFormat;
    D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC PictureTargetResolution;
    BOOL IsSupported;
    DWORD CompressedBitstreamBufferAccessAlignment;
    DWORD EncoderMetadataBufferAccessAlignment;
    DWORD MaxEncoderOutputMetadataBufferSize;
} D3D12_FEATURE_DATA_VIDEO_ENCODER_RESOURCE_REQUIREMENTS;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D12_VIDEO_ENCODER_PROFILE_DESC
{
    public uint DataSize;
    public _Anonymous_e__Union Anonymous;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC
{
    public uint Width;
    public uint Height;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D12_FEATURE_DATA_VIDEO_ENCODER_RESOURCE_REQUIREMENTS
{
    public uint NodeIndex;
    public int Codec;
    public D3D12_VIDEO_ENCODER_PROFILE_DESC Profile;
    public int InputFormat;
    public D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC PictureTargetResolution;
    [MarshalAs(UnmanagedType.Bool)] public bool IsSupported;
    public uint CompressedBitstreamBufferAccessAlignment;
    public uint EncoderMetadataBufferAccessAlignment;
    public uint MaxEncoderOutputMetadataBufferSize;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D12_VIDEO_ENCODER_PROFILE_DESC
    Public DataSize As UInteger
    Public Anonymous As _Anonymous_e__Union
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC
    Public Width As UInteger
    Public Height As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D12_FEATURE_DATA_VIDEO_ENCODER_RESOURCE_REQUIREMENTS
    Public NodeIndex As UInteger
    Public Codec As Integer
    Public Profile As D3D12_VIDEO_ENCODER_PROFILE_DESC
    Public InputFormat As Integer
    Public PictureTargetResolution As D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC
    <MarshalAs(UnmanagedType.Bool)> Public IsSupported As Boolean
    Public CompressedBitstreamBufferAccessAlignment As UInteger
    Public EncoderMetadataBufferAccessAlignment As UInteger
    Public MaxEncoderOutputMetadataBufferSize As UInteger
End Structure
import ctypes
from ctypes import wintypes

class D3D12_VIDEO_ENCODER_PROFILE_DESC(ctypes.Structure):
    _fields_ = [
        ("DataSize", wintypes.DWORD),
        ("Anonymous", _Anonymous_e__Union),
    ]

class D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC(ctypes.Structure):
    _fields_ = [
        ("Width", wintypes.DWORD),
        ("Height", wintypes.DWORD),
    ]

class D3D12_FEATURE_DATA_VIDEO_ENCODER_RESOURCE_REQUIREMENTS(ctypes.Structure):
    _fields_ = [
        ("NodeIndex", wintypes.DWORD),
        ("Codec", ctypes.c_int),
        ("Profile", D3D12_VIDEO_ENCODER_PROFILE_DESC),
        ("InputFormat", ctypes.c_int),
        ("PictureTargetResolution", D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC),
        ("IsSupported", wintypes.BOOL),
        ("CompressedBitstreamBufferAccessAlignment", wintypes.DWORD),
        ("EncoderMetadataBufferAccessAlignment", wintypes.DWORD),
        ("MaxEncoderOutputMetadataBufferSize", wintypes.DWORD),
    ]
#[repr(C)]
pub struct D3D12_VIDEO_ENCODER_PROFILE_DESC {
    pub DataSize: u32,
    pub Anonymous: _Anonymous_e__Union,
}

#[repr(C)]
pub struct D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC {
    pub Width: u32,
    pub Height: u32,
}

#[repr(C)]
pub struct D3D12_FEATURE_DATA_VIDEO_ENCODER_RESOURCE_REQUIREMENTS {
    pub NodeIndex: u32,
    pub Codec: i32,
    pub Profile: D3D12_VIDEO_ENCODER_PROFILE_DESC,
    pub InputFormat: i32,
    pub PictureTargetResolution: D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC,
    pub IsSupported: i32,
    pub CompressedBitstreamBufferAccessAlignment: u32,
    pub EncoderMetadataBufferAccessAlignment: u32,
    pub MaxEncoderOutputMetadataBufferSize: u32,
}
import "golang.org/x/sys/windows"

type D3D12_VIDEO_ENCODER_PROFILE_DESC struct {
	DataSize uint32
	Anonymous _Anonymous_e__Union
}

type D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC struct {
	Width uint32
	Height uint32
}

type D3D12_FEATURE_DATA_VIDEO_ENCODER_RESOURCE_REQUIREMENTS struct {
	NodeIndex uint32
	Codec int32
	Profile D3D12_VIDEO_ENCODER_PROFILE_DESC
	InputFormat int32
	PictureTargetResolution D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC
	IsSupported int32
	CompressedBitstreamBufferAccessAlignment uint32
	EncoderMetadataBufferAccessAlignment uint32
	MaxEncoderOutputMetadataBufferSize uint32
}
type
  D3D12_VIDEO_ENCODER_PROFILE_DESC = record
    DataSize: DWORD;
    Anonymous: _Anonymous_e__Union;
  end;

  D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC = record
    Width: DWORD;
    Height: DWORD;
  end;

  D3D12_FEATURE_DATA_VIDEO_ENCODER_RESOURCE_REQUIREMENTS = record
    NodeIndex: DWORD;
    Codec: Integer;
    Profile: D3D12_VIDEO_ENCODER_PROFILE_DESC;
    InputFormat: Integer;
    PictureTargetResolution: D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC;
    IsSupported: BOOL;
    CompressedBitstreamBufferAccessAlignment: DWORD;
    EncoderMetadataBufferAccessAlignment: DWORD;
    MaxEncoderOutputMetadataBufferSize: DWORD;
  end;
const D3D12_VIDEO_ENCODER_PROFILE_DESC = extern struct {
    DataSize: u32,
    Anonymous: _Anonymous_e__Union,
};

const D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC = extern struct {
    Width: u32,
    Height: u32,
};

const D3D12_FEATURE_DATA_VIDEO_ENCODER_RESOURCE_REQUIREMENTS = extern struct {
    NodeIndex: u32,
    Codec: i32,
    Profile: D3D12_VIDEO_ENCODER_PROFILE_DESC,
    InputFormat: i32,
    PictureTargetResolution: D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC,
    IsSupported: i32,
    CompressedBitstreamBufferAccessAlignment: u32,
    EncoderMetadataBufferAccessAlignment: u32,
    MaxEncoderOutputMetadataBufferSize: u32,
};
type
  D3D12_VIDEO_ENCODER_PROFILE_DESC {.bycopy.} = object
    DataSize: uint32
    Anonymous: _Anonymous_e__Union

  D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC {.bycopy.} = object
    Width: uint32
    Height: uint32

  D3D12_FEATURE_DATA_VIDEO_ENCODER_RESOURCE_REQUIREMENTS {.bycopy.} = object
    NodeIndex: uint32
    Codec: int32
    Profile: D3D12_VIDEO_ENCODER_PROFILE_DESC
    InputFormat: int32
    PictureTargetResolution: D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC
    IsSupported: int32
    CompressedBitstreamBufferAccessAlignment: uint32
    EncoderMetadataBufferAccessAlignment: uint32
    MaxEncoderOutputMetadataBufferSize: uint32
struct D3D12_VIDEO_ENCODER_PROFILE_DESC
{
    uint DataSize;
    _Anonymous_e__Union Anonymous;
}

struct D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC
{
    uint Width;
    uint Height;
}

struct D3D12_FEATURE_DATA_VIDEO_ENCODER_RESOURCE_REQUIREMENTS
{
    uint NodeIndex;
    int Codec;
    D3D12_VIDEO_ENCODER_PROFILE_DESC Profile;
    int InputFormat;
    D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC PictureTargetResolution;
    int IsSupported;
    uint CompressedBitstreamBufferAccessAlignment;
    uint EncoderMetadataBufferAccessAlignment;
    uint MaxEncoderOutputMetadataBufferSize;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; D3D12_FEATURE_DATA_VIDEO_ENCODER_RESOURCE_REQUIREMENTS サイズ: 44 バイト(x86)
dim st, 11    ; 4byte整数×11(構造体サイズ 44 / 4 切り上げ)
; NodeIndex : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; Codec : D3D12_VIDEO_ENCODER_CODEC (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; Profile : D3D12_VIDEO_ENCODER_PROFILE_DESC (+8, 8byte)  varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; InputFormat : DXGI_FORMAT (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; PictureTargetResolution : D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC (+20, 8byte)  varptr(st)+20 を基点に操作(8byte:入れ子/配列)
; IsSupported : BOOL (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; CompressedBitstreamBufferAccessAlignment : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; EncoderMetadataBufferAccessAlignment : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; MaxEncoderOutputMetadataBufferSize : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; D3D12_FEATURE_DATA_VIDEO_ENCODER_RESOURCE_REQUIREMENTS サイズ: 56 バイト(x64)
dim st, 14    ; 4byte整数×14(構造体サイズ 56 / 4 切り上げ)
; NodeIndex : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; Codec : D3D12_VIDEO_ENCODER_CODEC (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; Profile : D3D12_VIDEO_ENCODER_PROFILE_DESC (+8, 16byte)  varptr(st)+8 を基点に操作(16byte:入れ子/配列)
; InputFormat : DXGI_FORMAT (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; PictureTargetResolution : D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC (+28, 8byte)  varptr(st)+28 を基点に操作(8byte:入れ子/配列)
; IsSupported : BOOL (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; CompressedBitstreamBufferAccessAlignment : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; EncoderMetadataBufferAccessAlignment : DWORD (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; MaxEncoderOutputMetadataBufferSize : DWORD (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global D3D12_VIDEO_ENCODER_PROFILE_DESC
    #field int DataSize
    #field byte Anonymous 8
#endstruct

#defstruct global D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC
    #field int Width
    #field int Height
#endstruct

#defstruct global D3D12_FEATURE_DATA_VIDEO_ENCODER_RESOURCE_REQUIREMENTS
    #field int NodeIndex
    #field int Codec
    #field D3D12_VIDEO_ENCODER_PROFILE_DESC Profile
    #field int InputFormat
    #field D3D12_VIDEO_ENCODER_PICTURE_RESOLUTION_DESC PictureTargetResolution
    #field bool IsSupported
    #field int CompressedBitstreamBufferAccessAlignment
    #field int EncoderMetadataBufferAccessAlignment
    #field int MaxEncoderOutputMetadataBufferSize
#endstruct

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