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

VMRVIDEOSTREAMINFO

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

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

フィールド

フィールドサイズx64x86説明
pddsVideoSurfaceIDirectDrawSurface7*8/4+0+0ビデオを保持するIDirectDrawSurface7へのポインター。
dwWidthDWORD4+8+4ビデオの幅をピクセル単位で示す。
dwHeightDWORD4+12+8ビデオの高さをピクセル単位で示す。
dwStrmIDDWORD4+16+12ビデオストリームの識別子を示す。
fAlphaFLOAT4+20+16ストリームのアルファ値を0から1の範囲で示す。
ddClrKeyDDCOLORKEY8+24+20ストリームのカラーキーを示すDDCOLORKEY構造体。
rNormalNORMALIZEDRECT16+32+28ストリームの表示位置を示すNORMALIZEDRECT構造体。

各言語での定義

#include <windows.h>

// DDCOLORKEY  (x64 8 / x86 8 バイト)
typedef struct DDCOLORKEY {
    DWORD dwColorSpaceLowValue;
    DWORD dwColorSpaceHighValue;
} DDCOLORKEY;

// NORMALIZEDRECT  (x64 16 / x86 16 バイト)
typedef struct NORMALIZEDRECT {
    FLOAT left;
    FLOAT top;
    FLOAT right;
    FLOAT bottom;
} NORMALIZEDRECT;

