Win32 API 日本語リファレンス
ホームGraphics.Direct3D11 › D3D11_VIDEO_PROCESSOR_CUSTOM_RATE

D3D11_VIDEO_PROCESSOR_CUSTOM_RATE

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

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

フィールド

フィールドサイズx64x86説明
CustomRateDXGI_RATIONAL8+0+0カスタムフレームレートを分子/分母で表すDXGI_RATIONAL値。
OutputFramesDWORD4+8+8入力に対して生成される出力フレーム数。
InputInterlacedBOOL4+12+12入力がインターレースかどうか。TRUEでインターレース。
InputFramesOrFieldsDWORD4+16+16入力フレームまたはフィールドの数。

各言語での定義

#include <windows.h>

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

// D3D11_VIDEO_PROCESSOR_CUSTOM_RATE  (x64 20 / x86 20 バイト)
typedef struct D3D11_VIDEO_PROCESSOR_CUSTOM_RATE {
    DXGI_RATIONAL CustomRate;
    DWORD OutputFrames;
    BOOL InputInterlaced;
    DWORD InputFramesOrFields;
} D3D11_VIDEO_PROCESSOR_CUSTOM_RATE;
using System;
using System.Runtime.InteropServices;

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

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D11_VIDEO_PROCESSOR_CUSTOM_RATE
{
    public DXGI_RATIONAL CustomRate;
    public uint OutputFrames;
    [MarshalAs(UnmanagedType.Bool)] public bool InputInterlaced;
    public uint InputFramesOrFields;
}
Imports System.Runtime.InteropServices

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

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D11_VIDEO_PROCESSOR_CUSTOM_RATE
    Public CustomRate As DXGI_RATIONAL
    Public OutputFrames As UInteger
    <MarshalAs(UnmanagedType.Bool)> Public InputInterlaced As Boolean
    Public InputFramesOrFields As UInteger
End Structure
import ctypes
from ctypes import wintypes

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

class D3D11_VIDEO_PROCESSOR_CUSTOM_RATE(ctypes.Structure):
    _fields_ = [
        ("CustomRate", DXGI_RATIONAL),
        ("OutputFrames", wintypes.DWORD),
        ("InputInterlaced", wintypes.BOOL),
        ("InputFramesOrFields", wintypes.DWORD),
    ]
#[repr(C)]
pub struct DXGI_RATIONAL {
    pub Numerator: u32,
    pub Denominator: u32,
}

#[repr(C)]
pub struct D3D11_VIDEO_PROCESSOR_CUSTOM_RATE {
    pub CustomRate: DXGI_RATIONAL,
    pub OutputFrames: u32,
    pub InputInterlaced: i32,
    pub InputFramesOrFields: u32,
}
import "golang.org/x/sys/windows"

type DXGI_RATIONAL struct {
	Numerator uint32
	Denominator uint32
}

type D3D11_VIDEO_PROCESSOR_CUSTOM_RATE struct {
	CustomRate DXGI_RATIONAL
	OutputFrames uint32
	InputInterlaced int32
	InputFramesOrFields uint32
}
type
  DXGI_RATIONAL = record
    Numerator: DWORD;
    Denominator: DWORD;
  end;

  D3D11_VIDEO_PROCESSOR_CUSTOM_RATE = record
    CustomRate: DXGI_RATIONAL;
    OutputFrames: DWORD;
    InputInterlaced: BOOL;
    InputFramesOrFields: DWORD;
  end;
const DXGI_RATIONAL = extern struct {
    Numerator: u32,
    Denominator: u32,
};

const D3D11_VIDEO_PROCESSOR_CUSTOM_RATE = extern struct {
    CustomRate: DXGI_RATIONAL,
    OutputFrames: u32,
    InputInterlaced: i32,
    InputFramesOrFields: u32,
};
type
  DXGI_RATIONAL {.bycopy.} = object
    Numerator: uint32
    Denominator: uint32

  D3D11_VIDEO_PROCESSOR_CUSTOM_RATE {.bycopy.} = object
    CustomRate: DXGI_RATIONAL
    OutputFrames: uint32
    InputInterlaced: int32
    InputFramesOrFields: uint32
struct DXGI_RATIONAL
{
    uint Numerator;
    uint Denominator;
}

struct D3D11_VIDEO_PROCESSOR_CUSTOM_RATE
{
    DXGI_RATIONAL CustomRate;
    uint OutputFrames;
    int InputInterlaced;
    uint InputFramesOrFields;
}

HSP用 定義

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

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

#defstruct global D3D11_VIDEO_PROCESSOR_CUSTOM_RATE
    #field DXGI_RATIONAL CustomRate
    #field int OutputFrames
    #field bool InputInterlaced
    #field int InputFramesOrFields
#endstruct

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