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

VMR9AllocationInfo

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

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

フィールド

フィールドサイズx64x86説明
dwFlagsDWORD4+0+0サーフェス割り当ての種類を示すフラグ(VMR9SurfaceAllocationFlags)。
dwWidthDWORD4+4+4割り当てるサーフェスの幅。単位はピクセル。
dwHeightDWORD4+8+8割り当てるサーフェスの高さ。単位はピクセル。
FormatD3DFORMAT4+12+12サーフェスのピクセルフォーマット(D3DFORMAT)。
PoolD3DPOOL4+16+16サーフェスのメモリプール種別(D3DPOOL)。
MinBuffersDWORD4+20+20割り当てるサーフェスの最小数。
szAspectRatioSIZE8+24+24映像のアスペクト比を示すサイズ(SIZE)。
szNativeSizeSIZE8+32+32映像本来のサイズ(SIZE)。単位はピクセル。

各言語での定義

#include <windows.h>

// SIZE  (x64 8 / x86 8 バイト)
typedef struct SIZE {
    INT cx;
    INT cy;
} SIZE;

// VMR9AllocationInfo  (x64 40 / x86 40 バイト)
typedef struct VMR9AllocationInfo {
    DWORD dwFlags;
    DWORD dwWidth;
    DWORD dwHeight;
    D3DFORMAT Format;
    D3DPOOL Pool;
    DWORD MinBuffers;
    SIZE szAspectRatio;
    SIZE szNativeSize;
} VMR9AllocationInfo;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SIZE
{
    public int cx;
    public int cy;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct VMR9AllocationInfo
{
    public uint dwFlags;
    public uint dwWidth;
    public uint dwHeight;
    public uint Format;
    public int Pool;
    public uint MinBuffers;
    public SIZE szAspectRatio;
    public SIZE szNativeSize;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SIZE
    Public cx As Integer
    Public cy As Integer
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure VMR9AllocationInfo
    Public dwFlags As UInteger
    Public dwWidth As UInteger
    Public dwHeight As UInteger
    Public Format As UInteger
    Public Pool As Integer
    Public MinBuffers As UInteger
    Public szAspectRatio As SIZE
    Public szNativeSize As SIZE
End Structure
import ctypes
from ctypes import wintypes

class SIZE(ctypes.Structure):
    _fields_ = [
        ("cx", ctypes.c_int),
        ("cy", ctypes.c_int),
    ]

class VMR9AllocationInfo(ctypes.Structure):
    _fields_ = [
        ("dwFlags", wintypes.DWORD),
        ("dwWidth", wintypes.DWORD),
        ("dwHeight", wintypes.DWORD),
        ("Format", wintypes.DWORD),
        ("Pool", ctypes.c_int),
        ("MinBuffers", wintypes.DWORD),
        ("szAspectRatio", SIZE),
        ("szNativeSize", SIZE),
    ]
#[repr(C)]
pub struct SIZE {
    pub cx: i32,
    pub cy: i32,
}

#[repr(C)]
pub struct VMR9AllocationInfo {
    pub dwFlags: u32,
    pub dwWidth: u32,
    pub dwHeight: u32,
    pub Format: u32,
    pub Pool: i32,
    pub MinBuffers: u32,
    pub szAspectRatio: SIZE,
    pub szNativeSize: SIZE,
}
import "golang.org/x/sys/windows"

type SIZE struct {
	cx int32
	cy int32
}

type VMR9AllocationInfo struct {
	dwFlags uint32
	dwWidth uint32
	dwHeight uint32
	Format uint32
	Pool int32
	MinBuffers uint32
	szAspectRatio SIZE
	szNativeSize SIZE
}
type
  SIZE = record
    cx: Integer;
    cy: Integer;
  end;

  VMR9AllocationInfo = record
    dwFlags: DWORD;
    dwWidth: DWORD;
    dwHeight: DWORD;
    Format: DWORD;
    Pool: Integer;
    MinBuffers: DWORD;
    szAspectRatio: SIZE;
    szNativeSize: SIZE;
  end;
const SIZE = extern struct {
    cx: i32,
    cy: i32,
};

const VMR9AllocationInfo = extern struct {
    dwFlags: u32,
    dwWidth: u32,
    dwHeight: u32,
    Format: u32,
    Pool: i32,
    MinBuffers: u32,
    szAspectRatio: SIZE,
    szNativeSize: SIZE,
};
type
  SIZE {.bycopy.} = object
    cx: int32
    cy: int32

  VMR9AllocationInfo {.bycopy.} = object
    dwFlags: uint32
    dwWidth: uint32
    dwHeight: uint32
    Format: uint32
    Pool: int32
    MinBuffers: uint32
    szAspectRatio: SIZE
    szNativeSize: SIZE
struct SIZE
{
    int cx;
    int cy;
}

struct VMR9AllocationInfo
{
    uint dwFlags;
    uint dwWidth;
    uint dwHeight;
    uint Format;
    int Pool;
    uint MinBuffers;
    SIZE szAspectRatio;
    SIZE szNativeSize;
}

HSP用 定義

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

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

#defstruct global VMR9AllocationInfo
    #field int dwFlags
    #field int dwWidth
    #field int dwHeight
    #field int Format
    #field int Pool
    #field int MinBuffers
    #field SIZE szAspectRatio
    #field SIZE szNativeSize
#endstruct

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