// VMRVIDEOSTREAMINFO  (x64 48 / x86 44 バイト)
typedef struct VMRVIDEOSTREAMINFO {
    IDirectDrawSurface7* pddsVideoSurface;
    DWORD dwWidth;
    DWORD dwHeight;
    DWORD dwStrmID;
    FLOAT fAlpha;
    DDCOLORKEY ddClrKey;
    NORMALIZEDRECT rNormal;
} VMRVIDEOSTREAMINFO;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DDCOLORKEY
{
    public uint dwColorSpaceLowValue;
    public uint dwColorSpaceHighValue;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct NORMALIZEDRECT
{
    public float left;
    public float top;
    public float right;
    public float bottom;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct VMRVIDEOSTREAMINFO
{
    public IntPtr pddsVideoSurface;
    public uint dwWidth;
    public uint dwHeight;
    public uint dwStrmID;
    public float fAlpha;
    public DDCOLORKEY ddClrKey;
    public NORMALIZEDRECT rNormal;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DDCOLORKEY
    Public dwColorSpaceLowValue As UInteger
    Public dwColorSpaceHighValue As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure NORMALIZEDRECT
    Public left As Single
    Public top As Single
    Public right As Single
    Public bottom As Single
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure VMRVIDEOSTREAMINFO
    Public pddsVideoSurface As IntPtr
    Public dwWidth As UInteger
    Public dwHeight As UInteger
    Public dwStrmID As UInteger
    Public fAlpha As Single
    Public ddClrKey As DDCOLORKEY
    Public rNormal As NORMALIZEDRECT
End Structure
import ctypes
from ctypes import wintypes

class DDCOLORKEY(ctypes.Structure):
    _fields_ = [
        ("dwColorSpaceLowValue", wintypes.DWORD),
        ("dwColorSpaceHighValue", wintypes.DWORD),
    ]

class NORMALIZEDRECT(ctypes.Structure):
    _fields_ = [
        ("left", ctypes.c_float),
        ("top", ctypes.c_float),
        ("right", ctypes.c_float),
        ("bottom", ctypes.c_float),
    ]

class VMRVIDEOSTREAMINFO(ctypes.Structure):
    _fields_ = [
        ("pddsVideoSurface", ctypes.c_void_p),
        ("dwWidth", wintypes.DWORD),
        ("dwHeight", wintypes.DWORD),
        ("dwStrmID", wintypes.DWORD),
        ("fAlpha", ctypes.c_float),
        ("ddClrKey", DDCOLORKEY),
        ("rNormal", NORMALIZEDRECT),
    ]
#[repr(C)]
pub struct DDCOLORKEY {
    pub dwColorSpaceLowValue: u32,
    pub dwColorSpaceHighValue: u32,
}

#[repr(C)]
pub struct NORMALIZEDRECT {
    pub left: f32,
    pub top: f32,
    pub right: f32,
    pub bottom: f32,
}

#[repr(C)]
pub struct VMRVIDEOSTREAMINFO {
    pub pddsVideoSurface: *mut core::ffi::c_void,
    pub dwWidth: u32,
    pub dwHeight: u32,
    pub dwStrmID: u32,
    pub fAlpha: f32,
    pub ddClrKey: DDCOLORKEY,
    pub rNormal: NORMALIZEDRECT,
}
import "golang.org/x/sys/windows"

type DDCOLORKEY struct {
	dwColorSpaceLowValue uint32
	dwColorSpaceHighValue uint32
}

type NORMALIZEDRECT struct {
	left float32
	top float32
	right float32
	bottom float32
}

type VMRVIDEOSTREAMINFO struct {
	pddsVideoSurface uintptr
	dwWidth uint32
	dwHeight uint32
	dwStrmID uint32
	fAlpha float32
	ddClrKey DDCOLORKEY
	rNormal NORMALIZEDRECT
}
type
  DDCOLORKEY = record
    dwColorSpaceLowValue: DWORD;
    dwColorSpaceHighValue: DWORD;
  end;

  NORMALIZEDRECT = record
    left: Single;
    top: Single;
    right: Single;
    bottom: Single;
  end;

  VMRVIDEOSTREAMINFO = record
    pddsVideoSurface: Pointer;
    dwWidth: DWORD;
    dwHeight: DWORD;
    dwStrmID: DWORD;
    fAlpha: Single;
    ddClrKey: DDCOLORKEY;
    rNormal: NORMALIZEDRECT;
  end;
const DDCOLORKEY = extern struct {
    dwColorSpaceLowValue: u32,
    dwColorSpaceHighValue: u32,
};

const NORMALIZEDRECT = extern struct {
    left: f32,
    top: f32,
    right: f32,
    bottom: f32,
};

const VMRVIDEOSTREAMINFO = extern struct {
    pddsVideoSurface: ?*anyopaque,
    dwWidth: u32,
    dwHeight: u32,
    dwStrmID: u32,
    fAlpha: f32,
    ddClrKey: DDCOLORKEY,
    rNormal: NORMALIZEDRECT,
};
type
  DDCOLORKEY {.bycopy.} = object
    dwColorSpaceLowValue: uint32
    dwColorSpaceHighValue: uint32

  NORMALIZEDRECT {.bycopy.} = object
    left: float32
    top: float32
    right: float32
    bottom: float32

  VMRVIDEOSTREAMINFO {.bycopy.} = object
    pddsVideoSurface: pointer
    dwWidth: uint32
    dwHeight: uint32
    dwStrmID: uint32
    fAlpha: float32
    ddClrKey: DDCOLORKEY
    rNormal: NORMALIZEDRECT
struct DDCOLORKEY
{
    uint dwColorSpaceLowValue;
    uint dwColorSpaceHighValue;
}

struct NORMALIZEDRECT
{
    float left;
    float top;
    float right;
    float bottom;
}

struct VMRVIDEOSTREAMINFO
{
    void* pddsVideoSurface;
    uint dwWidth;
    uint dwHeight;
    uint dwStrmID;
    float fAlpha;
    DDCOLORKEY ddClrKey;
    NORMALIZEDRECT rNormal;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; VMRVIDEOSTREAMINFO サイズ: 44 バイト(x86)
dim st, 11    ; 4byte整数×11(構造体サイズ 44 / 4 切り上げ)
; pddsVideoSurface : IDirectDrawSurface7* (+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 も可)
; dwStrmID : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; fAlpha : FLOAT (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; ddClrKey : DDCOLORKEY (+20, 8byte)  varptr(st)+20 を基点に操作(8byte:入れ子/配列)
; rNormal : NORMALIZEDRECT (+28, 16byte)  varptr(st)+28 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; VMRVIDEOSTREAMINFO サイズ: 48 バイト(x64)
dim st, 12    ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; pddsVideoSurface : IDirectDrawSurface7* (+0, 8byte)  qpoke st,0,値 / qpeek(st,0)  ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; dwWidth : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; dwHeight : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; dwStrmID : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; fAlpha : FLOAT (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; ddClrKey : DDCOLORKEY (+24, 8byte)  varptr(st)+24 を基点に操作(8byte:入れ子/配列)
; rNormal : NORMALIZEDRECT (+32, 16byte)  varptr(st)+32 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global DDCOLORKEY
    #field int dwColorSpaceLowValue
    #field int dwColorSpaceHighValue
#endstruct

#defstruct global NORMALIZEDRECT
    #field float left
    #field float top
    #field float right
    #field float bottom
#endstruct

#defstruct global VMRVIDEOSTREAMINFO
    #field intptr pddsVideoSurface
    #field int dwWidth
    #field int dwHeight
    #field int dwStrmID
    #field float fAlpha
    #field DDCOLORKEY ddClrKey
    #field NORMALIZEDRECT rNormal
#endstruct

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